More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 43 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Send Message Pay... | 124025954 | 121 days ago | IN | 0.000211762826265 ETH | 0.000001365337 | ||||
Send Message Pay... | 124024300 | 121 days ago | IN | 0.000134062550646 ETH | 0.000001225879 | ||||
Send Message Pay... | 124024278 | 121 days ago | IN | 0.000134062550646 ETH | 0.000001204758 | ||||
Send Message Pay... | 124023712 | 121 days ago | IN | 0.000782216492063 ETH | 0.000001616214 | ||||
Send Message Pay... | 123986912 | 122 days ago | IN | 0.001195484066948 ETH | 0.000003123174 | ||||
Send Message Pay... | 123984946 | 122 days ago | IN | 0.00014751318409 ETH | 0.000001694622 | ||||
Send Message Pay... | 123984912 | 122 days ago | IN | 0.00014751318409 ETH | 0.000001684797 | ||||
Send Message Pay... | 123984744 | 122 days ago | IN | 0.000196674850433 ETH | 0.000001526181 | ||||
Send Message Pay... | 123928004 | 124 days ago | IN | 0.001151143160952 ETH | 0.000000997947 | ||||
Send Message Pay... | 123927940 | 124 days ago | IN | 0.000143251299618 ETH | 0.000000970913 | ||||
Send Message Pay... | 123927851 | 124 days ago | IN | 0.000194874754592 ETH | 0.000000687099 | ||||
Send Message Pay... | 123927796 | 124 days ago | IN | 0.000140247632463 ETH | 0.000000802289 | ||||
Send Message Pay... | 123812860 | 126 days ago | IN | 0.000171874379798 ETH | 0.000001132512 | ||||
Send Message Pay... | 123765698 | 127 days ago | IN | 0.001234130585183 ETH | 0.000003002988 | ||||
Send Message Pay... | 123765660 | 127 days ago | IN | 0.001237080868986 ETH | 0.000013371183 | ||||
Send Message Pay... | 123765591 | 127 days ago | IN | 0.000158627192252 ETH | 0.000002140187 | ||||
Send Message Pay... | 123765553 | 127 days ago | IN | 0.000259043154353 ETH | 0.000002785535 | ||||
Send Message Pay... | 123765516 | 127 days ago | IN | 0.000238555103909 ETH | 0.000004094774 | ||||
Send Message Pay... | 123496762 | 134 days ago | IN | 0.000117909336212 ETH | 0.000000822498 | ||||
Send Message Pay... | 123487499 | 134 days ago | IN | 0.001130275563194 ETH | 0.000000324253 | ||||
Send Message Pay... | 123487322 | 134 days ago | IN | 0.000126893348089 ETH | 0.000000561817 | ||||
Send Message Pay... | 123487204 | 134 days ago | IN | 0.000168031864827 ETH | 0.000000635283 | ||||
Send Message Pay... | 123487167 | 134 days ago | IN | 0.000118001164736 ETH | 0.000000265915 | ||||
Send Message Pay... | 123419078 | 135 days ago | IN | 0.001119103627358 ETH | 0.000001560592 | ||||
Send Message Pay... | 123418686 | 135 days ago | IN | 0.000118023685308 ETH | 0.000001419789 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
124026128 | 121 days ago | 0.000007910944652 ETH | ||||
124026128 | 121 days ago | 0.000007910944652 ETH | ||||
124025954 | 121 days ago | 0.000035293804377 ETH | ||||
124025954 | 121 days ago | 0.000176469021887 ETH | ||||
124024300 | 121 days ago | 0.000022343758441 ETH | ||||
124024300 | 121 days ago | 0.000111718792205 ETH | ||||
124024278 | 121 days ago | 0.000022343758441 ETH | ||||
124024278 | 121 days ago | 0.000111718792205 ETH | ||||
124023712 | 121 days ago | 0.000130369415343 ETH | ||||
124023712 | 121 days ago | 0.000651847076719 ETH | ||||
123992247 | 122 days ago | 0.000078405035094 ETH | ||||
123992247 | 122 days ago | 0.000078405035094 ETH | ||||
123986912 | 122 days ago | 0.000199247344491 ETH | ||||
123986912 | 122 days ago | 0.000996236722456 ETH | ||||
123984946 | 122 days ago | 0.000022918864015 ETH | ||||
123984946 | 122 days ago | 0.000114594320075 ETH | ||||
123984946 | 122 days ago | 0.00001 ETH | ||||
123984912 | 122 days ago | 0.000022918864015 ETH | ||||
123984912 | 122 days ago | 0.000114594320075 ETH | ||||
123984912 | 122 days ago | 0.00001 ETH | ||||
123984744 | 122 days ago | 0.000031112475072 ETH | ||||
123984744 | 122 days ago | 0.000155562375361 ETH | ||||
123984744 | 122 days ago | 0.00001 ETH | ||||
123983989 | 122 days ago | 0.00000383516816 ETH | ||||
123983989 | 122 days ago | 0.00000383516816 ETH |
Loading...
Loading
Contract Name:
CCIP
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 100 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import '@openzeppelin/contracts/access/Ownable2Step.sol'; import {IRouterClient} from '@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol'; import {Client} from '@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol'; import {CCIPReceiver} from '@chainlink/contracts-ccip/src/v0.8/ccip/applications/CCIPReceiver.sol'; // import {IERC20} from '@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/utils/structs/EnumerableMap.sol'; // import {SafeERC20} from '@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/utils/SafeERC20.sol'; // import {EnumerableMap} from '@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.0/contracts/utils/structs/EnumerableMap.sol'; library Path { using BytesLib for bytes; /// @dev The length of the bytes encoded address uint256 private constant ADDR_SIZE = 20; /// @dev The length of the bytes encoded fee uint256 private constant FEE_SIZE = 3; /// @dev The offset of a single token address and pool fee uint256 private constant NEXT_OFFSET = ADDR_SIZE + FEE_SIZE; /// @dev The offset of an encoded pool key uint256 private constant POP_OFFSET = NEXT_OFFSET + ADDR_SIZE; /// @dev The minimum length of an encoding that contains 2 or more pools uint256 private constant MULTIPLE_POOLS_MIN_LENGTH = POP_OFFSET + NEXT_OFFSET; /// @notice Returns true iff the path contains two or more pools /// @param path The encoded swap path /// @return True if path contains two or more pools, otherwise false function hasMultiplePools(bytes memory path) internal pure returns (bool) { return path.length >= MULTIPLE_POOLS_MIN_LENGTH; } /// @notice Returns the number of pools in the path /// @param path The encoded swap path /// @return The number of pools in the path function numPools(bytes memory path) internal pure returns (uint256) { // Ignore the first token address. From then on every fee and token offset indicates a pool. return ((path.length - ADDR_SIZE) / NEXT_OFFSET); } /// @notice Decodes the first pool in path /// @param path The bytes encoded swap path /// @return tokenA The first token of the given pool /// @return tokenB The second token of the given pool /// @return fee The fee level of the pool function decodeFirstPool(bytes memory path) internal pure returns (address tokenA, address tokenB, uint24 fee) { tokenA = path.toAddress(0); fee = path.toUint24(ADDR_SIZE); tokenB = path.toAddress(NEXT_OFFSET); } /// @notice Gets the segment corresponding to the first pool in the path /// @param path The bytes encoded swap path /// @return The segment containing all data necessary to target the first pool in the path function getFirstPool(bytes memory path) internal pure returns (bytes memory) { return path.slice(0, POP_OFFSET); } /// @notice Skips a token + fee element from the buffer and returns the remainder /// @param path The swap path /// @return The remaining token + fee elements in the path function skipToken(bytes memory path) internal pure returns (bytes memory) { return path.slice(NEXT_OFFSET, path.length - NEXT_OFFSET); } } interface IWETH is IERC20 { function deposit() external payable; function withdraw(uint amount) external; } abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } } library BytesLib { function slice(bytes memory _bytes, uint256 _start, uint256 _length) internal pure returns (bytes memory) { require(_length + 31 >= _length, 'slice_overflow'); require(_start + _length >= _start, 'slice_overflow'); require(_bytes.length >= _start + _length, 'slice_outOfBounds'); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_start + 20 >= _start, 'toAddress_overflow'); require(_bytes.length >= _start + 20, 'toAddress_outOfBounds'); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) { require(_start + 3 >= _start, 'toUint24_overflow'); require(_bytes.length >= _start + 3, 'toUint24_outOfBounds'); uint24 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x3), _start)) } return tempUint; } } /// @title - A simple messenger contract for transferring/receiving tokens and data across chains. /// @dev - This example shows how to recover tokens in case of revert contract CCIP is CCIPReceiver, Ownable2Step { using EnumerableMap for EnumerableMap.Bytes32ToUintMap; using SafeERC20 for IERC20; using BytesLib for bytes; using Path for bytes; // Using Path library for bytes // Custom errors to provide more descriptive revert messages. error NotEnoughBalance(uint256 currentBalance, uint256 calculatedFees); // Used to make sure contract has enough balance to cover the fees. error NothingToWithdraw(); // Used when trying to withdraw Ether but there's nothing to withdraw. error FailedToWithdrawEth(address owner, address target, uint256 value); // Used when the withdrawal of Ether fails. error DestinationChainNotAllowlisted(uint64 destinationChainSelector); // Used when the destination chain has not been allowlisted by the contract owner. error SourceChainNotAllowed(uint64 sourceChainSelector); // Used when the source chain has not been allowlisted by the contract owner. error SenderNotAllowed(address sender); // Used when the sender has not been allowlisted by the contract owner. error InvalidReceiverAddress(); // Used when the receiver address is 0. error OnlySelf(); // Used when a function is called outside of the contract itself. error MessageNotFailed(bytes32 messageId); error FailedCall(); // Used when transfer function is failed. error InvalidMessage(); // Example error code, could have many different error codes. enum ErrorCode { // RESOLVED is first so that the default value is resolved. RESOLVED, // Could have any number of error codes here. FAILED } struct FailedMessage { bytes32 messageId; ErrorCode errorCode; } struct FailedMessagesUsers { address token; address receiver; uint256 amount; bool isRedeemed; bytes32 messageId; } struct AddressNumber { address user; uint256 index; } // Event emitted when a message is sent to another chain. event MessageSent( bytes32 indexed messageId, // The unique ID of the CCIP message. uint64 indexed destinationChainSelector, // The chain selector of the destination chain. address receiver, // The address of the receiver on the destination chain. string text, // The text being sent. address token, // The token address that was transferred. uint256 tokenAmount, // The token amount that was transferred. address feeToken, // the token address used to pay CCIP fees. uint256 fees // The fees paid for sending the message. ); // Event emitted when a message is received from another chain. event MessageReceived( bytes32 indexed messageId, // The unique ID of the CCIP message. uint64 indexed sourceChainSelector, // The chain selector of the source chain. address sender, // The address of the sender from the source chain. string text, // The text that was received. address token, // The token address that was transferred. uint256 tokenAmount // The token amount that was transferred. ); event MessageFailed(bytes32 indexed messageId, bytes reason); event MessageRecovered(bytes32 indexed messageId); event TimeLockActivated(uint256 indexed time); bytes32 private s_lastReceivedMessageId; // Store the last received messageId. address private s_lastReceivedTokenAddress; // Store the last received token address. uint256 private s_lastReceivedTokenAmount; // Store the last received amount. string private s_lastReceivedText; // Store the last received text. // Mapping to keep track of allowlisted destination chains. mapping(uint64 => bool) public allowlistedDestinationChains; // Mapping to keep track of allowlisted source chains. mapping(uint64 => bool) public allowlistedSourceChains; // Mapping to keep track of allowlisted senders. mapping(address => bool) public allowlistedSenders; IERC20 private immutable s_linkToken; address public immutable weth; address public immutable usdc; address public immutable paraRouter; // The message contents of failed messages are stored here. mapping(bytes32 messageId => Client.Any2EVMMessage contents) public s_messageContents; // User => FailedMessagesUsers[] mapping(address => FailedMessagesUsers[]) public failedMessagesUsers; // MessageId => (address, number) mapping(bytes32 => AddressNumber) public failedMessageByMessageId; // Contains failed messages and their state. EnumerableMap.Bytes32ToUintMap internal s_failedMessages; uint256 public swapFee; // Fee must be by 1000, so if you want 5% this will be 5000 address public feeReceiver; uint256 public constant maxFee = 20000; // Max fee is 20% uint256 public constant feeBps = 1000; // 1000 is 1% so we can have many decimals uint256 public timeLockTime; /// @notice Constructor initializes the contract with the router address. /// @param _router The address of the router contract. /// @param _link The address of the link contract. constructor( address _router, address _link, address _usdc, address _weth, uint256 _swapFee, address _feeReceiver, address _owner, address _paraRouter ) CCIPReceiver(_router) Ownable(_owner) { s_linkToken = IERC20(_link); usdc = _usdc; weth = _weth; swapFee = _swapFee; feeReceiver = _feeReceiver; paraRouter = _paraRouter; } /// @dev Modifier that checks if the chain with the given destinationChainSelector is allowlisted. /// @param _destinationChainSelector The selector of the destination chain. modifier onlyAllowlistedDestinationChain(uint64 _destinationChainSelector) { if (!allowlistedDestinationChains[_destinationChainSelector]) revert DestinationChainNotAllowlisted(_destinationChainSelector); _; } /// @dev Modifier that checks if the chain with the given sourceChainSelector is allowlisted and if the sender is allowlisted. /// @param _sourceChainSelector The selector of the destination chain. /// @param _sender The address of the sender. modifier onlyAllowlisted(uint64 _sourceChainSelector, address _sender) { if (!allowlistedSourceChains[_sourceChainSelector]) revert SourceChainNotAllowed(_sourceChainSelector); if (!allowlistedSenders[_sender]) revert SenderNotAllowed(_sender); _; } /// @dev Modifier that checks the receiver address is not 0. /// @param _receiver The receiver address. modifier validateReceiver(address _receiver) { if (_receiver == address(0)) revert InvalidReceiverAddress(); _; } /// @dev Modifier to allow only the contract itself to execute a function. /// Throws an exception if called by any account other than the contract itself. modifier onlySelf() { if (msg.sender != address(this)) revert OnlySelf(); _; } function activateTimelock() external onlyOwner { timeLockTime = block.timestamp + 48 hours; emit TimeLockActivated(timeLockTime); } function transferOwnership(address newOwner) public override onlyOwner { require(timeLockTime > 0 && block.timestamp > timeLockTime, 'Timelocked'); timeLockTime = 0; // Reset it if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } function changeFeeAndAddress(uint256 _fee, address _feeReceiver) external onlyOwner { require(timeLockTime > 0 && block.timestamp > timeLockTime, 'Timelocked'); timeLockTime = 0; // Reset it require(_fee < maxFee, 'Max fee exceeded'); swapFee = _fee; feeReceiver = _feeReceiver; } // function changeRouters(address _v2Router, address _v3Router) external onlyOwner { // require(timeLockTime > 0 && block.timestamp > timeLockTime, 'Timelocked'); // timeLockTime = 0; // Reset it // v3Router = IV3SwapRouter(_v3Router); // v2Router = IUniswapV2Router02(_v2Router); // } /// @dev Updates the allowlist status of a destination chain for transactions. /// @notice This function can only be called by the owner. /// @param _destinationChainSelector The selector of the destination chain to be updated. /// @param allowed The allowlist status to be set for the destination chain. function allowlistDestinationChain(uint64 _destinationChainSelector, bool allowed) external onlyOwner { allowlistedDestinationChains[_destinationChainSelector] = allowed; } /// @dev Updates the allowlist status of a source chain /// @notice This function can only be called by the owner. /// @param _sourceChainSelector The selector of the source chain to be updated. /// @param allowed The allowlist status to be set for the source chain. function allowlistSourceChain(uint64 _sourceChainSelector, bool allowed) external onlyOwner { allowlistedSourceChains[_sourceChainSelector] = allowed; } /// @dev Updates the allowlist status of a sender for transactions. /// @notice This function can only be called by the owner. /// @param _sender The address of the sender to be updated. /// @param allowed The allowlist status to be set for the sender. function allowlistSender(address _sender, bool allowed) external onlyOwner { allowlistedSenders[_sender] = allowed; } /// @notice Sends data and transfer tokens to receiver on the destination chain. /// @notice Pay for fees in LINK. /// @dev Assumes your contract has sufficient LINK to pay for CCIP fees. /// @param _destinationChainSelector The identifier (aka selector) for the destination blockchain. /// @param _receiver The address of the recipient on the destination blockchain. /// @param _text The string data to be sent. /// @param _token token address. /// @param _amount token amount. /// @return messageId The ID of the CCIP message that was sent. function sendMessagePayLINK( uint64 _destinationChainSelector, address _receiver, string memory _text, address _token, uint256 _amount, uint256 _gasLimitReceiver ) internal onlyAllowlistedDestinationChain(_destinationChainSelector) validateReceiver(_receiver) returns (bytes32 messageId) { // Create an EVM2AnyMessage struct in memory with necessary information for sending a cross-chain message // address(linkToken) means fees are paid in LINK Client.EVM2AnyMessage memory evm2AnyMessage = _buildCCIPMessage( _receiver, _text, _token, _amount, address(s_linkToken), _gasLimitReceiver ); // Initialize a router client instance to interact with cross-chain router IRouterClient router = IRouterClient(this.getRouter()); // Get the fee required to send the CCIP message uint256 fees = router.getFee(_destinationChainSelector, evm2AnyMessage); // Revert invalid message if the fee is zero if (fees == 0) revert InvalidMessage(); if (fees > s_linkToken.balanceOf(address(this))) revert NotEnoughBalance(s_linkToken.balanceOf(address(this)), fees); // approve the Router to transfer LINK tokens on contract's behalf. It will spend the fees in LINK s_linkToken.approve(address(router), fees); // approve the Router to spend tokens on contract's behalf. It will spend the amount of the given token checkAndApproveAll(_token, address(router), _amount); // Send the message through the router and store the returned message ID messageId = router.ccipSend(_destinationChainSelector, evm2AnyMessage); // Refund any excess LINK tokens to the user refundExcessLink(fees); // Emit an event with message details emit MessageSent( messageId, _destinationChainSelector, _receiver, _text, _token, _amount, address(s_linkToken), fees ); // Return the message ID return messageId; } /// @notice Refunds any excess LINK tokens to the sender. /// @dev This function calculates the difference between the remaining LINK balance and the fees, then transfers any excess back to the sender. /// @param fees The amount of LINK tokens used for the transaction fees. function refundExcessLink(uint256 fees) internal { uint256 remainingLinkBalance = s_linkToken.balanceOf(address(this)); uint256 excessLink = remainingLinkBalance - fees; if (excessLink > 0) { s_linkToken.transfer(msg.sender, excessLink); } } /// @notice Sends data and transfer tokens to receiver on the destination chain. /// @notice Pay for fees in native gas. /// @dev Assumes your contract has sufficient native gas like ETH on Ethereum or MATIC on Polygon. /// @param _destinationChainSelector The identifier (aka selector) for the destination blockchain. /// @param _receiver The address of the recipient on the destination blockchain. /// @param _text The string data to be sent. /// @param _token token address. /// @param _amount token amount. /// @return messageId The ID of the CCIP message that was sent. function sendMessagePayNative( uint64 _destinationChainSelector, address _receiver, string memory _text, address _token, uint256 _amount, uint256 _gasLimitReceiver ) internal onlyAllowlistedDestinationChain(_destinationChainSelector) validateReceiver(_receiver) returns (bytes32 messageId) { // Create an EVM2AnyMessage struct in memory with necessary information for sending a cross-chain message // address(0) means fees are paid in native gas Client.EVM2AnyMessage memory evm2AnyMessage = _buildCCIPMessage( _receiver, _text, _token, _amount, address(0), _gasLimitReceiver ); // Initialize a router client instance to interact with cross-chain router IRouterClient router = IRouterClient(this.getRouter()); // Get the fee required to send the CCIP message uint256 fees = router.getFee(_destinationChainSelector, evm2AnyMessage); // Revert invalid message if the fee is zero if (fees == 0) revert InvalidMessage(); if (fees > address(this).balance) revert NotEnoughBalance(address(this).balance, fees); // approve the Router to spend tokens on contract's behalf. It will spend the amount of the given token checkAndApproveAll(_token, address(router), _amount); // Send the message through the router and store the returned message ID messageId = router.ccipSend{value: fees}(_destinationChainSelector, evm2AnyMessage); // payable(msg.sender).transfer(address(this).balance); // Refund the remaining msg.value (bool success, ) = msg.sender.call{value: address(this).balance}(''); if (!success) { revert FailedCall(); } // Emit an event with message details emit MessageSent(messageId, _destinationChainSelector, _receiver, _text, _token, _amount, address(0), fees); // Return the message ID return messageId; } /*** My functions ***/ struct ReceiverSwapData { address finalToken; address userReceiver; uint256 minAmountOut; bool withdrawETH; bytes dataOut; } struct InitialSwapData { address tokenIn; // Token you're sending for a crosschain swap uint256 amountIn; // For the token you send uint256 minAmountOut; uint256 sendUSDCAmount; bool withdrawWETH; // Users may want to use WETH directly instead of ETH bytes dataIn; } // All it does is encode the parameters and convert that bytes into string for the transfer and executes the right function /// swapTokenInV2First Is used to determine how we get USDC. USDC is always at V3, meaning we gotta go from token -v2 or v3-> ETH -v3-> USDC /* a. If the token is USDC we don't swap it at all and just send it b. If the token is a v2 token, swap it for weth first, then swap the weth for USDC (using _v3InitialSwap) c. If the token is a v3 token, swap it for weth and for USDC in the same router (using _v3InitialSwap) */ /** * @notice Extracts the last token address from a given Uniswap V3 path. * @param _path The bytes array representing the encoded Uniswap V3 swap path. * @return The address of the last token in the path. */ function getLastAddressPath(bytes memory _path) public pure returns (address) { // Get the number of pools in the path. Each pool represents a swap step. uint256 pools = _path.numPools(); // Declare a variable to store the last token address. address last; // Loop through each pool in the path to decode the tokens. for (uint256 i = 0; i < pools; i++) { // Decode the first pool in the path to get the output token of the pool. // The decodeFirstPool function returns the input token, fee, and output token. (, address tokenOut, ) = _path.decodeFirstPool(); // Update the last token address with the output token of the current pool. last = tokenOut; // Skip to the next pool in the path by removing the already decoded pool data. _path = _path.skipToken(); } // Return the last token address in the path. return last; } // Approves from this to the target contract unlimited tokens function checkAndApproveAll(address _token, address _target, uint256 _amountToCheck) internal { if (IERC20(_token).allowance(address(this), _target) < _amountToCheck) { IERC20(_token).forceApprove(_target, 0); IERC20(_token).forceApprove(_target, ~uint256(0)); } } function swapInitialData(InitialSwapData memory _initialSwapData) internal returns (uint256 USDCOut) { if (_initialSwapData.tokenIn == usdc) { USDCOut = _initialSwapData.amountIn; } else { checkAndApproveAll(_initialSwapData.tokenIn, paraRouter, _initialSwapData.amountIn); uint256 beforeUSDCBalance = IERC20(usdc).balanceOf(address(this)); (bool success, ) = paraRouter.call(_initialSwapData.dataIn); require(success, 'Call to paraswap router failed'); uint256 afterUSDCBalance = IERC20(usdc).balanceOf(address(this)); USDCOut = afterUSDCBalance - beforeUSDCBalance; } // Send the fee uint256 feeAmount = USDCOut - _initialSwapData.sendUSDCAmount; IERC20(usdc).safeTransfer(feeReceiver, feeAmount); USDCOut = _initialSwapData.sendUSDCAmount; } // The token that will be crossed is always USDC function sendMessagePayFirstStep( uint64 _destinationChainSelector, address _receiverCCIPInOtherChain, uint256 _gasLimitReceiver, // How much gas the receiver will have to work with bool _isLinkOrNative, // True = LINK, false = Native InitialSwapData calldata _initialSwapData, ReceiverSwapData calldata _receiverSwapData ) external payable returns (bytes32 messageId) { require(allowlistedSenders[_receiverCCIPInOtherChain], 'Must be a valid destination address'); // Create a memory copy of the InitialSwapData struct InitialSwapData memory initialSwapData = _initialSwapData; if (!_initialSwapData.withdrawWETH && _initialSwapData.tokenIn == weth) { IWETH(weth).deposit{value: msg.value - _initialSwapData.amountIn}(); // _initialSwapData.amountIn will be the CCIP fee when using eth initialSwapData.amountIn = msg.value - initialSwapData.amountIn; } else { // To take into consideration transfer fees uint256 beforeSending = IERC20(_initialSwapData.tokenIn).balanceOf(address(this)); IERC20(_initialSwapData.tokenIn).safeTransferFrom(msg.sender, address(this), _initialSwapData.amountIn); uint256 afterSending = IERC20(_initialSwapData.tokenIn).balanceOf(address(this)); initialSwapData.amountIn = afterSending - beforeSending; } // address outputToken = getLastAddressPath(initialSwapData.v3InitialSwap); // require(outputToken == usdc, "Must swap to USDC"); uint256 USDCOut = swapInitialData(initialSwapData); if (_isLinkOrNative) { return sendMessagePayLINK( _destinationChainSelector, _receiverCCIPInOtherChain, string(abi.encode(_receiverSwapData)), usdc, USDCOut, _gasLimitReceiver ); } else { return sendMessagePayNative( _destinationChainSelector, _receiverCCIPInOtherChain, string(abi.encode(_receiverSwapData)), usdc, USDCOut, _gasLimitReceiver ); } } function calculateFeeGas( uint64 _destinationChainSelector, address _receiver, address _token, uint256 _amount, uint256 _gasLimitReceiver, bool _payInLINK, ReceiverSwapData memory _receiverSwapData ) external view returns (uint256 fees) { // Create an EVM2AnyMessage struct in memory with necessary information for sending a cross-chain message // address(0) means fees are paid in native gas Client.EVM2AnyMessage memory evm2AnyMessage = _buildCCIPMessage( _receiver, string(abi.encode(_receiverSwapData)), _token, _amount, _payInLINK ? address(s_linkToken) : address(0), _gasLimitReceiver ); // Initialize a router client instance to interact with cross-chain router IRouterClient router = IRouterClient(this.getRouter()); // Get the fee required to send the CCIP message fees = router.getFee(_destinationChainSelector, evm2AnyMessage); } /*** My functions ***/ /** * @notice Returns the details of the last CCIP received message. * @dev This function retrieves the ID, text, token address, and token amount of the last received CCIP message. * @return messageId The ID of the last received CCIP message. * @return text The text of the last received CCIP message. * @return tokenAddress The address of the token in the last CCIP received message. * @return tokenAmount The amount of the token in the last CCIP received message. */ function getLastReceivedMessageDetails() public view returns (bytes32 messageId, string memory text, address tokenAddress, uint256 tokenAmount) { return (s_lastReceivedMessageId, s_lastReceivedText, s_lastReceivedTokenAddress, s_lastReceivedTokenAmount); } /** * @notice Retrieves a paginated list of failed messages. * @dev This function returns a subset of failed messages defined by `offset` and `limit` parameters. It ensures that the pagination parameters are within the bounds of the available data set. * @param offset The index of the first failed message to return, enabling pagination by skipping a specified number of messages from the start of the dataset. * @param limit The maximum number of failed messages to return, restricting the size of the returned array. * @return failedMessages An array of `FailedMessage` struct, each containing a `messageId` and an `errorCode` (RESOLVED or FAILED), representing the requested subset of failed messages. The length of the returned array is determined by the `limit` and the total number of failed messages. */ function getFailedMessages(uint256 offset, uint256 limit) external view returns (FailedMessage[] memory) { uint256 length = s_failedMessages.length(); // Calculate the actual number of items to return (can't exceed total length or requested limit) uint256 returnLength = (offset + limit > length) ? length - offset : limit; FailedMessage[] memory failedMessages = new FailedMessage[](returnLength); // Adjust loop to respect pagination (start at offset, end at offset + limit or total length) for (uint256 i = 0; i < returnLength; i++) { (bytes32 messageId, uint256 errorCode) = s_failedMessages.at(offset + i); failedMessages[i] = FailedMessage(messageId, ErrorCode(errorCode)); } return failedMessages; } /// @notice The entrypoint for the CCIP router to call. This function should /// never revert, all errors should be handled internally in this contract. /// @param any2EvmMessage The message to process. /// @dev Extremely important to ensure only router calls this. function ccipReceive( Client.Any2EVMMessage calldata any2EvmMessage ) external override onlyRouter onlyAllowlisted(any2EvmMessage.sourceChainSelector, abi.decode(any2EvmMessage.sender, (address))) // Make sure the source chain and sender are allowlisted { /* solhint-disable no-empty-blocks */ try this.processMessage(any2EvmMessage) { // Intentionally empty in this example; no action needed if processMessage succeeds } catch (bytes memory err) { // Could set different error codes based on the caught error. Each could be // handled differently. s_failedMessages.set(any2EvmMessage.messageId, uint256(ErrorCode.FAILED)); s_messageContents[any2EvmMessage.messageId] = any2EvmMessage; /*- My code -*/ string memory text = abi.decode(any2EvmMessage.data, (string)); // abi-decoding of the sent text ReceiverSwapData memory receiverData = abi.decode(bytes(text), (ReceiverSwapData)); failedMessagesUsers[receiverData.userReceiver].push( FailedMessagesUsers( usdc, receiverData.userReceiver, any2EvmMessage.destTokenAmounts[0].amount, false, any2EvmMessage.messageId ) ); failedMessageByMessageId[any2EvmMessage.messageId] = AddressNumber( receiverData.userReceiver, failedMessagesUsers[receiverData.userReceiver].length ); /*- My code -*/ // Don't revert so CCIP doesn't revert. Emit event instead. // The message can be retried later without having to do manual execution of CCIP. emit MessageFailed(any2EvmMessage.messageId, err); return; } } /// @notice Serves as the entry point for this contract to process incoming messages. /// @param any2EvmMessage Received CCIP message. /// @dev Transfers specified token amounts to the owner of this contract. This function /// must be external because of the try/catch for error handling. /// It uses the `onlySelf`: can only be called from the contract. function processMessage(Client.Any2EVMMessage calldata any2EvmMessage) external onlySelf { _ccipReceive(any2EvmMessage); // process the message - may revert as well } /// @notice Allows the owner to retry a failed message in order to unblock the associated tokens. /// @param messageId The unique identifier of the failed message. /// @param tokenReceiver The address to which the tokens will be sent. /// @dev This function is only callable by the contract owner. It changes the status of the message /// from 'failed' to 'resolved' to prevent reentry and multiple retries of the same message. function retryFailedMessage(bytes32 messageId, address tokenReceiver, uint256 index) external onlyOwner { // Check if the message has failed; if not, revert the transaction. if (s_failedMessages.get(messageId) != uint256(ErrorCode.FAILED)) revert MessageNotFailed(messageId); // Set the error code to RESOLVED to disallow reentry and multiple retries of the same failed message. s_failedMessages.set(messageId, uint256(ErrorCode.RESOLVED)); /*- My code -*/ require(!failedMessagesUsers[tokenReceiver][index].isRedeemed, 'Already redeemed'); failedMessagesUsers[tokenReceiver][index].isRedeemed = true; /*- My code -*/ // Retrieve the content of the failed message. Client.Any2EVMMessage storage message = s_messageContents[messageId]; // This example expects one token to have been sent, but you can handle multiple tokens. // Transfer the associated tokens to the specified receiver as an escape hatch. IERC20(message.destTokenAmounts[0].token).safeTransfer(tokenReceiver, message.destTokenAmounts[0].amount); // Emit an event indicating that the message has been recovered. emit MessageRecovered(messageId); } /* 1. First we swap the USDC for ETH in v3 2. Then we check if the token we want is in v3 or v2, and swap that ETH for the token in the right uni swap */ function _ccipReceive(Client.Any2EVMMessage memory any2EvmMessage) internal override { s_lastReceivedMessageId = any2EvmMessage.messageId; // fetch the messageId s_lastReceivedText = abi.decode(any2EvmMessage.data, (string)); // abi-decoding of the sent text // Expect one token to be transferred at once, but you can transfer several tokens. s_lastReceivedTokenAddress = any2EvmMessage.destTokenAmounts[0].token; s_lastReceivedTokenAmount = any2EvmMessage.destTokenAmounts[0].amount; emit MessageReceived( any2EvmMessage.messageId, any2EvmMessage.sourceChainSelector, // fetch the source chain identifier (aka selector) abi.decode(any2EvmMessage.sender, (address)), // abi-decoding of the sender address, abi.decode(any2EvmMessage.data, (string)), any2EvmMessage.destTokenAmounts[0].token, any2EvmMessage.destTokenAmounts[0].amount ); ReceiverSwapData memory receiverData = abi.decode(bytes(s_lastReceivedText), (ReceiverSwapData)); if (receiverData.finalToken == usdc) { return IERC20(usdc).safeTransfer(receiverData.userReceiver, s_lastReceivedTokenAmount); } IERC20(usdc).approve(paraRouter, s_lastReceivedTokenAmount); uint256 beforeFinalTokenBalance = IERC20(receiverData.finalToken).balanceOf(address(this)); (bool success, ) = paraRouter.call(receiverData.dataOut); require(success, 'Call to paraswap router failed'); uint256 afterFinalTokenBalance = IERC20(receiverData.finalToken).balanceOf(address(this)); uint256 amountOutFinalToken = afterFinalTokenBalance - beforeFinalTokenBalance; if (receiverData.withdrawETH) { // Get ETH at the end uint256 wethBalance = IERC20(weth).balanceOf(address(this)); IWETH(weth).withdraw(wethBalance); // payable(receiverData.userReceiver).transfer(address(this).balance); (bool success, ) = receiverData.userReceiver.call{value: address(this).balance}(''); if (!success) { revert FailedCall(); } } else { IERC20(receiverData.finalToken).safeTransfer(receiverData.userReceiver, amountOutFinalToken); } } /// @notice Construct a CCIP message. /// @dev This function will create an EVM2AnyMessage struct with all the necessary information for programmable tokens transfer. /// @param _receiver The address of the receiver. /// @param _text The string data to be sent. /// @param _token The token to be transferred. /// @param _amount The amount of the token to be transferred. /// @param _feeTokenAddress The address of the token used for fees. Set address(0) for native gas. /// @return Client.EVM2AnyMessage Returns an EVM2AnyMessage struct which contains information for sending a CCIP message. function _buildCCIPMessage( address _receiver, string memory _text, address _token, uint256 _amount, address _feeTokenAddress, uint256 _gasLimitReceiver ) internal pure returns (Client.EVM2AnyMessage memory) { // Set the token amounts Client.EVMTokenAmount[] memory tokenAmounts = new Client.EVMTokenAmount[](1); Client.EVMTokenAmount memory tokenAmount = Client.EVMTokenAmount({token: _token, amount: _amount}); tokenAmounts[0] = tokenAmount; // Create an EVM2AnyMessage struct in memory with necessary information for sending a cross-chain message Client.EVM2AnyMessage memory evm2AnyMessage = Client.EVM2AnyMessage({ receiver: abi.encode(_receiver), // ABI-encoded receiver address data: abi.encode(_text), // ABI-encoded string tokenAmounts: tokenAmounts, // The amount and type of token being transferred extraArgs: Client._argsToBytes( // Additional arguments, setting gas limit Client.EVMExtraArgsV1({gasLimit: _gasLimitReceiver}) ), // Set the feeToken to a feeTokenAddress, indicating specific asset will be used for fees feeToken: _feeTokenAddress }); return evm2AnyMessage; } /// @notice Fallback function to allow the contract to receive Ether. /// @dev This function has no function body, making it a default function for receiving Ether. /// It is automatically called when Ether is sent to the contract without any data. receive() external payable {} /// @notice Allows the contract owner to withdraw the entire balance of Ether from the contract. /// @dev This function reverts if there are no funds to withdraw or if the transfer fails. /// It should only be callable by the owner of the contract. /// @param _beneficiary The address to which the Ether should be sent. function withdraw(address _beneficiary) public onlyOwner { require(timeLockTime > 0 && block.timestamp > timeLockTime, 'Timelocked'); timeLockTime = 0; // Reset it // Retrieve the balance of this contract uint256 amount = address(this).balance; // Revert if there is nothing to withdraw if (amount == 0) revert NothingToWithdraw(); // Attempt to send the funds, capturing the success status and discarding any return data (bool sent, ) = _beneficiary.call{value: amount}(''); // Revert if the send failed, with information about the attempted transfer if (!sent) revert FailedToWithdrawEth(msg.sender, _beneficiary, amount); } /// @notice Allows the owner of the contract to withdraw all tokens of a specific ERC20 token. /// @dev This function reverts with a 'NothingToWithdraw' error if there are no tokens to withdraw. /// @param _beneficiary The address to which the tokens will be sent. /// @param _token The contract address of the ERC20 token to be withdrawn. function withdrawToken(address _beneficiary, address _token) public onlyOwner { require(timeLockTime > 0 && block.timestamp > timeLockTime, 'Timelocked'); timeLockTime = 0; // Reset the timelock time to ensure the mechanism is valid for future withdrawals // Retrieve the balance of this contract uint256 amount = IERC20(_token).balanceOf(address(this)); // Revert if there is nothing to withdraw if (amount == 0) revert NothingToWithdraw(); IERC20(_token).safeTransfer(_beneficiary, amount); } /*- My functions -*/ function recoverFailedTransfer(address tokenReceiver, uint256 index) external { FailedMessagesUsers storage f = failedMessagesUsers[tokenReceiver][index]; require(!f.isRedeemed, 'Already redeemed'); f.isRedeemed = true; require(msg.sender == f.receiver, 'Must be executed by the receiver'); // Check if the message has failed; if not, revert the transaction. if (s_failedMessages.get(f.messageId) != uint256(ErrorCode.FAILED)) revert MessageNotFailed(f.messageId); // Set the error code to RESOLVED to disallow reentry and multiple retries of the same failed message. s_failedMessages.set(f.messageId, uint256(ErrorCode.RESOLVED)); // This example expects one token to have been sent, but you can handle multiple tokens. // Transfer the associated tokens to the specified receiver as an escape hatch. IERC20(f.token).safeTransfer(tokenReceiver, f.amount); // Emit an event indicating that the message has been recovered. emit MessageRecovered(f.messageId); } function getFailedMessagesUser( address _user, uint256 _offset, uint256 _limit ) external view returns (FailedMessagesUsers[] memory) { FailedMessagesUsers[] memory results = new FailedMessagesUsers[](_limit); for (uint256 i = 0; i < _limit; i++) { results[i] = failedMessagesUsers[_user][_offset + i]; } return results; } function getLengthFailedMessagesUser(address _user) external view returns (uint256) { uint256 size = failedMessagesUsers[_user].length; return size; } function getFailedMessageByMessageId(bytes32 _messageId) external view returns (FailedMessagesUsers memory) { AddressNumber storage an = failedMessageByMessageId[_messageId]; return failedMessagesUsers[an.user][an.index]; } /*- My functions -*/ }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IAny2EVMMessageReceiver} from "../interfaces/IAny2EVMMessageReceiver.sol"; import {Client} from "../libraries/Client.sol"; import {IERC165} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/introspection/IERC165.sol"; /// @title CCIPReceiver - Base contract for CCIP applications that can receive messages. abstract contract CCIPReceiver is IAny2EVMMessageReceiver, IERC165 { address internal immutable i_ccipRouter; constructor(address router) { if (router == address(0)) revert InvalidRouter(address(0)); i_ccipRouter = router; } /// @notice IERC165 supports an interfaceId /// @param interfaceId The interfaceId to check /// @return true if the interfaceId is supported /// @dev Should indicate whether the contract implements IAny2EVMMessageReceiver /// e.g. return interfaceId == type(IAny2EVMMessageReceiver).interfaceId || interfaceId == type(IERC165).interfaceId /// This allows CCIP to check if ccipReceive is available before calling it. /// If this returns false or reverts, only tokens are transferred to the receiver. /// If this returns true, tokens are transferred and ccipReceive is called atomically. /// Additionally, if the receiver address does not have code associated with /// it at the time of execution (EXTCODESIZE returns 0), only tokens will be transferred. function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) { return interfaceId == type(IAny2EVMMessageReceiver).interfaceId || interfaceId == type(IERC165).interfaceId; } /// @inheritdoc IAny2EVMMessageReceiver function ccipReceive(Client.Any2EVMMessage calldata message) external virtual override onlyRouter { _ccipReceive(message); } /// @notice Override this function in your implementation. /// @param message Any2EVMMessage function _ccipReceive(Client.Any2EVMMessage memory message) internal virtual; ///////////////////////////////////////////////////////////////////// // Plumbing ///////////////////////////////////////////////////////////////////// /// @notice Return the current router /// @return CCIP router address function getRouter() public view returns (address) { return address(i_ccipRouter); } error InvalidRouter(address router); /// @dev only calls from the set router are accepted. modifier onlyRouter() { if (msg.sender != address(i_ccipRouter)) revert InvalidRouter(msg.sender); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {Client} from "../libraries/Client.sol"; /// @notice Application contracts that intend to receive messages from /// the router should implement this interface. interface IAny2EVMMessageReceiver { /// @notice Called by the Router to deliver a message. /// If this reverts, any token transfers also revert. The message /// will move to a FAILED state and become available for manual execution. /// @param message CCIP Message /// @dev Note ensure you check the msg.sender is the OffRampRouter function ccipReceive(Client.Any2EVMMessage calldata message) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {Client} from "../libraries/Client.sol"; interface IRouterClient { error UnsupportedDestinationChain(uint64 destChainSelector); error InsufficientFeeTokenAmount(); error InvalidMsgValue(); /// @notice Checks if the given chain ID is supported for sending/receiving. /// @param chainSelector The chain to check. /// @return supported is true if it is supported, false if not. function isChainSupported(uint64 chainSelector) external view returns (bool supported); /// @notice Gets a list of all supported tokens which can be sent or received /// to/from a given chain id. /// @param chainSelector The chainSelector. /// @return tokens The addresses of all tokens that are supported. function getSupportedTokens(uint64 chainSelector) external view returns (address[] memory tokens); /// @param destinationChainSelector The destination chainSelector /// @param message The cross-chain CCIP message including data and/or tokens /// @return fee returns execution fee for the message /// delivery to destination chain, denominated in the feeToken specified in the message. /// @dev Reverts with appropriate reason upon invalid message. function getFee( uint64 destinationChainSelector, Client.EVM2AnyMessage memory message ) external view returns (uint256 fee); /// @notice Request a message to be sent to the destination chain /// @param destinationChainSelector The destination chain ID /// @param message The cross-chain CCIP message including data and/or tokens /// @return messageId The message ID /// @dev Note if msg.value is larger than the required fee (from getFee) we accept /// the overpayment with no refund. /// @dev Reverts with appropriate reason upon invalid message. function ccipSend( uint64 destinationChainSelector, Client.EVM2AnyMessage calldata message ) external payable returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // End consumer library. library Client { /// @dev RMN depends on this struct, if changing, please notify the RMN maintainers. struct EVMTokenAmount { address token; // token address on the local chain. uint256 amount; // Amount of tokens. } struct Any2EVMMessage { bytes32 messageId; // MessageId corresponding to ccipSend on source. uint64 sourceChainSelector; // Source chain selector. bytes sender; // abi.decode(sender) if coming from an EVM chain. bytes data; // payload sent in original message. EVMTokenAmount[] destTokenAmounts; // Tokens and their amounts in their destination chain representation. } // If extraArgs is empty bytes, the default is 200k gas limit. struct EVM2AnyMessage { bytes receiver; // abi.encode(receiver address) for dest EVM chains bytes data; // Data payload EVMTokenAmount[] tokenAmounts; // Token transfers address feeToken; // Address of feeToken. address(0) means you will send msg.value. bytes extraArgs; // Populate this with _argsToBytes(EVMExtraArgsV1) } // bytes4(keccak256("CCIP EVMExtraArgsV1")); bytes4 public constant EVM_EXTRA_ARGS_V1_TAG = 0x97a657c9; struct EVMExtraArgsV1 { uint256 gasLimit; } function _argsToBytes(EVMExtraArgsV1 memory extraArgs) internal pure returns (bytes memory bts) { return abi.encodeWithSelector(EVM_EXTRA_ARGS_V1_TAG, extraArgs); } }
// 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol) pragma solidity ^0.8.20; import {Ownable} from "./Ownable.sol"; /** * @dev Contract module which provides access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is specified at deployment time in the constructor for `Ownable`. This * can later be changed with {transferOwnership} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2Step is Ownable { address private _pendingOwner; event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { return _pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override onlyOwner { _pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { delete _pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() public virtual { address sender = _msgSender(); if (pendingOwner() != sender) { revert OwnableUnauthorizedAccount(sender); } _transferOwnership(sender); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @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. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ 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]. * * CAUTION: See Security Considerations above. */ 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 v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @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 value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` 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 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../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 An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @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.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @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); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @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(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) 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 FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableMap.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableMap.js. pragma solidity ^0.8.20; import {EnumerableSet} from "./EnumerableSet.sol"; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * The following map types are supported: * * - `uint256 -> address` (`UintToAddressMap`) since v3.0.0 * - `address -> uint256` (`AddressToUintMap`) since v4.6.0 * - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0 * - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0 * - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0 * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableMap. * ==== */ library EnumerableMap { using EnumerableSet for EnumerableSet.Bytes32Set; // To implement this library for multiple types with as little code repetition as possible, we write it in // terms of a generic Map type with bytes32 keys and values. The Map implementation uses private functions, // and user-facing implementations such as `UintToAddressMap` are just wrappers around the underlying Map. // This means that we can only create new EnumerableMaps for types that fit in bytes32. /** * @dev Query for a nonexistent map key. */ error EnumerableMapNonexistentKey(bytes32 key); struct Bytes32ToBytes32Map { // Storage of keys EnumerableSet.Bytes32Set _keys; mapping(bytes32 key => bytes32) _values; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) internal returns (bool) { map._values[key] = value; return map._keys.add(key); } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) { delete map._values[key]; return map._keys.remove(key); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) { return map._keys.contains(key); } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) { return map._keys.length(); } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32, bytes32) { bytes32 key = map._keys.at(index); return (key, map._values[key]); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) { bytes32 value = map._values[key]; if (value == bytes32(0)) { return (contains(map, key), bytes32(0)); } else { return (true, value); } } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) { bytes32 value = map._values[key]; if (value == 0 && !contains(map, key)) { revert EnumerableMapNonexistentKey(key); } return value; } /** * @dev Return the an array containing all the keys * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(Bytes32ToBytes32Map storage map) internal view returns (bytes32[] memory) { return map._keys.values(); } // UintToUintMap struct UintToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToUintMap storage map, uint256 key, uint256 value) internal returns (bool) { return set(map._inner, bytes32(key), bytes32(value)); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToUintMap storage map, uint256 key) internal returns (bool) { return remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToUintMap storage map, uint256 key) internal view returns (bool) { return contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToUintMap storage map, uint256 index) internal view returns (uint256, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (uint256(key), uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(key)); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) { return uint256(get(map._inner, bytes32(key))); } /** * @dev Return the an array containing all the keys * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(UintToUintMap storage map) internal view returns (uint256[] memory) { bytes32[] memory store = keys(map._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintToAddressMap struct UintToAddressMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(get(map._inner, bytes32(key))))); } /** * @dev Return the an array containing all the keys * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(UintToAddressMap storage map) internal view returns (uint256[] memory) { bytes32[] memory store = keys(map._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressToUintMap struct AddressToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(AddressToUintMap storage map, address key, uint256 value) internal returns (bool) { return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value)); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(AddressToUintMap storage map, address key) internal returns (bool) { return remove(map._inner, bytes32(uint256(uint160(key)))); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(AddressToUintMap storage map, address key) internal view returns (bool) { return contains(map._inner, bytes32(uint256(uint160(key)))); } /** * @dev Returns the number of elements in the map. O(1). */ function length(AddressToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressToUintMap storage map, uint256 index) internal view returns (address, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (address(uint160(uint256(key))), uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key)))); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(AddressToUintMap storage map, address key) internal view returns (uint256) { return uint256(get(map._inner, bytes32(uint256(uint160(key))))); } /** * @dev Return the an array containing all the keys * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(AddressToUintMap storage map) internal view returns (address[] memory) { bytes32[] memory store = keys(map._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // Bytes32ToUintMap struct Bytes32ToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(Bytes32ToUintMap storage map, bytes32 key, uint256 value) internal returns (bool) { return set(map._inner, key, bytes32(value)); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(Bytes32ToUintMap storage map, bytes32 key) internal returns (bool) { return remove(map._inner, key); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool) { return contains(map._inner, key); } /** * @dev Returns the number of elements in the map. O(1). */ function length(Bytes32ToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (key, uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, key); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) { return uint256(get(map._inner, key)); } /** * @dev Return the an array containing all the keys * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(Bytes32ToUintMap storage map) internal view returns (bytes32[] memory) { bytes32[] memory store = keys(map._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.20; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position is the index of the value in the `values` array plus 1. // Position 0 is used to mean a value is not in the set. mapping(bytes32 value => uint256) _positions; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._positions[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We cache the value's position to prevent multiple reads from the same storage slot uint256 position = set._positions[value]; if (position != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 valueIndex = position - 1; uint256 lastIndex = set._values.length - 1; if (valueIndex != lastIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the lastValue to the index where the value to delete is set._values[valueIndex] = lastValue; // Update the tracked position of the lastValue (that was just moved) set._positions[lastValue] = position; } // Delete the slot where the moved value was stored set._values.pop(); // Delete the tracked position for the deleted slot delete set._positions[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._positions[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
{ "optimizer": { "enabled": true, "runs": 100 }, "viaIR": true, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_router","type":"address"},{"internalType":"address","name":"_link","type":"address"},{"internalType":"address","name":"_usdc","type":"address"},{"internalType":"address","name":"_weth","type":"address"},{"internalType":"uint256","name":"_swapFee","type":"uint256"},{"internalType":"address","name":"_feeReceiver","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_paraRouter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[{"internalType":"uint64","name":"destinationChainSelector","type":"uint64"}],"name":"DestinationChainNotAllowlisted","type":"error"},{"inputs":[{"internalType":"bytes32","name":"key","type":"bytes32"}],"name":"EnumerableMapNonexistentKey","type":"error"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"FailedToWithdrawEth","type":"error"},{"inputs":[],"name":"InvalidMessage","type":"error"},{"inputs":[],"name":"InvalidReceiverAddress","type":"error"},{"inputs":[{"internalType":"address","name":"router","type":"address"}],"name":"InvalidRouter","type":"error"},{"inputs":[{"internalType":"bytes32","name":"messageId","type":"bytes32"}],"name":"MessageNotFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"currentBalance","type":"uint256"},{"internalType":"uint256","name":"calculatedFees","type":"uint256"}],"name":"NotEnoughBalance","type":"error"},{"inputs":[],"name":"NothingToWithdraw","type":"error"},{"inputs":[],"name":"OnlySelf","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"SenderNotAllowed","type":"error"},{"inputs":[{"internalType":"uint64","name":"sourceChainSelector","type":"uint64"}],"name":"SourceChainNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"messageId","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"reason","type":"bytes"}],"name":"MessageFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"messageId","type":"bytes32"},{"indexed":true,"internalType":"uint64","name":"sourceChainSelector","type":"uint64"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"string","name":"text","type":"string"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"MessageReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"messageId","type":"bytes32"}],"name":"MessageRecovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"messageId","type":"bytes32"},{"indexed":true,"internalType":"uint64","name":"destinationChainSelector","type":"uint64"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"string","name":"text","type":"string"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"feeToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"fees","type":"uint256"}],"name":"MessageSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"time","type":"uint256"}],"name":"TimeLockActivated","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"activateTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_destinationChainSelector","type":"uint64"},{"internalType":"bool","name":"allowed","type":"bool"}],"name":"allowlistDestinationChain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"bool","name":"allowed","type":"bool"}],"name":"allowlistSender","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_sourceChainSelector","type":"uint64"},{"internalType":"bool","name":"allowed","type":"bool"}],"name":"allowlistSourceChain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"","type":"uint64"}],"name":"allowlistedDestinationChains","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowlistedSenders","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"","type":"uint64"}],"name":"allowlistedSourceChains","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_destinationChainSelector","type":"uint64"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_gasLimitReceiver","type":"uint256"},{"internalType":"bool","name":"_payInLINK","type":"bool"},{"components":[{"internalType":"address","name":"finalToken","type":"address"},{"internalType":"address","name":"userReceiver","type":"address"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"bool","name":"withdrawETH","type":"bool"},{"internalType":"bytes","name":"dataOut","type":"bytes"}],"internalType":"struct CCIP.ReceiverSwapData","name":"_receiverSwapData","type":"tuple"}],"name":"calculateFeeGas","outputs":[{"internalType":"uint256","name":"fees","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"messageId","type":"bytes32"},{"internalType":"uint64","name":"sourceChainSelector","type":"uint64"},{"internalType":"bytes","name":"sender","type":"bytes"},{"internalType":"bytes","name":"data","type":"bytes"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Client.EVMTokenAmount[]","name":"destTokenAmounts","type":"tuple[]"}],"internalType":"struct Client.Any2EVMMessage","name":"any2EvmMessage","type":"tuple"}],"name":"ccipReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"},{"internalType":"address","name":"_feeReceiver","type":"address"}],"name":"changeFeeAndAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"failedMessageByMessageId","outputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"failedMessagesUsers","outputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"isRedeemed","type":"bool"},{"internalType":"bytes32","name":"messageId","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeBps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_messageId","type":"bytes32"}],"name":"getFailedMessageByMessageId","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"isRedeemed","type":"bool"},{"internalType":"bytes32","name":"messageId","type":"bytes32"}],"internalType":"struct CCIP.FailedMessagesUsers","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offset","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"getFailedMessages","outputs":[{"components":[{"internalType":"bytes32","name":"messageId","type":"bytes32"},{"internalType":"enum CCIP.ErrorCode","name":"errorCode","type":"uint8"}],"internalType":"struct CCIP.FailedMessage[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_offset","type":"uint256"},{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"getFailedMessagesUser","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"isRedeemed","type":"bool"},{"internalType":"bytes32","name":"messageId","type":"bytes32"}],"internalType":"struct CCIP.FailedMessagesUsers[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_path","type":"bytes"}],"name":"getLastAddressPath","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getLastReceivedMessageDetails","outputs":[{"internalType":"bytes32","name":"messageId","type":"bytes32"},{"internalType":"string","name":"text","type":"string"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getLengthFailedMessagesUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRouter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paraRouter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"messageId","type":"bytes32"},{"internalType":"uint64","name":"sourceChainSelector","type":"uint64"},{"internalType":"bytes","name":"sender","type":"bytes"},{"internalType":"bytes","name":"data","type":"bytes"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Client.EVMTokenAmount[]","name":"destTokenAmounts","type":"tuple[]"}],"internalType":"struct Client.Any2EVMMessage","name":"any2EvmMessage","type":"tuple"}],"name":"processMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenReceiver","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"recoverFailedTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"messageId","type":"bytes32"},{"internalType":"address","name":"tokenReceiver","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"retryFailedMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"messageId","type":"bytes32"}],"name":"s_messageContents","outputs":[{"internalType":"bytes32","name":"messageId","type":"bytes32"},{"internalType":"uint64","name":"sourceChainSelector","type":"uint64"},{"internalType":"bytes","name":"sender","type":"bytes"},{"internalType":"bytes","name":"data","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_destinationChainSelector","type":"uint64"},{"internalType":"address","name":"_receiverCCIPInOtherChain","type":"address"},{"internalType":"uint256","name":"_gasLimitReceiver","type":"uint256"},{"internalType":"bool","name":"_isLinkOrNative","type":"bool"},{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"uint256","name":"sendUSDCAmount","type":"uint256"},{"internalType":"bool","name":"withdrawWETH","type":"bool"},{"internalType":"bytes","name":"dataIn","type":"bytes"}],"internalType":"struct CCIP.InitialSwapData","name":"_initialSwapData","type":"tuple"},{"components":[{"internalType":"address","name":"finalToken","type":"address"},{"internalType":"address","name":"userReceiver","type":"address"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"bool","name":"withdrawETH","type":"bool"},{"internalType":"bytes","name":"dataOut","type":"bytes"}],"internalType":"struct CCIP.ReceiverSwapData","name":"_receiverSwapData","type":"tuple"}],"name":"sendMessagePayFirstStep","outputs":[{"internalType":"bytes32","name":"messageId","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"swapFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timeLockTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdc","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_beneficiary","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_beneficiary","type":"address"},{"internalType":"address","name":"_token","type":"address"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
61012034620001f3576200469838819003601f8101601f191683016001600160401b03811184821017620001f85783928291604052833961010092839181010312620001f35762000050816200020e565b6200005e602083016200020e565b6200006c604084016200020e565b926200007b606082016200020e565b60808201516200008e60a084016200020e565b91620000ab60e0620000a360c087016200020e565b95016200020e565b956001600160a01b039485821615620001da57859160805216968715620001c1578460018060a01b03199687600154166001556000549980898c1617600055826040519b167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a31660a05260e05260c052600f5516906010541617601055825261447491826200022483396080518281816111950152611629015260a0518281816122d4015281816127450152612eb7015260c0518281816109eb01528181611ed1015281816120ff0152613f68015260e05182818161096001528181611f7f01528181611fc001528181612ca30152818161383d0152613e0001525181818161033901528181612d010152613e3e0152f35b604051631e4fbdf760e01b815260006004820152602490fd5b6040516335fdcccd60e21b815260006004820152602490fd5b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203620001f35756fe6080604052600436101561001b575b361561001957600080fd5b005b60003560e01c806301f59d161461029b57806301ffc9a714610296578063046d293c146102915780630e6bd3e21461028c57806324a9d85314610287578063263596a5146102825780632c94785a1461027d5780633aeac4e1146102785780633bf64452146102735780633e413bee1461026e5780633e957731146102695780633fc8cef3146102645780634030d5211461025f5780634b127efd1461025a5780634dd315601461025557806351cff8d91461025057806354cf2aeb1461024b5780635aacd56a146102465780636122750f146102415780636159ada11461023c57806363a5d29814610237578063715018a61461023257806375c67c661461022d57806379ba50971461022857806380665c2a1461022357806382b55c7b1461021e57806385572ffb146102195780638d9d89fe146102145780638da5cb5b1461020f57806396d3b83d1461020a5780639889509514610205578063a05bdb5b14610200578063b0f479a1146101fb578063b3f00674146101f6578063cf6730f8146101f1578063d0d1fc3d146101ec578063db04fa49146101e7578063e30c3978146101e2578063eab5b02c146101dd5763f2fde38b0361000e57611964565b611909565b6118e0565b61189e565b611809565b611681565b611658565b611613565b61156d565b6114c4565b611482565b611434565b611340565b61117d565b611116565b6110f8565b6110b2565b61106f565b611009565b610fb2565b610f70565b610e36565b610d5b565b610cf5565b610c5c565b610b31565b610a94565b610a1a565b6109d5565b61098f565b61094a565b6108ca565b6107d2565b61076a565b610638565b6105d3565b6104da565b610323565b6102cd565b6102b0565b60009103126102ab57565b600080fd5b346102ab5760003660031901126102ab576020604051614e208152f35b346102ab5760203660031901126102ab5760043563ffffffff60e01b81168091036102ab576020906385572ffb60e01b8114908115610312575b506040519015158152f35b6301ffc9a760e01b14905038610307565b346102ab5760003660031901126102ab576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b6001600160401b038116036102ab57565b359061038482610368565b565b6001600160a01b038116036102ab57565b801515036102ab57565b359061038482610397565b634e487b7160e01b600052604160045260246000fd5b60a081019081106001600160401b038211176103dd57604052565b6103ac565b6001600160401b0381116103dd57604052565b604081019081106001600160401b038211176103dd57604052565b90601f801991011681019081106001600160401b038211176103dd57604052565b60405190610384826103f5565b60405190610384826103c2565b60405190602082018281106001600160401b038211176103dd57604052565b6001600160401b0381116103dd57601f01601f191660200190565b9291926104918261046a565b9161049f6040519384610410565b8294818452818301116102ab578281602093846000960137010152565b9080601f830112156102ab578160206104d793359101610485565b90565b346102ab5760031960e0368201126102ab576004356104f881610368565b60243561050481610386565b6044359061051182610386565b60a4359061051e82610397565b60c435936001600160401b03958686116102ab5760a09086360301126102ab576040519361054b856103c2565b856004013561055981610386565b8552602486013561056981610386565b602086015260448601356040860152606486013561058681610397565b606086015260848601359687116102ab576105ad6105bf9660046105cf99369201016104bc565b60808601526084359260643592612e8d565b6040519081529081906020820190565b0390f35b346102ab5760003660031901126102ab5760206040516103e88152f35b60005b8381106106035750506000910152565b81810151838201526020016105f3565b9060209161062c815180928185528580860191016105f0565b601f01601f1916010190565b346102ab5760008060031936011261072e5760025460018060a01b036003541660045460405193848160055461066d81611739565b8084529060019081811690811561070b57506001146106c0575b505061069592500385610410565b6106b16040519485948552608060208601526080850190610613565b91604084015260608301520390f35b600585526000805160206143ff833981519152946020935091905b8183106106f357505061069593508201013880610687565b85548a840185015294850194899450918301916106db565b91505061069594506020925060ff191682840152151560051b8201013880610687565b80fd5b6080809160018060a01b038082511685526020820151166020850152604081015160408501526060810151151560608501520151910152565b346102ab5760203660031901126102ab57610783614386565b50600435600052600b60205260a06107c36107bd6040600020600180851b03815416600052600a6020526001604060002091015490610a73565b506143b1565b6107d06040518092610731565bf35b346102ab5760403660031901126102ab576004356107ef81610386565b6024356107fb81610386565b6108036119d4565b61081960115480151590816108b2575b50611a75565b6108236000601155565b6040516370a0823160e01b81523060048201526001600160a01b039190911691602082602481865afa9182156108ad5760009261087d575b50811561086b5761001992612e08565b604051630686827b60e51b8152600490fd5b61089f91925060203d81116108a6575b6108978183610410565b810190611d9b565b903861085b565b503d61088d565b611daa565b9050421138610813565b908160a09103126102ab5790565b60031960c0368201126102ab57600435906108e482610368565b6024356108f081610386565b606435906108fd82610397565b608435916001600160401b03938484116102ab5760c09084360301126102ab5760a4359384116102ab576105cf9461093c6105bf9536906004016108bc565b936004019260443591611e7f565b346102ab5760003660031901126102ab576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346102ab5760203660031901126102ab576004356000908152600b6020908152604091829020805460019091015483516001600160a01b03909216825291810191909152f35b346102ab5760003660031901126102ab576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346102ab5760203660031901126102ab576001600160401b03600435610a3f81610368565b166000526007602052602060ff604060002054166040519015158152f35b634e487b7160e01b600052603260045260246000fd5b8054821015610a8f576000526005602060002091020190600090565b610a5d565b346102ab5760403660031901126102ab57600435610ab181610386565b6001600160a01b039081166000908152600a602052604090208054602435908110156102ab57610ae091610a73565b508054600182015460028301546003840154600490940154604080516001600160a01b03958816861681529690931690931660208601529084015260ff90911615156060830152608082015260a090f35b346102ab5760403660031901126102ab57600435610b4e81610386565b6001600160a01b0381166000908152600a60205260409020610b789060243590610a73565b610a73565b50610ba760038201610b9a610b95610b91835460ff1690565b1590565b613a35565b805460ff19166001179055565b6001810154610bd190610bca906001600160a01b03165b6001600160a01b031690565b331461433b565b60048101908154926001610be485613a89565b03610c3f57610bf6610c179394613908565b508154600290610c0e906001600160a01b0316610bbe565b92015491612e08565b547fef3bf8c64bc480286c4f3503b870ceb23e648d2d902e31fb7bb46680da6de8ad600080a2005b6040516305b73c1360e51b815260048101859052602490fd5b0390fd5b346102ab5760203660031901126102ab57600435610c7981610386565b610c816119d4565b610c9660115480151590816108b25750611a75565b610ca06000601155565b47801561086b576000918280808085855af1610cba6121ff565b5015610cc4578280f35b604051639d11f56360e01b81523360048201526001600160a01b039190911660248201526044810191909152606490fd5b346102ab5760003660031901126102ab576020600f54604051908152f35b6020908160408183019282815285518094520193019160005b828110610d3a575050505090565b909192938260a082610d4f6001948951610731565b01950193929101610d2c565b346102ab5760603660031901126102ab57600435610d7881610386565b604435602435610d8782612f87565b92610d956040519485610410565b828452601f19610da484612f87565b0160005b818110610e1f57505060005b838110610dc957604051806105cf8782610d13565b610e1a90610dff6107bd610def8560018060a01b0316600052600a602052604060002090565b610df98488611a68565b90610a73565b610e098288612fd0565b52610e148187612fd0565b50611aae565b610db4565b602090610e2a614386565b82828901015201610da8565b346102ab5760603660031901126102ab57600435602435610e5681610386565b604435610e616119d4565b6001610e6c84613a89565b03610f575790610ee76003610ed8610f3094610e8787613908565b50610ebb610b95610b9185610eb285610b738b60018060a01b0316600052600a602052604060002090565b50015460ff1690565b6001600160a01b0385166000908152600a60205260409020610a73565b5001805460ff19166001179055565b6004610efd846000526009602052604060002090565b01906001610f27610f21610bbe610f1386613a74565b50546001600160a01b031690565b93613a74565b50015491612e08565b7fef3bf8c64bc480286c4f3503b870ceb23e648d2d902e31fb7bb46680da6de8ad600080a2005b6040516305b73c1360e51b815260048101849052602490fd5b346102ab5760203660031901126102ab57600435610f8d81610386565b60018060a01b03166000526008602052602060ff604060002054166040519015158152f35b346102ab5760008060031936011261072e57610fcc6119d4565b6202a300420180421161100457806011557f7c907b8735e3b64d39d41766c0e80d8acd40b0a9fd407745b5d0b396488a4b488280a280f35b611a36565b346102ab5760008060031936011261072e576110236119d4565b600180546001600160a01b03199081169091558154908116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b346102ab5760203660031901126102ab576001600160401b0360043561109481610368565b166000526006602052602060ff604060002054166040519015158152f35b346102ab5760003660031901126102ab57600154336001600160a01b03909116036110e057610019336119e8565b60405163118cdaa760e01b8152336004820152602490fd5b346102ab5760003660031901126102ab576020601154604051908152f35b346102ab5760203660031901126102ab5760043561113381610386565b60018060a01b0316600052600a6020526020604060002054604051908152f35b60206003198201126102ab57600435906001600160401b0382116102ab576104d7916004016108bc565b346102ab5761118b36611153565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081163303611299576020820135906111cb82610368565b60206111da6040850185613024565b90809291810103126102ab57356111f081610386565b169061121c610b91611215836001600160401b03166000526007602052604060002090565b5460ff1690565b61127657506001600160a01b038116600090815260086020526040902061124690610b9190611215565b611253576100198261371f565b6040516368692cbb60e11b81526001600160a01b03919091166004820152602490fd5b60405163042784cf60e31b81526001600160401b03919091166004820152602490fd5b6040516335fdcccd60e21b8152336004820152602490fd5b600211156112bb57565b634e487b7160e01b600052602160045260246000fd5b602090818101828252835180915282604080930194019260009283905b8382106112fe5750505050505090565b909192939495838751805183520151600281101561132c5784820152810195830194939291600101906112ee565b634e487b7160e01b87526021600452602487fd5b346102ab5760403660031901126102ab57600435602435600c54908083018084116110045782101561142d5750818103908111611004575b61138181612f87565b9161138f6040519384610410565b818352601f1961139e83612f87565b0160005b81811061141657505060005b8281106113c357604051806105cf86826112d1565b806113fc6113dc6113d76114119486611a68565b612fe4565b6113e8819392936112b1565b6113f0610431565b92835260208301612fb7565b6114068287612fd0565b52610e148186612fd0565b6113ae565b602090611421612f9e565b828288010152016113a2565b9050611378565b346102ab5760003660031901126102ab576000546040516001600160a01b039091168152602090f35b60409060031901126102ab5760043561147581610368565b906024356104d781610397565b346102ab576100196001600160401b0361149b3661145d565b91906114a56119d4565b16600052600660205260406000209060ff801983541691151516179055565b346102ab5760403660031901126102ab576024356004356114e482610386565b6114ec6119d4565b61150160115480151590816108b25750611a75565b6000601155614e2081101561153557600f55601080546001600160a01b0319166001600160a01b0392909216919091179055005b60405162461bcd60e51b815260206004820152601060248201526f13585e0819995948195e18d95959195960821b6044820152606490fd5b346102ab5760203660031901126102ab576004356001600160401b0381116102ab5761159d9036906004016104bc565b80516013198101919082116110045790601780910460009182905b8282106115d3576040516001600160a01b0385168152602090f35b909192506115e084611c3a565b506115ee8185511015611c64565b6116096116036115fd86611c53565b95611aca565b92611aae565b90939291936115b8565b346102ab5760003660031901126102ab576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346102ab5760003660031901126102ab576010546040516001600160a01b039091168152602090f35b346102ab5761168f36611153565b3033036117275760a0813603126102ab576116a861043e565b813581526116b860208301610379565b60208201526001600160401b0360408301358181116102ab576116de90369085016104bc565b604083015260608301358181116102ab576116fc90369085016104bc565b606083015260808301359081116102ab576100199261171d913691016139aa565b6080820152613cb8565b60405163029a949d60e31b8152600490fd5b90600182811c92168015611769575b602083101461175357565b634e487b7160e01b600052602260045260246000fd5b91607f1691611748565b906000929180549161178483611739565b9182825260019384811690816000146117e657506001146117a6575b50505050565b90919394506000526020928360002092846000945b8386106117d25750505050010190388080806117a0565b8054858701830152940193859082016117bb565b9294505050602093945060ff191683830152151560051b010190388080806117a0565b346102ab5760203660031901126102ab576004356000526009602052604060002080546105cf60036118906001600160401b0360018601541694611872604051916118628361185b8160028501611773565b0384610410565b61185b6040518096819301611773565b60405195869586526020860152608060408601526080850190610613565b908382036060850152610613565b346102ab576100196001600160401b036118b73661145d565b91906118c16119d4565b16600052600760205260406000209060ff801983541691151516179055565b346102ab5760003660031901126102ab576001546040516001600160a01b039091168152602090f35b346102ab5760403660031901126102ab5761001960043561192981610386565b6024359061193682610397565b61193e6119d4565b60018060a01b0316600052600860205260406000209060ff801983541691151516179055565b346102ab5760203660031901126102ab5760043561198181610386565b6119896119d4565b61199e60115480151590816108b25750611a75565b60006011556001600160a01b038116156119bb57610019906119e8565b604051631e4fbdf760e01b815260006004820152602490fd5b6000546001600160a01b031633036110e057565b60018060a01b031990816001541660015560005460018060a01b038092168093821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b634e487b7160e01b600052601160045260246000fd5b90601f820180921161100457565b601701908160171161100457565b9190820180921161100457565b15611a7c57565b60405162461bcd60e51b815260206004820152600a602482015269151a5b595b1bd8dad95960b21b6044820152606490fd5b60001981146110045760010190565b9190820391821161100457565b8051601619918282019082821161100457611aef82611ae881611a4c565b1015611b79565b611afd6017611ae884611a5a565b611b128151611b0b84611a5a565b1115611bb6565b60178303611b2f5750505050604051600081526020810160405290565b601760405194601f8416801560051b9182828901019687010193010101905b808410611b665750508252601f01601f191660405290565b9092835181526020809101930190611b4e565b15611b8057565b60405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606490fd5b15611bbd57565b60405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606490fd5b15611bfd57565b60405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606490fd5b602090611c4b601482511015611bf6565b015160601c90565b603790611c4b602b82511015611bf6565b15611c6b57565b60405162461bcd60e51b8152602060048201526014602482015273746f55696e7432345f6f75744f66426f756e647360601b6044820152606490fd5b15611cae57565b60405162461bcd60e51b815260206004820152602360248201527f4d75737420626520612076616c69642064657374696e6174696f6e206164647260448201526265737360e81b6064820152608490fd5b91909160c0818403126102ab57604051906001600160401b039060c08301828111848210176103dd5760405282948135611d3881610386565b8452602082013560208501526040820135604085015260608201356060850152611d64608083016103a1565b608085015260a08201359283116102ab5760a092611d8292016104bc565b910152565b356104d781610397565b356104d781610386565b908160209103126102ab575190565b6040513d6000823e3d90fd5b9035601e19823603018112156102ab5701602081359101916001600160401b0382116102ab5781360383136102ab57565b908060209392818452848401376000828201840152601f01601f1916010190565b60c0611e6f6104d793602084528035611e2081610386565b6001600160a01b03908116602086810191909152820135611e4081610386565b166040850152604081013560608501526060810135611e5e81610397565b151560808501526080810190611db6565b91909260a0808201520191611de7565b9193949094611eab611ea66112158860018060a01b03166000526008602052604060002090565b611ca7565b611eb53682611cff565b611ec4610b9160808401611d87565b806120f3575b15611ffe577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691611f08906020013534611abd565b91803b156102ab57600090600460405180958193630d0e30db60e41b83525af19182156108ad57611f4f92611fe5575b5060208101611f48815134611abd565b9052612c93565b9215611fa4576104d794611f7d611f6f9260405193849160208301611e08565b03601f198101845283610410565b7f000000000000000000000000000000000000000000000000000000000000000092612292565b6104d794611fbe611f6f9260405193849160208301611e08565b7f0000000000000000000000000000000000000000000000000000000000000000926127f8565b80611ff2611ff8926103e2565b806102a0565b38611f38565b61200d610bbe610bbe84611d91565b6040516370a0823160e01b80825230600483015290936020928390869060249082905afa9485156108ad576000956120c6575b5061206e610bbe610bbe8361206961205b610bbe8997611d91565b868301359030903390612131565b611d91565b604051928352306004840152829060249082905afa9384156108ad57611f4f946120a0926000916120a9575b50611abd565b90820152612c93565b6120c09150843d86116108a6576108978183610410565b3861209a565b83919550610bbe610bbe6120e961206e93853d87116108a6576108978183610410565b9793505050612040565b506120fd82611d91565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03908116911614611eca565b6040516323b872dd60e01b60208201526001600160a01b0392831660248201529290911660448301526064820192909252610384916121738260848101611f6f565b61218d565b908160209103126102ab57516104d781610397565b6000806121b69260018060a01b03169360208151910182865af16121af6121ff565b908361222f565b80519081151591826121e4575b50506121cc5750565b60249060405190635274afe760e01b82526004820152fd5b6121f79250602080918301019101612178565b1538806121c3565b3d1561222a573d906122108261046a565b9161221e6040519384610410565b82523d6000602084013e565b606090565b90612256575080511561224457805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580612289575b612267575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561225f565b909192946001600160401b038216946000968688526020936006855260409060ff828b205416156125ad576001600160a01b03958787161561259c576122ff877f000000000000000000000000000000000000000000000000000000000000000016968787878d8d614225565b96835163b0f479a160e01b81528281600481305afa9081156108ad578d9161256f575b5084516320487ded60e01b81529891168289806123438588600484016125da565b0381845afa9889156108ad578d99612550575b50881561253f5784516370a0823160e01b8082523060048301529084816024818d5afa9081156108ad578f91612522575b508a116124af5750845163095ea7b360e01b81526001600160a01b0382166004820152602481018a9052919083838f81806044810103918d5af19485156108ad578e85946123fb97612482575b506123e08a848b6129e5565b87518097819582946396f4e9f960e01b8452600484016125da565b03925af19a8b156108ad579a612441575b50509261243b92859260008051602061441f83398151915297956124318c9a98612725565b51968796876126e5565b0390a390565b60008051602061441f8339815191529795929896939a5061243b94918161247392903d106108a6576108978183610410565b9992959791949681945061240c565b6124a190863d88116124a8575b6124998183610410565b810190612178565b50386123d4565b503d61248f565b855190815230600482015289908e9087908680828e81806024810103915afa9384156108ad57936124fd575b505051634787a10360e11b815260048101919091526024810191909152604490fd5b610c58929350908161251a92903d106108a6576108978183610410565b9190846124db565b6125399150853d87116108a6576108978183610410565b38612387565b8451636eca2e4b60e01b8152600490fd5b612568919950833d85116108a6576108978183610410565b9738612356565b61258f9150833d8511612595575b6125878183610410565b8101906125c5565b38612322565b503d61257d565b825163502ffa3f60e11b8152600490fd5b8151630a503cdb60e01b8152600481018a9052602490fd5b908160209103126102ab57516104d781610386565b906001600160401b039093929316815260406020918183820152612609855160a08484015260e0830190610613565b916126258487015193603f199485858303016060860152610613565b8187015194848483030160808501528080875193848152019601926000905b83821061267d5750505060608701516001600160a01b031660a08401525093946104d7945060c090608001519282850301910152610613565b845180516001600160a01b03168952830151888401529687019693820193600190910190612644565b91906126ce60a09497969592600180871b03809316855260c0602086015260c0850190610613565b961660408301526060820152600060808201520152565b92969594909360a09461270f600180881b039485809316875260c0602088015260c0870190610613565b9816604085015260608401521660808201520152565b6040516370a0823160e01b81523060048201526020916001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691908382602481865afa80156108ad57612786926000916127e15750611abd565b908161279157505050565b60405163a9059cbb60e01b815233600482015260248101929092528290829060449082906000905af180156108ad576127c8575050565b816127de92903d106124a8576124998183610410565b50565b6120c09150853d87116108a6576108978183610410565b909192936001600160401b0382169460008681526020976006895260409160ff8382205416156129cd576001600160a01b0391878316156129bc576128409086868b8b614130565b835163b0f479a160e01b8152600493908c818681305afa9081156108ad57849161299f575b50168451976320487ded60e01b89528c898061288486858a84016125da565b0381855afa9889156108ad578499612980575b5088156129705747891161294d5791816128d3936128b88f948b908b6129e5565b8a88518096819582946396f4e9f960e01b84528b84016125da565b03925af19a8b156108ad57829b61292e575b505080808047335af16128f66121ff565b501561292057509260008051602061441f833981519152949261243b9289979551958695866126a6565b905163d6bda27560e01b8152fd5b612945929b50803d106108a6576108978183610410565b9838806128e5565b8551634787a10360e11b815247818701908152602081018b905281906040010390fd5b8551636eca2e4b60e01b81528590fd5b6129989199508d803d106108a6576108978183610410565b9738612897565b6129b691508d803d10612595576125878183610410565b38612865565b835163502ffa3f60e11b8152600490fd5b8251630a503cdb60e01b8152600481018a9052602490fd5b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152602094921691908481604481865afa9081156108ad57600091612b30575b5010612a3157505050565b60405163095ea7b360e01b8482018181526001600160a01b038516602484015260006044808501829052845261038496929392601f19929091908190612a78606487610410565b85519082895af1612a876121ff565b81612b00575b5080612af6575b15612aa3575b50505050612b4d565b604051908101939093526001600160a01b038516602484015260006044840152612aed92612ae791612ae19082606481015b03908101835282610410565b8461218d565b8261218d565b38808080612a9a565b50843b1515612a94565b80518015925083908315612b18575b50505038612a8d565b612b289350820181019101612178565b388281612b0f565b612b479150853d87116108a6576108978183610410565b38612a26565b60405163095ea7b360e01b602082018181526001600160a01b038516602484015260001960448085019190915283529093919291601f1991612b90606486610410565b84516001600160a01b03851691600091829182855af190612baf6121ff565b82612c15575b5081612c0a575b5015612bca575b5050505050565b60405160208101959095526001600160a01b0316602485015260006044850152612c009361217391612ae7908260648101612ad5565b3880808080612bc3565b90503b151538612bbc565b80519192508115918215612c2d575b50509038612bb5565b612c409250602080918301019101612178565b3880612c24565b15612c4e57565b60405162461bcd60e51b815260206004820152601e60248201527f43616c6c20746f20706172617377617020726f75746572206661696c656400006044820152606490fd5b80516001600160a01b03908116907f000000000000000000000000000000000000000000000000000000000000000016818103612cff57612cfb9150612ce560606020850151945b0193845190611abd565b6010549091906001600160a01b03165b90612e08565b5190565b7f000000000000000000000000000000000000000000000000000000000000000091612d326020918483870151916129e5565b6040516370a0823160e01b80825230600483015290938285602481875afa9485156108ad57600095612de0575b50600080612d849260a089015190828783519301915af1612d7e6121ff565b50612c47565b6040519081523060048201528181602481865afa9182156108ad57612cfb94612ce593606093612dbd93600092612dc3575b5050611abd565b94612cdb565b612dd99250803d106108a6576108978183610410565b3880612db6565b612d849195506000612dff8192863d88116108a6576108978183610410565b96925050612d5f565b60405163a9059cbb60e01b60208201526001600160a01b0390921660248301526044820192909252610384916121738260648101611f6f565b60c060806104d7936020845260018060a01b03808251166020860152602082015116604085015260408101516060850152606081015115158285015201519160a0808201520190610613565b9491612ee59493919260405190612eac82611f6f60209b8c8301612e41565b60009015612f8157507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031693614225565b60405163b0f479a160e01b8152908382600481305afa80156108ad57612f2c938593600092612f62575b506040518095819482936320487ded60e01b8452600484016125da565b03916001600160a01b03165afa9182156108ad57600092612f4c57505090565b6104d79250803d106108a6576108978183610410565b612f7a919250843d8611612595576125878183610410565b9038612f0f565b93614225565b6001600160401b0381116103dd5760051b60200190565b60405190612fab826103f5565b60006020838281520152565b60028210156112bb5752565b805115610a8f5760200190565b8051821015610a8f5760209160051b010190565b600c54811015610a8f577fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c701546000818152600e60205260409020549091565b903590601e19813603018212156102ab57018035906001600160401b0382116102ab576020019181360383136102ab57565b9190808252602080920192916000905b828210613074575050505090565b90919293600190853561308681610386565b828060a01b03168152828601358382015260408091019501920190929192613066565b9060208252803560208301526020810135916130c483610368565b6001600160401b0380931660408201526130f56130e46040840184611db6565b60a0606085015260c0840191611de7565b9261311a6131066060850185611db6565b601f19858803810160808701529691611de7565b926080810135601e19823603018112156102ab5701916020833593019183116102ab578260061b360382136102ab5760a06104d79582860301910152613056565b601f8111613167575050565b6000906005825260208220906020601f850160051c830194106131a5575b601f0160051c01915b82811061319a57505050565b81815560010161318e565b9092508290613185565b90601f81116131bd57505050565b600091825260208220906020601f850160051c830194106131f9575b601f0160051c01915b8281106131ee57505050565b8181556001016131e2565b90925082906131d9565b9092916001600160401b0381116103dd57613228816132228454611739565b846131af565b6000601f82116001146132625781929394600092613257575b50508160011b916000199060031b1c1916179055565b013590503880613241565b601f1982169461327784600052602060002090565b91805b8781106132b2575083600195969710613298575b505050811b019055565b0135600019600384901b60f8161c1916905538808061328e565b9092602060018192868601358155019401910161327a565b903590601e19813603018212156102ab57018035906001600160401b0382116102ab57602001918160061b360383136102ab57565b90602060019161332f813561331381610386565b85546001600160a01b0319166001600160a01b03909116178555565b0135910155565b90600160401b83116103dd57815483835580841061338e575b506133609091600052602060002090565b6000915b8383106133715750505050565b6002604082613382600194866132ff565b01920192019190613364565b6001600160ff1b03818116820361100457841684036110045760008381526020812091600190811b83019286821b015b8381106133cd5750505061334f565b8083600292558383820155016133be565b813581559060208082013560018085016133f783610368565b805467ffffffffffffffff19166001600160401b0393841617905560028501926134246040860186613024565b9384116103dd5761343f846134398754611739565b876131af565b600091601f85116001146134b157509280806004979461038499979461349d976000946134a6575b50501b916000199060031b1c19161790555b6134936134896060830183613024565b9060038601613203565b60808101906132ca565b92909101613336565b013592503880613467565b91601f9493941984166134c987600052602060002090565b9382905b8282106135155750509261349d95928592600499966103849b9996106134fb575b505050811b019055613479565b0135600019600384901b60f8161c191690553880806134ee565b8088859782949688013581550196019301906134cd565b6020818303126102ab578035906001600160401b0382116102ab57019080601f830112156102ab578160206104d793359101610485565b909291926135708161046a565b9161357e6040519384610410565b8294828452828201116102ab5760206103849301906105f0565b906020828203126102ab5781516001600160401b03928382116102ab57019160a0838303126102ab57604051926135ce846103c2565b80516135d981610386565b845260208101516135e981610386565b602085015260408101516040850152606081015161360681610397565b606085015260808101519182116102ab57019080601f830112156102ab57815161363292602001613563565b608082015290565b9015610a8f5790565b8054600160401b8110156103dd5761366091600182018155610a73565b9190916136cf57805182546001600160a01b039182166001600160a01b03199182161784556020830151600185018054919093169116179055600490608090604081015160028501556136c860608201511515600386019060ff801983541691151516179055565b0151910155565b634e487b7160e01b600052600060045260246000fd5b815181546001600160a01b0319166001600160a01b0391909116178155906001906020906136c8565b9060206104d7928181520190610613565b303b156102ab576040516319ece61f60e31b81526000818061374485600483016130a9565b038183305af190816138f5575b506127de577f55bc02a9ef6f146737edeeb425738006f67f077e7138de3bf84a15bde1a5b56f6138f06137826121ff565b6138e46137e361389386359661379788613921565b506137b5816137b08a6000526009602052604060002090565b6133de565b6138866137d06137c86060840184613024565b81019061352c565b6020948186808094518301019101613598565b0180516001600160a01b03166000908152600a602052604090209092908351869061382690613820906001600160a01b03169460808101906132ca565b9061363a565b013561386f61383361043e565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152936001600160a01b031684890152565b6040830152600060608301528a6080830152613643565b516001600160a01b031690565b6001600160a01b0381166000908152600a602052604090205490916138c86138b9610431565b6001600160a01b039094168452565b8201526138df86600052600b602052604060002090565b6136e5565b6040519182918261370e565b0390a2565b80611ff2613902926103e2565b38613751565b6104d79080600052600e60205260006040812055613937565b6104d79080600052600e60205260016040600020555b6000818152600d60205260408120546139a557600c5490600160401b8210156103dd576001820180600c55821015610a8f577fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7909101829055600c54918152600d6020526040902055600190565b905090565b81601f820112156102ab578035906139c182612f87565b926040926139d184519586610410565b808552602091828087019260061b850101938185116102ab578301915b8483106139fe5750505050505090565b85838303126102ab578386918251613a15816103f5565b8535613a2081610386565b815282860135838201528152019201916139ee565b15613a3c57565b60405162461bcd60e51b815260206004820152601060248201526f105b1c9958591e481c995919595b595960821b6044820152606490fd5b805415610a8f57600052602060002090600090565b80600052600e60205260406000205490811580613ac1575b613aa9575090565b6024906040519063015ab34360e11b82526004820152fd5b50600d60205260406000205415613aa1565b6020818303126102ab578051906001600160401b0382116102ab57019080601f830112156102ab5781516104d792602001613563565b9081516001600160401b0381116103dd57613b2e81613b29600554611739565b61315b565b602080601f8311600114613b6a5750819293600092613b5f575b50508160011b916000199060031b1c191617600555565b015190503880613b48565b6005600052601f198316949091906000805160206143ff833981519152926000905b878210613bc4575050836001959610613bab575b505050811b01600555565b015160001960f88460031b161c19169055388080613ba0565b80600185968294968601518155019501930190613b8c565b90613c046060939695949660018060a01b038093168452608060208501526080840190610613565b951660408201520152565b6040519060008260055491613c2383611739565b808352600193808516908115613c975750600114613c49575b5061038492500383610410565b600560009081526000805160206143ff83398151915294602093509091905b818310613c7f575050610384935082010138613c3c565b85548884018501529485019487945091830191613c68565b905061038494506020925060ff191682840152151560051b82010138613c3c565b613cc28151600255565b6060810190815191613ce6613ce1602094858082518301019101613ad3565b613b09565b60808201613d2a613d08613cfa8351612fc3565b51516001600160a01b031690565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b613d4084613d388351612fc3565b510151600455565b7f90ec910a8f80bb04e184a806e2ae6f8786ef2ae898859a3180f953397edc12016001600160401b03845192613dd7613d82888801516001600160401b031690565b91613dad613d9d6040809a01518b80825183010191016125c5565b97518a8082518301019101613ad3565b9089613dc6613dbf613cfa8451612fc3565b9251612fc3565b510151918951958695169885613bdc565b0390a3613df3613de5613c0f565b838082518301019101613598565b80516001600160a01b03937f00000000000000000000000000000000000000000000000000000000000000008516929091851683146140d95760048054855163095ea7b360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0381168285015260248201929092529196908483806044810103816000809a5af19283156108ad5788936140bc575b508351613eaa90610bbe906001600160a01b031681565b87516370a0823160e01b808252309582019586529490929187918491908290819060200103915afa80156108ad5787613f35938192614099575b5080613f029293608089015190828b83519301915af1612d7e6121ff565b845186908a90613f1c90610bbe906001600160a01b031681565b8a51878152309281019283529485928391829160200190565b03915afa80156108ad57613f4f9288916140825750611abd565b60608401511561405157508551918252308783019081527f00000000000000000000000000000000000000000000000000000000000000009190911691908490829081906020010381855afa9081156108ad578591614034575b50813b15614030578551632e1a7d4d60e01b815287810191825291859183919082908490829060200103925af180156108ad57849384938493613ffa9361401d575b5001516001600160a01b031690565b47905af16140066121ff565b5015614010575050565b5163d6bda27560e01b8152fd5b80611ff261402a926103e2565b38613feb565b8480fd5b61404b9150843d86116108a6576108978183610410565b38613fa9565b9550505091506103849350612cf590614073610bbe845160018060a01b031690565b9201516001600160a01b031690565b6120c09150873d89116108a6576108978183610410565b613f0292506140b582918a3d8c116108a6576108978183610410565b9250613ee4565b6140d290863d88116124a8576124998183610410565b5038613e93565b0151600454610384945092506001600160a01b031690612e08565b60405190614101826103f5565b600182528160005b6020908181101561412b5760209161411f612f9e565b90828501015201614109565b505050565b926142046141c5956141f46080946141e897600097604051614151816103c2565b606098818a8093528260208201528260408201528b8382015201526141746140f4565b9661418f614180610431565b6001600160a01b039093168352565b602082015261419d87612fc3565b526141a786612fc3565b50604080516001600160a01b03909216602083015290998a91820190565b03906141d9601f19928381018c528b610410565b6040519889916020830161370e565b03908101885287610410565b6141fc61044b565b908152614304565b9361420d61043e565b95865260208601526040850152830152608082015290565b926142dd6142ae966141f4608094613632976142d19997604051614248816103c2565b606098818a809352826020820152826040820152600083820152015261426c6140f4565b96614278614180610431565b602082015261428687612fc3565b5261429086612fc3565b50604080516001600160a01b039092166020830152909a8b91820190565b03906142c2601f19928381018d528c610410565b604051998a916020830161370e565b03908101895288610410565b946142e661043e565b968752602087015260408601526001600160a01b0390911690840152565b604051906397a657c960e01b602083015251602482015260248152606081018181106001600160401b038211176103dd5760405290565b1561434257565b606460405162461bcd60e51b815260206004820152602060248201527f4d757374206265206578656375746564206279207468652072656365697665726044820152fd5b60405190614393826103c2565b60006080838281528260208201528260408201528260608201520152565b906040516143be816103c2565b82546001600160a01b039081168252600184015416602082015260028301546040820152600383015460ff1615156060820152600490920154608083015256fe036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0437cb3c5ba4364504dda6ba3c906ffb0897c7beeb1675f3aaf22a1b9a99b3994a2646970667358221220a7458295f46cee4c4a1516da19909854307939254c6cda51294dc60f8c3b99e164736f6c634300081400330000000000000000000000003206695cae29952f4b0c22a169725a865bc8ce0f000000000000000000000000350a791bfc2c21f9ed5d10980dad2e2638ffa7f60000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff85000000000000000000000000420000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000e1ff5a4c489b11e094bfbb5d23c6d4597a3a79ad000000000000000000000000a24e8ce77d4a7ce869da3730e6560bfb66553f940000000000000000000000006a000f20005980200259b80c5102003040001068
Deployed Bytecode
0x6080604052600436101561001b575b361561001957600080fd5b005b60003560e01c806301f59d161461029b57806301ffc9a714610296578063046d293c146102915780630e6bd3e21461028c57806324a9d85314610287578063263596a5146102825780632c94785a1461027d5780633aeac4e1146102785780633bf64452146102735780633e413bee1461026e5780633e957731146102695780633fc8cef3146102645780634030d5211461025f5780634b127efd1461025a5780634dd315601461025557806351cff8d91461025057806354cf2aeb1461024b5780635aacd56a146102465780636122750f146102415780636159ada11461023c57806363a5d29814610237578063715018a61461023257806375c67c661461022d57806379ba50971461022857806380665c2a1461022357806382b55c7b1461021e57806385572ffb146102195780638d9d89fe146102145780638da5cb5b1461020f57806396d3b83d1461020a5780639889509514610205578063a05bdb5b14610200578063b0f479a1146101fb578063b3f00674146101f6578063cf6730f8146101f1578063d0d1fc3d146101ec578063db04fa49146101e7578063e30c3978146101e2578063eab5b02c146101dd5763f2fde38b0361000e57611964565b611909565b6118e0565b61189e565b611809565b611681565b611658565b611613565b61156d565b6114c4565b611482565b611434565b611340565b61117d565b611116565b6110f8565b6110b2565b61106f565b611009565b610fb2565b610f70565b610e36565b610d5b565b610cf5565b610c5c565b610b31565b610a94565b610a1a565b6109d5565b61098f565b61094a565b6108ca565b6107d2565b61076a565b610638565b6105d3565b6104da565b610323565b6102cd565b6102b0565b60009103126102ab57565b600080fd5b346102ab5760003660031901126102ab576020604051614e208152f35b346102ab5760203660031901126102ab5760043563ffffffff60e01b81168091036102ab576020906385572ffb60e01b8114908115610312575b506040519015158152f35b6301ffc9a760e01b14905038610307565b346102ab5760003660031901126102ab576040517f0000000000000000000000006a000f20005980200259b80c51020030400010686001600160a01b03168152602090f35b6001600160401b038116036102ab57565b359061038482610368565b565b6001600160a01b038116036102ab57565b801515036102ab57565b359061038482610397565b634e487b7160e01b600052604160045260246000fd5b60a081019081106001600160401b038211176103dd57604052565b6103ac565b6001600160401b0381116103dd57604052565b604081019081106001600160401b038211176103dd57604052565b90601f801991011681019081106001600160401b038211176103dd57604052565b60405190610384826103f5565b60405190610384826103c2565b60405190602082018281106001600160401b038211176103dd57604052565b6001600160401b0381116103dd57601f01601f191660200190565b9291926104918261046a565b9161049f6040519384610410565b8294818452818301116102ab578281602093846000960137010152565b9080601f830112156102ab578160206104d793359101610485565b90565b346102ab5760031960e0368201126102ab576004356104f881610368565b60243561050481610386565b6044359061051182610386565b60a4359061051e82610397565b60c435936001600160401b03958686116102ab5760a09086360301126102ab576040519361054b856103c2565b856004013561055981610386565b8552602486013561056981610386565b602086015260448601356040860152606486013561058681610397565b606086015260848601359687116102ab576105ad6105bf9660046105cf99369201016104bc565b60808601526084359260643592612e8d565b6040519081529081906020820190565b0390f35b346102ab5760003660031901126102ab5760206040516103e88152f35b60005b8381106106035750506000910152565b81810151838201526020016105f3565b9060209161062c815180928185528580860191016105f0565b601f01601f1916010190565b346102ab5760008060031936011261072e5760025460018060a01b036003541660045460405193848160055461066d81611739565b8084529060019081811690811561070b57506001146106c0575b505061069592500385610410565b6106b16040519485948552608060208601526080850190610613565b91604084015260608301520390f35b600585526000805160206143ff833981519152946020935091905b8183106106f357505061069593508201013880610687565b85548a840185015294850194899450918301916106db565b91505061069594506020925060ff191682840152151560051b8201013880610687565b80fd5b6080809160018060a01b038082511685526020820151166020850152604081015160408501526060810151151560608501520151910152565b346102ab5760203660031901126102ab57610783614386565b50600435600052600b60205260a06107c36107bd6040600020600180851b03815416600052600a6020526001604060002091015490610a73565b506143b1565b6107d06040518092610731565bf35b346102ab5760403660031901126102ab576004356107ef81610386565b6024356107fb81610386565b6108036119d4565b61081960115480151590816108b2575b50611a75565b6108236000601155565b6040516370a0823160e01b81523060048201526001600160a01b039190911691602082602481865afa9182156108ad5760009261087d575b50811561086b5761001992612e08565b604051630686827b60e51b8152600490fd5b61089f91925060203d81116108a6575b6108978183610410565b810190611d9b565b903861085b565b503d61088d565b611daa565b9050421138610813565b908160a09103126102ab5790565b60031960c0368201126102ab57600435906108e482610368565b6024356108f081610386565b606435906108fd82610397565b608435916001600160401b03938484116102ab5760c09084360301126102ab5760a4359384116102ab576105cf9461093c6105bf9536906004016108bc565b936004019260443591611e7f565b346102ab5760003660031901126102ab576040517f0000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff856001600160a01b03168152602090f35b346102ab5760203660031901126102ab576004356000908152600b6020908152604091829020805460019091015483516001600160a01b03909216825291810191909152f35b346102ab5760003660031901126102ab576040517f00000000000000000000000042000000000000000000000000000000000000066001600160a01b03168152602090f35b346102ab5760203660031901126102ab576001600160401b03600435610a3f81610368565b166000526007602052602060ff604060002054166040519015158152f35b634e487b7160e01b600052603260045260246000fd5b8054821015610a8f576000526005602060002091020190600090565b610a5d565b346102ab5760403660031901126102ab57600435610ab181610386565b6001600160a01b039081166000908152600a602052604090208054602435908110156102ab57610ae091610a73565b508054600182015460028301546003840154600490940154604080516001600160a01b03958816861681529690931690931660208601529084015260ff90911615156060830152608082015260a090f35b346102ab5760403660031901126102ab57600435610b4e81610386565b6001600160a01b0381166000908152600a60205260409020610b789060243590610a73565b610a73565b50610ba760038201610b9a610b95610b91835460ff1690565b1590565b613a35565b805460ff19166001179055565b6001810154610bd190610bca906001600160a01b03165b6001600160a01b031690565b331461433b565b60048101908154926001610be485613a89565b03610c3f57610bf6610c179394613908565b508154600290610c0e906001600160a01b0316610bbe565b92015491612e08565b547fef3bf8c64bc480286c4f3503b870ceb23e648d2d902e31fb7bb46680da6de8ad600080a2005b6040516305b73c1360e51b815260048101859052602490fd5b0390fd5b346102ab5760203660031901126102ab57600435610c7981610386565b610c816119d4565b610c9660115480151590816108b25750611a75565b610ca06000601155565b47801561086b576000918280808085855af1610cba6121ff565b5015610cc4578280f35b604051639d11f56360e01b81523360048201526001600160a01b039190911660248201526044810191909152606490fd5b346102ab5760003660031901126102ab576020600f54604051908152f35b6020908160408183019282815285518094520193019160005b828110610d3a575050505090565b909192938260a082610d4f6001948951610731565b01950193929101610d2c565b346102ab5760603660031901126102ab57600435610d7881610386565b604435602435610d8782612f87565b92610d956040519485610410565b828452601f19610da484612f87565b0160005b818110610e1f57505060005b838110610dc957604051806105cf8782610d13565b610e1a90610dff6107bd610def8560018060a01b0316600052600a602052604060002090565b610df98488611a68565b90610a73565b610e098288612fd0565b52610e148187612fd0565b50611aae565b610db4565b602090610e2a614386565b82828901015201610da8565b346102ab5760603660031901126102ab57600435602435610e5681610386565b604435610e616119d4565b6001610e6c84613a89565b03610f575790610ee76003610ed8610f3094610e8787613908565b50610ebb610b95610b9185610eb285610b738b60018060a01b0316600052600a602052604060002090565b50015460ff1690565b6001600160a01b0385166000908152600a60205260409020610a73565b5001805460ff19166001179055565b6004610efd846000526009602052604060002090565b01906001610f27610f21610bbe610f1386613a74565b50546001600160a01b031690565b93613a74565b50015491612e08565b7fef3bf8c64bc480286c4f3503b870ceb23e648d2d902e31fb7bb46680da6de8ad600080a2005b6040516305b73c1360e51b815260048101849052602490fd5b346102ab5760203660031901126102ab57600435610f8d81610386565b60018060a01b03166000526008602052602060ff604060002054166040519015158152f35b346102ab5760008060031936011261072e57610fcc6119d4565b6202a300420180421161100457806011557f7c907b8735e3b64d39d41766c0e80d8acd40b0a9fd407745b5d0b396488a4b488280a280f35b611a36565b346102ab5760008060031936011261072e576110236119d4565b600180546001600160a01b03199081169091558154908116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b346102ab5760203660031901126102ab576001600160401b0360043561109481610368565b166000526006602052602060ff604060002054166040519015158152f35b346102ab5760003660031901126102ab57600154336001600160a01b03909116036110e057610019336119e8565b60405163118cdaa760e01b8152336004820152602490fd5b346102ab5760003660031901126102ab576020601154604051908152f35b346102ab5760203660031901126102ab5760043561113381610386565b60018060a01b0316600052600a6020526020604060002054604051908152f35b60206003198201126102ab57600435906001600160401b0382116102ab576104d7916004016108bc565b346102ab5761118b36611153565b6001600160a01b037f0000000000000000000000003206695cae29952f4b0c22a169725a865bc8ce0f81163303611299576020820135906111cb82610368565b60206111da6040850185613024565b90809291810103126102ab57356111f081610386565b169061121c610b91611215836001600160401b03166000526007602052604060002090565b5460ff1690565b61127657506001600160a01b038116600090815260086020526040902061124690610b9190611215565b611253576100198261371f565b6040516368692cbb60e11b81526001600160a01b03919091166004820152602490fd5b60405163042784cf60e31b81526001600160401b03919091166004820152602490fd5b6040516335fdcccd60e21b8152336004820152602490fd5b600211156112bb57565b634e487b7160e01b600052602160045260246000fd5b602090818101828252835180915282604080930194019260009283905b8382106112fe5750505050505090565b909192939495838751805183520151600281101561132c5784820152810195830194939291600101906112ee565b634e487b7160e01b87526021600452602487fd5b346102ab5760403660031901126102ab57600435602435600c54908083018084116110045782101561142d5750818103908111611004575b61138181612f87565b9161138f6040519384610410565b818352601f1961139e83612f87565b0160005b81811061141657505060005b8281106113c357604051806105cf86826112d1565b806113fc6113dc6113d76114119486611a68565b612fe4565b6113e8819392936112b1565b6113f0610431565b92835260208301612fb7565b6114068287612fd0565b52610e148186612fd0565b6113ae565b602090611421612f9e565b828288010152016113a2565b9050611378565b346102ab5760003660031901126102ab576000546040516001600160a01b039091168152602090f35b60409060031901126102ab5760043561147581610368565b906024356104d781610397565b346102ab576100196001600160401b0361149b3661145d565b91906114a56119d4565b16600052600660205260406000209060ff801983541691151516179055565b346102ab5760403660031901126102ab576024356004356114e482610386565b6114ec6119d4565b61150160115480151590816108b25750611a75565b6000601155614e2081101561153557600f55601080546001600160a01b0319166001600160a01b0392909216919091179055005b60405162461bcd60e51b815260206004820152601060248201526f13585e0819995948195e18d95959195960821b6044820152606490fd5b346102ab5760203660031901126102ab576004356001600160401b0381116102ab5761159d9036906004016104bc565b80516013198101919082116110045790601780910460009182905b8282106115d3576040516001600160a01b0385168152602090f35b909192506115e084611c3a565b506115ee8185511015611c64565b6116096116036115fd86611c53565b95611aca565b92611aae565b90939291936115b8565b346102ab5760003660031901126102ab576040517f0000000000000000000000003206695cae29952f4b0c22a169725a865bc8ce0f6001600160a01b03168152602090f35b346102ab5760003660031901126102ab576010546040516001600160a01b039091168152602090f35b346102ab5761168f36611153565b3033036117275760a0813603126102ab576116a861043e565b813581526116b860208301610379565b60208201526001600160401b0360408301358181116102ab576116de90369085016104bc565b604083015260608301358181116102ab576116fc90369085016104bc565b606083015260808301359081116102ab576100199261171d913691016139aa565b6080820152613cb8565b60405163029a949d60e31b8152600490fd5b90600182811c92168015611769575b602083101461175357565b634e487b7160e01b600052602260045260246000fd5b91607f1691611748565b906000929180549161178483611739565b9182825260019384811690816000146117e657506001146117a6575b50505050565b90919394506000526020928360002092846000945b8386106117d25750505050010190388080806117a0565b8054858701830152940193859082016117bb565b9294505050602093945060ff191683830152151560051b010190388080806117a0565b346102ab5760203660031901126102ab576004356000526009602052604060002080546105cf60036118906001600160401b0360018601541694611872604051916118628361185b8160028501611773565b0384610410565b61185b6040518096819301611773565b60405195869586526020860152608060408601526080850190610613565b908382036060850152610613565b346102ab576100196001600160401b036118b73661145d565b91906118c16119d4565b16600052600760205260406000209060ff801983541691151516179055565b346102ab5760003660031901126102ab576001546040516001600160a01b039091168152602090f35b346102ab5760403660031901126102ab5761001960043561192981610386565b6024359061193682610397565b61193e6119d4565b60018060a01b0316600052600860205260406000209060ff801983541691151516179055565b346102ab5760203660031901126102ab5760043561198181610386565b6119896119d4565b61199e60115480151590816108b25750611a75565b60006011556001600160a01b038116156119bb57610019906119e8565b604051631e4fbdf760e01b815260006004820152602490fd5b6000546001600160a01b031633036110e057565b60018060a01b031990816001541660015560005460018060a01b038092168093821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b634e487b7160e01b600052601160045260246000fd5b90601f820180921161100457565b601701908160171161100457565b9190820180921161100457565b15611a7c57565b60405162461bcd60e51b815260206004820152600a602482015269151a5b595b1bd8dad95960b21b6044820152606490fd5b60001981146110045760010190565b9190820391821161100457565b8051601619918282019082821161100457611aef82611ae881611a4c565b1015611b79565b611afd6017611ae884611a5a565b611b128151611b0b84611a5a565b1115611bb6565b60178303611b2f5750505050604051600081526020810160405290565b601760405194601f8416801560051b9182828901019687010193010101905b808410611b665750508252601f01601f191660405290565b9092835181526020809101930190611b4e565b15611b8057565b60405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606490fd5b15611bbd57565b60405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606490fd5b15611bfd57565b60405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606490fd5b602090611c4b601482511015611bf6565b015160601c90565b603790611c4b602b82511015611bf6565b15611c6b57565b60405162461bcd60e51b8152602060048201526014602482015273746f55696e7432345f6f75744f66426f756e647360601b6044820152606490fd5b15611cae57565b60405162461bcd60e51b815260206004820152602360248201527f4d75737420626520612076616c69642064657374696e6174696f6e206164647260448201526265737360e81b6064820152608490fd5b91909160c0818403126102ab57604051906001600160401b039060c08301828111848210176103dd5760405282948135611d3881610386565b8452602082013560208501526040820135604085015260608201356060850152611d64608083016103a1565b608085015260a08201359283116102ab5760a092611d8292016104bc565b910152565b356104d781610397565b356104d781610386565b908160209103126102ab575190565b6040513d6000823e3d90fd5b9035601e19823603018112156102ab5701602081359101916001600160401b0382116102ab5781360383136102ab57565b908060209392818452848401376000828201840152601f01601f1916010190565b60c0611e6f6104d793602084528035611e2081610386565b6001600160a01b03908116602086810191909152820135611e4081610386565b166040850152604081013560608501526060810135611e5e81610397565b151560808501526080810190611db6565b91909260a0808201520191611de7565b9193949094611eab611ea66112158860018060a01b03166000526008602052604060002090565b611ca7565b611eb53682611cff565b611ec4610b9160808401611d87565b806120f3575b15611ffe577f00000000000000000000000042000000000000000000000000000000000000066001600160a01b031691611f08906020013534611abd565b91803b156102ab57600090600460405180958193630d0e30db60e41b83525af19182156108ad57611f4f92611fe5575b5060208101611f48815134611abd565b9052612c93565b9215611fa4576104d794611f7d611f6f9260405193849160208301611e08565b03601f198101845283610410565b7f0000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff8592612292565b6104d794611fbe611f6f9260405193849160208301611e08565b7f0000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff85926127f8565b80611ff2611ff8926103e2565b806102a0565b38611f38565b61200d610bbe610bbe84611d91565b6040516370a0823160e01b80825230600483015290936020928390869060249082905afa9485156108ad576000956120c6575b5061206e610bbe610bbe8361206961205b610bbe8997611d91565b868301359030903390612131565b611d91565b604051928352306004840152829060249082905afa9384156108ad57611f4f946120a0926000916120a9575b50611abd565b90820152612c93565b6120c09150843d86116108a6576108978183610410565b3861209a565b83919550610bbe610bbe6120e961206e93853d87116108a6576108978183610410565b9793505050612040565b506120fd82611d91565b7f00000000000000000000000042000000000000000000000000000000000000066001600160a01b03908116911614611eca565b6040516323b872dd60e01b60208201526001600160a01b0392831660248201529290911660448301526064820192909252610384916121738260848101611f6f565b61218d565b908160209103126102ab57516104d781610397565b6000806121b69260018060a01b03169360208151910182865af16121af6121ff565b908361222f565b80519081151591826121e4575b50506121cc5750565b60249060405190635274afe760e01b82526004820152fd5b6121f79250602080918301019101612178565b1538806121c3565b3d1561222a573d906122108261046a565b9161221e6040519384610410565b82523d6000602084013e565b606090565b90612256575080511561224457805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580612289575b612267575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561225f565b909192946001600160401b038216946000968688526020936006855260409060ff828b205416156125ad576001600160a01b03958787161561259c576122ff877f000000000000000000000000350a791bfc2c21f9ed5d10980dad2e2638ffa7f616968787878d8d614225565b96835163b0f479a160e01b81528281600481305afa9081156108ad578d9161256f575b5084516320487ded60e01b81529891168289806123438588600484016125da565b0381845afa9889156108ad578d99612550575b50881561253f5784516370a0823160e01b8082523060048301529084816024818d5afa9081156108ad578f91612522575b508a116124af5750845163095ea7b360e01b81526001600160a01b0382166004820152602481018a9052919083838f81806044810103918d5af19485156108ad578e85946123fb97612482575b506123e08a848b6129e5565b87518097819582946396f4e9f960e01b8452600484016125da565b03925af19a8b156108ad579a612441575b50509261243b92859260008051602061441f83398151915297956124318c9a98612725565b51968796876126e5565b0390a390565b60008051602061441f8339815191529795929896939a5061243b94918161247392903d106108a6576108978183610410565b9992959791949681945061240c565b6124a190863d88116124a8575b6124998183610410565b810190612178565b50386123d4565b503d61248f565b855190815230600482015289908e9087908680828e81806024810103915afa9384156108ad57936124fd575b505051634787a10360e11b815260048101919091526024810191909152604490fd5b610c58929350908161251a92903d106108a6576108978183610410565b9190846124db565b6125399150853d87116108a6576108978183610410565b38612387565b8451636eca2e4b60e01b8152600490fd5b612568919950833d85116108a6576108978183610410565b9738612356565b61258f9150833d8511612595575b6125878183610410565b8101906125c5565b38612322565b503d61257d565b825163502ffa3f60e11b8152600490fd5b8151630a503cdb60e01b8152600481018a9052602490fd5b908160209103126102ab57516104d781610386565b906001600160401b039093929316815260406020918183820152612609855160a08484015260e0830190610613565b916126258487015193603f199485858303016060860152610613565b8187015194848483030160808501528080875193848152019601926000905b83821061267d5750505060608701516001600160a01b031660a08401525093946104d7945060c090608001519282850301910152610613565b845180516001600160a01b03168952830151888401529687019693820193600190910190612644565b91906126ce60a09497969592600180871b03809316855260c0602086015260c0850190610613565b961660408301526060820152600060808201520152565b92969594909360a09461270f600180881b039485809316875260c0602088015260c0870190610613565b9816604085015260608401521660808201520152565b6040516370a0823160e01b81523060048201526020916001600160a01b037f000000000000000000000000350a791bfc2c21f9ed5d10980dad2e2638ffa7f61691908382602481865afa80156108ad57612786926000916127e15750611abd565b908161279157505050565b60405163a9059cbb60e01b815233600482015260248101929092528290829060449082906000905af180156108ad576127c8575050565b816127de92903d106124a8576124998183610410565b50565b6120c09150853d87116108a6576108978183610410565b909192936001600160401b0382169460008681526020976006895260409160ff8382205416156129cd576001600160a01b0391878316156129bc576128409086868b8b614130565b835163b0f479a160e01b8152600493908c818681305afa9081156108ad57849161299f575b50168451976320487ded60e01b89528c898061288486858a84016125da565b0381855afa9889156108ad578499612980575b5088156129705747891161294d5791816128d3936128b88f948b908b6129e5565b8a88518096819582946396f4e9f960e01b84528b84016125da565b03925af19a8b156108ad57829b61292e575b505080808047335af16128f66121ff565b501561292057509260008051602061441f833981519152949261243b9289979551958695866126a6565b905163d6bda27560e01b8152fd5b612945929b50803d106108a6576108978183610410565b9838806128e5565b8551634787a10360e11b815247818701908152602081018b905281906040010390fd5b8551636eca2e4b60e01b81528590fd5b6129989199508d803d106108a6576108978183610410565b9738612897565b6129b691508d803d10612595576125878183610410565b38612865565b835163502ffa3f60e11b8152600490fd5b8251630a503cdb60e01b8152600481018a9052602490fd5b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152602094921691908481604481865afa9081156108ad57600091612b30575b5010612a3157505050565b60405163095ea7b360e01b8482018181526001600160a01b038516602484015260006044808501829052845261038496929392601f19929091908190612a78606487610410565b85519082895af1612a876121ff565b81612b00575b5080612af6575b15612aa3575b50505050612b4d565b604051908101939093526001600160a01b038516602484015260006044840152612aed92612ae791612ae19082606481015b03908101835282610410565b8461218d565b8261218d565b38808080612a9a565b50843b1515612a94565b80518015925083908315612b18575b50505038612a8d565b612b289350820181019101612178565b388281612b0f565b612b479150853d87116108a6576108978183610410565b38612a26565b60405163095ea7b360e01b602082018181526001600160a01b038516602484015260001960448085019190915283529093919291601f1991612b90606486610410565b84516001600160a01b03851691600091829182855af190612baf6121ff565b82612c15575b5081612c0a575b5015612bca575b5050505050565b60405160208101959095526001600160a01b0316602485015260006044850152612c009361217391612ae7908260648101612ad5565b3880808080612bc3565b90503b151538612bbc565b80519192508115918215612c2d575b50509038612bb5565b612c409250602080918301019101612178565b3880612c24565b15612c4e57565b60405162461bcd60e51b815260206004820152601e60248201527f43616c6c20746f20706172617377617020726f75746572206661696c656400006044820152606490fd5b80516001600160a01b03908116907f0000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff8516818103612cff57612cfb9150612ce560606020850151945b0193845190611abd565b6010549091906001600160a01b03165b90612e08565b5190565b7f0000000000000000000000006a000f20005980200259b80c510200304000106891612d326020918483870151916129e5565b6040516370a0823160e01b80825230600483015290938285602481875afa9485156108ad57600095612de0575b50600080612d849260a089015190828783519301915af1612d7e6121ff565b50612c47565b6040519081523060048201528181602481865afa9182156108ad57612cfb94612ce593606093612dbd93600092612dc3575b5050611abd565b94612cdb565b612dd99250803d106108a6576108978183610410565b3880612db6565b612d849195506000612dff8192863d88116108a6576108978183610410565b96925050612d5f565b60405163a9059cbb60e01b60208201526001600160a01b0390921660248301526044820192909252610384916121738260648101611f6f565b60c060806104d7936020845260018060a01b03808251166020860152602082015116604085015260408101516060850152606081015115158285015201519160a0808201520190610613565b9491612ee59493919260405190612eac82611f6f60209b8c8301612e41565b60009015612f8157507f000000000000000000000000350a791bfc2c21f9ed5d10980dad2e2638ffa7f66001600160a01b031693614225565b60405163b0f479a160e01b8152908382600481305afa80156108ad57612f2c938593600092612f62575b506040518095819482936320487ded60e01b8452600484016125da565b03916001600160a01b03165afa9182156108ad57600092612f4c57505090565b6104d79250803d106108a6576108978183610410565b612f7a919250843d8611612595576125878183610410565b9038612f0f565b93614225565b6001600160401b0381116103dd5760051b60200190565b60405190612fab826103f5565b60006020838281520152565b60028210156112bb5752565b805115610a8f5760200190565b8051821015610a8f5760209160051b010190565b600c54811015610a8f577fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c701546000818152600e60205260409020549091565b903590601e19813603018212156102ab57018035906001600160401b0382116102ab576020019181360383136102ab57565b9190808252602080920192916000905b828210613074575050505090565b90919293600190853561308681610386565b828060a01b03168152828601358382015260408091019501920190929192613066565b9060208252803560208301526020810135916130c483610368565b6001600160401b0380931660408201526130f56130e46040840184611db6565b60a0606085015260c0840191611de7565b9261311a6131066060850185611db6565b601f19858803810160808701529691611de7565b926080810135601e19823603018112156102ab5701916020833593019183116102ab578260061b360382136102ab5760a06104d79582860301910152613056565b601f8111613167575050565b6000906005825260208220906020601f850160051c830194106131a5575b601f0160051c01915b82811061319a57505050565b81815560010161318e565b9092508290613185565b90601f81116131bd57505050565b600091825260208220906020601f850160051c830194106131f9575b601f0160051c01915b8281106131ee57505050565b8181556001016131e2565b90925082906131d9565b9092916001600160401b0381116103dd57613228816132228454611739565b846131af565b6000601f82116001146132625781929394600092613257575b50508160011b916000199060031b1c1916179055565b013590503880613241565b601f1982169461327784600052602060002090565b91805b8781106132b2575083600195969710613298575b505050811b019055565b0135600019600384901b60f8161c1916905538808061328e565b9092602060018192868601358155019401910161327a565b903590601e19813603018212156102ab57018035906001600160401b0382116102ab57602001918160061b360383136102ab57565b90602060019161332f813561331381610386565b85546001600160a01b0319166001600160a01b03909116178555565b0135910155565b90600160401b83116103dd57815483835580841061338e575b506133609091600052602060002090565b6000915b8383106133715750505050565b6002604082613382600194866132ff565b01920192019190613364565b6001600160ff1b03818116820361100457841684036110045760008381526020812091600190811b83019286821b015b8381106133cd5750505061334f565b8083600292558383820155016133be565b813581559060208082013560018085016133f783610368565b805467ffffffffffffffff19166001600160401b0393841617905560028501926134246040860186613024565b9384116103dd5761343f846134398754611739565b876131af565b600091601f85116001146134b157509280806004979461038499979461349d976000946134a6575b50501b916000199060031b1c19161790555b6134936134896060830183613024565b9060038601613203565b60808101906132ca565b92909101613336565b013592503880613467565b91601f9493941984166134c987600052602060002090565b9382905b8282106135155750509261349d95928592600499966103849b9996106134fb575b505050811b019055613479565b0135600019600384901b60f8161c191690553880806134ee565b8088859782949688013581550196019301906134cd565b6020818303126102ab578035906001600160401b0382116102ab57019080601f830112156102ab578160206104d793359101610485565b909291926135708161046a565b9161357e6040519384610410565b8294828452828201116102ab5760206103849301906105f0565b906020828203126102ab5781516001600160401b03928382116102ab57019160a0838303126102ab57604051926135ce846103c2565b80516135d981610386565b845260208101516135e981610386565b602085015260408101516040850152606081015161360681610397565b606085015260808101519182116102ab57019080601f830112156102ab57815161363292602001613563565b608082015290565b9015610a8f5790565b8054600160401b8110156103dd5761366091600182018155610a73565b9190916136cf57805182546001600160a01b039182166001600160a01b03199182161784556020830151600185018054919093169116179055600490608090604081015160028501556136c860608201511515600386019060ff801983541691151516179055565b0151910155565b634e487b7160e01b600052600060045260246000fd5b815181546001600160a01b0319166001600160a01b0391909116178155906001906020906136c8565b9060206104d7928181520190610613565b303b156102ab576040516319ece61f60e31b81526000818061374485600483016130a9565b038183305af190816138f5575b506127de577f55bc02a9ef6f146737edeeb425738006f67f077e7138de3bf84a15bde1a5b56f6138f06137826121ff565b6138e46137e361389386359661379788613921565b506137b5816137b08a6000526009602052604060002090565b6133de565b6138866137d06137c86060840184613024565b81019061352c565b6020948186808094518301019101613598565b0180516001600160a01b03166000908152600a602052604090209092908351869061382690613820906001600160a01b03169460808101906132ca565b9061363a565b013561386f61383361043e565b6001600160a01b037f0000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff85168152936001600160a01b031684890152565b6040830152600060608301528a6080830152613643565b516001600160a01b031690565b6001600160a01b0381166000908152600a602052604090205490916138c86138b9610431565b6001600160a01b039094168452565b8201526138df86600052600b602052604060002090565b6136e5565b6040519182918261370e565b0390a2565b80611ff2613902926103e2565b38613751565b6104d79080600052600e60205260006040812055613937565b6104d79080600052600e60205260016040600020555b6000818152600d60205260408120546139a557600c5490600160401b8210156103dd576001820180600c55821015610a8f577fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7909101829055600c54918152600d6020526040902055600190565b905090565b81601f820112156102ab578035906139c182612f87565b926040926139d184519586610410565b808552602091828087019260061b850101938185116102ab578301915b8483106139fe5750505050505090565b85838303126102ab578386918251613a15816103f5565b8535613a2081610386565b815282860135838201528152019201916139ee565b15613a3c57565b60405162461bcd60e51b815260206004820152601060248201526f105b1c9958591e481c995919595b595960821b6044820152606490fd5b805415610a8f57600052602060002090600090565b80600052600e60205260406000205490811580613ac1575b613aa9575090565b6024906040519063015ab34360e11b82526004820152fd5b50600d60205260406000205415613aa1565b6020818303126102ab578051906001600160401b0382116102ab57019080601f830112156102ab5781516104d792602001613563565b9081516001600160401b0381116103dd57613b2e81613b29600554611739565b61315b565b602080601f8311600114613b6a5750819293600092613b5f575b50508160011b916000199060031b1c191617600555565b015190503880613b48565b6005600052601f198316949091906000805160206143ff833981519152926000905b878210613bc4575050836001959610613bab575b505050811b01600555565b015160001960f88460031b161c19169055388080613ba0565b80600185968294968601518155019501930190613b8c565b90613c046060939695949660018060a01b038093168452608060208501526080840190610613565b951660408201520152565b6040519060008260055491613c2383611739565b808352600193808516908115613c975750600114613c49575b5061038492500383610410565b600560009081526000805160206143ff83398151915294602093509091905b818310613c7f575050610384935082010138613c3c565b85548884018501529485019487945091830191613c68565b905061038494506020925060ff191682840152151560051b82010138613c3c565b613cc28151600255565b6060810190815191613ce6613ce1602094858082518301019101613ad3565b613b09565b60808201613d2a613d08613cfa8351612fc3565b51516001600160a01b031690565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b613d4084613d388351612fc3565b510151600455565b7f90ec910a8f80bb04e184a806e2ae6f8786ef2ae898859a3180f953397edc12016001600160401b03845192613dd7613d82888801516001600160401b031690565b91613dad613d9d6040809a01518b80825183010191016125c5565b97518a8082518301019101613ad3565b9089613dc6613dbf613cfa8451612fc3565b9251612fc3565b510151918951958695169885613bdc565b0390a3613df3613de5613c0f565b838082518301019101613598565b80516001600160a01b03937f0000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff858516929091851683146140d95760048054855163095ea7b360e01b81527f0000000000000000000000006a000f20005980200259b80c51020030400010686001600160a01b0381168285015260248201929092529196908483806044810103816000809a5af19283156108ad5788936140bc575b508351613eaa90610bbe906001600160a01b031681565b87516370a0823160e01b808252309582019586529490929187918491908290819060200103915afa80156108ad5787613f35938192614099575b5080613f029293608089015190828b83519301915af1612d7e6121ff565b845186908a90613f1c90610bbe906001600160a01b031681565b8a51878152309281019283529485928391829160200190565b03915afa80156108ad57613f4f9288916140825750611abd565b60608401511561405157508551918252308783019081527f00000000000000000000000042000000000000000000000000000000000000069190911691908490829081906020010381855afa9081156108ad578591614034575b50813b15614030578551632e1a7d4d60e01b815287810191825291859183919082908490829060200103925af180156108ad57849384938493613ffa9361401d575b5001516001600160a01b031690565b47905af16140066121ff565b5015614010575050565b5163d6bda27560e01b8152fd5b80611ff261402a926103e2565b38613feb565b8480fd5b61404b9150843d86116108a6576108978183610410565b38613fa9565b9550505091506103849350612cf590614073610bbe845160018060a01b031690565b9201516001600160a01b031690565b6120c09150873d89116108a6576108978183610410565b613f0292506140b582918a3d8c116108a6576108978183610410565b9250613ee4565b6140d290863d88116124a8576124998183610410565b5038613e93565b0151600454610384945092506001600160a01b031690612e08565b60405190614101826103f5565b600182528160005b6020908181101561412b5760209161411f612f9e565b90828501015201614109565b505050565b926142046141c5956141f46080946141e897600097604051614151816103c2565b606098818a8093528260208201528260408201528b8382015201526141746140f4565b9661418f614180610431565b6001600160a01b039093168352565b602082015261419d87612fc3565b526141a786612fc3565b50604080516001600160a01b03909216602083015290998a91820190565b03906141d9601f19928381018c528b610410565b6040519889916020830161370e565b03908101885287610410565b6141fc61044b565b908152614304565b9361420d61043e565b95865260208601526040850152830152608082015290565b926142dd6142ae966141f4608094613632976142d19997604051614248816103c2565b606098818a809352826020820152826040820152600083820152015261426c6140f4565b96614278614180610431565b602082015261428687612fc3565b5261429086612fc3565b50604080516001600160a01b039092166020830152909a8b91820190565b03906142c2601f19928381018d528c610410565b604051998a916020830161370e565b03908101895288610410565b946142e661043e565b968752602087015260408601526001600160a01b0390911690840152565b604051906397a657c960e01b602083015251602482015260248152606081018181106001600160401b038211176103dd5760405290565b1561434257565b606460405162461bcd60e51b815260206004820152602060248201527f4d757374206265206578656375746564206279207468652072656365697665726044820152fd5b60405190614393826103c2565b60006080838281528260208201528260408201528260608201520152565b906040516143be816103c2565b82546001600160a01b039081168252600184015416602082015260028301546040820152600383015460ff1615156060820152600490920154608083015256fe036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0437cb3c5ba4364504dda6ba3c906ffb0897c7beeb1675f3aaf22a1b9a99b3994a2646970667358221220a7458295f46cee4c4a1516da19909854307939254c6cda51294dc60f8c3b99e164736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000003206695cae29952f4b0c22a169725a865bc8ce0f000000000000000000000000350a791bfc2c21f9ed5d10980dad2e2638ffa7f60000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff85000000000000000000000000420000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000e1ff5a4c489b11e094bfbb5d23c6d4597a3a79ad000000000000000000000000a24e8ce77d4a7ce869da3730e6560bfb66553f940000000000000000000000006a000f20005980200259b80c5102003040001068
-----Decoded View---------------
Arg [0] : _router (address): 0x3206695CaE29952f4b0c22a169725a865bc8Ce0f
Arg [1] : _link (address): 0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6
Arg [2] : _usdc (address): 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85
Arg [3] : _weth (address): 0x4200000000000000000000000000000000000006
Arg [4] : _swapFee (uint256): 500
Arg [5] : _feeReceiver (address): 0xe1Ff5a4C489B11E094BFBB5d23c6d4597a3a79AD
Arg [6] : _owner (address): 0xa24e8cE77D4A7Ce869DA3730e6560BfB66553F94
Arg [7] : _paraRouter (address): 0x6A000F20005980200259B80c5102003040001068
-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 0000000000000000000000003206695cae29952f4b0c22a169725a865bc8ce0f
Arg [1] : 000000000000000000000000350a791bfc2c21f9ed5d10980dad2e2638ffa7f6
Arg [2] : 0000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff85
Arg [3] : 0000000000000000000000004200000000000000000000000000000000000006
Arg [4] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [5] : 000000000000000000000000e1ff5a4c489b11e094bfbb5d23c6d4597a3a79ad
Arg [6] : 000000000000000000000000a24e8ce77d4a7ce869da3730e6560bfb66553f94
Arg [7] : 0000000000000000000000006a000f20005980200259b80c5102003040001068
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.