Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
MAPOmnichainServiceV2
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@mapprotocol/protocol/contracts/interface/ILightNode.sol"; import "@mapprotocol/protocol/contracts/utils/Utils.sol"; import "./interface/IWrappedToken.sol"; import "./interface/IMintableToken.sol"; import "./interface/IButterReceiver.sol"; import "./interface/IButterMosV2.sol"; import "./utils/EvmDecoder.sol"; contract MAPOmnichainServiceV2 is ReentrancyGuard, Initializable, Pausable, IButterMosV2, UUPSUpgradeable { using Address for address; uint256 public immutable selfChainId = block.chainid; uint256 public nonce; address public wToken; // native wrapped token address public relayContract; uint256 public relayChainId; ILightNode public lightNode; mapping(bytes32 => bool) public orderList; mapping(address => bool) public mintableTokens; mapping(uint256 => mapping(address => bool)) public tokenMappingList; address public butterRouter; // reserved IEvent.swapOutEvent[] private verifiedLogs; mapping(bytes32 => bool) public storedOrderId; // log hash event SetButterRouter(address butterRouter); event SetLightClient(address lightNode); event SetWrappedToken(address wToken); event UpdateMintableToken(address token, bool mintable); event SetRelayContract(uint256 chainId, address relay); event RegisterToken(address token, uint256 toChain, bool enable); // event mapSwapExecute(uint256 indexed fromChain, uint256 indexed toChain, address indexed from); event mapSwapInVerified(bytes logs); function initialize( address _wToken, address _lightNode, address _owner ) public initializer checkAddress(_wToken) checkAddress(_lightNode) checkAddress(_owner) { wToken = _wToken; emit SetWrappedToken(_wToken); lightNode = ILightNode(_lightNode); emit SetLightClient(_lightNode); _changeAdmin(_owner); } receive() external payable {} modifier checkOrder(bytes32 _orderId) { require(!orderList[_orderId], "order exist"); orderList[_orderId] = true; _; } modifier checkBridgeable(address _token, uint256 _chainId) { require(tokenMappingList[_chainId][_token], "token not registered"); _; } modifier checkAddress(address _address) { require(_address != address(0), "address is zero"); _; } modifier onlyOwner() { require(msg.sender == _getAdmin(), "mos :: only admin"); _; } function setPause() external onlyOwner { _pause(); } function setUnpause() external onlyOwner { _unpause(); } function setLightClient(address _lightNode) external onlyOwner checkAddress(_lightNode) { lightNode = ILightNode(_lightNode); emit SetLightClient(_lightNode); } /* function setWrappedToken(address _wToken) external onlyOwner { wToken = _wToken; emit SetWrappedToken(_wToken); } */ function setButterRouter(address _butterRouter) external onlyOwner { butterRouter = _butterRouter; emit SetButterRouter(_butterRouter); } function updateMintableToken(address[] memory _tokens, bool _mintable) external onlyOwner { for (uint256 i = 0; i < _tokens.length; i++) { mintableTokens[_tokens[i]] = _mintable; emit UpdateMintableToken(_tokens[i], _mintable); } } function setRelayContract(uint256 _chainId, address _relay) external onlyOwner checkAddress(_relay) { relayContract = _relay; relayChainId = _chainId; emit SetRelayContract(_chainId, _relay); } function registerTokenChains(address _token, uint256[] memory _toChains, bool _enable) external onlyOwner { require(_token.isContract(), "token is not contract"); for (uint256 i = 0; i < _toChains.length; i++) { uint256 toChain = _toChains[i]; tokenMappingList[toChain][_token] = _enable; emit RegisterToken(_token, toChain, _enable); } } /* function withdraw(address _token, address payable _receiver,uint256 _amount) external onlyOwner { _transfer(_token, _receiver, _amount); } */ // ------------------------------------------ function swapOutToken( address _initiator, // swap initiator address address _token, // src token bytes memory _to, uint256 _amount, uint256 _toChain, // target chain id bytes calldata _swapData ) external payable virtual override nonReentrant whenNotPaused returns (bytes32 orderId) { require(_amount > 0, "Sending value is zero"); address token = _token; if (token == address(0)) { token = wToken; require(msg.value >= _amount, "Invalid msg value"); IWrappedToken(token).deposit{value: _amount}(); } else { SafeERC20.safeTransferFrom(IERC20(token), msg.sender, address(this), _amount); if (isMintable(token)) { IMintableToken(token).burn(_amount); } } orderId = _swapOut(token, _to, _initiator, _amount, _toChain, _swapData); } function depositToken(address _token, address _to, uint256 _amount) external payable override whenNotPaused { require(_amount > 0, "Sending value is zero"); address from = msg.sender; address token = _token; if (token == address(0)) { token = wToken; require(msg.value >= _amount, "Invalid msg value"); IWrappedToken(token).deposit{value: _amount}(); } else { SafeERC20.safeTransferFrom(IERC20(token), from, address(this), _amount); if (isMintable(token)) { IMintableToken(token).burn(_amount); } } _deposit(token, from, _to, _amount, selfChainId, relayChainId); } function swapIn( uint256 _chainId, uint256 _logIndex, bytes32 _orderId, bytes memory _receiptProof ) external nonReentrant whenNotPaused { require(!orderList[_orderId], "order exist"); require(_chainId == relayChainId, "invalid chain id"); (bool success, string memory message, bytes memory logArray) = lightNode.verifyProofDataWithCache( _receiptProof ); require(success, message); _swapInVerifiedWithIndex(logArray, _logIndex); // emit mapSwapExecute(_chainId, selfChainId, msg.sender); } /* // verify swap in logs and store hash function swapInVerify(uint256 _chainId, uint256 _logIndex, bytes32 _orderId, bytes memory _receiptProof) external nonReentrant whenNotPaused { require(!orderList[_orderId], "order exist"); require(_chainId == relayChainId, "invalid chain id"); (bool success, string memory message, bytes memory logArray) = lightNode.verifyProofDataWithCache( _receiptProof ); require(success, message); bytes32 hash = keccak256(logArray); require(!storedOrderId[hash], "already verified"); storedOrderId[hash] = true; emit mapSwapInVerified(logArray); } // execute stored swap in logs function swapInVerified(bytes calldata _logArray, uint256 _logIndex, bytes32 _orderId) external nonReentrant whenNotPaused { require(!orderList[_orderId], "order exist"); bytes32 hash = keccak256(_logArray); require(storedOrderId[hash], "not verified"); _swapInVerifiedWithIndex(_logArray, _logIndex); } */ function isMintable(address _token) public view returns (bool) { return mintableTokens[_token]; } function isBridgeable(address _token, uint256 _toChain) public view returns (bool) { return tokenMappingList[_toChain][_token]; } function getOrderStatus( uint256, uint256 _blockNum, bytes32 _orderId ) external view override returns (bool exists, bool verifiable, uint256 nodeType) { exists = orderList[_orderId]; verifiable = lightNode.isVerifiable(_blockNum, bytes32("")); nodeType = lightNode.nodeType(); } function _getOrderID(address _from, bytes memory _to, uint256 _fromChain, uint256 _toChain) internal returns (bytes32) { return keccak256(abi.encodePacked(address(this), nonce++, _fromChain, _toChain, _from, _to)); } function _swapInVerifiedWithIndex(bytes memory logArray, uint256 logIndex) private { IEvent.txLog memory log = EvmDecoder.decodeTxLog(logArray, logIndex); // bytes32 topic = abi.decode(log.topics[0], (bytes32)); require(relayContract == log.addr, "Invalid relay contract"); require(log.topics[0] == EvmDecoder.MAP_SWAPOUT_TOPIC, "Invalid relay topic"); IEvent.swapOutEvent memory outEvent = EvmDecoder.decodeSwapOutLog(log); // there might be more than one events to multi-chains // only process the event for this chain require(selfChainId == outEvent.toChain, "Invalid to chain id"); _swapIn(outEvent); } function _swapIn(IEvent.swapOutEvent memory _outEvent) internal checkOrder(_outEvent.orderId) { address tokenIn = Utils.fromBytes(_outEvent.token); // receiving address address payable toAddress = payable(Utils.fromBytes(_outEvent.to)); // amount of token need to be sent uint256 actualAmountIn = _outEvent.amount; if (isMintable(tokenIn)) { IMintableToken(tokenIn).mint(address(this), actualAmountIn); } // if swap params is not empty, then we need to do swap on current chain if (_outEvent.swapData.length > 0 && address(toAddress).isContract()) { _transfer(_outEvent.toChain, tokenIn, toAddress, actualAmountIn); try IButterReceiver(toAddress).onReceived( _outEvent.orderId, tokenIn, actualAmountIn, _outEvent.fromChain, _outEvent.from, _outEvent.swapData ) { // do nothing } catch { // do nothing } } else { // transfer token if swap did not happen if (tokenIn == wToken) { IWrappedToken(tokenIn).withdraw(actualAmountIn); Address.sendValue(payable(toAddress), actualAmountIn); } else { _transfer(_outEvent.toChain, tokenIn, toAddress, actualAmountIn); } } emit mapSwapIn( _outEvent.fromChain, _outEvent.toChain, _outEvent.orderId, tokenIn, _outEvent.from, toAddress, actualAmountIn ); } function _transfer(uint256 _chainId, address _token, address _to, uint256 _amount) internal { if (_token == address(0)) { Address.sendValue(payable(_to), _amount); } else { if (_chainId == 728126428 && _token == 0xa614f803B6FD780986A42c78Ec9c7f77e6DeD13C) { // Tron USDT _token.call(abi.encodeWithSelector(0xa9059cbb, _to, _amount)); } else { SafeERC20.safeTransfer(IERC20(_token), _to, _amount); } } } function _swapOut( address _token, // src token bytes memory _to, address _from, uint256 _amount, uint256 _toChain, // target chain id bytes calldata _swapData ) internal checkBridgeable(_token, _toChain) returns (bytes32 orderId) { uint256 fromChain = selfChainId; require(_toChain != fromChain, "Cannot swap to self chain"); orderId = _getOrderID(msg.sender, _to, fromChain, _toChain); _from = (msg.sender == butterRouter) ? _from : msg.sender; _notifyLightClient(bytes("")); emit mapSwapOut( fromChain, _toChain, orderId, Utils.toBytes(_token), Utils.toBytes(_from), _to, _amount, _swapData ); } function _deposit(address _token, address _from, address _to, uint256 _amount, uint256 _fromChain, uint256 _toChain) internal checkBridgeable(_token, _toChain) { bytes32 orderId = _getOrderID(_from, Utils.toBytes(_to), _fromChain, _toChain); _notifyLightClient(bytes("")); emit mapDepositOut(_fromChain, _toChain, orderId, _token, Utils.toBytes(_from), _to, _amount); } function _notifyLightClient(bytes memory _data) internal { lightNode.notifyLightClient(address(this), _data); } /** UUPS *********************************************************/ function _authorizeUpgrade(address) internal view override { require(msg.sender == _getAdmin(), "MAPOmnichainService: only Admin can upgrade"); } function changeAdmin(address _admin) external onlyOwner checkAddress(_admin) { _changeAdmin(_admin); } function getAdmin() external view returns (address) { return _getAdmin(); } function getImplementation() external view returns (address) { return _getImplementation(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ILightNode { event UpdateBlockHeader(address indexed maintainer, uint256 indexed blockHeight); event ClientNotifySend(address indexed sender, uint256 indexed blockHeight, bytes notifyData); function updateBlockHeader(bytes memory _blockHeader) external; function updateLightClient(bytes memory _data) external; // @notice Notify light client to relay the block // @param _data - notify data, if no data set it to empty function notifyLightClient(address _from, bytes memory _data) external; // @notice Validate the receipt according to the block header and receipt merkel proof // Using block header number and block receipt root cache to optimize the validation gas cost. // @param _receiptProof - the bytes to receipt proof // @return success - verification result // @return message - the result message // @return logs - the logs included in the receipt function verifyProofDataWithCache( bytes memory _receiptProof ) external returns (bool success, string memory message, bytes memory logs); // @notice Validate the receipt according to the block header and receipt merkel proof // @param _receiptProof - the bytes to receipt proof // @return success - verification result // @return message - the result message // @return logs - the logs included in the receipt function verifyProofData( bytes memory _receiptProof ) external view returns (bool success, string memory message, bytes memory logs); // Get client state function clientState() external view returns (bytes memory); function finalizedState(bytes memory _data) external view returns (bytes memory); // @notice Get the light client block height // @return height - current block height or slot number function headerHeight() external view returns (uint256 height); // function verifiableHeaderRange() external view returns (uint256, uint256); // @notice Check whether the block can be verified // @return function isVerifiable(uint256 _blockHeight, bytes32 _hash) external view returns (bool); // @notice Get the light client type // @return - 1 default light client // 2 zk light client // 3 oracle client function nodeType() external view returns (uint256); }
// SPDX-License-Identifier: MIT /* * @author Hamdi Allam [email protected] * Please reach out with any questions or concerns */ pragma solidity ^0.8.0; library RLPReader { uint8 constant STRING_SHORT_START = 0x80; uint8 constant STRING_LONG_START = 0xb8; uint8 constant LIST_SHORT_START = 0xc0; uint8 constant LIST_LONG_START = 0xf8; uint8 constant WORD_SIZE = 32; struct RLPItem { uint256 len; uint256 memPtr; } struct Iterator { RLPItem item; // Item that's being iterated over. uint256 nextPtr; // Position of the next item in the list. } /* * @dev Returns the next element in the iteration. Reverts if it has not next element. * @param self The iterator. * @return The next element in the iteration. */ function next(Iterator memory self) internal pure returns (RLPItem memory) { require(hasNext(self), "not have next"); uint256 ptr = self.nextPtr; uint256 itemLength = _itemLength(ptr); self.nextPtr = ptr + itemLength; return RLPItem(itemLength, ptr); } /* * @dev Returns true if the iteration has more elements. * @param self The iterator. * @return true if the iteration has more elements. */ function hasNext(Iterator memory self) internal pure returns (bool) { RLPItem memory item = self.item; return self.nextPtr < item.memPtr + item.len; } /* * @param item RLP encoded bytes */ function toRlpItem(bytes memory item) internal pure returns (RLPItem memory) { uint256 memPtr; assembly { memPtr := add(item, 0x20) } return RLPItem(item.length, memPtr); } /* * @dev Create an iterator. Reverts if item is not a list. * @param self The RLP item. * @return An 'Iterator' over the item. */ function iterator(RLPItem memory self) internal pure returns (Iterator memory) { require(isList(self), "check self list fail"); uint256 ptr = self.memPtr + _payloadOffset(self.memPtr); return Iterator(self, ptr); } /* * @param the RLP item. */ function rlpLen(RLPItem memory item) internal pure returns (uint256) { return item.len; } /* * @param the RLP item. * @return (memPtr, len) pair: location of the item's payload in memory. */ function payloadLocation(RLPItem memory item) internal pure returns (uint256, uint256) { uint256 offset = _payloadOffset(item.memPtr); uint256 memPtr = item.memPtr + offset; uint256 len = item.len - offset; // data length return (memPtr, len); } /* * @param the RLP item. */ function payloadLen(RLPItem memory item) internal pure returns (uint256) { (, uint256 len) = payloadLocation(item); return len; } /* * @param the RLP item containing the encoded list. */ function toList(RLPItem memory item) internal pure returns (RLPItem[] memory) { require(isList(item), "is list fail"); uint256 items = numItems(item); RLPItem[] memory result = new RLPItem[](items); uint256 memPtr = item.memPtr + _payloadOffset(item.memPtr); uint256 dataLen; for (uint256 i = 0; i < items; i++) { dataLen = _itemLength(memPtr); result[i] = RLPItem(dataLen, memPtr); memPtr = memPtr + dataLen; } return result; } /* * @param get the RLP item by index. save gas. */ function getItemByIndex(RLPItem memory item, uint idx) internal pure returns (RLPItem memory) { require(isList(item), "is list fail"); uint memPtr = item.memPtr + _payloadOffset(item.memPtr); uint dataLen; for (uint i = 0; i < idx; i++) { dataLen = _itemLength(memPtr); memPtr = memPtr + dataLen; } dataLen = _itemLength(memPtr); return RLPItem(dataLen, memPtr); } /* * @param get the RLP item by index. save gas. */ function safeGetItemByIndex(RLPItem memory item, uint idx) internal pure returns (RLPItem memory) { require(isList(item), "is list fail"); uint endPtr = item.memPtr + item.len; uint memPtr = item.memPtr + _payloadOffset(item.memPtr); uint dataLen; for (uint i = 0; i < idx; i++) { dataLen = _itemLength(memPtr); memPtr = memPtr + dataLen; } dataLen = _itemLength(memPtr); require(memPtr + dataLen <= endPtr, "RLP item overflow"); return RLPItem(dataLen, memPtr); } // @return indicator whether encoded payload is a list. negate this function call for isData. function isList(RLPItem memory item) internal pure returns (bool) { if (item.len == 0) return false; uint8 byte0; uint256 memPtr = item.memPtr; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < LIST_SHORT_START) return false; return true; } /* * @dev A cheaper version of keccak256(toRlpBytes(item)) that avoids copying memory. * @return keccak256 hash of RLP encoded bytes. */ function rlpBytesKeccak256(RLPItem memory item) internal pure returns (bytes32) { uint256 ptr = item.memPtr; uint256 len = item.len; bytes32 result; assembly { result := keccak256(ptr, len) } return result; } /* * @dev A cheaper version of keccak256(toBytes(item)) that avoids copying memory. * @return keccak256 hash of the item payload. */ function payloadKeccak256(RLPItem memory item) internal pure returns (bytes32) { (uint256 memPtr, uint256 len) = payloadLocation(item); bytes32 result; assembly { result := keccak256(memPtr, len) } return result; } /** RLPItem conversions into data types **/ // @returns raw rlp encoding in bytes function toRlpBytes(RLPItem memory item) internal pure returns (bytes memory) { bytes memory result = new bytes(item.len); if (result.length == 0) return result; uint256 ptr; assembly { ptr := add(0x20, result) } copy(item.memPtr, ptr, item.len); return result; } // any non-zero byte except "0x80" is considered true function toBoolean(RLPItem memory item) internal pure returns (bool) { require(item.len == 1, "item len is not one"); uint256 result; uint256 memPtr = item.memPtr; assembly { result := byte(0, mload(memPtr)) } // SEE Github Issue #5. // Summary: Most commonly used RLP libraries (i.e Geth) will encode // "0" as "0x80" instead of as "0". We handle this edge case explicitly // here. if (result == 0 || result == STRING_SHORT_START) { return false; } else { return true; } } function toAddress(RLPItem memory item) internal pure returns (address) { // 1 byte for the length prefix require(item.len == 21, "item len is not 21"); return address(uint160(toUint(item))); } function toUint(RLPItem memory item) internal pure returns (uint256) { require(item.len > 0 && item.len <= 33, "item len is not uint"); (uint256 memPtr, uint256 len) = payloadLocation(item); uint256 result; assembly { result := mload(memPtr) // shfit to the correct location if neccesary if lt(len, 32) { result := div(result, exp(256, sub(32, len))) } } return result; } // enforces 32 byte length function toUintStrict(RLPItem memory item) internal pure returns (uint256) { // one byte prefix require(item.len == 33, "item is not uint strict"); uint256 result; uint256 memPtr = item.memPtr + 1; assembly { result := mload(memPtr) } return result; } function toBytes(RLPItem memory item) internal pure returns (bytes memory) { require(item.len > 0, "item len is zero"); (uint256 memPtr, uint256 len) = payloadLocation(item); bytes memory result = new bytes(len); uint256 destPtr; assembly { destPtr := add(0x20, result) } copy(memPtr, destPtr, len); return result; } function toBytes32(RLPItem memory item) internal pure returns (bytes32) { // one byte prefix require(item.len == 33, "item is not bytes32"); bytes32 result; uint256 memPtr = item.memPtr + 1; assembly { result := mload(memPtr) } return result; } /* * @dev A cheaper version of toRlpBytes(item) that avoids copying memory. * This will destroy the original data. * @return RLP encoded bytes. */ function unsafeToRlpBytes(RLPItem memory item) internal pure returns (bytes memory result) { if (item.len == 0) return result; uint256 len = item.len; uint256 memPtr = item.memPtr; assembly { result := sub(memPtr, 0x20) mstore(result, len) } return result; } /* * @dev A cheaper version of toBytes(item) that avoids copying memory. * This will destroy the original data. * @return RLP encoded bytes. */ function unsafeToBytes(RLPItem memory item) internal pure returns (bytes memory result) { if (item.len == 0) return result; (uint256 memPtr, uint256 len) = payloadLocation(item); assembly { result := sub(memPtr, 0x20) mstore(result, len) } return result; } /* * Private Helpers */ // @return number of payload items inside an encoded list. function numItems(RLPItem memory item) internal pure returns (uint256) { if (item.len == 0) return 0; uint256 count = 0; uint256 currPtr = item.memPtr + _payloadOffset(item.memPtr); uint256 endPtr = item.memPtr + item.len; while (currPtr < endPtr) { currPtr = currPtr + _itemLength(currPtr); // skip over an item count++; } return count; } // @return entire rlp item byte length function _itemLength(uint256 memPtr) private pure returns (uint256) { uint256 itemLen; uint256 byte0; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < STRING_SHORT_START) itemLen = 1; else if (byte0 < STRING_LONG_START) itemLen = byte0 - STRING_SHORT_START + 1; else if (byte0 < LIST_SHORT_START) { assembly { let byteLen := sub(byte0, 0xb7) // # of bytes the actual length is memPtr := add(memPtr, 1) // skip over the first byte /* 32 byte word size */ let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to get the len itemLen := add(dataLen, add(byteLen, 1)) } } else if (byte0 < LIST_LONG_START) { itemLen = byte0 - LIST_SHORT_START + 1; } else { assembly { let byteLen := sub(byte0, 0xf7) memPtr := add(memPtr, 1) let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to the correct length itemLen := add(dataLen, add(byteLen, 1)) } } return itemLen; } // @return number of bytes until the data function _payloadOffset(uint256 memPtr) private pure returns (uint256) { uint256 byte0; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < STRING_SHORT_START) return 0; else if (byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LONG_START)) return 1; else if (byte0 < LIST_SHORT_START) // being explicit return byte0 - (STRING_LONG_START - 1) + 1; else return byte0 - (LIST_LONG_START - 1) + 1; } /* * @param src Pointer to source * @param dest Pointer to destination * @param len Amount of memory to copy from the source */ function copy(uint256 src, uint256 dest, uint256 len) private pure { if (len == 0) return; // copy as many word sizes as possible for (; len >= WORD_SIZE; len -= WORD_SIZE) { assembly { mstore(dest, mload(src)) } src += WORD_SIZE; dest += WORD_SIZE; } if (len > 0) { // left over bytes. Mask is used to remove unwanted bytes from the word uint256 mask = 256 ** (WORD_SIZE - len) - 1; assembly { let srcpart := and(mload(src), not(mask)) // zero out src let destpart := and(mload(dest), mask) // retrieve the bytes mstore(dest, or(destpart, srcpart)) } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library Utils { uint256 constant MIN_NEAR_ADDRESS_LEN = 2; uint256 constant MAX_NEAR_ADDRESS_LEN = 64; function checkBytes(bytes memory b1, bytes memory b2) internal pure returns (bool) { return keccak256(b1) == keccak256(b2); } function fromBytes(bytes memory bys) internal pure returns (address addr) { assembly { addr := mload(add(bys, 20)) } } function toBytes(address self) internal pure returns (bytes memory b) { b = abi.encodePacked(self); } function splitExtra(bytes memory extra) internal pure returns (bytes memory newExtra) { require(extra.length >= 64, "Invalid extra result type"); newExtra = new bytes(64); for (uint256 i = 0; i < 64; i++) { newExtra[i] = extra[i]; } } function hexStrToBytes(bytes memory _hexStr) internal pure returns (bytes memory) { //Check hex string is valid if (_hexStr.length % 2 != 0 || _hexStr.length < 4) { revert("hexStrToBytes: invalid input"); } bytes memory bytes_array = new bytes(_hexStr.length / 2 - 32); for (uint256 i = 64; i < _hexStr.length; i += 2) { uint8 tetrad1 = 16; uint8 tetrad2 = 16; //left digit if (uint8(_hexStr[i]) >= 48 && uint8(_hexStr[i]) <= 57) tetrad1 = uint8(_hexStr[i]) - 48; //right digit if (uint8(_hexStr[i + 1]) >= 48 && uint8(_hexStr[i + 1]) <= 57) tetrad2 = uint8(_hexStr[i + 1]) - 48; //left A->F if (uint8(_hexStr[i]) >= 65 && uint8(_hexStr[i]) <= 70) tetrad1 = uint8(_hexStr[i]) - 65 + 10; //right A->F if (uint8(_hexStr[i + 1]) >= 65 && uint8(_hexStr[i + 1]) <= 70) tetrad2 = uint8(_hexStr[i + 1]) - 65 + 10; //left a->f if (uint8(_hexStr[i]) >= 97 && uint8(_hexStr[i]) <= 102) tetrad1 = uint8(_hexStr[i]) - 97 + 10; //right a->f if (uint8(_hexStr[i + 1]) >= 97 && uint8(_hexStr[i + 1]) <= 102) tetrad2 = uint8(_hexStr[i + 1]) - 97 + 10; //Check all symbols are allowed if (tetrad1 == 16 || tetrad2 == 16) revert("hexStrToBytes: invalid input"); bytes_array[i / 2 - 32] = bytes1(16 * tetrad1 + tetrad2); } return bytes_array; } function isValidNearAddress(bytes memory _addr) internal pure returns (bool) { if (_addr.length < MIN_NEAR_ADDRESS_LEN || _addr.length > MAX_NEAR_ADDRESS_LEN) { return false; } bool last_char_is_separator = true; for (uint256 i = 0; i < _addr.length; i++) { uint8 char = uint8(_addr[i]); bool current_char_is_separator = false; //char 97-122 is a-z, 48-57 is 0-9 , 45 is - ,46 is .,95 is _ if ((char >= 97 && char <= 122) || (char >= 48 && char <= 57) || (char == 45 || char == 46 || char == 95)) { if ((char == 45 || char == 46 || char == 95)) { current_char_is_separator = true; } } else { return false; } if (current_char_is_separator && last_char_is_separator) { return false; } last_char_is_separator = current_char_is_separator; } return !last_char_is_separator; } function isValidEvmAddress(bytes memory _addr) internal pure returns (bool) { return _addr.length == 20; } function isValidAddress(bytes memory _addr, uint256 chainType) internal pure returns (bool) { if (chainType == 1) return isValidEvmAddress(_addr); if (chainType == 2) return isValidNearAddress(_addr); return false; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol) pragma solidity ^0.8.0; /** * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC. * * _Available since v4.8.3._ */ interface IERC1967 { /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeacon.sol"; import "../../interfaces/IERC1967.sol"; import "../../interfaces/draft-IERC1822.sol"; import "../../utils/Address.sol"; import "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ */ abstract contract ERC1967Upgrade is IERC1967 { // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/Address.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822.sol"; import "../ERC1967/ERC1967Upgrade.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is IERC1822Proxiable, ERC1967Upgrade { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeTo(address newImplementation) public virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== 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 v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ * _Available since v4.9 for `string`, `bytes`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IButterMosV2 { function swapOutToken( address _sender, address _token, // src token bytes memory _to, uint256 _amount, uint256 _toChain, // target chain id bytes calldata _swapData ) external payable returns (bytes32 orderId); //function swapOutNative( // address _sender, // bytes memory _to, // uint256 _toChain, // target chain id // bytes calldata _swapData //) external payable returns (bytes32 orderId); function depositToken(address _token, address to, uint256 _amount) external payable; //function depositNative(address _to) external payable; function getOrderStatus( uint256 _chainId, uint256 _blockNum, bytes32 _orderId ) external view returns (bool exists, bool verifiable, uint256 nodeType); event mapTransferOut( uint256 indexed fromChain, uint256 indexed toChain, bytes32 orderId, bytes token, bytes from, bytes to, uint256 amount, bytes toChainToken ); event mapDepositOut( uint256 indexed fromChain, uint256 indexed toChain, bytes32 orderId, address token, bytes from, address to, uint256 amount ); event mapSwapOut( uint256 indexed fromChain, // from chain uint256 indexed toChain, // to chain bytes32 orderId, // order id bytes token, // token to transfer bytes from, // source chain from address bytes to, uint256 amount, bytes swapData // swap data, used on target chain dex. ); event mapSwapIn( uint256 indexed fromChain, uint256 indexed toChain, bytes32 indexed orderId, address token, bytes from, address toAddress, uint256 amountOut ); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IButterReceiver { //_srcToken received token (wtoken or erc20 token) function onReceived( bytes32 _orderId, address _srcToken, uint256 _amount, uint256 _fromChain, bytes calldata _from, bytes calldata _payload ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IEvent { struct depositOutEvent { bytes token; bytes from; bytes32 orderId; uint256 fromChain; uint256 toChain; bytes to; uint256 amount; } struct swapOutEvent { uint256 fromChain; uint256 toChain; bytes32 orderId; bytes token; // token to transfer bytes from; bytes to; uint256 amount; bytes swapData; } struct txLog { address addr; bytes32[] topics; bytes data; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IMintableToken { function mint(address to, uint256 amount) external; function burn(uint256 amount) external; function burnFrom(address from, uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IWrappedToken { function deposit() external payable; function transfer(address to, uint256 value) external returns (bool); function withdraw(uint256) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; import "@mapprotocol/protocol/contracts/utils/Utils.sol"; import "@mapprotocol/protocol/contracts/lib/RLPReader.sol"; import "../interface/IEvent.sol"; library EvmDecoder { using RLPReader for bytes; using RLPReader for RLPReader.RLPItem; bytes32 constant MAP_DEPOSITOUT_TOPIC = keccak256(bytes("mapDepositOut(uint256,uint256,bytes32,address,bytes,address,uint256)")); bytes32 constant MAP_SWAPOUT_TOPIC = keccak256(bytes("mapSwapOut(uint256,uint256,bytes32,bytes,bytes,bytes,uint256,bytes)")); function decodeTxLogs(bytes memory logsHash) internal pure returns (IEvent.txLog[] memory _txLogs) { RLPReader.RLPItem[] memory ls = logsHash.toRlpItem().toList(); _txLogs = new IEvent.txLog[](ls.length); for (uint256 i = 0; i < ls.length; i++) { _txLogs[i] = _decodeTxLog(ls[i]); } } function decodeTxLog(bytes memory logsHash, uint256 logIndex) internal pure returns (IEvent.txLog memory _txLog) { RLPReader.RLPItem memory ls = logsHash.toRlpItem().safeGetItemByIndex(logIndex); _txLog = _decodeTxLog(ls); } function _decodeTxLog(RLPReader.RLPItem memory item) private pure returns (IEvent.txLog memory _txLog) { RLPReader.RLPItem[] memory items = item.toList(); require(items.length >= 3, "log length to low"); RLPReader.RLPItem[] memory firstItemList = items[1].toList(); bytes32[] memory topic = new bytes32[](firstItemList.length); for (uint256 j = 0; j < firstItemList.length; j++) { topic[j] = firstItemList[j].toBytes32(); } _txLog = IEvent.txLog({addr: items[0].toAddress(), topics: topic, data: items[2].unsafeToBytes()}); } function decodeSwapOutLog( IEvent.txLog memory log ) internal pure returns (IEvent.swapOutEvent memory outEvent) { // executorId = Utils.toBytes(log.addr); //outEvent.fromChain = abi.decode(log.topics[1], (uint256)); //outEvent.toChain = abi.decode(log.topics[2], (uint256)); outEvent.fromChain = uint256(log.topics[1]); outEvent.toChain = uint256(log.topics[2]); (outEvent.orderId, outEvent.token, outEvent.from, outEvent.to, outEvent.amount, outEvent.swapData) = abi.decode( log.data, (bytes32, bytes, bytes, bytes, uint256, bytes) ); } function decodeDepositOutLog( IEvent.txLog memory log ) internal pure returns (bytes memory executorId, IEvent.depositOutEvent memory depositEvent) { executorId = Utils.toBytes(log.addr); //depositEvent.fromChain = abi.decode(log.topics[1], (uint256)); //depositEvent.toChain = abi.decode(log.topics[2], (uint256)); depositEvent.fromChain = uint256(log.topics[1]); depositEvent.toChain = uint256(log.topics[2]); address token; address toAddress; (depositEvent.orderId, token, depositEvent.from, toAddress, depositEvent.amount) = abi.decode( log.data, (bytes32, address, bytes, address, uint256) ); depositEvent.token = Utils.toBytes(token); depositEvent.to = Utils.toBytes(toAddress); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "london", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"toChain","type":"uint256"},{"indexed":false,"internalType":"bool","name":"enable","type":"bool"}],"name":"RegisterToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"butterRouter","type":"address"}],"name":"SetButterRouter","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"lightNode","type":"address"}],"name":"SetLightClient","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"chainId","type":"uint256"},{"indexed":false,"internalType":"address","name":"relay","type":"address"}],"name":"SetRelayContract","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"wToken","type":"address"}],"name":"SetWrappedToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bool","name":"mintable","type":"bool"}],"name":"UpdateMintableToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromChain","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"toChain","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"orderId","type":"bytes32"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bytes","name":"from","type":"bytes"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mapDepositOut","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromChain","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"toChain","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"orderId","type":"bytes32"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bytes","name":"from","type":"bytes"},{"indexed":false,"internalType":"address","name":"toAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"mapSwapIn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"logs","type":"bytes"}],"name":"mapSwapInVerified","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromChain","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"toChain","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"orderId","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"token","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"from","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"to","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"swapData","type":"bytes"}],"name":"mapSwapOut","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromChain","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"toChain","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"orderId","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"token","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"from","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"to","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"toChainToken","type":"bytes"}],"name":"mapTransferOut","type":"event"},{"inputs":[],"name":"butterRouter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"changeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"_blockNum","type":"uint256"},{"internalType":"bytes32","name":"_orderId","type":"bytes32"}],"name":"getOrderStatus","outputs":[{"internalType":"bool","name":"exists","type":"bool"},{"internalType":"bool","name":"verifiable","type":"bool"},{"internalType":"uint256","name":"nodeType","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_wToken","type":"address"},{"internalType":"address","name":"_lightNode","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_toChain","type":"uint256"}],"name":"isBridgeable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"isMintable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lightNode","outputs":[{"internalType":"contract ILightNode","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"mintableTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"orderList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256[]","name":"_toChains","type":"uint256[]"},{"internalType":"bool","name":"_enable","type":"bool"}],"name":"registerTokenChains","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"relayChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"relayContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"selfChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_butterRouter","type":"address"}],"name":"setButterRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_lightNode","type":"address"}],"name":"setLightClient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_chainId","type":"uint256"},{"internalType":"address","name":"_relay","type":"address"}],"name":"setRelayContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setUnpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"storedOrderId","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_chainId","type":"uint256"},{"internalType":"uint256","name":"_logIndex","type":"uint256"},{"internalType":"bytes32","name":"_orderId","type":"bytes32"},{"internalType":"bytes","name":"_receiptProof","type":"bytes"}],"name":"swapIn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_initiator","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"bytes","name":"_to","type":"bytes"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_toChain","type":"uint256"},{"internalType":"bytes","name":"_swapData","type":"bytes"}],"name":"swapOutToken","outputs":[{"internalType":"bytes32","name":"orderId","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"tokenMappingList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"bool","name":"_mintable","type":"bool"}],"name":"updateMintableToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"wToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60c0604052306080524660a05234801561001857600080fd5b5060016000819055805462ff00001916905560805160a051613d5d610080600039600081816104ff0152818161160001528181611a850152611cd7015260008181610688015281816106d10152818161080d0152818161084d01526108c90152613d5d6000f3fe6080604052600436106101e75760003560e01c80638df0dcde11610102578063d431b1ac11610095578063ea618b8711610064578063ea618b87146105b3578063ee9592b9146105d3578063f5d66c2e1461060e578063fb0f97a81461063e57600080fd5b8063d431b1ac14610521578063d93765fc14610536578063d962e33b14610573578063e35ee9cc1461059357600080fd5b8063b899f904116100d1578063b899f9041461049a578063c0c53b8b146104ad578063ca75ecbf146104cd578063cc9e3e89146104ed57600080fd5b80638df0dcde146104395780638f2839701461044f578063aaf10f421461046f578063affed0e01461048457600080fd5b806352d1902d1161017a5780635f670bd3116101495780635f670bd3146103bf5780636af6400d146103df5780636e9960c31461040f578063848cb5c61461042457600080fd5b806352d1902d1461033e57806355d35a40146103615780635c550ac2146103815780635c975abb146103a157600080fd5b80633e553bab116101b65780633e553bab146102bb57806345711d48146102db5780634de5103e1461030b5780634f1ef2861461032b57600080fd5b80630babd864146101f3578063222b15fb146102305780632b585db4146102795780633659cfe61461029957600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b50600354610213906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561023c57600080fd5b5061026961024b36600461321d565b6001600160a01b031660009081526008602052604090205460ff1690565b6040519015158152602001610227565b34801561028557600080fd5b50610269610294366004613238565b610651565b3480156102a557600080fd5b506102b96102b436600461321d565b61067e565b005b3480156102c757600080fd5b506102b96102d636600461321d565b61074f565b3480156102e757600080fd5b506102696102f636600461321d565b60086020526000908152604090205460ff1681565b34801561031757600080fd5b50600a54610213906001600160a01b031681565b6102b9610339366004613327565b610803565b34801561034a57600080fd5b506103536108bc565b604051908152602001610227565b34801561036d57600080fd5b506102b961037c366004613375565b61096f565b34801561038d57600080fd5b50600454610213906001600160a01b031681565b3480156103ad57600080fd5b5060015462010000900460ff16610269565b3480156103cb57600080fd5b50600654610213906001600160a01b031681565b3480156103eb57600080fd5b506102696103fa3660046133a1565b60076020526000908152604090205460ff1681565b34801561041b57600080fd5b50610213610a30565b34801561043057600080fd5b506102b9610a3f565b34801561044557600080fd5b5061035360055481565b34801561045b57600080fd5b506102b961046a36600461321d565b610a81565b34801561047b57600080fd5b50610213610ae9565b34801561049057600080fd5b5061035360025481565b6103536104a83660046133ba565b610af3565b3480156104b957600080fd5b506102b96104c8366004613486565b610cb5565b3480156104d957600080fd5b506102b96104e8366004613506565b610ede565b3480156104f957600080fd5b506103537f000000000000000000000000000000000000000000000000000000000000000081565b34801561052d57600080fd5b506102b9611015565b34801561054257600080fd5b506105566105513660046135b1565b611055565b604080519315158452911515602084015290820152606001610227565b34801561057f57600080fd5b506102b961058e36600461321d565b611165565b34801561059f57600080fd5b506102b96105ae3660046135dd565b6111f1565b3480156105bf57600080fd5b506102b96105ce366004613687565b61130a565b3480156105df57600080fd5b506102696105ee366004613375565b600960209081526000928352604080842090915290825290205460ff1681565b34801561061a57600080fd5b506102696106293660046133a1565b600c6020526000908152604090205460ff1681565b6102b961064c3660046136e1565b611465565b60008181526009602090815260408083206001600160a01b038616845290915290205460ff165b92915050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036106cf5760405162461bcd60e51b81526004016106c69061371d565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661070161162e565b6001600160a01b0316146107275760405162461bcd60e51b81526004016106c690613769565b6107308161164f565b6040805160008082526020820190925261074c918391906116cb565b50565b610757611836565b6001600160a01b0316336001600160a01b0316146107875760405162461bcd60e51b81526004016106c6906137b5565b806001600160a01b0381166107ae5760405162461bcd60e51b81526004016106c6906137e0565b600680546001600160a01b0319166001600160a01b0384169081179091556040519081527fdbbd7b2f0d0e7ab85011e3c9115c836f3cc29f189c9c0f77b8f0dc718116c9469060200160405180910390a15050565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361084b5760405162461bcd60e51b81526004016106c69061371d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661087d61162e565b6001600160a01b0316146108a35760405162461bcd60e51b81526004016106c690613769565b6108ac8261164f565b6108b8828260016116cb565b5050565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461095c5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016106c6565b50600080516020613c9e83398151915290565b610977611836565b6001600160a01b0316336001600160a01b0316146109a75760405162461bcd60e51b81526004016106c6906137b5565b806001600160a01b0381166109ce5760405162461bcd60e51b81526004016106c6906137e0565b600480546001600160a01b0319166001600160a01b03841690811790915560058490556040805185815260208101929092527f1a43895ae95563631980575c9049ad602ade0cced91de88c94af53e71de9f080910160405180910390a1505050565b6000610a3a611836565b905090565b610a47611836565b6001600160a01b0316336001600160a01b031614610a775760405162461bcd60e51b81526004016106c6906137b5565b610a7f61185e565b565b610a89611836565b6001600160a01b0316336001600160a01b031614610ab95760405162461bcd60e51b81526004016106c6906137b5565b806001600160a01b038116610ae05760405162461bcd60e51b81526004016106c6906137e0565b6108b8826118b2565b6000610a3a61162e565b6000610afd611906565b610b0561195f565b60008511610b4d5760405162461bcd60e51b815260206004820152601560248201527453656e64696e672076616c7565206973207a65726f60581b60448201526064016106c6565b866001600160a01b038116610c0657506003546001600160a01b031634861115610bad5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964206d73672076616c756560781b60448201526064016106c6565b806001600160a01b031663d0e30db0876040518263ffffffff1660e01b81526004016000604051808303818588803b158015610be857600080fd5b505af1158015610bfc573d6000803e3d6000fd5b5050505050610c8e565b610c12813330896119ab565b6001600160a01b03811660009081526008602052604090205460ff1615610c8e57604051630852cd8d60e31b8152600481018790526001600160a01b038216906342966c6890602401600060405180830381600087803b158015610c7557600080fd5b505af1158015610c89573d6000803e3d6000fd5b505050505b610c9d81888b89898989611a16565b915050610caa6001600055565b979650505050505050565b600154610100900460ff1615808015610cd257506001805460ff16105b80610ceb5750303b158015610ceb57506001805460ff16145b610d4e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016106c6565b6001805460ff1916811790558015610d70576001805461ff0019166101001790555b836001600160a01b038116610d975760405162461bcd60e51b81526004016106c6906137e0565b836001600160a01b038116610dbe5760405162461bcd60e51b81526004016106c6906137e0565b836001600160a01b038116610de55760405162461bcd60e51b81526004016106c6906137e0565b600380546001600160a01b0319166001600160a01b0389169081179091556040519081527f556b8b8772c1552cbcc67f9bb7c7fd60934af593e54ec7aa4e8b2683632675f89060200160405180910390a1600680546001600160a01b0319166001600160a01b0388169081179091556040519081527fdbbd7b2f0d0e7ab85011e3c9115c836f3cc29f189c9c0f77b8f0dc718116c9469060200160405180910390a1610e90856118b2565b5050508015610ed8576001805461ff00191681556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b610ee6611836565b6001600160a01b0316336001600160a01b031614610f165760405162461bcd60e51b81526004016106c6906137b5565b6001600160a01b0383163b610f655760405162461bcd60e51b81526020600482015260156024820152741d1bdad95b881a5cc81b9bdd0818dbdb9d1c9858dd605a1b60448201526064016106c6565b60005b8251811015610ed8576000838281518110610f8557610f85613809565b60209081029190910181015160008181526009835260408082206001600160a01b038a1680845290855291819020805460ff1916881515908117909155815192835293820183905281019290925291507fb7e2e36d837b3e9a99d8c3de2eed62d21e4b1550a939fe020796d059a023800a9060600160405180910390a1508061100d81613835565b915050610f68565b61101d611836565b6001600160a01b0316336001600160a01b03161461104d5760405162461bcd60e51b81526004016106c6906137b5565b610a7f611b99565b6000818152600760205260408082205460065491516303f77f1160e21b8152600481018690526024810184905260ff909116929182916001600160a01b0390911690630fddfc4490604401602060405180830381865afa1580156110bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e1919061384e565b9150600660009054906101000a90046001600160a01b03166001600160a01b0316633fa9a8de6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611136573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115a919061386b565b905093509350939050565b61116d611836565b6001600160a01b0316336001600160a01b03161461119d5760405162461bcd60e51b81526004016106c6906137b5565b600a80546001600160a01b0319166001600160a01b0383169081179091556040519081527f6966311b8795d1205fa0a2a7b88a0d12234ec213d66e503526fd5db465aae70e9060200160405180910390a150565b6111f9611836565b6001600160a01b0316336001600160a01b0316146112295760405162461bcd60e51b81526004016106c6906137b5565b60005b825181101561130557816008600085848151811061124c5761124c613809565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055507fc62e9940e0af53c422f2a75fd6298cfe31f6c7e05a1de1b65e759b6e423767c78382815181106112be576112be613809565b6020026020010151836040516112eb9291906001600160a01b039290921682521515602082015260400190565b60405180910390a1806112fd81613835565b91505061122c565b505050565b611312611906565b61131a61195f565b60008281526007602052604090205460ff16156113675760405162461bcd60e51b815260206004820152600b60248201526a1bdc99195c88195e1a5cdd60aa1b60448201526064016106c6565b60055484146113ab5760405162461bcd60e51b815260206004820152601060248201526f1a5b9d985b1a590818da185a5b881a5960821b60448201526064016106c6565b6006546040516316d2cf7360e21b8152600091829182916001600160a01b031690635b4b3dcc906113e09087906004016138d4565b6000604051808303816000875af11580156113ff573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114279190810190613937565b92509250925082829061144d5760405162461bcd60e51b81526004016106c691906138d4565b506114588187611bda565b505050610ed86001600055565b61146d61195f565b600081116114b55760405162461bcd60e51b815260206004820152601560248201527453656e64696e672076616c7565206973207a65726f60581b60448201526064016106c6565b33836001600160a01b03811661156f57506003546001600160a01b0316348311156115165760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964206d73672076616c756560781b60448201526064016106c6565b806001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561155157600080fd5b505af1158015611565573d6000803e3d6000fd5b50505050506115f7565b61157b818330866119ab565b6001600160a01b03811660009081526008602052604090205460ff16156115f757604051630852cd8d60e31b8152600481018490526001600160a01b038216906342966c6890602401600060405180830381600087803b1580156115de57600080fd5b505af11580156115f2573d6000803e3d6000fd5b505050505b611627818386867f0000000000000000000000000000000000000000000000000000000000000000600554611d42565b5050505050565b6000600080516020613c9e8339815191525b546001600160a01b0316919050565b611657611836565b6001600160a01b0316336001600160a01b03161461074c5760405162461bcd60e51b815260206004820152602b60248201527f4d41504f6d6e69636861696e536572766963653a206f6e6c792041646d696e2060448201526a63616e207570677261646560a81b60648201526084016106c6565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156116fe5761130583611e33565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611758575060408051601f3d908101601f191682019092526117559181019061386b565b60015b6117bb5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016106c6565b600080516020613c9e833981519152811461182a5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016106c6565b50611305838383611ed2565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103611640565b611866611ef7565b6001805462ff0000191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6118db611836565b604080516001600160a01b03928316815291841660208301520160405180910390a161074c81611f46565b6002600054036119585760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106c6565b6002600055565b60015462010000900460ff1615610a7f5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016106c6565b6040516001600160a01b0380851660248301528316604482015260648101829052610ed89085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611fd2565b60008381526009602090815260408083206001600160a01b038b1684529091528120548890859060ff16611a835760405162461bcd60e51b81526020600482015260146024820152731d1bdad95b881b9bdd081c9959da5cdd195c995960621b60448201526064016106c6565b7f0000000000000000000000000000000000000000000000000000000000000000808703611af35760405162461bcd60e51b815260206004820152601960248201527f43616e6e6f74207377617020746f2073656c6620636861696e0000000000000060448201526064016106c6565b611aff338b838a6120a7565b600a549094506001600160a01b03163314611b1a5733611b1c565b885b9850611b36604051806020016040528060008152506120f9565b86817fca1cf8cebf88499429cca8f87cbca15ab8dafd06702259a5344ddce89ef3f3a586611b638f612159565b611b6c8e612159565b8f8e8d8d604051611b8397969594939291906139c5565b60405180910390a3505050979650505050505050565b611ba161195f565b6001805462ff00001916620100001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586118953390565b6000611be6838361218f565b80516004549192506001600160a01b03918216911614611c415760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a59081c995b185e4818dbdb9d1c9858dd60521b60448201526064016106c6565b604051806080016040528060438152602001613ce560439139805190602001208160200151600081518110611c7857611c78613809565b602002602001015114611cc35760405162461bcd60e51b8152602060048201526013602482015272496e76616c69642072656c617920746f70696360681b60448201526064016106c6565b6000611cce82612204565b905080602001517f000000000000000000000000000000000000000000000000000000000000000014611d395760405162461bcd60e51b8152602060048201526013602482015272125b9d985b1a59081d1bc818da185a5b881a59606a1b60448201526064016106c6565b610ed8816122d4565b60008181526009602090815260408083206001600160a01b038a1684529091529020548690829060ff16611daf5760405162461bcd60e51b81526020600482015260146024820152731d1bdad95b881b9bdd081c9959da5cdd195c995960621b60448201526064016106c6565b6000611dc588611dbe89612159565b87876120a7565b9050611ddf604051806020016040528060008152506120f9565b83857fb7100086a8e13ebae772a0f09b07046e389a6b036406d22b86f2d2e5b860a8d9838c611e0d8d612159565b8c8c604051611e20959493929190613a43565b60405180910390a3505050505050505050565b6001600160a01b0381163b611ea05760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016106c6565b80600080516020613c9e8339815191525b80546001600160a01b0319166001600160a01b039290921691909117905550565b611edb8361257f565b600082511180611ee85750805b1561130557610ed883836125bf565b60015462010000900460ff16610a7f5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016106c6565b6001600160a01b038116611fab5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084016106c6565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103611eb1565b6000612027826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125eb9092919063ffffffff16565b9050805160001480612048575080806020019051810190612048919061384e565b6113055760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106c6565b60028054600091309190836120bb83613835565b91905055848488886040516020016120d896959493929190613a7e565b6040516020818303038152906040528051906020012090505b949350505050565b600654604051630121b06960e71b81526001600160a01b03909116906390d834809061212b9030908590600401613ad9565b600060405180830381600087803b15801561214557600080fd5b505af1158015611627573d6000803e3d6000fd5b604051606082811b6bffffffffffffffffffffffff19166020830152906034016040516020818303038152906040529050919050565b6121bc604051806060016040528060006001600160a01b0316815260200160608152602001606081525090565b60006121f9836121f38660408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b906125fa565b90506120f181612732565b61224f60405180610100016040528060008152602001600081526020016000801916815260200160608152602001606081526020016060815260200160008152602001606081525090565b816020015160018151811061226657612266613809565b60209081029190910181015182528201518051600290811061228a5761228a613809565b60209081029190910181015182820152604083015180516122b19290820181019101613afd565b60e087015260c086015260a0850152608084015260608301526040820152919050565b60408082015160008181526007602052919091205460ff16156123275760405162461bcd60e51b815260206004820152600b60248201526a1bdc99195c88195e1a5cdd60aa1b60448201526064016106c6565b6000818152600760205260408120805460ff191660011790556060830151612350906014015190565b905060006123638460a001516014015190565b60c085015190915061238d836001600160a01b031660009081526008602052604090205460ff1690565b156123f3576040516340c10f1960e01b8152306004820152602481018290526001600160a01b038416906340c10f1990604401600060405180830381600087803b1580156123da57600080fd5b505af11580156123ee573d6000803e3d6000fd5b505050505b60008560e001515111801561241157506001600160a01b0382163b15155b1561249e5761242685602001518484846128ef565b6040808601518651608088015160e08901519351632344e65560e01b81526001600160a01b03871694632344e655946124689490938a93899390600401613bbc565b600060405180830381600087803b15801561248257600080fd5b505af1925050508015612493575060015b15612528575b612528565b6003546001600160a01b039081169084160361251857604051632e1a7d4d60e01b8152600481018290526001600160a01b03841690632e1a7d4d90602401600060405180830381600087803b1580156124f657600080fd5b505af115801561250a573d6000803e3d6000fd5b5050505061249982826129ec565b61252885602001518484846128ef565b8460400151856020015186600001517f2a945137b011d4aadec6425788c652197d107fc33f6cdccbb0c269273be9c1c986896080015187876040516125709493929190613c0e565b60405180910390a45050505050565b61258881611e33565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606125e48383604051806060016040528060278152602001613cbe60279139612b05565b9392505050565b60606120f18484600085612b7d565b604080518082019091526000808252602082015261261783612c4d565b6126525760405162461bcd60e51b815260206004820152600c60248201526b1a5cc81b1a5cdd0819985a5b60a21b60448201526064016106c6565b8251602084015160009161266591613c42565b905060006126768560200151612c88565b85602001516126859190613c42565b90506000805b858110156126bc5761269c83612d03565b91506126a88284613c42565b9250806126b481613835565b91505061268b565b506126c682612d03565b9050826126d38284613c42565b11156127155760405162461bcd60e51b8152602060048201526011602482015270524c50206974656d206f766572666c6f7760781b60448201526064016106c6565b604080518082019091529081526020810191909152949350505050565b61275f604051806060016040528060006001600160a01b0316815260200160608152602001606081525090565b600061276a83612dac565b90506003815110156127b25760405162461bcd60e51b81526020600482015260116024820152706c6f67206c656e67746820746f206c6f7760781b60448201526064016106c6565b60006127d7826001815181106127ca576127ca613809565b6020026020010151612dac565b90506000815167ffffffffffffffff8111156127f5576127f5613262565b60405190808252806020026020018201604052801561281e578160200160208202803683370190505b50905060005b825181101561287e5761284f83828151811061284257612842613809565b6020026020010151612ef4565b82828151811061286157612861613809565b60209081029190910101528061287681613835565b915050612824565b5060405180606001604052806128ad856000815181106128a0576128a0613809565b6020026020010151612f5b565b6001600160a01b031681526020018281526020016128e4856002815181106128d7576128d7613809565b6020026020010151612fad565b905295945050505050565b6001600160a01b03831661290c5761290782826129ec565b610ed8565b83632b6653dc14801561293b575073a614f803b6fd780986a42c78ec9c7f77e6ded13c6001600160a01b038416145b156129e157604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151918516916129979190613c55565b6000604051808303816000865af19150503d80600081146129d4576040519150601f19603f3d011682016040523d82523d6000602084013e6129d9565b606091505b505050610ed8565b610ed8838383612fdb565b80471015612a3c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016106c6565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612a89576040519150601f19603f3d011682016040523d82523d6000602084013e612a8e565b606091505b50509050806113055760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016106c6565b6060600080856001600160a01b031685604051612b229190613c55565b600060405180830381855af49150503d8060008114612b5d576040519150601f19603f3d011682016040523d82523d6000602084013e612b62565b606091505b5091509150612b738683838761300b565b9695505050505050565b606082471015612bde5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016106c6565b600080866001600160a01b03168587604051612bfa9190613c55565b60006040518083038185875af1925050503d8060008114612c37576040519150601f19603f3d011682016040523d82523d6000602084013e612c3c565b606091505b5091509150610caa8783838761300b565b80516000908103612c6057506000919050565b6020820151805160001a9060c0821015612c7e575060009392505050565b5060019392505050565b8051600090811a6080811015612ca15750600092915050565b60b8811080612cbc575060c08110801590612cbc575060f881105b15612cca5750600192915050565b60c0811015612cf757612cdf600160b8613c71565b612cec9060ff1682613c8a565b6125e4906001613c42565b612cdf600160f8613c71565b80516000908190811a6080811015612d1e5760019150612da5565b60b8811015612d4457612d32608082613c8a565b612d3d906001613c42565b9150612da5565b60c0811015612d715760b78103600185019450806020036101000a85510460018201810193505050612da5565b60f8811015612d8557612d3260c082613c8a565b60f78103600185019450806020036101000a855104600182018101935050505b5092915050565b6060612db782612c4d565b612df25760405162461bcd60e51b815260206004820152600c60248201526b1a5cc81b1a5cdd0819985a5b60a21b60448201526064016106c6565b6000612dfd83613084565b905060008167ffffffffffffffff811115612e1a57612e1a613262565b604051908082528060200260200182016040528015612e5f57816020015b6040805180820190915260008082526020820152815260200190600190039081612e385790505b5090506000612e718560200151612c88565b8560200151612e809190613c42565b90506000805b84811015612ee957612e9783612d03565b9150604051806040016040528083815260200184815250848281518110612ec057612ec0613809565b6020908102919091010152612ed58284613c42565b925080612ee181613835565b915050612e86565b509195945050505050565b8051600090602114612f3e5760405162461bcd60e51b815260206004820152601360248201527234ba32b69034b9903737ba10313cba32b9999960691b60448201526064016106c6565b60008083602001516001612f529190613c42565b51949350505050565b8051600090601514612fa45760405162461bcd60e51b81526020600482015260126024820152716974656d206c656e206973206e6f7420323160701b60448201526064016106c6565b61067882613109565b8051606090600003612fbe57919050565b600080612fca84613190565b601f19909101908152949350505050565b6040516001600160a01b03831660248201526044810182905261130590849063a9059cbb60e01b906064016119df565b6060831561307a578251600003613073576001600160a01b0385163b6130735760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106c6565b50816120f1565b6120f183836131d7565b8051600090810361309757506000919050565b6000806130a78460200151612c88565b84602001516130b69190613c42565b90506000846000015185602001516130ce9190613c42565b90505b80821015613100576130e282612d03565b6130ec9083613c42565b9150826130f881613835565b9350506130d1565b50909392505050565b80516000901580159061311e57508151602110155b6131615760405162461bcd60e51b81526020600482015260146024820152731a5d195b481b195b881a5cc81b9bdd081d5a5b9d60621b60448201526064016106c6565b60008061316d84613190565b8151919350915060208210156120f15760208290036101000a9004949350505050565b60008060006131a28460200151612c88565b905060008185602001516131b69190613c42565b905060008286600001516131ca9190613c8a565b9196919550909350505050565b8151156131e75781518083602001fd5b8060405162461bcd60e51b81526004016106c691906138d4565b80356001600160a01b038116811461321857600080fd5b919050565b60006020828403121561322f57600080fd5b6125e482613201565b6000806040838503121561324b57600080fd5b61325483613201565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156132a1576132a1613262565b604052919050565b600067ffffffffffffffff8211156132c3576132c3613262565b50601f01601f191660200190565b600082601f8301126132e257600080fd5b81356132f56132f0826132a9565b613278565b81815284602083860101111561330a57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561333a57600080fd5b61334383613201565b9150602083013567ffffffffffffffff81111561335f57600080fd5b61336b858286016132d1565b9150509250929050565b6000806040838503121561338857600080fd5b8235915061339860208401613201565b90509250929050565b6000602082840312156133b357600080fd5b5035919050565b600080600080600080600060c0888a0312156133d557600080fd5b6133de88613201565b96506133ec60208901613201565b9550604088013567ffffffffffffffff8082111561340957600080fd5b6134158b838c016132d1565b965060608a0135955060808a0135945060a08a013591508082111561343957600080fd5b818a0191508a601f83011261344d57600080fd5b81358181111561345c57600080fd5b8b602082850101111561346e57600080fd5b60208301945080935050505092959891949750929550565b60008060006060848603121561349b57600080fd5b6134a484613201565b92506134b260208501613201565b91506134c060408501613201565b90509250925092565b600067ffffffffffffffff8211156134e3576134e3613262565b5060051b60200190565b801515811461074c57600080fd5b8035613218816134ed565b60008060006060848603121561351b57600080fd5b61352484613201565b925060208085013567ffffffffffffffff81111561354157600080fd5b8501601f8101871361355257600080fd5b80356135606132f0826134c9565b81815260059190911b8201830190838101908983111561357f57600080fd5b928401925b8284101561359d57833582529284019290840190613584565b80965050505050506134c0604085016134fb565b6000806000606084860312156135c657600080fd5b505081359360208301359350604090920135919050565b600080604083850312156135f057600080fd5b823567ffffffffffffffff81111561360757600080fd5b8301601f8101851361361857600080fd5b803560206136286132f0836134c9565b82815260059290921b8301810191818101908884111561364757600080fd5b938201935b8385101561366c5761365d85613201565b8252938201939082019061364c565b955061367b90508682016134fb565b93505050509250929050565b6000806000806080858703121561369d57600080fd5b843593506020850135925060408501359150606085013567ffffffffffffffff8111156136c957600080fd5b6136d5878288016132d1565b91505092959194509250565b6000806000606084860312156136f657600080fd5b6136ff84613201565b925061370d60208501613201565b9150604084013590509250925092565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60208082526011908201527036b7b9901d1d1037b7363c9030b236b4b760791b604082015260600190565b6020808252600f908201526e61646472657373206973207a65726f60881b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016138475761384761381f565b5060010190565b60006020828403121561386057600080fd5b81516125e4816134ed565b60006020828403121561387d57600080fd5b5051919050565b60005b8381101561389f578181015183820152602001613887565b50506000910152565b600081518084526138c0816020860160208601613884565b601f01601f19169290920160200192915050565b6020815260006125e460208301846138a8565b60006138f56132f0846132a9565b905082815283838301111561390957600080fd5b6125e4836020830184613884565b600082601f83011261392857600080fd5b6125e4838351602085016138e7565b60008060006060848603121561394c57600080fd5b8351613957816134ed565b602085015190935067ffffffffffffffff8082111561397557600080fd5b818601915086601f83011261398957600080fd5b613998878351602085016138e7565b935060408601519150808211156139ae57600080fd5b506139bb86828701613917565b9150509250925092565b87815260c0602082015260006139de60c08301896138a8565b82810360408401526139f081896138a8565b90508281036060840152613a0481886138a8565b905085608084015282810360a0840152838152838560208301376000602085830101526020601f19601f86011682010191505098975050505050505050565b858152600060018060a01b03808716602084015260a06040840152613a6b60a08401876138a8565b9416606083015250608001529392505050565b60006bffffffffffffffffffffffff19808960601b168352876014840152866034840152856054840152808560601b166074840152508251613ac7816088850160208701613884565b91909101608801979650505050505050565b6001600160a01b03831681526040602082018190526000906120f1908301846138a8565b60008060008060008060c08789031215613b1657600080fd5b86519550602087015167ffffffffffffffff80821115613b3557600080fd5b613b418a838b01613917565b96506040890151915080821115613b5757600080fd5b613b638a838b01613917565b95506060890151915080821115613b7957600080fd5b613b858a838b01613917565b94506080890151935060a0890151915080821115613ba257600080fd5b50613baf89828a01613917565b9150509295509295509295565b86815260018060a01b038616602082015284604082015283606082015260c060808201526000613bef60c08301856138a8565b82810360a0840152613c0181856138a8565b9998505050505050505050565b600060018060a01b03808716835260806020840152613c3060808401876138a8565b94166040830152506060015292915050565b808201808211156106785761067861381f565b60008251613c67818460208701613884565b9190910192915050565b60ff82811682821603908111156106785761067861381f565b818103818111156106785761067861381f56fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65646d6170537761704f75742875696e743235362c75696e743235362c627974657333322c62797465732c62797465732c62797465732c75696e743235362c627974657329a264697066735822122031fcfe9cf12b8a11efda53e7e0d7f80ae04f55862f8be29ecf3c8cceb64a2c7064736f6c63430008140033
Deployed Bytecode
0x6080604052600436106101e75760003560e01c80638df0dcde11610102578063d431b1ac11610095578063ea618b8711610064578063ea618b87146105b3578063ee9592b9146105d3578063f5d66c2e1461060e578063fb0f97a81461063e57600080fd5b8063d431b1ac14610521578063d93765fc14610536578063d962e33b14610573578063e35ee9cc1461059357600080fd5b8063b899f904116100d1578063b899f9041461049a578063c0c53b8b146104ad578063ca75ecbf146104cd578063cc9e3e89146104ed57600080fd5b80638df0dcde146104395780638f2839701461044f578063aaf10f421461046f578063affed0e01461048457600080fd5b806352d1902d1161017a5780635f670bd3116101495780635f670bd3146103bf5780636af6400d146103df5780636e9960c31461040f578063848cb5c61461042457600080fd5b806352d1902d1461033e57806355d35a40146103615780635c550ac2146103815780635c975abb146103a157600080fd5b80633e553bab116101b65780633e553bab146102bb57806345711d48146102db5780634de5103e1461030b5780634f1ef2861461032b57600080fd5b80630babd864146101f3578063222b15fb146102305780632b585db4146102795780633659cfe61461029957600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b50600354610213906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561023c57600080fd5b5061026961024b36600461321d565b6001600160a01b031660009081526008602052604090205460ff1690565b6040519015158152602001610227565b34801561028557600080fd5b50610269610294366004613238565b610651565b3480156102a557600080fd5b506102b96102b436600461321d565b61067e565b005b3480156102c757600080fd5b506102b96102d636600461321d565b61074f565b3480156102e757600080fd5b506102696102f636600461321d565b60086020526000908152604090205460ff1681565b34801561031757600080fd5b50600a54610213906001600160a01b031681565b6102b9610339366004613327565b610803565b34801561034a57600080fd5b506103536108bc565b604051908152602001610227565b34801561036d57600080fd5b506102b961037c366004613375565b61096f565b34801561038d57600080fd5b50600454610213906001600160a01b031681565b3480156103ad57600080fd5b5060015462010000900460ff16610269565b3480156103cb57600080fd5b50600654610213906001600160a01b031681565b3480156103eb57600080fd5b506102696103fa3660046133a1565b60076020526000908152604090205460ff1681565b34801561041b57600080fd5b50610213610a30565b34801561043057600080fd5b506102b9610a3f565b34801561044557600080fd5b5061035360055481565b34801561045b57600080fd5b506102b961046a36600461321d565b610a81565b34801561047b57600080fd5b50610213610ae9565b34801561049057600080fd5b5061035360025481565b6103536104a83660046133ba565b610af3565b3480156104b957600080fd5b506102b96104c8366004613486565b610cb5565b3480156104d957600080fd5b506102b96104e8366004613506565b610ede565b3480156104f957600080fd5b506103537f000000000000000000000000000000000000000000000000000000000000000181565b34801561052d57600080fd5b506102b9611015565b34801561054257600080fd5b506105566105513660046135b1565b611055565b604080519315158452911515602084015290820152606001610227565b34801561057f57600080fd5b506102b961058e36600461321d565b611165565b34801561059f57600080fd5b506102b96105ae3660046135dd565b6111f1565b3480156105bf57600080fd5b506102b96105ce366004613687565b61130a565b3480156105df57600080fd5b506102696105ee366004613375565b600960209081526000928352604080842090915290825290205460ff1681565b34801561061a57600080fd5b506102696106293660046133a1565b600c6020526000908152604090205460ff1681565b6102b961064c3660046136e1565b611465565b60008181526009602090815260408083206001600160a01b038616845290915290205460ff165b92915050565b6001600160a01b037f0000000000000000000000007ae91d37bb987aa2fa37b2d45676f4b44bc945c01630036106cf5760405162461bcd60e51b81526004016106c69061371d565b60405180910390fd5b7f0000000000000000000000007ae91d37bb987aa2fa37b2d45676f4b44bc945c06001600160a01b031661070161162e565b6001600160a01b0316146107275760405162461bcd60e51b81526004016106c690613769565b6107308161164f565b6040805160008082526020820190925261074c918391906116cb565b50565b610757611836565b6001600160a01b0316336001600160a01b0316146107875760405162461bcd60e51b81526004016106c6906137b5565b806001600160a01b0381166107ae5760405162461bcd60e51b81526004016106c6906137e0565b600680546001600160a01b0319166001600160a01b0384169081179091556040519081527fdbbd7b2f0d0e7ab85011e3c9115c836f3cc29f189c9c0f77b8f0dc718116c9469060200160405180910390a15050565b6001600160a01b037f0000000000000000000000007ae91d37bb987aa2fa37b2d45676f4b44bc945c016300361084b5760405162461bcd60e51b81526004016106c69061371d565b7f0000000000000000000000007ae91d37bb987aa2fa37b2d45676f4b44bc945c06001600160a01b031661087d61162e565b6001600160a01b0316146108a35760405162461bcd60e51b81526004016106c690613769565b6108ac8261164f565b6108b8828260016116cb565b5050565b6000306001600160a01b037f0000000000000000000000007ae91d37bb987aa2fa37b2d45676f4b44bc945c0161461095c5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016106c6565b50600080516020613c9e83398151915290565b610977611836565b6001600160a01b0316336001600160a01b0316146109a75760405162461bcd60e51b81526004016106c6906137b5565b806001600160a01b0381166109ce5760405162461bcd60e51b81526004016106c6906137e0565b600480546001600160a01b0319166001600160a01b03841690811790915560058490556040805185815260208101929092527f1a43895ae95563631980575c9049ad602ade0cced91de88c94af53e71de9f080910160405180910390a1505050565b6000610a3a611836565b905090565b610a47611836565b6001600160a01b0316336001600160a01b031614610a775760405162461bcd60e51b81526004016106c6906137b5565b610a7f61185e565b565b610a89611836565b6001600160a01b0316336001600160a01b031614610ab95760405162461bcd60e51b81526004016106c6906137b5565b806001600160a01b038116610ae05760405162461bcd60e51b81526004016106c6906137e0565b6108b8826118b2565b6000610a3a61162e565b6000610afd611906565b610b0561195f565b60008511610b4d5760405162461bcd60e51b815260206004820152601560248201527453656e64696e672076616c7565206973207a65726f60581b60448201526064016106c6565b866001600160a01b038116610c0657506003546001600160a01b031634861115610bad5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964206d73672076616c756560781b60448201526064016106c6565b806001600160a01b031663d0e30db0876040518263ffffffff1660e01b81526004016000604051808303818588803b158015610be857600080fd5b505af1158015610bfc573d6000803e3d6000fd5b5050505050610c8e565b610c12813330896119ab565b6001600160a01b03811660009081526008602052604090205460ff1615610c8e57604051630852cd8d60e31b8152600481018790526001600160a01b038216906342966c6890602401600060405180830381600087803b158015610c7557600080fd5b505af1158015610c89573d6000803e3d6000fd5b505050505b610c9d81888b89898989611a16565b915050610caa6001600055565b979650505050505050565b600154610100900460ff1615808015610cd257506001805460ff16105b80610ceb5750303b158015610ceb57506001805460ff16145b610d4e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016106c6565b6001805460ff1916811790558015610d70576001805461ff0019166101001790555b836001600160a01b038116610d975760405162461bcd60e51b81526004016106c6906137e0565b836001600160a01b038116610dbe5760405162461bcd60e51b81526004016106c6906137e0565b836001600160a01b038116610de55760405162461bcd60e51b81526004016106c6906137e0565b600380546001600160a01b0319166001600160a01b0389169081179091556040519081527f556b8b8772c1552cbcc67f9bb7c7fd60934af593e54ec7aa4e8b2683632675f89060200160405180910390a1600680546001600160a01b0319166001600160a01b0388169081179091556040519081527fdbbd7b2f0d0e7ab85011e3c9115c836f3cc29f189c9c0f77b8f0dc718116c9469060200160405180910390a1610e90856118b2565b5050508015610ed8576001805461ff00191681556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b610ee6611836565b6001600160a01b0316336001600160a01b031614610f165760405162461bcd60e51b81526004016106c6906137b5565b6001600160a01b0383163b610f655760405162461bcd60e51b81526020600482015260156024820152741d1bdad95b881a5cc81b9bdd0818dbdb9d1c9858dd605a1b60448201526064016106c6565b60005b8251811015610ed8576000838281518110610f8557610f85613809565b60209081029190910181015160008181526009835260408082206001600160a01b038a1680845290855291819020805460ff1916881515908117909155815192835293820183905281019290925291507fb7e2e36d837b3e9a99d8c3de2eed62d21e4b1550a939fe020796d059a023800a9060600160405180910390a1508061100d81613835565b915050610f68565b61101d611836565b6001600160a01b0316336001600160a01b03161461104d5760405162461bcd60e51b81526004016106c6906137b5565b610a7f611b99565b6000818152600760205260408082205460065491516303f77f1160e21b8152600481018690526024810184905260ff909116929182916001600160a01b0390911690630fddfc4490604401602060405180830381865afa1580156110bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e1919061384e565b9150600660009054906101000a90046001600160a01b03166001600160a01b0316633fa9a8de6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611136573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115a919061386b565b905093509350939050565b61116d611836565b6001600160a01b0316336001600160a01b03161461119d5760405162461bcd60e51b81526004016106c6906137b5565b600a80546001600160a01b0319166001600160a01b0383169081179091556040519081527f6966311b8795d1205fa0a2a7b88a0d12234ec213d66e503526fd5db465aae70e9060200160405180910390a150565b6111f9611836565b6001600160a01b0316336001600160a01b0316146112295760405162461bcd60e51b81526004016106c6906137b5565b60005b825181101561130557816008600085848151811061124c5761124c613809565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055507fc62e9940e0af53c422f2a75fd6298cfe31f6c7e05a1de1b65e759b6e423767c78382815181106112be576112be613809565b6020026020010151836040516112eb9291906001600160a01b039290921682521515602082015260400190565b60405180910390a1806112fd81613835565b91505061122c565b505050565b611312611906565b61131a61195f565b60008281526007602052604090205460ff16156113675760405162461bcd60e51b815260206004820152600b60248201526a1bdc99195c88195e1a5cdd60aa1b60448201526064016106c6565b60055484146113ab5760405162461bcd60e51b815260206004820152601060248201526f1a5b9d985b1a590818da185a5b881a5960821b60448201526064016106c6565b6006546040516316d2cf7360e21b8152600091829182916001600160a01b031690635b4b3dcc906113e09087906004016138d4565b6000604051808303816000875af11580156113ff573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114279190810190613937565b92509250925082829061144d5760405162461bcd60e51b81526004016106c691906138d4565b506114588187611bda565b505050610ed86001600055565b61146d61195f565b600081116114b55760405162461bcd60e51b815260206004820152601560248201527453656e64696e672076616c7565206973207a65726f60581b60448201526064016106c6565b33836001600160a01b03811661156f57506003546001600160a01b0316348311156115165760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964206d73672076616c756560781b60448201526064016106c6565b806001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561155157600080fd5b505af1158015611565573d6000803e3d6000fd5b50505050506115f7565b61157b818330866119ab565b6001600160a01b03811660009081526008602052604090205460ff16156115f757604051630852cd8d60e31b8152600481018490526001600160a01b038216906342966c6890602401600060405180830381600087803b1580156115de57600080fd5b505af11580156115f2573d6000803e3d6000fd5b505050505b611627818386867f0000000000000000000000000000000000000000000000000000000000000001600554611d42565b5050505050565b6000600080516020613c9e8339815191525b546001600160a01b0316919050565b611657611836565b6001600160a01b0316336001600160a01b03161461074c5760405162461bcd60e51b815260206004820152602b60248201527f4d41504f6d6e69636861696e536572766963653a206f6e6c792041646d696e2060448201526a63616e207570677261646560a81b60648201526084016106c6565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156116fe5761130583611e33565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611758575060408051601f3d908101601f191682019092526117559181019061386b565b60015b6117bb5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016106c6565b600080516020613c9e833981519152811461182a5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016106c6565b50611305838383611ed2565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103611640565b611866611ef7565b6001805462ff0000191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6118db611836565b604080516001600160a01b03928316815291841660208301520160405180910390a161074c81611f46565b6002600054036119585760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106c6565b6002600055565b60015462010000900460ff1615610a7f5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016106c6565b6040516001600160a01b0380851660248301528316604482015260648101829052610ed89085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611fd2565b60008381526009602090815260408083206001600160a01b038b1684529091528120548890859060ff16611a835760405162461bcd60e51b81526020600482015260146024820152731d1bdad95b881b9bdd081c9959da5cdd195c995960621b60448201526064016106c6565b7f0000000000000000000000000000000000000000000000000000000000000001808703611af35760405162461bcd60e51b815260206004820152601960248201527f43616e6e6f74207377617020746f2073656c6620636861696e0000000000000060448201526064016106c6565b611aff338b838a6120a7565b600a549094506001600160a01b03163314611b1a5733611b1c565b885b9850611b36604051806020016040528060008152506120f9565b86817fca1cf8cebf88499429cca8f87cbca15ab8dafd06702259a5344ddce89ef3f3a586611b638f612159565b611b6c8e612159565b8f8e8d8d604051611b8397969594939291906139c5565b60405180910390a3505050979650505050505050565b611ba161195f565b6001805462ff00001916620100001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586118953390565b6000611be6838361218f565b80516004549192506001600160a01b03918216911614611c415760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a59081c995b185e4818dbdb9d1c9858dd60521b60448201526064016106c6565b604051806080016040528060438152602001613ce560439139805190602001208160200151600081518110611c7857611c78613809565b602002602001015114611cc35760405162461bcd60e51b8152602060048201526013602482015272496e76616c69642072656c617920746f70696360681b60448201526064016106c6565b6000611cce82612204565b905080602001517f000000000000000000000000000000000000000000000000000000000000000114611d395760405162461bcd60e51b8152602060048201526013602482015272125b9d985b1a59081d1bc818da185a5b881a59606a1b60448201526064016106c6565b610ed8816122d4565b60008181526009602090815260408083206001600160a01b038a1684529091529020548690829060ff16611daf5760405162461bcd60e51b81526020600482015260146024820152731d1bdad95b881b9bdd081c9959da5cdd195c995960621b60448201526064016106c6565b6000611dc588611dbe89612159565b87876120a7565b9050611ddf604051806020016040528060008152506120f9565b83857fb7100086a8e13ebae772a0f09b07046e389a6b036406d22b86f2d2e5b860a8d9838c611e0d8d612159565b8c8c604051611e20959493929190613a43565b60405180910390a3505050505050505050565b6001600160a01b0381163b611ea05760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016106c6565b80600080516020613c9e8339815191525b80546001600160a01b0319166001600160a01b039290921691909117905550565b611edb8361257f565b600082511180611ee85750805b1561130557610ed883836125bf565b60015462010000900460ff16610a7f5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016106c6565b6001600160a01b038116611fab5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084016106c6565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103611eb1565b6000612027826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125eb9092919063ffffffff16565b9050805160001480612048575080806020019051810190612048919061384e565b6113055760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106c6565b60028054600091309190836120bb83613835565b91905055848488886040516020016120d896959493929190613a7e565b6040516020818303038152906040528051906020012090505b949350505050565b600654604051630121b06960e71b81526001600160a01b03909116906390d834809061212b9030908590600401613ad9565b600060405180830381600087803b15801561214557600080fd5b505af1158015611627573d6000803e3d6000fd5b604051606082811b6bffffffffffffffffffffffff19166020830152906034016040516020818303038152906040529050919050565b6121bc604051806060016040528060006001600160a01b0316815260200160608152602001606081525090565b60006121f9836121f38660408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b906125fa565b90506120f181612732565b61224f60405180610100016040528060008152602001600081526020016000801916815260200160608152602001606081526020016060815260200160008152602001606081525090565b816020015160018151811061226657612266613809565b60209081029190910181015182528201518051600290811061228a5761228a613809565b60209081029190910181015182820152604083015180516122b19290820181019101613afd565b60e087015260c086015260a0850152608084015260608301526040820152919050565b60408082015160008181526007602052919091205460ff16156123275760405162461bcd60e51b815260206004820152600b60248201526a1bdc99195c88195e1a5cdd60aa1b60448201526064016106c6565b6000818152600760205260408120805460ff191660011790556060830151612350906014015190565b905060006123638460a001516014015190565b60c085015190915061238d836001600160a01b031660009081526008602052604090205460ff1690565b156123f3576040516340c10f1960e01b8152306004820152602481018290526001600160a01b038416906340c10f1990604401600060405180830381600087803b1580156123da57600080fd5b505af11580156123ee573d6000803e3d6000fd5b505050505b60008560e001515111801561241157506001600160a01b0382163b15155b1561249e5761242685602001518484846128ef565b6040808601518651608088015160e08901519351632344e65560e01b81526001600160a01b03871694632344e655946124689490938a93899390600401613bbc565b600060405180830381600087803b15801561248257600080fd5b505af1925050508015612493575060015b15612528575b612528565b6003546001600160a01b039081169084160361251857604051632e1a7d4d60e01b8152600481018290526001600160a01b03841690632e1a7d4d90602401600060405180830381600087803b1580156124f657600080fd5b505af115801561250a573d6000803e3d6000fd5b5050505061249982826129ec565b61252885602001518484846128ef565b8460400151856020015186600001517f2a945137b011d4aadec6425788c652197d107fc33f6cdccbb0c269273be9c1c986896080015187876040516125709493929190613c0e565b60405180910390a45050505050565b61258881611e33565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606125e48383604051806060016040528060278152602001613cbe60279139612b05565b9392505050565b60606120f18484600085612b7d565b604080518082019091526000808252602082015261261783612c4d565b6126525760405162461bcd60e51b815260206004820152600c60248201526b1a5cc81b1a5cdd0819985a5b60a21b60448201526064016106c6565b8251602084015160009161266591613c42565b905060006126768560200151612c88565b85602001516126859190613c42565b90506000805b858110156126bc5761269c83612d03565b91506126a88284613c42565b9250806126b481613835565b91505061268b565b506126c682612d03565b9050826126d38284613c42565b11156127155760405162461bcd60e51b8152602060048201526011602482015270524c50206974656d206f766572666c6f7760781b60448201526064016106c6565b604080518082019091529081526020810191909152949350505050565b61275f604051806060016040528060006001600160a01b0316815260200160608152602001606081525090565b600061276a83612dac565b90506003815110156127b25760405162461bcd60e51b81526020600482015260116024820152706c6f67206c656e67746820746f206c6f7760781b60448201526064016106c6565b60006127d7826001815181106127ca576127ca613809565b6020026020010151612dac565b90506000815167ffffffffffffffff8111156127f5576127f5613262565b60405190808252806020026020018201604052801561281e578160200160208202803683370190505b50905060005b825181101561287e5761284f83828151811061284257612842613809565b6020026020010151612ef4565b82828151811061286157612861613809565b60209081029190910101528061287681613835565b915050612824565b5060405180606001604052806128ad856000815181106128a0576128a0613809565b6020026020010151612f5b565b6001600160a01b031681526020018281526020016128e4856002815181106128d7576128d7613809565b6020026020010151612fad565b905295945050505050565b6001600160a01b03831661290c5761290782826129ec565b610ed8565b83632b6653dc14801561293b575073a614f803b6fd780986a42c78ec9c7f77e6ded13c6001600160a01b038416145b156129e157604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151918516916129979190613c55565b6000604051808303816000865af19150503d80600081146129d4576040519150601f19603f3d011682016040523d82523d6000602084013e6129d9565b606091505b505050610ed8565b610ed8838383612fdb565b80471015612a3c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016106c6565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612a89576040519150601f19603f3d011682016040523d82523d6000602084013e612a8e565b606091505b50509050806113055760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016106c6565b6060600080856001600160a01b031685604051612b229190613c55565b600060405180830381855af49150503d8060008114612b5d576040519150601f19603f3d011682016040523d82523d6000602084013e612b62565b606091505b5091509150612b738683838761300b565b9695505050505050565b606082471015612bde5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016106c6565b600080866001600160a01b03168587604051612bfa9190613c55565b60006040518083038185875af1925050503d8060008114612c37576040519150601f19603f3d011682016040523d82523d6000602084013e612c3c565b606091505b5091509150610caa8783838761300b565b80516000908103612c6057506000919050565b6020820151805160001a9060c0821015612c7e575060009392505050565b5060019392505050565b8051600090811a6080811015612ca15750600092915050565b60b8811080612cbc575060c08110801590612cbc575060f881105b15612cca5750600192915050565b60c0811015612cf757612cdf600160b8613c71565b612cec9060ff1682613c8a565b6125e4906001613c42565b612cdf600160f8613c71565b80516000908190811a6080811015612d1e5760019150612da5565b60b8811015612d4457612d32608082613c8a565b612d3d906001613c42565b9150612da5565b60c0811015612d715760b78103600185019450806020036101000a85510460018201810193505050612da5565b60f8811015612d8557612d3260c082613c8a565b60f78103600185019450806020036101000a855104600182018101935050505b5092915050565b6060612db782612c4d565b612df25760405162461bcd60e51b815260206004820152600c60248201526b1a5cc81b1a5cdd0819985a5b60a21b60448201526064016106c6565b6000612dfd83613084565b905060008167ffffffffffffffff811115612e1a57612e1a613262565b604051908082528060200260200182016040528015612e5f57816020015b6040805180820190915260008082526020820152815260200190600190039081612e385790505b5090506000612e718560200151612c88565b8560200151612e809190613c42565b90506000805b84811015612ee957612e9783612d03565b9150604051806040016040528083815260200184815250848281518110612ec057612ec0613809565b6020908102919091010152612ed58284613c42565b925080612ee181613835565b915050612e86565b509195945050505050565b8051600090602114612f3e5760405162461bcd60e51b815260206004820152601360248201527234ba32b69034b9903737ba10313cba32b9999960691b60448201526064016106c6565b60008083602001516001612f529190613c42565b51949350505050565b8051600090601514612fa45760405162461bcd60e51b81526020600482015260126024820152716974656d206c656e206973206e6f7420323160701b60448201526064016106c6565b61067882613109565b8051606090600003612fbe57919050565b600080612fca84613190565b601f19909101908152949350505050565b6040516001600160a01b03831660248201526044810182905261130590849063a9059cbb60e01b906064016119df565b6060831561307a578251600003613073576001600160a01b0385163b6130735760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106c6565b50816120f1565b6120f183836131d7565b8051600090810361309757506000919050565b6000806130a78460200151612c88565b84602001516130b69190613c42565b90506000846000015185602001516130ce9190613c42565b90505b80821015613100576130e282612d03565b6130ec9083613c42565b9150826130f881613835565b9350506130d1565b50909392505050565b80516000901580159061311e57508151602110155b6131615760405162461bcd60e51b81526020600482015260146024820152731a5d195b481b195b881a5cc81b9bdd081d5a5b9d60621b60448201526064016106c6565b60008061316d84613190565b8151919350915060208210156120f15760208290036101000a9004949350505050565b60008060006131a28460200151612c88565b905060008185602001516131b69190613c42565b905060008286600001516131ca9190613c8a565b9196919550909350505050565b8151156131e75781518083602001fd5b8060405162461bcd60e51b81526004016106c691906138d4565b80356001600160a01b038116811461321857600080fd5b919050565b60006020828403121561322f57600080fd5b6125e482613201565b6000806040838503121561324b57600080fd5b61325483613201565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156132a1576132a1613262565b604052919050565b600067ffffffffffffffff8211156132c3576132c3613262565b50601f01601f191660200190565b600082601f8301126132e257600080fd5b81356132f56132f0826132a9565b613278565b81815284602083860101111561330a57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561333a57600080fd5b61334383613201565b9150602083013567ffffffffffffffff81111561335f57600080fd5b61336b858286016132d1565b9150509250929050565b6000806040838503121561338857600080fd5b8235915061339860208401613201565b90509250929050565b6000602082840312156133b357600080fd5b5035919050565b600080600080600080600060c0888a0312156133d557600080fd5b6133de88613201565b96506133ec60208901613201565b9550604088013567ffffffffffffffff8082111561340957600080fd5b6134158b838c016132d1565b965060608a0135955060808a0135945060a08a013591508082111561343957600080fd5b818a0191508a601f83011261344d57600080fd5b81358181111561345c57600080fd5b8b602082850101111561346e57600080fd5b60208301945080935050505092959891949750929550565b60008060006060848603121561349b57600080fd5b6134a484613201565b92506134b260208501613201565b91506134c060408501613201565b90509250925092565b600067ffffffffffffffff8211156134e3576134e3613262565b5060051b60200190565b801515811461074c57600080fd5b8035613218816134ed565b60008060006060848603121561351b57600080fd5b61352484613201565b925060208085013567ffffffffffffffff81111561354157600080fd5b8501601f8101871361355257600080fd5b80356135606132f0826134c9565b81815260059190911b8201830190838101908983111561357f57600080fd5b928401925b8284101561359d57833582529284019290840190613584565b80965050505050506134c0604085016134fb565b6000806000606084860312156135c657600080fd5b505081359360208301359350604090920135919050565b600080604083850312156135f057600080fd5b823567ffffffffffffffff81111561360757600080fd5b8301601f8101851361361857600080fd5b803560206136286132f0836134c9565b82815260059290921b8301810191818101908884111561364757600080fd5b938201935b8385101561366c5761365d85613201565b8252938201939082019061364c565b955061367b90508682016134fb565b93505050509250929050565b6000806000806080858703121561369d57600080fd5b843593506020850135925060408501359150606085013567ffffffffffffffff8111156136c957600080fd5b6136d5878288016132d1565b91505092959194509250565b6000806000606084860312156136f657600080fd5b6136ff84613201565b925061370d60208501613201565b9150604084013590509250925092565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60208082526011908201527036b7b9901d1d1037b7363c9030b236b4b760791b604082015260600190565b6020808252600f908201526e61646472657373206973207a65726f60881b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016138475761384761381f565b5060010190565b60006020828403121561386057600080fd5b81516125e4816134ed565b60006020828403121561387d57600080fd5b5051919050565b60005b8381101561389f578181015183820152602001613887565b50506000910152565b600081518084526138c0816020860160208601613884565b601f01601f19169290920160200192915050565b6020815260006125e460208301846138a8565b60006138f56132f0846132a9565b905082815283838301111561390957600080fd5b6125e4836020830184613884565b600082601f83011261392857600080fd5b6125e4838351602085016138e7565b60008060006060848603121561394c57600080fd5b8351613957816134ed565b602085015190935067ffffffffffffffff8082111561397557600080fd5b818601915086601f83011261398957600080fd5b613998878351602085016138e7565b935060408601519150808211156139ae57600080fd5b506139bb86828701613917565b9150509250925092565b87815260c0602082015260006139de60c08301896138a8565b82810360408401526139f081896138a8565b90508281036060840152613a0481886138a8565b905085608084015282810360a0840152838152838560208301376000602085830101526020601f19601f86011682010191505098975050505050505050565b858152600060018060a01b03808716602084015260a06040840152613a6b60a08401876138a8565b9416606083015250608001529392505050565b60006bffffffffffffffffffffffff19808960601b168352876014840152866034840152856054840152808560601b166074840152508251613ac7816088850160208701613884565b91909101608801979650505050505050565b6001600160a01b03831681526040602082018190526000906120f1908301846138a8565b60008060008060008060c08789031215613b1657600080fd5b86519550602087015167ffffffffffffffff80821115613b3557600080fd5b613b418a838b01613917565b96506040890151915080821115613b5757600080fd5b613b638a838b01613917565b95506060890151915080821115613b7957600080fd5b613b858a838b01613917565b94506080890151935060a0890151915080821115613ba257600080fd5b50613baf89828a01613917565b9150509295509295509295565b86815260018060a01b038616602082015284604082015283606082015260c060808201526000613bef60c08301856138a8565b82810360a0840152613c0181856138a8565b9998505050505050505050565b600060018060a01b03808716835260806020840152613c3060808401876138a8565b94166040830152506060015292915050565b808201808211156106785761067861381f565b60008251613c67818460208701613884565b9190910192915050565b60ff82811682821603908111156106785761067861381f565b818103818111156106785761067861381f56fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65646d6170537761704f75742875696e743235362c75696e743235362c627974657333322c62797465732c62797465732c62797465732c75696e743235362c627974657329a264697066735822122031fcfe9cf12b8a11efda53e7e0d7f80ae04f55862f8be29ecf3c8cceb64a2c7064736f6c63430008140033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.