Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00Token Holdings
More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 193 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Set White List T... | 20475323 | 153 days ago | IN | 0 ETH | 0.00020041 | ||||
Withdraw Funds | 20474481 | 153 days ago | IN | 0 ETH | 0.00013358 | ||||
Withdraw Funds | 20474475 | 153 days ago | IN | 0 ETH | 0.0000986 | ||||
Withdraw Funds | 20474468 | 153 days ago | IN | 0 ETH | 0.000107 | ||||
Withdraw Funds | 20474464 | 153 days ago | IN | 0 ETH | 0.00008476 | ||||
Withdraw Funds | 20474455 | 153 days ago | IN | 0 ETH | 0.00009475 | ||||
Withdraw Funds | 20474449 | 153 days ago | IN | 0 ETH | 0.00008792 | ||||
Withdraw Funds | 20474441 | 153 days ago | IN | 0 ETH | 0.0000711 | ||||
Withdraw Funds | 20474433 | 153 days ago | IN | 0 ETH | 0.00012035 | ||||
Set White List T... | 20469456 | 153 days ago | IN | 0 ETH | 0.00008329 | ||||
Set White List T... | 20462100 | 154 days ago | IN | 0 ETH | 0.00173266 | ||||
Transfer Token | 20454014 | 156 days ago | IN | 0 ETH | 0.00010609 | ||||
Swap And Transfe... | 20450876 | 156 days ago | IN | 0 ETH | 0.00010842 | ||||
Transfer Token | 20444118 | 157 days ago | IN | 0 ETH | 0.00006555 | ||||
Set White List T... | 20433719 | 158 days ago | IN | 0 ETH | 0.0002254 | ||||
Transfer Token | 20433128 | 158 days ago | IN | 0 ETH | 0.00024986 | ||||
Swap And Transfe... | 20430918 | 159 days ago | IN | 0 ETH | 0.00035129 | ||||
Transfer Token | 20429001 | 159 days ago | IN | 0 ETH | 0.00070929 | ||||
Transfer Token | 20429000 | 159 days ago | IN | 0 ETH | 0.00080243 | ||||
Transfer Token | 20427801 | 159 days ago | IN | 0 ETH | 0.00099372 | ||||
Transfer Token | 20427799 | 159 days ago | IN | 0 ETH | 0.00095342 | ||||
Transfer Token | 20425145 | 160 days ago | IN | 0 ETH | 0.00058202 | ||||
Transfer Token | 20425050 | 160 days ago | IN | 0 ETH | 0.00049121 | ||||
Transfer Token | 20422311 | 160 days ago | IN | 0 ETH | 0.00042141 | ||||
Transfer Token | 20421922 | 160 days ago | IN | 0 ETH | 0.00087766 |
Latest 15 internal transactions
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
20402326 | 163 days ago | 0.5 ETH | ||||
20399863 | 163 days ago | 0.005 ETH | ||||
20209373 | 190 days ago | 0.00758455 ETH | ||||
20148940 | 198 days ago | 0.005 ETH | ||||
20095843 | 206 days ago | 0.0075 ETH | ||||
20033118 | 214 days ago | 0.05 ETH | ||||
20024680 | 215 days ago | 0.00853463 ETH | ||||
20000487 | 219 days ago | 0.037 ETH | ||||
19996433 | 219 days ago | 0.1225 ETH | ||||
19991208 | 220 days ago | 0.0153 ETH | ||||
19989814 | 220 days ago | 0.09 ETH | ||||
19988300 | 221 days ago | 0.11 ETH | ||||
19988052 | 221 days ago | 0.02 ETH | ||||
19987838 | 221 days ago | 0.01 ETH | ||||
19909373 | 232 days ago | 0.02 ETH |
Loading...
Loading
Contract Name:
AssetBridge
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "@routerprotocol/evm-gateway-contracts/contracts/IGateway.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "./interfaces/IAssetBridge.sol"; import "@routerprotocol/asset-forwarder/src/interfaces/IMessageHandler.sol"; import "./interfaces/IDexSpan.sol"; import "./interfaces/IWETH.sol"; import "./interfaces/IBurnableERC20.sol"; import "./ReentrancyGuard.sol"; /// @title Handles ERC20 deposits and relay executions. /// @author Router Protocol. /// @notice This contract is intended to be used with the Bridge contract. contract AssetBridge is Context, AccessControl, ReentrancyGuard, Pausable, IAssetBridge { using SafeMath for uint256; using SafeERC20 for IERC20; bytes32 public constant RESOURCE_SETTER = keccak256("RESOURCE_SETTER"); bytes32 public constant PAUSER = keccak256("PAUSER"); // NOTE: Change chainId everytime we deploy string public constant ROUTER_CHAIN_ID = "router_9600-1"; bytes32 public constant ROUTER_CHAIN_ID_BYTES = keccak256(bytes(ROUTER_CHAIN_ID)); // only dest gas limit specified 6 mill, rest is 0 bytes public constant AssetBridge_REQUEST_METADATA = hex"00000000005B8D80000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; address private constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; // Instance of the gateway contract IGateway public immutable gateway; IDexSpan public dexSpan; // NOTE: Change ROUTER_BRIDGE_ADDRESS everytime we deploy string public constant ROUTER_BRIDGE_ADDRESS = "router17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgsmpev85"; bytes32 public constant ROUTER_BRIDGE_ADDRESS_BYTES = keccak256(bytes(ROUTER_BRIDGE_ADDRESS)); address public immutable wrappedNative; uint256 public depositNonce; // keccak256(abi.encode(destChainId)) + depositNonce => Revert Executed? mapping(bytes32 => mapping(uint256 => bool)) public _executionRevertCompleted; // token => isBurnable mapping(address => address) public _contractToLP; mapping(address => address) public _lpToContract; // token contract address => is reserve mapping(address => uint256) public _tokenWhitelist; // keccak256(abi.encode(sourceChainId)) + nonce => isExecuted mapping(bytes32 => mapping(uint256 => bool)) public executeRecord; // codeId: // 1 -> Only Gateway contract // 2 -> array length mismatch // 3 -> contract address cannot be zero address // 4 -> provided contract is not whitelisted // 5 -> Either reserve handler or dest caller address is zero address // 6 -> Insufficient native assets sent // 7 -> token not whitelisted // 8 -> min amount lower than required // 9 -> invalid data // 10 -> invalid token addresses // 11 -> data for reserve transfer // 12 -> data for LP transfer // 13 -> only AssetBridge middleware // 14 -> already reverted // 15 -> no deposit found // 16 -> dest chain not configured // 17 -> InvalidChainID // 18 -> InvalidMiddlewareAddress error AssetBridgeError(uint8 codeId); modifier isGateway() { if (msg.sender != address(gateway)) { // Only gateway contracts revert AssetBridgeError(1); } _; } modifier isLengthSame(uint256 l1, uint256 l2) { if (l1 != l2) { // array length mismatch revert AssetBridgeError(2); } _; } constructor( address _dexSpan, address _wrappedNative, address _gatewayAddress, string memory chainId, string memory routerBridgeAddress, uint256 startNonce ) { _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setupRole(RESOURCE_SETTER, msg.sender); _setupRole(PAUSER, msg.sender); dexSpan = IDexSpan(_dexSpan); wrappedNative = _wrappedNative; gateway = IGateway(_gatewayAddress); if (ROUTER_CHAIN_ID_BYTES != keccak256(bytes(chainId))) { revert AssetBridgeError(17); } if (ROUTER_BRIDGE_ADDRESS_BYTES != keccak256(bytes(routerBridgeAddress))) { revert AssetBridgeError(18); } depositNonce = startNonce; } /// @notice Pauses deposits on the handler. /// @notice Only callable by an address that currently has the PAUSER role. function pause() external onlyRole(PAUSER) whenNotPaused { _pause(); } /// @notice Unpauses deposits on the handler. /// @notice Only callable by an address that currently has the PAUSER role. function unpause() external onlyRole(PAUSER) whenPaused { _unpause(); } function isNative(address token) internal pure returns (bool) { return token == ETH_ADDRESS; } function setLiquidityPoolMulti( address[] memory _tokens, address[] memory _lptokens ) public onlyRole(RESOURCE_SETTER) isLengthSame(_tokens.length, _lptokens.length) { uint8 length = uint8(_tokens.length); for (uint8 i = 0; i < length; i++) { require((_tokenWhitelist[_tokens[i]] != 0), "provided some token is not whitelisted"); _lpToContract[_lptokens[i]] = _tokens[i]; _contractToLP[_tokens[i]] = _lptokens[i]; } } function setWhiteListTokenMulti( address[] memory _tokens, uint256[] memory types ) public onlyRole(RESOURCE_SETTER) isLengthSame(_tokens.length, types.length) { uint8 length = uint8(_tokens.length); for (uint8 i = 0; i < length; i++) { if (_tokens[i] == address(0)) { // token address can't be zero revert AssetBridgeError(3); } _tokenWhitelist[_tokens[i]] = types[i]; } } function setDappMetadata(string memory feePayer) external payable onlyRole(RESOURCE_SETTER) { gateway.setDappMetadata{ value: msg.value }(feePayer); } /// @notice Sets DexSpan address. /// @param _dexSpan Address of DexSpan contract function setDexSpanAddress(address _dexSpan) external onlyRole(RESOURCE_SETTER) { if (_dexSpan == address(0)) { // contract address cannot be zero address revert AssetBridgeError(3); } dexSpan = IDexSpan(_dexSpan); } function iSend(bytes memory packet, uint256 value) internal { bytes memory requestPacket = abi.encode(ROUTER_BRIDGE_ADDRESS, packet); gateway.iSend{ value: value }(1, 0, "", ROUTER_CHAIN_ID, AssetBridge_REQUEST_METADATA, requestPacket); } function getTransferPacket( bytes32 destChainIdBytes, address srcTokenAddress, uint256 srcTokenAmount, bytes memory recipient, uint256 partnerId ) internal returns (bytes memory) { unchecked { ++depositNonce; } return abi.encode( uint8(0), destChainIdBytes, srcTokenAddress, srcTokenAmount, msg.sender, recipient, depositNonce, partnerId ); } function getTransferWithInstructionPacket( bytes32 destChainIdBytes, address srcTokenAddress, uint256 srcTokenAmount, bytes memory recipient, uint256 partnerId, uint64 gasLimit, bytes calldata instruction ) internal returns (bytes memory) { unchecked { ++depositNonce; } return abi.encode( uint8(1), destChainIdBytes, srcTokenAddress, srcTokenAmount, msg.sender, recipient, depositNonce, partnerId, gasLimit, instruction ); } function tokenAndAmountValidation(address token) internal view { if (_tokenWhitelist[token] == 0) { revert AssetBridgeError(7); // token not whitelisted } } function safeTransferETH(address to, uint256 value) internal { require(to != address(0), "safeTransferETH: transfer to address 0"); (bool success, ) = to.call{ value: value }(new bytes(0)); require(success, "safeTransferETH: ETH transfer failed"); } function safeTransferFrom(address token, address from, address to, uint256 amount) internal { if (from == address(this)) { IERC20(token).transfer(to, amount); } else { IERC20(token).transferFrom(from, to, amount); } } function lockOrBurnToken(address token, address from, uint256 amount) internal { uint256 tokenType = _tokenWhitelist[token]; if (tokenType == 1) { if (from != address(this)) safeTransferFrom(token, from, address(this), amount); } else if ( tokenType == 2) { // Old ERC20 Contracts IBurnableERC20V1(token).burn(from,amount); } else if ( tokenType == 3) { // New ERC20 Contracts if (from == address(this)) { IBurnableERC20V2(token).burn(amount); } else { IBurnableERC20V2(token).burnFrom(from, amount); } } else { revert AssetBridgeError(7); // token not whitelisted } } function transferToken(TransferPayload memory transferPayload) external nonReentrant payable whenNotPaused { tokenAndAmountValidation(transferPayload.srcTokenAddress); bool isSourceNative = isNative(transferPayload.srcTokenAddress); if (!isSourceNative) lockOrBurnToken(transferPayload.srcTokenAddress, msg.sender, transferPayload.srcTokenAmount); else { if (msg.value < transferPayload.srcTokenAmount) { // No native assets sent revert AssetBridgeError(6); } IWETH(wrappedNative).deposit{ value: transferPayload.srcTokenAmount }(); transferPayload.srcTokenAddress = wrappedNative; } bytes memory packet = getTransferPacket( transferPayload.destChainIdBytes, transferPayload.srcTokenAddress, transferPayload.srcTokenAmount, transferPayload.recipient, transferPayload.partnerId ); if (!isSourceNative) iSend(packet, msg.value); else iSend(packet, msg.value.sub(transferPayload.srcTokenAmount)); emit TokenTransfer( transferPayload.destChainIdBytes, transferPayload.srcTokenAddress, transferPayload.srcTokenAmount, transferPayload.recipient, transferPayload.partnerId, depositNonce ); } function transferTokenWithInstruction( TransferPayload memory transferPayload, uint64 destGasLimit, bytes calldata instruction ) external nonReentrant payable whenNotPaused { tokenAndAmountValidation(transferPayload.srcTokenAddress); bool isSourceNative = isNative(transferPayload.srcTokenAddress); if (!isSourceNative) lockOrBurnToken(transferPayload.srcTokenAddress, msg.sender, transferPayload.srcTokenAmount); else { if (msg.value < transferPayload.srcTokenAmount) { // No native assets sent revert AssetBridgeError(6); } IWETH(wrappedNative).deposit{ value: transferPayload.srcTokenAmount }(); transferPayload.srcTokenAddress = wrappedNative; } bytes memory packet = getTransferWithInstructionPacket( transferPayload.destChainIdBytes, transferPayload.srcTokenAddress, transferPayload.srcTokenAmount, transferPayload.recipient, transferPayload.partnerId, destGasLimit, instruction ); if (!isSourceNative) iSend(packet, msg.value); else iSend(packet, msg.value.sub(transferPayload.srcTokenAmount)); emit TokenTransferWithInstruction( transferPayload.destChainIdBytes, transferPayload.srcTokenAddress, transferPayload.srcTokenAmount, transferPayload.recipient, transferPayload.partnerId, destGasLimit, instruction, depositNonce ); } function swapAndTransferToken( SwapTransferPayload memory transferPayload ) external nonReentrant payable whenNotPaused { bool isSourceNative = isNative(transferPayload.tokens[0]); if (!isSourceNative) safeTransferFrom(transferPayload.tokens[0], msg.sender, address(dexSpan), transferPayload.srcTokenAmount); else { if (msg.value < transferPayload.srcTokenAmount) { // No native assets sent revert AssetBridgeError(6); } IWETH(wrappedNative).deposit{ value: transferPayload.srcTokenAmount }(); IWETH(wrappedNative).transfer(address(dexSpan), transferPayload.srcTokenAmount); transferPayload.tokens[0] = wrappedNative; } address toToken = transferPayload.tokens[transferPayload.tokens.length - 1]; uint256 oldBalance = IBurnableERC20V2(toToken).balanceOf(address(this)); uint256 returnAmount = dexSpan.swapMultiWithRecipient( transferPayload.tokens, transferPayload.srcTokenAmount, transferPayload.minToAmount, transferPayload.flags, transferPayload.dataTx, true, address(this) ); uint256 newBalance = IBurnableERC20V2(toToken).balanceOf(address(this)); assert(oldBalance + returnAmount == newBalance); tokenAndAmountValidation(toToken); lockOrBurnToken(toToken, address(this), returnAmount); bytes memory packet = getTransferPacket( transferPayload.destChainIdBytes, toToken, returnAmount, transferPayload.recipient, transferPayload.partnerId ); if (!isSourceNative) iSend(packet, msg.value); else iSend(packet, msg.value.sub(transferPayload.srcTokenAmount)); emit TokenTransfer( transferPayload.destChainIdBytes, toToken, returnAmount, transferPayload.recipient, transferPayload.partnerId, depositNonce ); } function swapAndTransferTokenWithInstruction( SwapTransferPayload memory transferPayload, uint64 destGasLimit, bytes calldata instruction ) external nonReentrant payable whenNotPaused { bool isSourceNative = isNative(transferPayload.tokens[0]); if (!isSourceNative) safeTransferFrom(transferPayload.tokens[0], msg.sender, address(dexSpan), transferPayload.srcTokenAmount); else { if (msg.value < transferPayload.srcTokenAmount) { // No native assets sent revert AssetBridgeError(6); } IWETH(wrappedNative).deposit{ value: transferPayload.srcTokenAmount }(); IWETH(wrappedNative).transfer(address(dexSpan), transferPayload.srcTokenAmount); transferPayload.tokens[0] = wrappedNative; } address toToken = transferPayload.tokens[transferPayload.tokens.length - 1]; uint256 oldBalance = IBurnableERC20V2(toToken).balanceOf(address(this)); uint256 returnAmount = dexSpan.swapMultiWithRecipient( transferPayload.tokens, transferPayload.srcTokenAmount, transferPayload.minToAmount, transferPayload.flags, transferPayload.dataTx, true, address(this) ); uint256 newBalance = IBurnableERC20V2(toToken).balanceOf(address(this)); assert(oldBalance + returnAmount == newBalance); tokenAndAmountValidation(toToken); lockOrBurnToken(toToken, address(this), returnAmount); bytes memory packet = getTransferWithInstructionPacket( transferPayload.destChainIdBytes, toToken, returnAmount, transferPayload.recipient, transferPayload.partnerId, destGasLimit, instruction ); if (!isSourceNative) iSend(packet, msg.value); else iSend(packet, msg.value.sub(transferPayload.srcTokenAmount)); emit TokenTransferWithInstruction( transferPayload.destChainIdBytes, toToken, returnAmount, transferPayload.recipient, transferPayload.partnerId, destGasLimit, instruction, depositNonce ); } /// @notice Function to handle the request for execution received from Router Chain /// @param requestSender Address of the sender of the transaction on the source chain. /// @param srcChainId request source chain id. /// @param packet Packet coming from the router chain. function iReceive( string memory requestSender, bytes memory packet, string memory srcChainId ) external isGateway nonReentrant whenNotPaused { if (keccak256(bytes(srcChainId)) != ROUTER_CHAIN_ID_BYTES) { // only AssetBridge middleware revert AssetBridgeError(13); } if (keccak256(bytes(requestSender)) != ROUTER_BRIDGE_ADDRESS_BYTES) { // only AssetBridge middleware revert AssetBridgeError(17); } uint8 txType = abi.decode(packet, (uint8)); // Refunding deposited token in case of some issues on dest chain if (txType == 2) { (, bytes32 destChainIdBytes, IAssetBridge.DepositData memory depositData) = abi.decode( packet, (uint8, bytes32, IAssetBridge.DepositData) ); if (_executionRevertCompleted[destChainIdBytes][depositData.depositNonce]) { // already reverted revert AssetBridgeError(14); } if (depositData.srcTokenAddress == address(0)) { // no deposit found revert AssetBridgeError(15); } _executionRevertCompleted[destChainIdBytes][depositData.depositNonce] = true; executeProposalForReserveToken(depositData.srcTokenAddress, depositData.srcTokenAmount, depositData.sender); emit DepositReverted( destChainIdBytes, depositData.depositNonce, depositData.sender, depositData.srcTokenAddress, depositData.srcTokenAmount ); return; } if (txType == 0) { // mint token (, bytes32 srcChainIdBytes, IAssetBridge.ExecuteInfo memory executeDetails) = abi.decode( packet, (uint8, bytes32, IAssetBridge.ExecuteInfo) ); require(!executeRecord[srcChainIdBytes][executeDetails.depositNonce], "already executed"); executeRecord[srcChainIdBytes][executeDetails.depositNonce] = true; executeProposalForReserveToken( executeDetails.destTokenAddress, executeDetails.destTokenAmount, executeDetails.recipient ); emit Execute( 0, srcChainIdBytes, executeDetails.depositNonce, executeDetails.destTokenAddress, executeDetails.destTokenAmount, executeDetails.recipient ); return; } if (txType == 1) { // mint token and execute (, bytes32 srcChainIdBytes, IAssetBridge.ExecuteInfo memory executeDetails, bytes memory instruction) = abi .decode(packet, (uint8, bytes32, IAssetBridge.ExecuteInfo, bytes)); require(!executeRecord[srcChainIdBytes][executeDetails.depositNonce], "already executed"); executeRecord[srcChainIdBytes][executeDetails.depositNonce] = true; executeProposalForReserveToken( executeDetails.destTokenAddress, executeDetails.destTokenAmount, executeDetails.recipient ); (bool success, bytes memory data) = executeDetails.recipient.call( abi.encodeWithSelector( IMessageHandler.handleMessage.selector, // function handleAssetBridgeMessage(address tokenSent, uint256 amount, bytes memory instruction) external; executeDetails.destTokenAddress, executeDetails.destTokenAmount, instruction ) ); //TODO: do we need any check on data and success //TODO: there should be min gas left after call emit ExecuteWithMessage( 1, srcChainIdBytes, executeDetails.depositNonce, executeDetails.destTokenAddress, executeDetails.destTokenAmount, executeDetails.recipient, success, data ); return; } } function executeProposalForReserveToken(address token, uint256 amount, address recipient) internal { uint256 tokenType = _tokenWhitelist[token]; require((tokenType != 0), "token not whitelisted"); if (tokenType != 1) { IBurnableERC20V2(token).mint(recipient, amount); } else { uint256 reserveBalance; if (isNative(token)) { reserveBalance = address(this).balance; } else { reserveBalance = IBurnableERC20V2(token).balanceOf(address(this)); } if (reserveBalance < amount) { require(_contractToLP[token] != address(0), "ERC20Handler: Liquidity pool not found"); IBurnableERC20V2(_contractToLP[token]).mint(recipient, amount); // will there is liquidity provider type of concept here? } else { if (isNative(token)) { IWETH(wrappedNative).withdraw(amount); (bool success, ) = recipient.call{ value: amount }(""); require(success, "Transfer failed."); } else safeTransferFrom(token, address(this), recipient, amount); } } } /// @notice Used to stake ERC20 tokens into the LP. /// @param tokenAddress Address of the ERC20 token /// @param amount Amount of tokens to be staked function stake( address to, bool isSourceNative, address tokenAddress, uint256 amount ) external payable whenNotPaused { require(_contractToLP[tokenAddress] != address(0), "LP not created"); if (isSourceNative && tokenAddress == wrappedNative) { require(amount == msg.value, "amount != msg.value"); IWETH(wrappedNative).deposit{ value: msg.value }(); IBurnableERC20V2(_contractToLP[tokenAddress]).mint(to, msg.value); } else { require(msg.value == 0, "No need to pass Native Tokens"); safeTransferFrom(tokenAddress, msg.sender, address(this), amount); IBurnableERC20V2(_contractToLP[tokenAddress]).mint(to, amount); } } /// @notice Unstake the ERC20 tokens from LP. /// @param tokenAddress staking token of which liquidity needs to be removed. /// @param amount Amount that needs to be unstaked. function unstake(address to, bool isSourceNative, address tokenAddress, uint256 amount) external whenNotPaused { require(_lpToContract[tokenAddress] != address(0), "LP not created"); if (isSourceNative && _lpToContract[tokenAddress] == wrappedNative) { IBurnableERC20V2(tokenAddress).burnFrom(msg.sender, amount); IWETH(wrappedNative).withdraw(amount); safeTransferETH(to, amount); } else { IBurnableERC20V2(tokenAddress).burnFrom(msg.sender, amount); safeTransferFrom(_lpToContract[tokenAddress], address(this), to, amount); } } //TODO: we should remove this /// @notice Function to withdraw funds from this contract. /// @notice Only DEFAULT_ADMIN can call this function. /// @param token Address of token to withdraw. If native token, send address 0. /// @param amount Amount of tokens to withdraw. If all tokens, send 0. /// @param recipient Address of recipient. function withdrawFunds( address token, uint256 amount, address payable recipient ) external onlyRole(DEFAULT_ADMIN_ROLE) { if (token == address(0)) { amount = amount != 0 ? amount : address(this).balance; safeTransferETH(recipient, amount); } else { IBurnableERC20V2 _token = IBurnableERC20V2(token); amount = amount != 0 ? amount : _token.balanceOf(address(this)); safeTransferFrom(token, address(this), recipient, amount); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { _spendAllowance(account, _msgSender(), amount); _burn(account, amount); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; import "./Utils.sol"; /** * @dev Interface of the Gateway Self External Calls. */ interface IGateway { // requestMetadata = abi.encodePacked( // uint256 destGasLimit; // uint256 destGasPrice; // uint256 ackGasLimit; // uint256 ackGasPrice; // uint256 relayerFees; // uint8 ackType; // bool isReadCall; // bytes asmAddress; // ) function iSend( uint256 version, uint256 routeAmount, string calldata routeRecipient, string calldata destChainId, bytes calldata requestMetadata, bytes calldata requestPacket ) external payable returns (uint256); function setDappMetadata(string memory feePayerAddress) external payable returns (uint256); function currentVersion() external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; /// @title Interface for Voyager contracts that support deposits and deposit executions. /// @author Router Protocol. interface IAssetBridge { //TODO: can remove some field to optimize gas event TokenTransfer( bytes32 indexed destChainIdBytes, address indexed srcTokenAddress, uint256 srcTokenAmount, bytes recipient, uint256 partnerId, uint256 depositId ); //TODO: can remove some field to optimize gas event TokenTransferWithInstruction( bytes32 indexed destChainIdBytes, address indexed srcTokenAddress, uint256 srcTokenAmount, bytes recipient, uint256 partnerId, uint64 destGasLimit, bytes instruction, uint256 depositId ); event DepositReverted( bytes32 indexed destChainIdBytes, uint256 indexed depositNonce, address indexed sender, address srcSettlementToken, uint256 srcSettlementAmount ); event Execute( uint8 executeType, bytes32 indexed sourceChainIdBytes, uint256 indexed depositNonce, address settlementToken, uint256 settlementAmount, address recipient ); event ExecuteWithMessage( uint8 executeType, bytes32 indexed sourceChainIdBytes, uint256 indexed depositNonce, address settlementToken, uint256 settlementAmount, address recipient, bool flag, bytes data ); struct ExecuteInfo { address recipient; address destTokenAddress; uint256 destTokenAmount; uint256 depositNonce; } struct DepositData { address sender; address srcTokenAddress; uint256 srcTokenAmount; uint256 depositNonce; } struct TransferPayload { bytes32 destChainIdBytes; address srcTokenAddress; uint256 srcTokenAmount; bytes recipient; uint256 partnerId; } struct SwapTransferPayload { bytes32 destChainIdBytes; address[] tokens; // index 0 will be src token and index n-1 will be to address uint256[] flags; bytes[] dataTx; uint256 srcTokenAmount; uint256 minToAmount; bytes recipient; uint256 partnerId; } function transferTokenWithInstruction( TransferPayload memory transferPayload, uint64 destGasLimit, bytes calldata instruction ) external payable; function transferToken(TransferPayload memory transferPayload) external payable; function swapAndTransferToken(SwapTransferPayload memory transferPayload) external payable; function swapAndTransferTokenWithInstruction( SwapTransferPayload memory transferPayload, uint64 destGasLimit, bytes calldata instruction ) external payable; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.18; /// @title Handles ERC20 deposits and deposit executions. /// @author Router Protocol. /// @notice This contract is intended to be used with the Bridge contract. interface IMessageHandler { function handleMessage( address tokenSent, uint256 amount, bytes memory message ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; contract IDexSpanConsts { // flags = FLAG_DISABLE_UNISWAP + FLAG_DISABLE_BANCOR + ... uint256 internal constant FLAG_DISABLE_UNISWAP = 0x400; uint256 internal constant FLAG_DISABLE_SPLIT_RECALCULATION = 0x800000000000; uint256 internal constant FLAG_DISABLE_ALL_SPLIT_SOURCES = 0x20000000; uint256 internal constant FLAG_DISABLE_UNISWAP_V2_ALL = 0x400; uint256 internal constant FLAG_DISABLE_EMPTY = 0x100000000000; uint256 internal constant FLAG_DISABLE_DFYN = 0x800; uint256 internal constant FLAG_DISABLE_PANCAKESWAP = 0x80; uint256 internal constant FLAG_DISABLE_QUICKSWAP = 0x40000000000; uint256 internal constant FLAG_DISABLE_SUSHISWAP = 0x1000000; uint256 internal constant FLAG_DISABLE_ONEINCH = 0x100000; } abstract contract IDexSpan is IDexSpanConsts { function getExpectedReturn( address fromToken, address destToken, uint256 amount, uint256 parts, uint256 flags // See constants in IOneSplit.sol ) public view virtual returns (uint256 returnAmount, uint256[] memory distribution); function getExpectedReturnWithGasMulti( address[] memory tokens, uint256 amount, uint256[] memory parts, uint256[] memory flags, uint256[] memory destTokenEthPriceTimesGasPrices ) public view virtual returns (uint256[] memory returnAmounts, uint256 estimateGasAmount, uint256[] memory distribution); function getExpectedReturnWithGas( address fromToken, address destToken, uint256 amount, uint256 parts, uint256 flags, // See constants in IOneSplit.sol uint256 destTokenEthPriceTimesGasPrice ) public view virtual returns (uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution); function setHandlerAddress(address _handlerAddress) external virtual returns (bool); function setReserveAddress(address _reserveAddress) external virtual returns (bool); function setBridgeAddress(address _bridgeAddress) external virtual returns (bool); function withdraw(address tokenAddress, address recipient, uint256 amount) public payable virtual returns (bool); function swap( address fromToken, address destToken, uint256 amount, uint256 minReturn, uint256 flags, bytes memory dataTx, bool isWrapper ) public payable virtual returns (uint256 returnAmount); function swapWithRecipient( address fromToken, address destToken, uint256 amount, uint256 minReturn, uint256 flags, bytes memory dataTx, bool isWrapper, address recipient ) public payable virtual returns (uint256 returnAmount); function swapMulti( address[] memory tokens, uint256 amount, uint256 minReturn, uint256[] memory flags, bytes[] memory dataTx, bool isWrapper ) public payable virtual returns (uint256 returnAmount); function swapMultiWithRecipient( address[] memory tokens, uint256 amount, uint256 minReturn, uint256[] memory flags, bytes[] memory dataTx, bool isWrapper, address recipient ) public payable virtual returns (uint256 returnAmount); function getExpectedReturnETH( address srcStablefromtoken, uint256 srcStableFromTokenAmount, uint256 parts, uint256 flags ) public view virtual returns (uint256 returnAmount); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; interface IWETH { function deposit() external payable; function transfer(address to, uint256 value) external returns (bool); function withdraw(uint256) external; function transferFrom(address src, address dst, uint256 wad) external returns (bool); function approve(address guy, uint256 wad) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IBurnableERC20V2 is IERC20 { function mint(address account, uint256 amount) external; function burn(uint256 amount) external; function burnFrom(address account, uint256 amount) external; } interface IBurnableERC20V1 is IERC20 { function mint(address account, uint256 amount) external; function burn(address account, uint256 amount) external; }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.18; /** * @title A contract that provides modifiers to prevent reentrancy to state-changing and view-only methods. This contract * is inspired by https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/ReentrancyGuard.sol * and https://github.com/balancer-labs/balancer-core/blob/master/contracts/BPool.sol. * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported * by uma/contracts. */ contract ReentrancyGuard { bool internal _notEntered; constructor() { // Storing an initial non-zero value makes deployment a bit more expensive, but in exchange the refund on every // call to nonReentrant will be lower in amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to increase the likelihood of the full // refund coming into effect. _notEntered = true; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a nonReentrant function from another nonReentrant function is not supported. It is possible to * prevent this from happening by making the nonReentrant function external, and making it call a private * function that does the actual state modification. */ modifier nonReentrant() { _preEntranceCheck(); _preEntranceSet(); _; _postEntranceReset(); } /** * @dev Designed to prevent a view-only method from being re-entered during a call to a nonReentrant() state-changing method. */ modifier nonReentrantView() { _preEntranceCheck(); _; } /** * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this * contract, such as unwrapping WETH to ETH within the contract. */ function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) { return _notEntered; } // Internal methods are used to avoid copying the require statement's bytecode to every nonReentrant() method. // On entry into a function, _preEntranceCheck() should always be called to check if the function is being // re-entered. Then, if the function modifies state, it should call _postEntranceSet(), perform its logic, and // then call _postEntranceReset(). // View-only methods can simply call _preEntranceCheck() to make sure that it is not being re-entered. function _preEntranceCheck() internal view { // On the first call to nonReentrant, _notEntered will be true require(_notEntered, "ReentrancyGuard: reentrant call"); } function _preEntranceSet() internal { // Any calls to nonReentrant after this point will fail _notEntered = false; } function _postEntranceReset() internal { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _notEntered = true; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; library Utils { // This is used purely to avoid stack too deep errors // represents everything about a given validator set struct ValsetArgs { // the validators in this set, represented by an Ethereum address address[] validators; // the powers of the given validators in the same order as above uint64[] powers; // the nonce of this validator set uint256 valsetNonce; } struct RequestPayload { uint256 routeAmount; uint256 requestIdentifier; uint256 requestTimestamp; string srcChainId; address routeRecipient; string destChainId; address asmAddress; string requestSender; address handlerAddress; bytes packet; bool isReadCall; } struct CrossChainAckPayload { uint256 requestIdentifier; uint256 ackRequestIdentifier; string destChainId; address requestSender; bytes execData; bool execFlag; } enum AckType { NO_ACK, ACK_ON_SUCCESS, ACK_ON_ERROR, ACK_ON_BOTH } error IncorrectCheckpoint(); error InvalidValsetNonce(uint256 newNonce, uint256 currentNonce); error MalformedNewValidatorSet(); error MalformedCurrentValidatorSet(); error InsufficientPower(uint64 cumulativePower, uint64 powerThreshold); error InvalidSignature(); // constants string constant MSG_PREFIX = "\x19Ethereum Signed Message:\n32"; // The number of 'votes' required to execute a valset // update or batch execution, set to 2/3 of 2^32 uint64 constant CONSTANT_POWER_THRESHOLD = 2791728742; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "remappings": [ "@ethereum-waffle/=node_modules/@ethereum-waffle/", "@openzeppelin/=node_modules/@openzeppelin/", "@routerprotocol/=node_modules/@routerprotocol/", "eth-gas-reporter/=node_modules/eth-gas-reporter/", "ethpm-registry/=node_modules/ethpm-registry/", "ethpm-spec/=node_modules/ethpm-spec/", "ethpm/=node_modules/ethpm/", "hardhat-deploy/=node_modules/hardhat-deploy/", "hardhat/=node_modules/hardhat/", "tronbox/=node_modules/tronbox/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_dexSpan","type":"address"},{"internalType":"address","name":"_wrappedNative","type":"address"},{"internalType":"address","name":"_gatewayAddress","type":"address"},{"internalType":"string","name":"chainId","type":"string"},{"internalType":"string","name":"routerBridgeAddress","type":"string"},{"internalType":"uint256","name":"startNonce","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint8","name":"codeId","type":"uint8"}],"name":"AssetBridgeError","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"destChainIdBytes","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"depositNonce","type":"uint256"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"srcSettlementToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"srcSettlementAmount","type":"uint256"}],"name":"DepositReverted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"executeType","type":"uint8"},{"indexed":true,"internalType":"bytes32","name":"sourceChainIdBytes","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"depositNonce","type":"uint256"},{"indexed":false,"internalType":"address","name":"settlementToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"settlementAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"}],"name":"Execute","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"executeType","type":"uint8"},{"indexed":true,"internalType":"bytes32","name":"sourceChainIdBytes","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"depositNonce","type":"uint256"},{"indexed":false,"internalType":"address","name":"settlementToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"settlementAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"bool","name":"flag","type":"bool"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"ExecuteWithMessage","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"destChainIdBytes","type":"bytes32"},{"indexed":true,"internalType":"address","name":"srcTokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"srcTokenAmount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"recipient","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"partnerId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"depositId","type":"uint256"}],"name":"TokenTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"destChainIdBytes","type":"bytes32"},{"indexed":true,"internalType":"address","name":"srcTokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"srcTokenAmount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"recipient","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"partnerId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"destGasLimit","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"instruction","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"depositId","type":"uint256"}],"name":"TokenTransferWithInstruction","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"AssetBridge_REQUEST_METADATA","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RESOURCE_SETTER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROUTER_BRIDGE_ADDRESS","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROUTER_BRIDGE_ADDRESS_BYTES","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROUTER_CHAIN_ID","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROUTER_CHAIN_ID_BYTES","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_contractToLP","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"_executionRevertCompleted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_lpToContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_tokenWhitelist","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dexSpan","outputs":[{"internalType":"contract IDexSpan","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"executeRecord","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gateway","outputs":[{"internalType":"contract IGateway","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"requestSender","type":"string"},{"internalType":"bytes","name":"packet","type":"bytes"},{"internalType":"string","name":"srcChainId","type":"string"}],"name":"iReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"feePayer","type":"string"}],"name":"setDappMetadata","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_dexSpan","type":"address"}],"name":"setDexSpanAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"address[]","name":"_lptokens","type":"address[]"}],"name":"setLiquidityPoolMulti","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"types","type":"uint256[]"}],"name":"setWhiteListTokenMulti","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bool","name":"isSourceNative","type":"bool"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"destChainIdBytes","type":"bytes32"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"flags","type":"uint256[]"},{"internalType":"bytes[]","name":"dataTx","type":"bytes[]"},{"internalType":"uint256","name":"srcTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minToAmount","type":"uint256"},{"internalType":"bytes","name":"recipient","type":"bytes"},{"internalType":"uint256","name":"partnerId","type":"uint256"}],"internalType":"struct IAssetBridge.SwapTransferPayload","name":"transferPayload","type":"tuple"}],"name":"swapAndTransferToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"destChainIdBytes","type":"bytes32"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"flags","type":"uint256[]"},{"internalType":"bytes[]","name":"dataTx","type":"bytes[]"},{"internalType":"uint256","name":"srcTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minToAmount","type":"uint256"},{"internalType":"bytes","name":"recipient","type":"bytes"},{"internalType":"uint256","name":"partnerId","type":"uint256"}],"internalType":"struct IAssetBridge.SwapTransferPayload","name":"transferPayload","type":"tuple"},{"internalType":"uint64","name":"destGasLimit","type":"uint64"},{"internalType":"bytes","name":"instruction","type":"bytes"}],"name":"swapAndTransferTokenWithInstruction","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"destChainIdBytes","type":"bytes32"},{"internalType":"address","name":"srcTokenAddress","type":"address"},{"internalType":"uint256","name":"srcTokenAmount","type":"uint256"},{"internalType":"bytes","name":"recipient","type":"bytes"},{"internalType":"uint256","name":"partnerId","type":"uint256"}],"internalType":"struct IAssetBridge.TransferPayload","name":"transferPayload","type":"tuple"}],"name":"transferToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"destChainIdBytes","type":"bytes32"},{"internalType":"address","name":"srcTokenAddress","type":"address"},{"internalType":"uint256","name":"srcTokenAmount","type":"uint256"},{"internalType":"bytes","name":"recipient","type":"bytes"},{"internalType":"uint256","name":"partnerId","type":"uint256"}],"internalType":"struct IAssetBridge.TransferPayload","name":"transferPayload","type":"tuple"},{"internalType":"uint64","name":"destGasLimit","type":"uint64"},{"internalType":"bytes","name":"instruction","type":"bytes"}],"name":"transferTokenWithInstruction","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bool","name":"isSourceNative","type":"bool"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"}],"name":"withdrawFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wrappedNative","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60c06040523480156200001157600080fd5b50604051620048643803806200486483398101604081905262000034916200033f565b6001805461ffff1916811790556200004e600033620001ad565b6200007a7f8b9e7a9f25b0aca3f51c01b8fee30790fb16f4d4deded8385ae6643d054bb07833620001ad565b620000a67f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c33620001ad565b600180546001600160a01b03808916620100000262010000600160b01b03199092169190911790915585811660a0528416608052825160208481019190912060408051808201909152600d81526c726f757465725f393630302d3160981b9201919091527fe3cf61256e1ad9581d1186b6443e8553eb81e46c927284e38406e12335e1bf38146200015257604051632b10aaa760e01b8152601160048201526024015b60405180910390fd5b8180519060200120604051806080016040528060418152602001620048236041913980519060200120146200019e57604051632b10aaa760e01b81526012600482015260240162000149565b60025550620003ea9350505050565b620001b98282620001bd565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620001b9576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620002193390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b80516001600160a01b03811681146200027557600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620002a257600080fd5b81516001600160401b0380821115620002bf57620002bf6200027a565b604051601f8301601f19908116603f01168101908282118183101715620002ea57620002ea6200027a565b816040528381526020925086838588010111156200030757600080fd5b600091505b838210156200032b57858201830151818301840152908201906200030c565b600093810190920192909252949350505050565b60008060008060008060c087890312156200035957600080fd5b62000364876200025d565b955062000374602088016200025d565b945062000384604088016200025d565b60608801519094506001600160401b0380821115620003a257600080fd5b620003b08a838b0162000290565b94506080890151915080821115620003c757600080fd5b50620003d689828a0162000290565b92505060a087015190509295509295509295565b60805160a0516143956200048e60003960008181610742015281816108a90152818161093b015281816109c3015281816116a901528181611727015281816118bf01528181611951015281816119d901528181611d3a01528181611db801528181612140015281816121c0015281816124ca015281816125680152612d1c01526000818161028601528181610cc2015281816123b001526129f101526143956000f3fe6080604052600436106102255760003560e01c80638286513e11610123578063c025d98e116100ab578063df549c4f1161006f578063df549c4f1461071d578063eb6d3a1114610730578063ef15cbda14610764578063f3b7eddb14610777578063f5def7081461078c57600080fd5b8063c025d98e1461066b578063d547741f14610691578063d9dc8694146106b1578063db618e2a146106e5578063de35f5cb1461070757600080fd5b80639d6ecc0d116100f25780639d6ecc0d1461056e578063a217fddf146105a7578063aa50ec12146105bc578063ba1e319a146105f2578063bfb942c21461061257600080fd5b80638286513e146105045780638456cb591461052457806391d14854146105395780639bc9b6351461055957600080fd5b806336568abe116101b15780635fae9245116101755780635fae92451461047557806360f30b76146104ab57806363d42ae7146104cb578063751657d7146104de5780638121165f146104f157600080fd5b806336568abe146103c85780633f4ba83a146103e857806347c6b45e146103fd5780634e1240a51461041d5780635c975abb1461045857600080fd5b8063248a9ca3116101f8578063248a9ca3146102e0578063292f7d1e1461031e5780632bcbf934146103405780632f2ff15d1461036d578063356a89271461038d57600080fd5b806301ffc9a71461022a57806307927ded1461025f578063116191b6146102745780631aa6485a146102c0575b600080fd5b34801561023657600080fd5b5061024a610245366004613375565b6107ac565b60405190151581526020015b60405180910390f35b61027261026d366004613751565b6107e3565b005b34801561028057600080fd5b506102a87f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610256565b3480156102cc57600080fd5b506102726102db3660046137c7565b610cb7565b3480156102ec57600080fd5b506103106102fb36600461384e565b60009081526020819052604090206001015490565b604051908152602001610256565b34801561032a57600080fd5b5061033361124f565b60405161025691906138b7565b34801561034c57600080fd5b5061031061035b3660046138ca565b60066020526000908152604090205481565b34801561037957600080fd5b506102726103883660046138e7565b61126b565b34801561039957600080fd5b5061024a6103a8366004613917565b600360209081526000928352604080842090915290825290205460ff1681565b3480156103d457600080fd5b506102726103e33660046138e7565b611290565b3480156103f457600080fd5b5061027261130e565b34801561040957600080fd5b50610272610418366004613939565b61134b565b34801561042957600080fd5b5061024a610438366004613917565b600760209081526000928352604080842090915290825290205460ff1681565b34801561046457600080fd5b50600154610100900460ff1661024a565b34801561048157600080fd5b506102a86104903660046138ca565b6004602052600090815260409020546001600160a01b031681565b3480156104b757600080fd5b506102726104c636600461397b565b611413565b6102726104d9366004613a76565b611625565b6102726104ec366004613ab2565b61180b565b6102726104ff366004613ae6565b611cb6565b34801561051057600080fd5b5061027261051f3660046138ca565b611ea5565b34801561053057600080fd5b50610272611f12565b34801561054557600080fd5b5061024a6105543660046138e7565b611f4c565b34801561056557600080fd5b50610310611f75565b34801561057a57600080fd5b506103336040518060400160405280600d81526020016c726f757465725f393630302d3160981b81525081565b3480156105b357600080fd5b50610310600081565b3480156105c857600080fd5b506102a86105d73660046138ca565b6005602052600090815260409020546001600160a01b031681565b3480156105fe57600080fd5b5061027261060d366004613b1f565b611f98565b34801561061e57600080fd5b5060408051808201909152600d81526c726f757465725f393630302d3160981b6020909101526103107fe3cf61256e1ad9581d1186b6443e8553eb81e46c927284e38406e12335e1bf3881565b34801561067757600080fd5b506001546102a8906201000090046001600160a01b031681565b34801561069d57600080fd5b506102726106ac3660046138e7565b6120b1565b3480156106bd57600080fd5b506103107f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c81565b3480156106f157600080fd5b506103106000805160206142cd83398151915281565b34801561071357600080fd5b5061031060025481565b61027261072b366004613b86565b6120d6565b34801561073c57600080fd5b506102a87f000000000000000000000000000000000000000000000000000000000000000081565b610272610772366004613bd7565b612381565b34801561078357600080fd5b5061033361242a565b34801561079857600080fd5b506102726107a7366004613b86565b612446565b60006001600160e01b03198216637965db0b60e01b14806107dd57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6107eb61265f565b6107fa6001805460ff19169055565b6108026126b3565b600061082b856020015160008151811061081e5761081e613c0b565b60200260200101516126fe565b90508061087a57610875856020015160008151811061084c5761084c613c0b565b602002602001015133600160029054906101000a90046001600160a01b03168860800151612720565b610a1a565b84608001513410156108a757604051632b10aaa760e01b8152600660048201526024015b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db086608001516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561090657600080fd5b505af115801561091a573d6000803e3d6000fd5b5050600154608089015160405163a9059cbb60e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116965063a9059cbb955061097d94506201000090930490921691600401613c21565b6020604051808303816000875af115801561099c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c09190613c3a565b507f000000000000000000000000000000000000000000000000000000000000000085602001516000815181106109f9576109f9613c0b565b60200260200101906001600160a01b031690816001600160a01b0316815250505b6020850151805160009190610a3190600190613c6d565b81518110610a4157610a41613c0b565b60209081029190910101516040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610a96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aba9190613c80565b6001805460208a015160808b015160a08c01516040808e015160608f0151915163e738aa8d60e01b8152979850600097620100009096046001600160a01b03169663e738aa8d96610b149695949391903090600401613d29565b6020604051808303816000875af1158015610b33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b579190613c80565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038516906370a0823190602401602060405180830381865afa158015610ba1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc59190613c80565b905080610bd28385613dc6565b14610bdf57610bdf613dd9565b610be884612822565b610bf384308461285d565b6000610c118a6000015186858d60c001518e60e001518e8e8e612960565b905085610c2757610c2281346129b1565b610c47565b610c4781610c428c6080015134612ac690919063ffffffff16565b6129b1565b846001600160a01b03168a600001517f220aec4438bd2c268e817da97e3b821192adc2c11dfea86d51d6ffd8bf38de6e858d60c001518e60e001518e8e8e600254604051610c9b9796959493929190613e18565b60405180910390a3505050505050610cb1612ad9565b50505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610d0357604051632b10aaa760e01b81526001600482015260240161089e565b610d0b61265f565b610d1a6001805460ff19169055565b610d226126b3565b60408051808201909152600d81526c726f757465725f393630302d3160981b6020918201528151908201207fe3cf61256e1ad9581d1186b6443e8553eb81e46c927284e38406e12335e1bf3814610d8f57604051632b10aaa760e01b8152600d600482015260240161089e565b6040518060800160405280604181526020016142ed6041913980519060200120838051906020012014610dd857604051632b10aaa760e01b81526011600482015260240161089e565b600082806020019051810190610dee9190613e7f565b90508060ff16600203610f235760008084806020019051810190610e129190613f13565b600082815260036020908152604080832060608501518452909152902054919450925060ff16159050610e5b57604051632b10aaa760e01b8152600e600482015260240161089e565b60208101516001600160a01b0316610e8957604051632b10aaa760e01b8152600f600482015260240161089e565b600082815260036020908152604080832060608501518452825291829020805460ff19166001179055820151908201518251610ec6929190612ae7565b80600001516001600160a01b03168160600151837fc6cb37798db6a3c249b500abfed1b5787f96457834af95a59170a58e1874e51c84602001518560400151604051610f13929190613c21565b60405180910390a4505050611242565b8060ff1660000361105a5760008084806020019051810190610f459190613f13565b600082815260076020908152604080832060608501518452909152902054919450925060ff16159050610fad5760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e48195e1958dd5d195960821b604482015260640161089e565b600082815260076020908152604080832060608501518452825291829020805460ff19166001179055820151908201518251610fea929190612ae7565b60608082015160208084015160408086015186518251600081526001600160a01b03948516958101959095529184015216928101929092529083907fb937c701be72296797de30f67fec8bc6c096aa6b4c1850a5e659a0dc17165d8f9060800160405180910390a3505050611242565b8060ff166001036112405760008060008580602001905181019061107e9190613f50565b600083815260076020908152604080832060608601518452909152902054929650909450925060ff161590506110e95760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e48195e1958dd5d195960821b604482015260640161089e565b600083815260076020908152604080832060608601518452825291829020805460ff19166001179055830151908301518351611126929190612ae7565b60008083600001516001600160a01b031663d00a2d5f60e01b856020015186604001518660405160240161115c93929190613ff2565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161119a9190614022565b6000604051808303816000865af19150503d80600081146111d7576040519150601f19603f3d011682016040523d82523d6000602084013e6111dc565b606091505b50915091508360600151857f2c661efd5bbbd239384997a4afc5e16ba28d1cfdf0c6fe2318ffee919ac79abf6001876020015188604001518960000151888860405161122d9695949392919061403e565b60405180910390a3505050505050611242565b505b61124a612ad9565b505050565b6040518060800160405280604181526020016142ed6041913981565b60008281526020819052604090206001015461128681612e28565b61124a8383612e32565b6001600160a01b03811633146113005760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161089e565b61130a8282612eb6565b5050565b7f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c61133881612e28565b611340612f1b565b611348612f69565b50565b600061135681612e28565b6001600160a01b03841661138557826000036113725747611374565b825b92506113808284612fbc565b610cb1565b8360008490036113fc576040516370a0823160e01b81523060048201526001600160a01b038216906370a0823190602401602060405180830381865afa1580156113d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f79190613c80565b6113fe565b835b935061140c85308587612720565b5050505050565b6000805160206142cd83398151915261142b81612e28565b8251825180821461145257604051632b10aaa760e01b81526002600482015260240161089e565b845160005b8160ff168160ff16101561161c5760066000888360ff168151811061147e5761147e613c0b565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020546000036115055760405162461bcd60e51b815260206004820152602660248201527f70726f766964656420736f6d6520746f6b656e206973206e6f742077686974656044820152651b1a5cdd195960d21b606482015260840161089e565b868160ff168151811061151a5761151a613c0b565b602002602001015160056000888460ff168151811061153b5761153b613c0b565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550858160ff168151811061159c5761159c613c0b565b602002602001015160046000898460ff16815181106115bd576115bd613c0b565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550808061161490614082565b915050611457565b50505050505050565b61162d61265f565b61163c6001805460ff19169055565b6116446126b3565b6116518160200151612822565b600061166082602001516126fe565b90508061167f5761167a826020015133846040015161285d565b61174f565b81604001513410156116a757604051632b10aaa760e01b81526006600482015260240161089e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db083604001516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561170657600080fd5b505af115801561171a573d6000803e3d6000fd5b5050506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016602085015250505b6000611772836000015184602001518560400151866060015187608001516130ea565b9050816117885761178381346129b1565b6117a3565b6117a381610c42856040015134612ac690919063ffffffff16565b82602001516001600160a01b031683600001517f0a9a968c7c6cc6182a9339c64cb833f1fa34f5a5275c3e3cad13f5db1c6b82a88560400151866060015187608001516002546040516117f994939291906140a1565b60405180910390a35050611348612ad9565b61181361265f565b6118226001805460ff19169055565b61182a6126b3565b6000611846826020015160008151811061081e5761081e613c0b565b90508061189557611890826020015160008151811061186757611867613c0b565b602002602001015133600160029054906101000a90046001600160a01b03168560800151612720565b611a30565b81608001513410156118bd57604051632b10aaa760e01b81526006600482015260240161089e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db083608001516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561191c57600080fd5b505af1158015611930573d6000803e3d6000fd5b5050600154608086015160405163a9059cbb60e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116965063a9059cbb955061199394506201000090930490921691600401613c21565b6020604051808303816000875af11580156119b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119d69190613c3a565b507f00000000000000000000000000000000000000000000000000000000000000008260200151600081518110611a0f57611a0f613c0b565b60200260200101906001600160a01b031690816001600160a01b0316815250505b6020820151805160009190611a4790600190613c6d565b81518110611a5757611a57613c0b565b60209081029190910101516040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611aac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad09190613c80565b600180546020870151608088015160a08901516040808b015160608c0151915163e738aa8d60e01b8152979850600097620100009096046001600160a01b03169663e738aa8d96611b2a9695949391903090600401613d29565b6020604051808303816000875af1158015611b49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b6d9190613c80565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038516906370a0823190602401602060405180830381865afa158015611bb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bdb9190613c80565b905080611be88385613dc6565b14611bf557611bf5613dd9565b611bfe84612822565b611c0984308461285d565b6000611c24876000015186858a60c001518b60e001516130ea565b905085611c3a57611c3581346129b1565b611c55565b611c5581610c42896080015134612ac690919063ffffffff16565b865160c088015160e08901516002546040516001600160a01b038a1694937f0a9a968c7c6cc6182a9339c64cb833f1fa34f5a5275c3e3cad13f5db1c6b82a893611ca0938a936140a1565b60405180910390a3505050505050611348612ad9565b611cbe61265f565b611ccd6001805460ff19169055565b611cd56126b3565b611ce28460200151612822565b6000611cf185602001516126fe565b905080611d1057611d0b856020015133876040015161285d565b611de0565b8460400151341015611d3857604051632b10aaa760e01b81526006600482015260240161089e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db086604001516040518263ffffffff1660e01b81526004016000604051808303818588803b158015611d9757600080fd5b505af1158015611dab573d6000803e3d6000fd5b5050506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016602088015250505b6000611e0686600001518760200151886040015189606001518a608001518a8a8a612960565b905081611e1c57611e1781346129b1565b611e37565b611e3781610c42886040015134612ac690919063ffffffff16565b85602001516001600160a01b031686600001517f220aec4438bd2c268e817da97e3b821192adc2c11dfea86d51d6ffd8bf38de6e886040015189606001518a608001518a8a8a600254604051611e939796959493929190613e18565b60405180910390a35050610cb1612ad9565b6000805160206142cd833981519152611ebd81612e28565b6001600160a01b038216611ee757604051632b10aaa760e01b81526003600482015260240161089e565b50600180546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b7f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c611f3c81612e28565b611f446126b3565b611348613130565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6040518060800160405280604181526020016142ed604191398051906020012081565b6000805160206142cd833981519152611fb081612e28565b82518251808214611fd757604051632b10aaa760e01b81526002600482015260240161089e565b845160005b8160ff168160ff16101561161c5760006001600160a01b0316878260ff168151811061200a5761200a613c0b565b60200260200101516001600160a01b03160361203c57604051632b10aaa760e01b81526003600482015260240161089e565b858160ff168151811061205157612051613c0b565b602002602001015160066000898460ff168151811061207257612072613c0b565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000208190555080806120a990614082565b915050611fdc565b6000828152602081905260409020600101546120cc81612e28565b61124a8383612eb6565b6120de6126b3565b6001600160a01b03828116600090815260046020526040902054166121365760405162461bcd60e51b815260206004820152600e60248201526d1314081b9bdd0818dc99585d195960921b604482015260640161089e565b82801561217457507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316145b156122ac573481146121be5760405162461bcd60e51b8152602060048201526013602482015272616d6f756e7420213d206d73672e76616c756560681b604482015260640161089e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561221957600080fd5b505af115801561222d573d6000803e3d6000fd5b5050506001600160a01b038085166000908152600460208190526040918290205491516340c10f1960e01b81529190921693506340c10f199250612275918891349101613c21565b600060405180830381600087803b15801561228f57600080fd5b505af11580156122a3573d6000803e3d6000fd5b50505050610cb1565b34156122fa5760405162461bcd60e51b815260206004820152601d60248201527f4e6f206e65656420746f2070617373204e617469766520546f6b656e73000000604482015260640161089e565b61230682333084612720565b6001600160a01b038083166000908152600460208190526040918290205491516340c10f1960e01b815291909216916340c10f1991612349918891869101613c21565b600060405180830381600087803b15801561236357600080fd5b505af1158015612377573d6000803e3d6000fd5b5050505050505050565b6000805160206142cd83398151915261239981612e28565b60405163778ae5ed60e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063ef15cbda9034906123e79086906004016138b7565b60206040518083038185885af1158015612405573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061124a9190613c80565b60405180606001604052806032815260200161432e6032913981565b61244e6126b3565b6001600160a01b03828116600090815260056020526040902054166124a65760405162461bcd60e51b815260206004820152600e60248201526d1314081b9bdd0818dc99585d195960921b604482015260640161089e565b8280156124ef57506001600160a01b038281166000908152600560205260409020547f000000000000000000000000000000000000000000000000000000000000000082169116145b156125d85760405163079cc67960e41b81526001600160a01b038316906379cc6790906125229033908590600401613c21565b600060405180830381600087803b15801561253c57600080fd5b505af1158015612550573d6000803e3d6000fd5b5050604051632e1a7d4d60e01b8152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169250632e1a7d4d9150602401600060405180830381600087803b1580156125b657600080fd5b505af11580156125ca573d6000803e3d6000fd5b505050506113808482612fbc565b60405163079cc67960e41b81526001600160a01b038316906379cc6790906126069033908590600401613c21565b600060405180830381600087803b15801561262057600080fd5b505af1158015612634573d6000803e3d6000fd5b5050506001600160a01b03808416600090815260056020526040902054610cb1925016308684612720565b60015460ff166126b15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161089e565b565b600154610100900460ff16156126b15760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161089e565b6001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1490565b306001600160a01b038416036127a75760405163a9059cbb60e01b81526001600160a01b0385169063a9059cbb9061275e9085908590600401613c21565b6020604051808303816000875af115801561277d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a19190613c3a565b50610cb1565b6040516323b872dd60e01b81526001600160a01b0384811660048301528381166024830152604482018390528516906323b872dd906064016020604051808303816000875af11580156127fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140c9190613c3a565b6001600160a01b038116600090815260066020526040812054900361134857604051632b10aaa760e01b81526007600482015260240161089e565b6001600160a01b038316600090815260066020526040902054600181900361289b576001600160a01b03831630146113805761138084843085612720565b806002036128d157604051632770a7eb60e21b81526001600160a01b03851690639dc29fac906122759086908690600401613c21565b8060030361294457306001600160a01b0384160361291657604051630852cd8d60e31b8152600481018390526001600160a01b038516906342966c6890602401612275565b60405163079cc67960e41b81526001600160a01b038516906379cc6790906122759086908690600401613c21565b604051632b10aaa760e01b81526007600482015260240161089e565b6002805460019081019182905560405160609261299392918c918c918c9133918d91908d908d908d908d906020016140cd565b60405160208183030381529060405290505b98975050505050505050565b60006040518060800160405280604181526020016142ed60419139836040516020016129de929190614155565b60405160208183030381529060405290507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637bed470a83600160006040518060400160405280600d81526020016c726f757465725f393630302d3160981b81525060405180606001604052806032815260200161432e60329139876040518763ffffffff1660e01b8152600401612a8395949392919061417a565b60206040518083038185885af1158015612aa1573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610cb19190613c80565b6000612ad28284613c6d565b9392505050565b6001805460ff191681179055565b6001600160a01b03831660009081526006602052604081205490819003612b485760405162461bcd60e51b81526020600482015260156024820152741d1bdad95b881b9bdd081dda1a5d195b1a5cdd1959605a1b604482015260640161089e565b80600114612b7e576040516340c10f1960e01b81526001600160a01b038516906340c10f19906122759085908790600401613c21565b6000612b89856126fe565b15612b95575047612c00565b6040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa158015612bd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bfd9190613c80565b90505b83811015612cf8576001600160a01b0385811660009081526004602052604090205416612c7e5760405162461bcd60e51b815260206004820152602660248201527f455243323048616e646c65723a204c697175696469747920706f6f6c206e6f7460448201526508199bdd5b9960d21b606482015260840161089e565b6001600160a01b038086166000908152600460208190526040918290205491516340c10f1960e01b815291909216916340c10f1991612cc1918791899101613c21565b600060405180830381600087803b158015612cdb57600080fd5b505af1158015612cef573d6000803e3d6000fd5b5050505061140c565b612d01856126fe565b15612e1c57604051632e1a7d4d60e01b8152600481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015612d6857600080fd5b505af1158015612d7c573d6000803e3d6000fd5b505050506000836001600160a01b03168560405160006040518083038185875af1925050503d8060008114612dcd576040519150601f19603f3d011682016040523d82523d6000602084013e612dd2565b606091505b5050905080612e165760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b604482015260640161089e565b5061140c565b61140c85308587612720565b611348813361316f565b612e3c8282611f4c565b61130a576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055612e723390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b612ec08282611f4c565b1561130a576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600154610100900460ff166126b15760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161089e565b612f71612f1b565b6001805461ff00191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b0382166130215760405162461bcd60e51b815260206004820152602660248201527f736166655472616e736665724554483a207472616e7366657220746f2061646460448201526507265737320360d41b606482015260840161089e565b604080516000808252602082019092526001600160a01b03841690839060405161304b9190614022565b60006040518083038185875af1925050503d8060008114613088576040519150601f19603f3d011682016040523d82523d6000602084013e61308d565b606091505b505090508061124a5760405162461bcd60e51b8152602060048201526024808201527f736166655472616e736665724554483a20455448207472616e736665722066616044820152631a5b195960e21b606482015260840161089e565b60028054600101908190556040516060916131169160009189918991899133918a918a906020016141cd565b604051602081830303815290604052905095945050505050565b6131386126b3565b6001805461ff0019166101001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612f9f3390565b6131798282611f4c565b61130a57613186816131c8565b6131918360206131da565b6040516020016131a2929190614229565b60408051601f198184030181529082905262461bcd60e51b825261089e916004016138b7565b60606107dd6001600160a01b03831660145b606060006131e983600261429e565b6131f4906002613dc6565b6001600160401b0381111561320b5761320b61339f565b6040519080825280601f01601f191660200182016040528015613235576020820181803683370190505b509050600360fc1b8160008151811061325057613250613c0b565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061327f5761327f613c0b565b60200101906001600160f81b031916908160001a90535060006132a384600261429e565b6132ae906001613dc6565b90505b6001811115613326576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106132e2576132e2613c0b565b1a60f81b8282815181106132f8576132f8613c0b565b60200101906001600160f81b031916908160001a90535060049490941c9361331f816142b5565b90506132b1565b508315612ad25760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161089e565b60006020828403121561338757600080fd5b81356001600160e01b031981168114612ad257600080fd5b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156133d8576133d861339f565b60405290565b604051601f8201601f191681016001600160401b03811182821017156134065761340661339f565b604052919050565b60006001600160401b038211156134275761342761339f565b5060051b60200190565b6001600160a01b038116811461134857600080fd5b600082601f83011261345757600080fd5b8135602061346c6134678361340e565b6133de565b82815260059290921b8401810191818101908684111561348b57600080fd5b8286015b848110156134af5780356134a281613431565b835291830191830161348f565b509695505050505050565b600082601f8301126134cb57600080fd5b813560206134db6134678361340e565b82815260059290921b840181019181810190868411156134fa57600080fd5b8286015b848110156134af57803583529183019183016134fe565b60006001600160401b0382111561352e5761352e61339f565b50601f01601f191660200190565b600082601f83011261354d57600080fd5b813561355b61346782613515565b81815284602083860101111561357057600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f83011261359e57600080fd5b813560206135ae6134678361340e565b82815260059290921b840181019181810190868411156135cd57600080fd5b8286015b848110156134af5780356001600160401b038111156135f05760008081fd5b6135fe8986838b010161353c565b8452509183019183016135d1565b6000610100828403121561361f57600080fd5b6136276133b5565b90508135815260208201356001600160401b038082111561364757600080fd5b61365385838601613446565b6020840152604084013591508082111561366c57600080fd5b613678858386016134ba565b6040840152606084013591508082111561369157600080fd5b61369d8583860161358d565b60608401526080840135608084015260a084013560a084015260c08401359150808211156136ca57600080fd5b506136d78482850161353c565b60c08301525060e082013560e082015292915050565b80356001600160401b038116811461370457600080fd5b919050565b60008083601f84011261371b57600080fd5b5081356001600160401b0381111561373257600080fd5b60208301915083602082850101111561374a57600080fd5b9250929050565b6000806000806060858703121561376757600080fd5b84356001600160401b038082111561377e57600080fd5b61378a8883890161360c565b9550613798602088016136ed565b945060408701359150808211156137ae57600080fd5b506137bb87828801613709565b95989497509550505050565b6000806000606084860312156137dc57600080fd5b83356001600160401b03808211156137f357600080fd5b6137ff8783880161353c565b9450602086013591508082111561381557600080fd5b6138218783880161353c565b9350604086013591508082111561383757600080fd5b506138448682870161353c565b9150509250925092565b60006020828403121561386057600080fd5b5035919050565b60005b8381101561388257818101518382015260200161386a565b50506000910152565b600081518084526138a3816020860160208601613867565b601f01601f19169290920160200192915050565b602081526000612ad2602083018461388b565b6000602082840312156138dc57600080fd5b8135612ad281613431565b600080604083850312156138fa57600080fd5b82359150602083013561390c81613431565b809150509250929050565b6000806040838503121561392a57600080fd5b50508035926020909101359150565b60008060006060848603121561394e57600080fd5b833561395981613431565b925060208401359150604084013561397081613431565b809150509250925092565b6000806040838503121561398e57600080fd5b82356001600160401b03808211156139a557600080fd5b6139b186838701613446565b935060208501359150808211156139c757600080fd5b506139d485828601613446565b9150509250929050565b600060a082840312156139f057600080fd5b60405160a081016001600160401b038282108183111715613a1357613a1361339f565b816040528293508435835260208501359150613a2e82613431565b816020840152604085013560408401526060850135915080821115613a5257600080fd5b50613a5f8582860161353c565b606083015250608083013560808201525092915050565b600060208284031215613a8857600080fd5b81356001600160401b03811115613a9e57600080fd5b613aaa848285016139de565b949350505050565b600060208284031215613ac457600080fd5b81356001600160401b03811115613ada57600080fd5b613aaa8482850161360c565b60008060008060608587031215613afc57600080fd5b84356001600160401b0380821115613b1357600080fd5b61378a888389016139de565b60008060408385031215613b3257600080fd5b82356001600160401b0380821115613b4957600080fd5b613b5586838701613446565b93506020850135915080821115613b6b57600080fd5b506139d4858286016134ba565b801515811461134857600080fd5b60008060008060808587031215613b9c57600080fd5b8435613ba781613431565b93506020850135613bb781613b78565b92506040850135613bc781613431565b9396929550929360600135925050565b600060208284031215613be957600080fd5b81356001600160401b03811115613bff57600080fd5b613aaa8482850161353c565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03929092168252602082015260400190565b600060208284031215613c4c57600080fd5b8151612ad281613b78565b634e487b7160e01b600052601160045260246000fd5b818103818111156107dd576107dd613c57565b600060208284031215613c9257600080fd5b5051919050565b600081518084526020808501945080840160005b83811015613cc957815187529582019590820190600101613cad565b509495945050505050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d1c578284038952613d0a84835161388b565b98850198935090840190600101613cf2565b5091979650505050505050565b60e08082528851908201819052600090602090610100840190828c01845b82811015613d6c5781516001600160a01b031684529284019290840190600101613d47565b50505089828501528860408501528381036060850152613d8c8189613c99565b9150508281036080840152613da18187613cd4565b915050613db260a083018515159052565b6001600160a01b03831660c08301526129a5565b808201808211156107dd576107dd613c57565b634e487b7160e01b600052600160045260246000fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b87815260c060208201526000613e3160c083018961388b565b8760408401526001600160401b03871660608401528281036080840152613e59818688613def565b9150508260a083015298975050505050505050565b805160ff8116811461370457600080fd5b600060208284031215613e9157600080fd5b612ad282613e6e565b600060808284031215613eac57600080fd5b604051608081018181106001600160401b0382111715613ece57613ece61339f565b80604052508091508251613ee181613431565b81526020830151613ef181613431565b8060208301525060408301516040820152606083015160608201525092915050565b600080600060c08486031215613f2857600080fd5b613f3184613e6e565b925060208401519150613f478560408601613e9a565b90509250925092565b60008060008060e08587031215613f6657600080fd5b613f6f85613e6e565b935060208501519250613f858660408701613e9a565b915060c08501516001600160401b03811115613fa057600080fd5b8501601f81018713613fb157600080fd5b8051613fbf61346782613515565b818152886020838501011115613fd457600080fd5b613fe5826020830160208601613867565b9598949750929550505050565b60018060a01b0384168152826020820152606060408201526000614019606083018461388b565b95945050505050565b60008251614034818460208701613867565b9190910192915050565b60ff871681526001600160a01b0386811660208301526040820186905284166060820152821515608082015260c060a082018190526000906129a59083018461388b565b600060ff821660ff810361409857614098613c57565b60010192915050565b8481526080602082015260006140ba608083018661388b565b6040830194909452506060015292915050565b60ff8c168152602081018b90526001600160a01b038a81166040830152606082018a90528816608082015261014060a082018190526000906141118382018a61388b565b90508760c08401528660e08401526001600160401b038616610100840152828103610120840152614143818587613def565b9e9d5050505050505050505050505050565b604081526000614168604083018561388b565b8281036020840152614019818561388b565b85815284602082015260c06040820152600060c082015260e0606082015260006141a760e083018661388b565b82810360808401526141b9818661388b565b905082810360a08401526129a5818561388b565b60ff89168152602081018890526001600160a01b038781166040830152606082018790528516608082015261010060a082018190526000906142118382018761388b565b60c0840195909552505060e001529695505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614261816017850160208801613867565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614292816028840160208801613867565b01602801949350505050565b80820281158282048414176107dd576107dd613c57565b6000816142c4576142c4613c57565b50600019019056fe8b9e7a9f25b0aca3f51c01b8fee30790fb16f4d4deded8385ae6643d054bb078726f7574657231377039727a776e6e6678636a703332756e397567377968687a67746b68766c396a666b737a7467773575683639776163327067736d706576383500000000005b8d80000000000000000000000000000000000000000000000000000000000000000000000000000000000000a26469706673582212205b300391f7c52131f5425667bd6f2d8c6931beca5fb3b5d765e3a28e1835aa9564736f6c63430008120033726f7574657231377039727a776e6e6678636a703332756e397567377968687a67746b68766c396a666b737a7467773575683639776163327067736d70657638350000000000000000000000006a0fd5577c540e16a3a49c40b51e0880a2a528ce000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000086dfc31d9cb3280ee1eb1096caa9fc66299af97300000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d726f757465725f393630302d31000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041726f7574657231377039727a776e6e6678636a703332756e397567377968687a67746b68766c396a666b737a7467773575683639776163327067736d706576383500000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106102255760003560e01c80638286513e11610123578063c025d98e116100ab578063df549c4f1161006f578063df549c4f1461071d578063eb6d3a1114610730578063ef15cbda14610764578063f3b7eddb14610777578063f5def7081461078c57600080fd5b8063c025d98e1461066b578063d547741f14610691578063d9dc8694146106b1578063db618e2a146106e5578063de35f5cb1461070757600080fd5b80639d6ecc0d116100f25780639d6ecc0d1461056e578063a217fddf146105a7578063aa50ec12146105bc578063ba1e319a146105f2578063bfb942c21461061257600080fd5b80638286513e146105045780638456cb591461052457806391d14854146105395780639bc9b6351461055957600080fd5b806336568abe116101b15780635fae9245116101755780635fae92451461047557806360f30b76146104ab57806363d42ae7146104cb578063751657d7146104de5780638121165f146104f157600080fd5b806336568abe146103c85780633f4ba83a146103e857806347c6b45e146103fd5780634e1240a51461041d5780635c975abb1461045857600080fd5b8063248a9ca3116101f8578063248a9ca3146102e0578063292f7d1e1461031e5780632bcbf934146103405780632f2ff15d1461036d578063356a89271461038d57600080fd5b806301ffc9a71461022a57806307927ded1461025f578063116191b6146102745780631aa6485a146102c0575b600080fd5b34801561023657600080fd5b5061024a610245366004613375565b6107ac565b60405190151581526020015b60405180910390f35b61027261026d366004613751565b6107e3565b005b34801561028057600080fd5b506102a87f00000000000000000000000086dfc31d9cb3280ee1eb1096caa9fc66299af97381565b6040516001600160a01b039091168152602001610256565b3480156102cc57600080fd5b506102726102db3660046137c7565b610cb7565b3480156102ec57600080fd5b506103106102fb36600461384e565b60009081526020819052604090206001015490565b604051908152602001610256565b34801561032a57600080fd5b5061033361124f565b60405161025691906138b7565b34801561034c57600080fd5b5061031061035b3660046138ca565b60066020526000908152604090205481565b34801561037957600080fd5b506102726103883660046138e7565b61126b565b34801561039957600080fd5b5061024a6103a8366004613917565b600360209081526000928352604080842090915290825290205460ff1681565b3480156103d457600080fd5b506102726103e33660046138e7565b611290565b3480156103f457600080fd5b5061027261130e565b34801561040957600080fd5b50610272610418366004613939565b61134b565b34801561042957600080fd5b5061024a610438366004613917565b600760209081526000928352604080842090915290825290205460ff1681565b34801561046457600080fd5b50600154610100900460ff1661024a565b34801561048157600080fd5b506102a86104903660046138ca565b6004602052600090815260409020546001600160a01b031681565b3480156104b757600080fd5b506102726104c636600461397b565b611413565b6102726104d9366004613a76565b611625565b6102726104ec366004613ab2565b61180b565b6102726104ff366004613ae6565b611cb6565b34801561051057600080fd5b5061027261051f3660046138ca565b611ea5565b34801561053057600080fd5b50610272611f12565b34801561054557600080fd5b5061024a6105543660046138e7565b611f4c565b34801561056557600080fd5b50610310611f75565b34801561057a57600080fd5b506103336040518060400160405280600d81526020016c726f757465725f393630302d3160981b81525081565b3480156105b357600080fd5b50610310600081565b3480156105c857600080fd5b506102a86105d73660046138ca565b6005602052600090815260409020546001600160a01b031681565b3480156105fe57600080fd5b5061027261060d366004613b1f565b611f98565b34801561061e57600080fd5b5060408051808201909152600d81526c726f757465725f393630302d3160981b6020909101526103107fe3cf61256e1ad9581d1186b6443e8553eb81e46c927284e38406e12335e1bf3881565b34801561067757600080fd5b506001546102a8906201000090046001600160a01b031681565b34801561069d57600080fd5b506102726106ac3660046138e7565b6120b1565b3480156106bd57600080fd5b506103107f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c81565b3480156106f157600080fd5b506103106000805160206142cd83398151915281565b34801561071357600080fd5b5061031060025481565b61027261072b366004613b86565b6120d6565b34801561073c57600080fd5b506102a87f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b610272610772366004613bd7565b612381565b34801561078357600080fd5b5061033361242a565b34801561079857600080fd5b506102726107a7366004613b86565b612446565b60006001600160e01b03198216637965db0b60e01b14806107dd57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6107eb61265f565b6107fa6001805460ff19169055565b6108026126b3565b600061082b856020015160008151811061081e5761081e613c0b565b60200260200101516126fe565b90508061087a57610875856020015160008151811061084c5761084c613c0b565b602002602001015133600160029054906101000a90046001600160a01b03168860800151612720565b610a1a565b84608001513410156108a757604051632b10aaa760e01b8152600660048201526024015b60405180910390fd5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db086608001516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561090657600080fd5b505af115801561091a573d6000803e3d6000fd5b5050600154608089015160405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28116965063a9059cbb955061097d94506201000090930490921691600401613c21565b6020604051808303816000875af115801561099c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c09190613c3a565b507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc285602001516000815181106109f9576109f9613c0b565b60200260200101906001600160a01b031690816001600160a01b0316815250505b6020850151805160009190610a3190600190613c6d565b81518110610a4157610a41613c0b565b60209081029190910101516040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610a96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aba9190613c80565b6001805460208a015160808b015160a08c01516040808e015160608f0151915163e738aa8d60e01b8152979850600097620100009096046001600160a01b03169663e738aa8d96610b149695949391903090600401613d29565b6020604051808303816000875af1158015610b33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b579190613c80565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038516906370a0823190602401602060405180830381865afa158015610ba1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc59190613c80565b905080610bd28385613dc6565b14610bdf57610bdf613dd9565b610be884612822565b610bf384308461285d565b6000610c118a6000015186858d60c001518e60e001518e8e8e612960565b905085610c2757610c2281346129b1565b610c47565b610c4781610c428c6080015134612ac690919063ffffffff16565b6129b1565b846001600160a01b03168a600001517f220aec4438bd2c268e817da97e3b821192adc2c11dfea86d51d6ffd8bf38de6e858d60c001518e60e001518e8e8e600254604051610c9b9796959493929190613e18565b60405180910390a3505050505050610cb1612ad9565b50505050565b336001600160a01b037f00000000000000000000000086dfc31d9cb3280ee1eb1096caa9fc66299af9731614610d0357604051632b10aaa760e01b81526001600482015260240161089e565b610d0b61265f565b610d1a6001805460ff19169055565b610d226126b3565b60408051808201909152600d81526c726f757465725f393630302d3160981b6020918201528151908201207fe3cf61256e1ad9581d1186b6443e8553eb81e46c927284e38406e12335e1bf3814610d8f57604051632b10aaa760e01b8152600d600482015260240161089e565b6040518060800160405280604181526020016142ed6041913980519060200120838051906020012014610dd857604051632b10aaa760e01b81526011600482015260240161089e565b600082806020019051810190610dee9190613e7f565b90508060ff16600203610f235760008084806020019051810190610e129190613f13565b600082815260036020908152604080832060608501518452909152902054919450925060ff16159050610e5b57604051632b10aaa760e01b8152600e600482015260240161089e565b60208101516001600160a01b0316610e8957604051632b10aaa760e01b8152600f600482015260240161089e565b600082815260036020908152604080832060608501518452825291829020805460ff19166001179055820151908201518251610ec6929190612ae7565b80600001516001600160a01b03168160600151837fc6cb37798db6a3c249b500abfed1b5787f96457834af95a59170a58e1874e51c84602001518560400151604051610f13929190613c21565b60405180910390a4505050611242565b8060ff1660000361105a5760008084806020019051810190610f459190613f13565b600082815260076020908152604080832060608501518452909152902054919450925060ff16159050610fad5760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e48195e1958dd5d195960821b604482015260640161089e565b600082815260076020908152604080832060608501518452825291829020805460ff19166001179055820151908201518251610fea929190612ae7565b60608082015160208084015160408086015186518251600081526001600160a01b03948516958101959095529184015216928101929092529083907fb937c701be72296797de30f67fec8bc6c096aa6b4c1850a5e659a0dc17165d8f9060800160405180910390a3505050611242565b8060ff166001036112405760008060008580602001905181019061107e9190613f50565b600083815260076020908152604080832060608601518452909152902054929650909450925060ff161590506110e95760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e48195e1958dd5d195960821b604482015260640161089e565b600083815260076020908152604080832060608601518452825291829020805460ff19166001179055830151908301518351611126929190612ae7565b60008083600001516001600160a01b031663d00a2d5f60e01b856020015186604001518660405160240161115c93929190613ff2565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161119a9190614022565b6000604051808303816000865af19150503d80600081146111d7576040519150601f19603f3d011682016040523d82523d6000602084013e6111dc565b606091505b50915091508360600151857f2c661efd5bbbd239384997a4afc5e16ba28d1cfdf0c6fe2318ffee919ac79abf6001876020015188604001518960000151888860405161122d9695949392919061403e565b60405180910390a3505050505050611242565b505b61124a612ad9565b505050565b6040518060800160405280604181526020016142ed6041913981565b60008281526020819052604090206001015461128681612e28565b61124a8383612e32565b6001600160a01b03811633146113005760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161089e565b61130a8282612eb6565b5050565b7f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c61133881612e28565b611340612f1b565b611348612f69565b50565b600061135681612e28565b6001600160a01b03841661138557826000036113725747611374565b825b92506113808284612fbc565b610cb1565b8360008490036113fc576040516370a0823160e01b81523060048201526001600160a01b038216906370a0823190602401602060405180830381865afa1580156113d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f79190613c80565b6113fe565b835b935061140c85308587612720565b5050505050565b6000805160206142cd83398151915261142b81612e28565b8251825180821461145257604051632b10aaa760e01b81526002600482015260240161089e565b845160005b8160ff168160ff16101561161c5760066000888360ff168151811061147e5761147e613c0b565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020546000036115055760405162461bcd60e51b815260206004820152602660248201527f70726f766964656420736f6d6520746f6b656e206973206e6f742077686974656044820152651b1a5cdd195960d21b606482015260840161089e565b868160ff168151811061151a5761151a613c0b565b602002602001015160056000888460ff168151811061153b5761153b613c0b565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550858160ff168151811061159c5761159c613c0b565b602002602001015160046000898460ff16815181106115bd576115bd613c0b565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550808061161490614082565b915050611457565b50505050505050565b61162d61265f565b61163c6001805460ff19169055565b6116446126b3565b6116518160200151612822565b600061166082602001516126fe565b90508061167f5761167a826020015133846040015161285d565b61174f565b81604001513410156116a757604051632b10aaa760e01b81526006600482015260240161089e565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db083604001516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561170657600080fd5b505af115801561171a573d6000803e3d6000fd5b5050506001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216602085015250505b6000611772836000015184602001518560400151866060015187608001516130ea565b9050816117885761178381346129b1565b6117a3565b6117a381610c42856040015134612ac690919063ffffffff16565b82602001516001600160a01b031683600001517f0a9a968c7c6cc6182a9339c64cb833f1fa34f5a5275c3e3cad13f5db1c6b82a88560400151866060015187608001516002546040516117f994939291906140a1565b60405180910390a35050611348612ad9565b61181361265f565b6118226001805460ff19169055565b61182a6126b3565b6000611846826020015160008151811061081e5761081e613c0b565b90508061189557611890826020015160008151811061186757611867613c0b565b602002602001015133600160029054906101000a90046001600160a01b03168560800151612720565b611a30565b81608001513410156118bd57604051632b10aaa760e01b81526006600482015260240161089e565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db083608001516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561191c57600080fd5b505af1158015611930573d6000803e3d6000fd5b5050600154608086015160405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28116965063a9059cbb955061199394506201000090930490921691600401613c21565b6020604051808303816000875af11580156119b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119d69190613c3a565b507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28260200151600081518110611a0f57611a0f613c0b565b60200260200101906001600160a01b031690816001600160a01b0316815250505b6020820151805160009190611a4790600190613c6d565b81518110611a5757611a57613c0b565b60209081029190910101516040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611aac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad09190613c80565b600180546020870151608088015160a08901516040808b015160608c0151915163e738aa8d60e01b8152979850600097620100009096046001600160a01b03169663e738aa8d96611b2a9695949391903090600401613d29565b6020604051808303816000875af1158015611b49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b6d9190613c80565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038516906370a0823190602401602060405180830381865afa158015611bb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bdb9190613c80565b905080611be88385613dc6565b14611bf557611bf5613dd9565b611bfe84612822565b611c0984308461285d565b6000611c24876000015186858a60c001518b60e001516130ea565b905085611c3a57611c3581346129b1565b611c55565b611c5581610c42896080015134612ac690919063ffffffff16565b865160c088015160e08901516002546040516001600160a01b038a1694937f0a9a968c7c6cc6182a9339c64cb833f1fa34f5a5275c3e3cad13f5db1c6b82a893611ca0938a936140a1565b60405180910390a3505050505050611348612ad9565b611cbe61265f565b611ccd6001805460ff19169055565b611cd56126b3565b611ce28460200151612822565b6000611cf185602001516126fe565b905080611d1057611d0b856020015133876040015161285d565b611de0565b8460400151341015611d3857604051632b10aaa760e01b81526006600482015260240161089e565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db086604001516040518263ffffffff1660e01b81526004016000604051808303818588803b158015611d9757600080fd5b505af1158015611dab573d6000803e3d6000fd5b5050506001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216602088015250505b6000611e0686600001518760200151886040015189606001518a608001518a8a8a612960565b905081611e1c57611e1781346129b1565b611e37565b611e3781610c42886040015134612ac690919063ffffffff16565b85602001516001600160a01b031686600001517f220aec4438bd2c268e817da97e3b821192adc2c11dfea86d51d6ffd8bf38de6e886040015189606001518a608001518a8a8a600254604051611e939796959493929190613e18565b60405180910390a35050610cb1612ad9565b6000805160206142cd833981519152611ebd81612e28565b6001600160a01b038216611ee757604051632b10aaa760e01b81526003600482015260240161089e565b50600180546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b7f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c611f3c81612e28565b611f446126b3565b611348613130565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6040518060800160405280604181526020016142ed604191398051906020012081565b6000805160206142cd833981519152611fb081612e28565b82518251808214611fd757604051632b10aaa760e01b81526002600482015260240161089e565b845160005b8160ff168160ff16101561161c5760006001600160a01b0316878260ff168151811061200a5761200a613c0b565b60200260200101516001600160a01b03160361203c57604051632b10aaa760e01b81526003600482015260240161089e565b858160ff168151811061205157612051613c0b565b602002602001015160066000898460ff168151811061207257612072613c0b565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000208190555080806120a990614082565b915050611fdc565b6000828152602081905260409020600101546120cc81612e28565b61124a8383612eb6565b6120de6126b3565b6001600160a01b03828116600090815260046020526040902054166121365760405162461bcd60e51b815260206004820152600e60248201526d1314081b9bdd0818dc99585d195960921b604482015260640161089e565b82801561217457507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316826001600160a01b0316145b156122ac573481146121be5760405162461bcd60e51b8152602060048201526013602482015272616d6f756e7420213d206d73672e76616c756560681b604482015260640161089e565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561221957600080fd5b505af115801561222d573d6000803e3d6000fd5b5050506001600160a01b038085166000908152600460208190526040918290205491516340c10f1960e01b81529190921693506340c10f199250612275918891349101613c21565b600060405180830381600087803b15801561228f57600080fd5b505af11580156122a3573d6000803e3d6000fd5b50505050610cb1565b34156122fa5760405162461bcd60e51b815260206004820152601d60248201527f4e6f206e65656420746f2070617373204e617469766520546f6b656e73000000604482015260640161089e565b61230682333084612720565b6001600160a01b038083166000908152600460208190526040918290205491516340c10f1960e01b815291909216916340c10f1991612349918891869101613c21565b600060405180830381600087803b15801561236357600080fd5b505af1158015612377573d6000803e3d6000fd5b5050505050505050565b6000805160206142cd83398151915261239981612e28565b60405163778ae5ed60e11b81526001600160a01b037f00000000000000000000000086dfc31d9cb3280ee1eb1096caa9fc66299af973169063ef15cbda9034906123e79086906004016138b7565b60206040518083038185885af1158015612405573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061124a9190613c80565b60405180606001604052806032815260200161432e6032913981565b61244e6126b3565b6001600160a01b03828116600090815260056020526040902054166124a65760405162461bcd60e51b815260206004820152600e60248201526d1314081b9bdd0818dc99585d195960921b604482015260640161089e565b8280156124ef57506001600160a01b038281166000908152600560205260409020547f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc282169116145b156125d85760405163079cc67960e41b81526001600160a01b038316906379cc6790906125229033908590600401613c21565b600060405180830381600087803b15801561253c57600080fd5b505af1158015612550573d6000803e3d6000fd5b5050604051632e1a7d4d60e01b8152600481018490527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b03169250632e1a7d4d9150602401600060405180830381600087803b1580156125b657600080fd5b505af11580156125ca573d6000803e3d6000fd5b505050506113808482612fbc565b60405163079cc67960e41b81526001600160a01b038316906379cc6790906126069033908590600401613c21565b600060405180830381600087803b15801561262057600080fd5b505af1158015612634573d6000803e3d6000fd5b5050506001600160a01b03808416600090815260056020526040902054610cb1925016308684612720565b60015460ff166126b15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161089e565b565b600154610100900460ff16156126b15760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161089e565b6001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1490565b306001600160a01b038416036127a75760405163a9059cbb60e01b81526001600160a01b0385169063a9059cbb9061275e9085908590600401613c21565b6020604051808303816000875af115801561277d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a19190613c3a565b50610cb1565b6040516323b872dd60e01b81526001600160a01b0384811660048301528381166024830152604482018390528516906323b872dd906064016020604051808303816000875af11580156127fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140c9190613c3a565b6001600160a01b038116600090815260066020526040812054900361134857604051632b10aaa760e01b81526007600482015260240161089e565b6001600160a01b038316600090815260066020526040902054600181900361289b576001600160a01b03831630146113805761138084843085612720565b806002036128d157604051632770a7eb60e21b81526001600160a01b03851690639dc29fac906122759086908690600401613c21565b8060030361294457306001600160a01b0384160361291657604051630852cd8d60e31b8152600481018390526001600160a01b038516906342966c6890602401612275565b60405163079cc67960e41b81526001600160a01b038516906379cc6790906122759086908690600401613c21565b604051632b10aaa760e01b81526007600482015260240161089e565b6002805460019081019182905560405160609261299392918c918c918c9133918d91908d908d908d908d906020016140cd565b60405160208183030381529060405290505b98975050505050505050565b60006040518060800160405280604181526020016142ed60419139836040516020016129de929190614155565b60405160208183030381529060405290507f00000000000000000000000086dfc31d9cb3280ee1eb1096caa9fc66299af9736001600160a01b0316637bed470a83600160006040518060400160405280600d81526020016c726f757465725f393630302d3160981b81525060405180606001604052806032815260200161432e60329139876040518763ffffffff1660e01b8152600401612a8395949392919061417a565b60206040518083038185885af1158015612aa1573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610cb19190613c80565b6000612ad28284613c6d565b9392505050565b6001805460ff191681179055565b6001600160a01b03831660009081526006602052604081205490819003612b485760405162461bcd60e51b81526020600482015260156024820152741d1bdad95b881b9bdd081dda1a5d195b1a5cdd1959605a1b604482015260640161089e565b80600114612b7e576040516340c10f1960e01b81526001600160a01b038516906340c10f19906122759085908790600401613c21565b6000612b89856126fe565b15612b95575047612c00565b6040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa158015612bd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bfd9190613c80565b90505b83811015612cf8576001600160a01b0385811660009081526004602052604090205416612c7e5760405162461bcd60e51b815260206004820152602660248201527f455243323048616e646c65723a204c697175696469747920706f6f6c206e6f7460448201526508199bdd5b9960d21b606482015260840161089e565b6001600160a01b038086166000908152600460208190526040918290205491516340c10f1960e01b815291909216916340c10f1991612cc1918791899101613c21565b600060405180830381600087803b158015612cdb57600080fd5b505af1158015612cef573d6000803e3d6000fd5b5050505061140c565b612d01856126fe565b15612e1c57604051632e1a7d4d60e01b8152600481018590527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015612d6857600080fd5b505af1158015612d7c573d6000803e3d6000fd5b505050506000836001600160a01b03168560405160006040518083038185875af1925050503d8060008114612dcd576040519150601f19603f3d011682016040523d82523d6000602084013e612dd2565b606091505b5050905080612e165760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b604482015260640161089e565b5061140c565b61140c85308587612720565b611348813361316f565b612e3c8282611f4c565b61130a576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055612e723390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b612ec08282611f4c565b1561130a576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600154610100900460ff166126b15760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161089e565b612f71612f1b565b6001805461ff00191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b0382166130215760405162461bcd60e51b815260206004820152602660248201527f736166655472616e736665724554483a207472616e7366657220746f2061646460448201526507265737320360d41b606482015260840161089e565b604080516000808252602082019092526001600160a01b03841690839060405161304b9190614022565b60006040518083038185875af1925050503d8060008114613088576040519150601f19603f3d011682016040523d82523d6000602084013e61308d565b606091505b505090508061124a5760405162461bcd60e51b8152602060048201526024808201527f736166655472616e736665724554483a20455448207472616e736665722066616044820152631a5b195960e21b606482015260840161089e565b60028054600101908190556040516060916131169160009189918991899133918a918a906020016141cd565b604051602081830303815290604052905095945050505050565b6131386126b3565b6001805461ff0019166101001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612f9f3390565b6131798282611f4c565b61130a57613186816131c8565b6131918360206131da565b6040516020016131a2929190614229565b60408051601f198184030181529082905262461bcd60e51b825261089e916004016138b7565b60606107dd6001600160a01b03831660145b606060006131e983600261429e565b6131f4906002613dc6565b6001600160401b0381111561320b5761320b61339f565b6040519080825280601f01601f191660200182016040528015613235576020820181803683370190505b509050600360fc1b8160008151811061325057613250613c0b565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061327f5761327f613c0b565b60200101906001600160f81b031916908160001a90535060006132a384600261429e565b6132ae906001613dc6565b90505b6001811115613326576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106132e2576132e2613c0b565b1a60f81b8282815181106132f8576132f8613c0b565b60200101906001600160f81b031916908160001a90535060049490941c9361331f816142b5565b90506132b1565b508315612ad25760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161089e565b60006020828403121561338757600080fd5b81356001600160e01b031981168114612ad257600080fd5b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156133d8576133d861339f565b60405290565b604051601f8201601f191681016001600160401b03811182821017156134065761340661339f565b604052919050565b60006001600160401b038211156134275761342761339f565b5060051b60200190565b6001600160a01b038116811461134857600080fd5b600082601f83011261345757600080fd5b8135602061346c6134678361340e565b6133de565b82815260059290921b8401810191818101908684111561348b57600080fd5b8286015b848110156134af5780356134a281613431565b835291830191830161348f565b509695505050505050565b600082601f8301126134cb57600080fd5b813560206134db6134678361340e565b82815260059290921b840181019181810190868411156134fa57600080fd5b8286015b848110156134af57803583529183019183016134fe565b60006001600160401b0382111561352e5761352e61339f565b50601f01601f191660200190565b600082601f83011261354d57600080fd5b813561355b61346782613515565b81815284602083860101111561357057600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f83011261359e57600080fd5b813560206135ae6134678361340e565b82815260059290921b840181019181810190868411156135cd57600080fd5b8286015b848110156134af5780356001600160401b038111156135f05760008081fd5b6135fe8986838b010161353c565b8452509183019183016135d1565b6000610100828403121561361f57600080fd5b6136276133b5565b90508135815260208201356001600160401b038082111561364757600080fd5b61365385838601613446565b6020840152604084013591508082111561366c57600080fd5b613678858386016134ba565b6040840152606084013591508082111561369157600080fd5b61369d8583860161358d565b60608401526080840135608084015260a084013560a084015260c08401359150808211156136ca57600080fd5b506136d78482850161353c565b60c08301525060e082013560e082015292915050565b80356001600160401b038116811461370457600080fd5b919050565b60008083601f84011261371b57600080fd5b5081356001600160401b0381111561373257600080fd5b60208301915083602082850101111561374a57600080fd5b9250929050565b6000806000806060858703121561376757600080fd5b84356001600160401b038082111561377e57600080fd5b61378a8883890161360c565b9550613798602088016136ed565b945060408701359150808211156137ae57600080fd5b506137bb87828801613709565b95989497509550505050565b6000806000606084860312156137dc57600080fd5b83356001600160401b03808211156137f357600080fd5b6137ff8783880161353c565b9450602086013591508082111561381557600080fd5b6138218783880161353c565b9350604086013591508082111561383757600080fd5b506138448682870161353c565b9150509250925092565b60006020828403121561386057600080fd5b5035919050565b60005b8381101561388257818101518382015260200161386a565b50506000910152565b600081518084526138a3816020860160208601613867565b601f01601f19169290920160200192915050565b602081526000612ad2602083018461388b565b6000602082840312156138dc57600080fd5b8135612ad281613431565b600080604083850312156138fa57600080fd5b82359150602083013561390c81613431565b809150509250929050565b6000806040838503121561392a57600080fd5b50508035926020909101359150565b60008060006060848603121561394e57600080fd5b833561395981613431565b925060208401359150604084013561397081613431565b809150509250925092565b6000806040838503121561398e57600080fd5b82356001600160401b03808211156139a557600080fd5b6139b186838701613446565b935060208501359150808211156139c757600080fd5b506139d485828601613446565b9150509250929050565b600060a082840312156139f057600080fd5b60405160a081016001600160401b038282108183111715613a1357613a1361339f565b816040528293508435835260208501359150613a2e82613431565b816020840152604085013560408401526060850135915080821115613a5257600080fd5b50613a5f8582860161353c565b606083015250608083013560808201525092915050565b600060208284031215613a8857600080fd5b81356001600160401b03811115613a9e57600080fd5b613aaa848285016139de565b949350505050565b600060208284031215613ac457600080fd5b81356001600160401b03811115613ada57600080fd5b613aaa8482850161360c565b60008060008060608587031215613afc57600080fd5b84356001600160401b0380821115613b1357600080fd5b61378a888389016139de565b60008060408385031215613b3257600080fd5b82356001600160401b0380821115613b4957600080fd5b613b5586838701613446565b93506020850135915080821115613b6b57600080fd5b506139d4858286016134ba565b801515811461134857600080fd5b60008060008060808587031215613b9c57600080fd5b8435613ba781613431565b93506020850135613bb781613b78565b92506040850135613bc781613431565b9396929550929360600135925050565b600060208284031215613be957600080fd5b81356001600160401b03811115613bff57600080fd5b613aaa8482850161353c565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03929092168252602082015260400190565b600060208284031215613c4c57600080fd5b8151612ad281613b78565b634e487b7160e01b600052601160045260246000fd5b818103818111156107dd576107dd613c57565b600060208284031215613c9257600080fd5b5051919050565b600081518084526020808501945080840160005b83811015613cc957815187529582019590820190600101613cad565b509495945050505050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d1c578284038952613d0a84835161388b565b98850198935090840190600101613cf2565b5091979650505050505050565b60e08082528851908201819052600090602090610100840190828c01845b82811015613d6c5781516001600160a01b031684529284019290840190600101613d47565b50505089828501528860408501528381036060850152613d8c8189613c99565b9150508281036080840152613da18187613cd4565b915050613db260a083018515159052565b6001600160a01b03831660c08301526129a5565b808201808211156107dd576107dd613c57565b634e487b7160e01b600052600160045260246000fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b87815260c060208201526000613e3160c083018961388b565b8760408401526001600160401b03871660608401528281036080840152613e59818688613def565b9150508260a083015298975050505050505050565b805160ff8116811461370457600080fd5b600060208284031215613e9157600080fd5b612ad282613e6e565b600060808284031215613eac57600080fd5b604051608081018181106001600160401b0382111715613ece57613ece61339f565b80604052508091508251613ee181613431565b81526020830151613ef181613431565b8060208301525060408301516040820152606083015160608201525092915050565b600080600060c08486031215613f2857600080fd5b613f3184613e6e565b925060208401519150613f478560408601613e9a565b90509250925092565b60008060008060e08587031215613f6657600080fd5b613f6f85613e6e565b935060208501519250613f858660408701613e9a565b915060c08501516001600160401b03811115613fa057600080fd5b8501601f81018713613fb157600080fd5b8051613fbf61346782613515565b818152886020838501011115613fd457600080fd5b613fe5826020830160208601613867565b9598949750929550505050565b60018060a01b0384168152826020820152606060408201526000614019606083018461388b565b95945050505050565b60008251614034818460208701613867565b9190910192915050565b60ff871681526001600160a01b0386811660208301526040820186905284166060820152821515608082015260c060a082018190526000906129a59083018461388b565b600060ff821660ff810361409857614098613c57565b60010192915050565b8481526080602082015260006140ba608083018661388b565b6040830194909452506060015292915050565b60ff8c168152602081018b90526001600160a01b038a81166040830152606082018a90528816608082015261014060a082018190526000906141118382018a61388b565b90508760c08401528660e08401526001600160401b038616610100840152828103610120840152614143818587613def565b9e9d5050505050505050505050505050565b604081526000614168604083018561388b565b8281036020840152614019818561388b565b85815284602082015260c06040820152600060c082015260e0606082015260006141a760e083018661388b565b82810360808401526141b9818661388b565b905082810360a08401526129a5818561388b565b60ff89168152602081018890526001600160a01b038781166040830152606082018790528516608082015261010060a082018190526000906142118382018761388b565b60c0840195909552505060e001529695505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614261816017850160208801613867565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614292816028840160208801613867565b01602801949350505050565b80820281158282048414176107dd576107dd613c57565b6000816142c4576142c4613c57565b50600019019056fe8b9e7a9f25b0aca3f51c01b8fee30790fb16f4d4deded8385ae6643d054bb078726f7574657231377039727a776e6e6678636a703332756e397567377968687a67746b68766c396a666b737a7467773575683639776163327067736d706576383500000000005b8d80000000000000000000000000000000000000000000000000000000000000000000000000000000000000a26469706673582212205b300391f7c52131f5425667bd6f2d8c6931beca5fb3b5d765e3a28e1835aa9564736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000006a0fd5577c540e16a3a49c40b51e0880a2a528ce000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000086dfc31d9cb3280ee1eb1096caa9fc66299af97300000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d726f757465725f393630302d31000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041726f7574657231377039727a776e6e6678636a703332756e397567377968687a67746b68766c396a666b737a7467773575683639776163327067736d706576383500000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _dexSpan (address): 0x6A0fD5577c540e16A3A49C40b51E0880a2a528ce
Arg [1] : _wrappedNative (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [2] : _gatewayAddress (address): 0x86DFc31d9cB3280eE1eB1096caa9fC66299Af973
Arg [3] : chainId (string): router_9600-1
Arg [4] : routerBridgeAddress (string): router17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgsmpev85
Arg [5] : startNonce (uint256): 0
-----Encoded View---------------
12 Constructor Arguments found :
Arg [0] : 0000000000000000000000006a0fd5577c540e16a3a49c40b51e0880a2a528ce
Arg [1] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [2] : 00000000000000000000000086dfc31d9cb3280ee1eb1096caa9fc66299af973
Arg [3] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [6] : 000000000000000000000000000000000000000000000000000000000000000d
Arg [7] : 726f757465725f393630302d3100000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000041
Arg [9] : 726f7574657231377039727a776e6e6678636a703332756e397567377968687a
Arg [10] : 67746b68766c396a666b737a7467773575683639776163327067736d70657638
Arg [11] : 3500000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.