Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {StringToAddress, AddressToString} from '@axelar-network/axelar-gmp-sdk-s
import {AccessControlUpgradeable} from '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import './LZHandlerUpgradeable.sol';
import './AxelarHandlerUpgradeable.sol';
import './BridgeHelperLibrary.sol';
Expand Down Expand Up @@ -151,7 +152,7 @@ contract MessagePassingBridge is
__LZHandlerUpgradeable_init(lzEndpoint_);
guardian = msg.sender;
bridgeLimits = limits;
bridgeFees = fees;
setBridgeFees(fees);
feeRecipient = nameService.getAddress('UBISCHEME');
if (feeRecipient == address(0)) feeRecipient = avatar;

Expand Down Expand Up @@ -227,8 +228,9 @@ contract MessagePassingBridge is
* @dev Function for setting the bridge fees
* @param fees The bridge fees to set
*/
function setBridgeFees(BridgeFees memory fees) external {
function setBridgeFees(BridgeFees memory fees) public {
_onlyOwnerOrGuardian();
require(fees.fee <= 10000, 'invalid fee');
bridgeFees = fees;
}

Expand Down Expand Up @@ -263,7 +265,7 @@ contract MessagePassingBridge is
function withdraw(address token, uint256 amount) external {
_onlyAvatar();
if (amount == 0) amount = IERC20(token).balanceOf(address(this));
IERC20(token).transfer(msg.sender, amount);
SafeERC20.safeTransfer(IERC20(token), msg.sender, amount);
}

/**
Expand Down Expand Up @@ -309,7 +311,7 @@ contract MessagePassingBridge is
// }

/**
* @dev Enforces transfer limits and checks if the transfer is valid
* @dev Enforces transfer limits and checks if the transfer is valid. limits are enforced on the target minting side.
* @param from The address to transfer from
* @param target The address to transfer to
* @param amount The amount to transfer
Expand Down Expand Up @@ -357,7 +359,8 @@ contract MessagePassingBridge is
}

/**
* @dev Bridges tokens from one chain to another, this performs burning or locking
* @dev Bridges tokens from one chain to another, this performs burning or locking.
* @notice limits are not enforced here. limits are enforced on the target minting side.
* @param from The address to bridge tokens from
* @param target The address to bridge tokens to
* @param targetChainId The chain ID of the target chain
Expand Down Expand Up @@ -470,7 +473,7 @@ contract MessagePassingBridge is
}

/**
* @dev Bridges tokens from one chain to another, this performs minting or unlock
* @dev Bridges tokens from one chain to another, this performs minting or unlock. limits are enforced here
* @param from The address to bridge tokens from
* @param target The address to bridge tokens to
* @param normalizedAmount The amount of tokens to bridge
Expand Down
2 changes: 1 addition & 1 deletion packages/bridge-contracts/deploy/deployMessageBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const chainData = chainsData[network.name === 'localhost' ? 'celo' : network.name];

const proxySalt = ethers.utils.keccak256(
ethers.utils.arrayify(ethers.utils.toUtf8Bytes('MessagePassingBridge' + (isTestnet ? 'Testnet' : 'V1'))),
ethers.utils.arrayify(ethers.utils.toUtf8Bytes(isTestnet ? 'Testnet' : 'MessagePassingBridgeV1')),
);
console.log(chainData, network.name, { isTestnet, proxySalt });
const bridgeProxyDeploy = await deployments.deterministic('MessagePassingBridge', {
Expand Down
7 changes: 5 additions & 2 deletions packages/bridge-contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ import '@nomiclabs/hardhat-waffle';
import 'hardhat-deploy';
import { HttpNetworkAccountsConfig } from 'hardhat/types';
import { configDotenv } from 'dotenv';

import * as envEnc from '@chainlink/env-enc';
configDotenv();
envEnc.config();

const pkey = process.env.PRIVATE_KEY;
const pkey = process.argv.find((_) => _.includes('testnet') || _.includes('staging'))
? process.env.DEV_KEY
: process.env.PRIVATE_KEY;
const mnemonic = process.env.MNEMONIC;

let accounts: unknown = 'remote';
Expand Down
3 changes: 2 additions & 1 deletion packages/bridge-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"devDependencies": {
"@axelar-network/axelar-gmp-sdk-solidity": "^3.6.1",
"@axelar-network/axelarjs-sdk": "^0.13.6",
"@chainlink/env-enc": "^1.0.5",
"@gooddollar/goodprotocol": "2.0.34-beta.4",
"@layerzerolabs/scan-client": "^0.0.6",
"@layerzerolabs/solidity-examples": "^0.0.13",
Expand All @@ -48,7 +49,7 @@
"ethers": "^5.*",
"hardhat": "2.*",
"hardhat-contract-sizer": "^2.6.1",
"hardhat-deploy": "0.11.44",
"hardhat-deploy": "0.11.43",
"hardhat-gas-reporter": "^1.0.9",
"merkle-patricia-tree": "^2.*",
"prettier": "^2.5.1",
Expand Down
Loading