- Contract name:
- TokenGate
- Optimization enabled
- true
- Compiler version
- v0.8.2+commit.661d1103
- Optimization runs
- 999999
- Verified at
- 2024-01-29 06:45:35.680191Z
contracts/TokenGate.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./libraries/upgrade/PauseUpgradeSafe.sol"; import "./libraries/upgrade/OwnerOperatorUpgradeSafe.sol"; import "./libraries/BytesLibrary.sol"; import "./libraries/StringLibrary.sol"; import "./interfaces/ITransporter.sol"; contract TokenGate is OwnerOperatorUpgradeSafe, PauseUpgradeSafe { using SafeERC20 for IERC20; using SafeMath for uint256; using StringLibrary for string; using BytesLibrary for bytes32; struct DepositData { address payable owner; address token; uint256 blockExpired; uint256 amount; string none; uint8 v; bytes32 r; bytes32 s; } struct SavedDeposit { address owner; uint256 blockExpired; uint256 amount; } struct ClaimData { address payable owner; address token; uint256 blockExpired; uint256 amount; string none; uint8 v; bytes32 r; bytes32 s; } struct SavedClaim { address owner; uint256 blockExpired; uint256 amount; } // Mapping from token address to token deposit balance mapping(address => uint256) public tokenBalance; // Mapping from token address to accept value mapping(address => bool) public tokenAccepted; // Mapping from token address, vault address to balance mapping(address => mapping(address => uint256)) public vaultBalance; // Mapping from token address, sign message to checking value mapping(address => mapping(bytes32 => bool)) public depositCompleted; // Mapping from token address, none to depositData mapping(address => mapping(string => SavedDeposit)) public depositData; // Mapping from token address, user address to deposit count mapping(address => mapping(address => uint256)) public depositCountOf; // Mapping from token address, user address and deposit index to deposit none mapping(address => mapping(address => mapping(uint256 => string))) public depositNoneOf; // Mapping from token address, sign message to checking value mapping(address => mapping(bytes32 => bool)) public claimCompleted; // Mapping from token address, none to claimData mapping(address => mapping(string => SavedClaim)) public claimData; // Mapping from token address, user address to claim count mapping(address => mapping(address => uint256)) public claimCountOf; // Mapping from token address, user address and claim index to claim none mapping(address => mapping(address => mapping(uint256 => string))) public claimNoneOf; address public tokenMARE; address public tokenEMAS; event Deposit(address indexed from, address indexed token, address indexed signer, uint256 amount, string none); event Claim(address indexed receiver, address indexed token, address indexed signer, uint256 amount, string none); event DepositVault(address indexed from, address indexed vault, address indexed token, uint256 amount); event WithdrawVault(address indexed vault, address indexed token, uint256 amount); ITransporter public transporter; function init() public initializer { __OwnerOperator_init(); __Pause_init(); } /** * @dev pauses all deposits, claims. See {Pausable-_pause}. */ function pause() external virtual onlyOwner { _pause(); } /** * @dev unpauses all deposits, claims. See {Pausable-_pause}. */ function unpause() external virtual onlyOwner { _unpause(); } function approveToken(address token, bool value) external virtual onlyOwner { tokenAccepted[token] = value; } function setTransporter(address _transporter) external virtual onlyOwner { transporter = ITransporter(_transporter); } function setToken(address _tokenMARE, address _tokenEMAS) external virtual onlyOwner { tokenMARE = _tokenMARE; tokenEMAS = _tokenEMAS; } /** * @dev withdraw tokens that do not belong to the vault. */ function withdraw(address token) external virtual onlyOwner { uint256 amount = IERC20(token).balanceOf(address(this)).sub(tokenBalance[token]); require(amount > 0, "TokenGate: zero out amount"); IERC20(token).safeTransfer(msg.sender, amount); } /** * @dev only operator can deposit token to vault. */ function depositVault( address vault, address token, uint256 amount ) external virtual onlyOperator { require(tokenAccepted[token], "TokenGate: Not accept token"); require(operators[vault], "TokenGate: invalid vault"); require(amount > 0, "TokenGate: zero out amount"); tokenBalance[token] = tokenBalance[token].add(amount); vaultBalance[token][vault] = vaultBalance[token][vault].add(amount); transporter.safeTransferTokenFrom(token, msg.sender, address(this), amount); emit DepositVault(msg.sender, vault, token, amount); } /** * @dev only vault owner can withdraw token of vault. */ function withdrawVault(address token, uint256 amount) external virtual onlyOperator { require(tokenAccepted[token], "TokenGate: Not accept token"); require(amount > 0, "TokenGate: zero out amount"); require(vaultBalance[token][msg.sender] >= amount, "TokenGate: exceeded vault balance"); tokenBalance[token] = tokenBalance[token].sub(amount); vaultBalance[token][msg.sender] = vaultBalance[token][msg.sender].sub(amount); IERC20(token).safeTransfer(msg.sender, amount); emit WithdrawVault(msg.sender, token, amount); } /** * @dev deposit token to vault by sign message from server. */ function deposit(DepositData memory data) external virtual whenNotPaused { require(data.amount > 0, "TokenGate: zero out amount"); require(tokenAccepted[data.token], "TokenGate: Not accept token"); require(_msgSender() == data.owner, "TokenGate: sender is not owner"); (bytes32 message, address signer) = _verifyDeposit(data); depositCompleted[data.token][message] = true; depositData[data.token][data.none] = SavedDeposit({ owner: data.owner, blockExpired: block.number, amount: data.amount }); depositNoneOf[data.token][data.owner][depositCountOf[data.token][data.owner]] = data.none; depositCountOf[data.token][data.owner] = depositCountOf[data.token][data.owner].add(1); tokenBalance[data.token] = tokenBalance[data.token].add(data.amount); vaultBalance[data.token][signer] = vaultBalance[data.token][signer].add(data.amount); transporter.safeTransferTokenFrom(data.token, msg.sender, address(this), data.amount); emit Deposit(msg.sender, data.token, signer, data.amount, data.none); } function _verifyDeposit(DepositData memory data) internal view returns (bytes32, address) { bytes32 message = keccak256( abi.encode(address(this), "Deposit", data.owner, data.token, data.blockExpired, data.amount, data.none) ); address signer = message.toString().recover(data.v, data.r, data.s); require(operators[signer], "TokenGate: deposit not verify"); require(block.number < data.blockExpired, "TokenGate: deposit expired"); require(!depositCompleted[data.token][message], "TokenGate: deposit completed"); require(depositData[data.token][data.none].owner == address(0), "TokenGate: none existed"); return (message, signer); } /** * @dev claim token by sign message from server. */ function claim(ClaimData memory data) external virtual whenNotPaused { require(data.amount > 0, "TokenGate: zero out amount"); require(tokenAccepted[data.token], "TokenGate: Not accept token"); require(_msgSender() == data.owner, "TokenGate: sender is not owner"); (bytes32 message, address signer) = _verifyClaim(data); uint256 amount = data.amount; if (data.token == tokenEMAS && vaultBalance[tokenEMAS][signer] < amount) { // Claim EMAS // Caculate amount MARE in, amount EMAS out require(tokenAccepted[tokenMARE], "TokenGate: Not accept token"); require(tokenAccepted[tokenEMAS], "TokenGate: Not accept token"); require(amount > 0, "TokenGate: zero amount"); require(vaultBalance[tokenMARE][signer] >= amount, "TokenGate: exceeded vault balance"); tokenBalance[tokenMARE] = tokenBalance[tokenMARE].sub(amount); vaultBalance[tokenMARE][signer] = vaultBalance[tokenMARE][signer].sub(amount); tokenBalance[tokenEMAS] = tokenBalance[tokenEMAS].add(amount); vaultBalance[tokenEMAS][signer] = vaultBalance[tokenEMAS][signer].add(amount); IERC20(data.token).safeApprove(data.owner, amount); emit WithdrawVault(signer, tokenMARE, amount); emit DepositVault(signer, signer, tokenEMAS, amount); } require(vaultBalance[data.token][signer] >= amount, "TokenGate: exceeded vault balance"); claimCompleted[data.token][message] = true; claimData[data.token][data.none] = SavedClaim({ owner: data.owner, blockExpired: data.blockExpired, amount: amount }); claimNoneOf[data.token][data.owner][claimCountOf[data.token][data.owner]] = data.none; claimCountOf[data.token][data.owner] = claimCountOf[data.token][data.owner].add(1); tokenBalance[data.token] = tokenBalance[data.token].sub(amount); vaultBalance[data.token][signer] = vaultBalance[data.token][signer].sub(amount); IERC20(tokenMARE).safeTransfer(data.owner, amount); emit Claim(data.owner, data.token, signer, amount, data.none); } function _verifyClaim(ClaimData memory data) internal view returns (bytes32, address) { bytes32 message = keccak256( abi.encode(address(this), "Claim", data.owner, data.token, data.blockExpired, data.amount, data.none) ); address signer = message.toString().recover(data.v, data.r, data.s); require(operators[signer], "TokenGate: claim not verify"); require(block.number < data.blockExpired, "TokenGate: claim expired"); require(!claimCompleted[data.token][message], "TokenGate: claim completed"); require(claimData[data.token][data.none].owner == address(0), "TokenGate: none existed"); return (message, signer); } } // pragma solidity ^0.8.0; // import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; // import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; // import "@openzeppelin/contracts/utils/math/SafeMath.sol"; // import "./libraries/upgrade/PauseUpgradeSafe.sol"; // import "./libraries/upgrade/OwnerOperatorUpgradeSafe.sol"; // import "./libraries/BytesLibrary.sol"; // import "./libraries/StringLibrary.sol"; // import "./interfaces/ITransporter.sol"; // import "./interfaces/ITokenize.sol"; // contract TokenGate is OwnerOperatorUpgradeSafe, PauseUpgradeSafe { // using SafeERC20 for IERC20; // using SafeMath for uint256; // using StringLibrary for string; // using BytesLibrary for bytes32; // struct DepositData { // address payable owner; // address token; // uint256 blockExpired; // uint256 amount; // string none; // uint8 v; // bytes32 r; // bytes32 s; // } // struct SavedDeposit { // address owner; // uint256 blockExpired; // uint256 amount; // } // struct ClaimData { // address payable owner; // address token; // uint256 blockExpired; // uint256 amount; // string none; // uint8 v; // bytes32 r; // bytes32 s; // } // struct SavedClaim { // address owner; // uint256 blockExpired; // uint256 amount; // } // // Mapping from token address to token deposit balance // mapping(address => uint256) public tokenBalance; // // Mapping from token address to accept value // mapping(address => bool) public tokenAccepted; // // Mapping from token address, vault address to balance // mapping(address => mapping(address => uint256)) public vaultBalance; // // Mapping from token address, sign message to checking value // mapping(address => mapping(bytes32 => bool)) public depositCompleted; // // Mapping from token address, none to depositData // mapping(address => mapping(string => SavedDeposit)) public depositData; // // Mapping from token address, user address to deposit count // mapping(address => mapping(address => uint256)) public depositCountOf; // // Mapping from token address, user address and deposit index to deposit none // mapping(address => mapping(address => mapping(uint256 => string))) public depositNoneOf; // // Mapping from token address, sign message to checking value // mapping(address => mapping(bytes32 => bool)) public claimCompleted; // // Mapping from token address, none to claimData // mapping(address => mapping(string => SavedClaim)) public claimData; // // Mapping from token address, user address to claim count // mapping(address => mapping(address => uint256)) public claimCountOf; // // Mapping from token address, user address and claim index to claim none // mapping(address => mapping(address => mapping(uint256 => string))) public claimNoneOf; // address public tokenMARE; // address public tokenEMAS; // event Deposit(address indexed from, address indexed token, address indexed signer, uint256 amount, string none); // event Claim(address indexed receiver, address indexed token, address indexed signer, uint256 amount, string none); // event DepositVault(address indexed from, address indexed vault, address indexed token, uint256 amount); // event WithdrawVault(address indexed vault, address indexed token, uint256 amount); // ITransporter public transporter; // ITokenize public tokenize; // function init() public initializer { // __OwnerOperator_init(); // __Pause_init(); // } // /** // * @dev pauses all deposits, claims. See {Pausable-_pause}. // */ // function pause() external virtual onlyOwner { // _pause(); // } // /** // * @dev unpauses all deposits, claims. See {Pausable-_pause}. // */ // function unpause() external virtual onlyOwner { // _unpause(); // } // function approveToken(address token, bool value) external virtual onlyOwner { // tokenAccepted[token] = value; // } // function setTransporter(address _transporter) external virtual onlyOwner { // transporter = ITransporter(_transporter); // } // function setTokenize(address _tokenize) external virtual onlyOwner { // tokenize = ITokenize(_tokenize); // } // function setToken(address _tokenMARE, address _tokenEMAS) external virtual onlyOwner { // tokenMARE = _tokenMARE; // tokenEMAS = _tokenEMAS; // } // /** // * @dev withdraw tokens that do not belong to the vault. // */ // function withdraw(address token) external virtual onlyOwner { // uint256 amount = IERC20(token).balanceOf(address(this)).sub(tokenBalance[token]); // require(amount > 0, "TokenGate: zero out amount"); // IERC20(token).safeTransfer(msg.sender, amount); // } // /** // * @dev only operator can deposit token to vault. // */ // function depositVault( // address vault, // address token, // uint256 amount // ) external virtual onlyOperator { // require(tokenAccepted[token], "TokenGate: Not accept token"); // require(operators[vault], "TokenGate: invalid vault"); // require(amount > 0, "TokenGate: zero out amount"); // tokenBalance[token] = tokenBalance[token].add(amount); // vaultBalance[token][vault] = vaultBalance[token][vault].add(amount); // transporter.safeTransferTokenFrom(token, msg.sender, address(this), amount); // emit DepositVault(msg.sender, vault, token, amount); // } // /** // * @dev only vault owner can withdraw token of vault. // */ // function withdrawVault(address token, uint256 amount) external virtual onlyOperator { // require(tokenAccepted[token], "TokenGate: Not accept token"); // require(amount > 0, "TokenGate: zero out amount"); // require(vaultBalance[token][msg.sender] >= amount, "TokenGate: exceeded vault balance"); // tokenBalance[token] = tokenBalance[token].sub(amount); // vaultBalance[token][msg.sender] = vaultBalance[token][msg.sender].sub(amount); // IERC20(token).safeTransfer(msg.sender, amount); // emit WithdrawVault(msg.sender, token, amount); // } // /** // * @dev deposit token to vault by sign message from server. // */ // function deposit(DepositData memory data) external virtual whenNotPaused { // require(data.amount > 0, "TokenGate: zero out amount"); // require(tokenAccepted[data.token], "TokenGate: Not accept token"); // require(_msgSender() == data.owner, "TokenGate: sender is not owner"); // (bytes32 message, address signer) = _verifyDeposit(data); // depositCompleted[data.token][message] = true; // depositData[data.token][data.none] = SavedDeposit({ // owner: data.owner, // blockExpired: block.number, // amount: data.amount // }); // depositNoneOf[data.token][data.owner][depositCountOf[data.token][data.owner]] = data.none; // depositCountOf[data.token][data.owner] = depositCountOf[data.token][data.owner].add(1); // tokenBalance[data.token] = tokenBalance[data.token].add(data.amount); // vaultBalance[data.token][signer] = vaultBalance[data.token][signer].add(data.amount); // transporter.safeTransferTokenFrom(data.token, msg.sender, address(this), data.amount); // emit Deposit(msg.sender, data.token, signer, data.amount, data.none); // } // function _verifyDeposit(DepositData memory data) internal view returns (bytes32, address) { // bytes32 message = keccak256( // abi.encode(address(this), "Deposit", data.owner, data.token, data.blockExpired, data.amount, data.none) // ); // address signer = message.toString().recover(data.v, data.r, data.s); // require(operators[signer], "TokenGate: deposit not verify"); // require(block.number < data.blockExpired, "TokenGate: deposit expired"); // require(!depositCompleted[data.token][message], "TokenGate: deposit completed"); // require(depositData[data.token][data.none].owner == address(0), "TokenGate: none existed"); // return (message, signer); // } // /** // * @dev claim token by sign message from server. // */ // function claim(ClaimData memory data) external virtual whenNotPaused { // require(data.amount > 0, "TokenGate: zero out amount"); // require(tokenAccepted[data.token], "TokenGate: Not accept token"); // require(_msgSender() == data.owner, "TokenGate: sender is not owner"); // (bytes32 message, address signer) = _verifyClaim(data); // uint256 amount = data.amount; // if (data.token == tokenEMAS && vaultBalance[tokenEMAS][signer] < amount) { // // Claim EMAS // // Caculate amount MARE in, amount EMAS out // require(tokenAccepted[tokenMARE], "TokenGate: Not accept token"); // require(tokenAccepted[tokenEMAS], "TokenGate: Not accept token"); // uint256 amountIn = tokenize.calcAmountIn(tokenMARE, tokenEMAS, amount); // amount = tokenize.calcAmountOut(tokenMARE, amountIn, tokenEMAS); // require(amountIn > 0, "TokenGate: zero amount"); // require(vaultBalance[tokenMARE][signer] >= amountIn, "TokenGate: exceeded vault balance"); // tokenBalance[tokenMARE] = tokenBalance[tokenMARE].sub(amountIn); // vaultBalance[tokenMARE][signer] = vaultBalance[tokenMARE][signer].sub(amountIn); // tokenBalance[tokenEMAS] = tokenBalance[tokenEMAS].add(amount); // vaultBalance[tokenEMAS][signer] = vaultBalance[tokenEMAS][signer].add(amount); // IERC20(data.token).safeApprove(data.owner, amountIn); // emit WithdrawVault(signer, tokenMARE, amountIn); // emit DepositVault(signer, signer, tokenEMAS, amount); // } // require(vaultBalance[data.token][signer] >= amount, "TokenGate: exceeded vault balance"); // claimCompleted[data.token][message] = true; // claimData[data.token][data.none] = SavedClaim({ // owner: data.owner, // blockExpired: data.blockExpired, // amount: amount // }); // claimNoneOf[data.token][data.owner][claimCountOf[data.token][data.owner]] = data.none; // claimCountOf[data.token][data.owner] = claimCountOf[data.token][data.owner].add(1); // tokenBalance[data.token] = tokenBalance[data.token].sub(amount); // vaultBalance[data.token][signer] = vaultBalance[data.token][signer].sub(amount); // IERC20(tokenMARE).safeTransfer(data.owner, amount); // emit Claim(data.owner, data.token, signer, amount, data.none); // } // function _verifyClaim(ClaimData memory data) internal view returns (bytes32, address) { // bytes32 message = keccak256( // abi.encode(address(this), "Claim", data.owner, data.token, data.blockExpired, data.amount, data.none) // ); // address signer = message.toString().recover(data.v, data.r, data.s); // require(operators[signer], "TokenGate: claim not verify"); // require(block.number < data.blockExpired, "TokenGate: claim expired"); // require(!claimCompleted[data.token][message], "TokenGate: claim completed"); // require(claimData[data.token][data.none].owner == address(0), "TokenGate: none existed"); // return (message, signer); // } // function swapVaultMAREtoEMAS( // address tokenIn, // address tokenOut, // uint256 amountIn // ) external virtual onlyOperator { // require(tokenAccepted[tokenIn], "TokenGate: Not accept token"); // require(amountIn > 0, "TokenGate: zero out amount"); // require(vaultBalance[tokenIn][msg.sender] >= amountIn, "TokenGate: exceeded vault balance"); // uint256 amoutOut = tokenize.calcAmountOut(tokenIn, amountIn, tokenOut); // tokenBalance[tokenIn] = tokenBalance[tokenIn].sub(amountIn); // vaultBalance[tokenIn][msg.sender] = vaultBalance[tokenIn][msg.sender].sub(amountIn); // tokenBalance[tokenOut] = tokenBalance[tokenOut].add(amoutOut); // vaultBalance[tokenOut][msg.sender] = vaultBalance[tokenOut][msg.sender].add(amoutOut); // IERC20(tokenIn).safeApprove(address(tokenize), amountIn); // tokenize.swap(tokenIn, amountIn, tokenOut, amoutOut); // emit WithdrawVault(msg.sender, tokenIn, amountIn); // emit DepositVault(msg.sender, msg.sender, tokenOut, amoutOut); // } // }
contracts/libraries/BytesLibrary.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev BytesLibrary operations. */ library BytesLibrary { function toString(bytes32 value) internal pure returns (string memory) { bytes memory alphabet = "0123456789abcdef"; bytes memory str = new bytes(64); for (uint256 i = 0; i < 32; i++) { str[i * 2] = alphabet[uint8(value[i] >> 4)]; str[1 + i * 2] = alphabet[uint8(value[i] & 0x0f)]; } return string(str); } }
contracts/libraries/StringLibrary.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./UintLibrary.sol"; library StringLibrary { using UintLibrary for uint256; function append(string memory a, string memory b) internal pure returns (string memory) { bytes memory ba = bytes(a); bytes memory bb = bytes(b); bytes memory bab = new bytes(ba.length + bb.length); uint256 k = 0; for (uint256 i = 0; i < ba.length; i++) bab[k++] = ba[i]; for (uint256 i = 0; i < bb.length; i++) bab[k++] = bb[i]; return string(bab); } function append( string memory a, string memory b, string memory c ) internal pure returns (string memory) { bytes memory ba = bytes(a); bytes memory bb = bytes(b); bytes memory bc = bytes(c); bytes memory bbb = new bytes(ba.length + bb.length + bc.length); uint256 k = 0; for (uint256 i = 0; i < ba.length; i++) bbb[k++] = ba[i]; for (uint256 i = 0; i < bb.length; i++) bbb[k++] = bb[i]; for (uint256 i = 0; i < bc.length; i++) bbb[k++] = bc[i]; return string(bbb); } function recover( string memory message, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { bytes memory msgBytes = bytes(message); bytes memory fullMessage = concat( bytes("\x19Ethereum Signed Message:\n"), bytes(msgBytes.length.toString()), msgBytes, new bytes(0), new bytes(0), new bytes(0), new bytes(0) ); return ecrecover(keccak256(fullMessage), v, r, s); } function concat( bytes memory ba, bytes memory bb, bytes memory bc, bytes memory bd, bytes memory be, bytes memory bf, bytes memory bg ) internal pure returns (bytes memory) { bytes memory resultBytes = new bytes(ba.length + bb.length + bc.length + bd.length + be.length + bf.length + bg.length); uint256 k = 0; for (uint256 i = 0; i < ba.length; i++) resultBytes[k++] = ba[i]; for (uint256 i = 0; i < bb.length; i++) resultBytes[k++] = bb[i]; for (uint256 i = 0; i < bc.length; i++) resultBytes[k++] = bc[i]; for (uint256 i = 0; i < bd.length; i++) resultBytes[k++] = bd[i]; for (uint256 i = 0; i < be.length; i++) resultBytes[k++] = be[i]; for (uint256 i = 0; i < bf.length; i++) resultBytes[k++] = bf[i]; for (uint256 i = 0; i < bg.length; i++) resultBytes[k++] = bg[i]; return resultBytes; } }
@openzeppelin/contracts/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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 a proxied contract can't have 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. * * 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. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } }
@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount ) external returns (bool); /** * @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); }
@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.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; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } 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)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } 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"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @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"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
@openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return _verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) private pure returns (bytes memory) { if (success) { return returndata; } else { // 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
@openzeppelin/contracts/utils/math/SafeMath.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
contracts/interfaces/ITransporter.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ITransporter { function safeTransferTokenFrom( address token_, address from_, address to_, uint256 amount_ ) external; function safeTransferNFT721From( address token_, address from_, address to_, uint256 tokenId_ ) external; function safeBurnNFT721From(address token_, uint256 tokenId_) external; function safeTransferNFT1155From( address token_, address from_, address to_, uint256 tokenId_, uint256 amount_ ) external; function safeBurnNFT1155From( address token_, address from_, uint256 tokenId_, uint256 amount_ ) external; function safeBurnBatchNFT1155From( address token_, address from_, uint256[] memory tokenId_, uint256[] memory amount_ ) external; }
contracts/libraries/UintLibrary.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; library UintLibrary { using SafeMath for uint256; function toString(uint256 i) internal pure returns (string memory) { if (i == 0) { return "0"; } uint256 j = i; uint256 len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); for (uint256 k = len; k > 0; k--) { bstr[k - 1] = bytes1(uint8(48 + (i % 10))); i /= 10; } return string(bstr); } function bp(uint256 value, uint256 bpValue) internal pure returns (uint256) { return value.mul(bpValue).div(10000); } }
contracts/libraries/upgrade/ContextUpgradeSafe.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; abstract contract ContextUpgradeSafe is Initializable { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } // Reserved storage space to allow for layout changes in the future. uint256[50] private __gap; }
contracts/libraries/upgrade/OwnableUpgradeSafe.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ContextUpgradeSafe.sol"; abstract contract OwnableUpgradeSafe is ContextUpgradeSafe { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal initializer { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
contracts/libraries/upgrade/OwnerOperatorUpgradeSafe.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./OwnableUpgradeSafe.sol"; abstract contract OwnerOperatorUpgradeSafe is OwnableUpgradeSafe { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. mapping(address => bool) public operators; event AddOperator(address indexed operator); event RemoveOperator(address indexed operator); function __OwnerOperator_init() internal initializer { __Ownable_init(); } modifier operatorOrOwner() { require(operators[msg.sender] || owner() == msg.sender, "OwnerOperator: !operator, !owner"); _; } modifier onlyOperator() { require(operators[msg.sender], "OwnerOperator: !operator"); _; } function addOperator(address operator) external virtual onlyOwner { require(operator != address(0), "OwnerOperator: operator is the zero address"); require(!operators[operator], "OwnerOperator: operator existed"); operators[operator] = true; emit AddOperator(operator); } function removeOperator(address operator) external virtual onlyOwner { require(operator != address(0), "OwnerOperator: operator is the zero address"); require(operators[operator], "OwnerOperator: operator not exist"); operators[operator] = false; emit RemoveOperator(operator); } }
contracts/libraries/upgrade/PauseUpgradeSafe.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ContextUpgradeSafe.sol"; abstract contract PauseUpgradeSafe is ContextUpgradeSafe { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. /** * @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. */ function __Pause_init() internal initializer { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { 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()); } }
Contract ABI
[{"type":"event","name":"AddOperator","inputs":[{"type":"address","name":"operator","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Claim","inputs":[{"type":"address","name":"receiver","internalType":"address","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"signer","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"string","name":"none","internalType":"string","indexed":false}],"anonymous":false},{"type":"event","name":"Deposit","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"signer","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"string","name":"none","internalType":"string","indexed":false}],"anonymous":false},{"type":"event","name":"DepositVault","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"vault","internalType":"address","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RemoveOperator","inputs":[{"type":"address","name":"operator","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"WithdrawVault","inputs":[{"type":"address","name":"vault","internalType":"address","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addOperator","inputs":[{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"approveToken","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"bool","name":"value","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claim","inputs":[{"type":"tuple","name":"data","internalType":"struct TokenGate.ClaimData","components":[{"type":"address","name":"owner","internalType":"address payable"},{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"blockExpired","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"string","name":"none","internalType":"string"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}]}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"claimCompleted","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"claimCountOf","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"blockExpired","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"}],"name":"claimData","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"string","name":"","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"claimNoneOf","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deposit","inputs":[{"type":"tuple","name":"data","internalType":"struct TokenGate.DepositData","components":[{"type":"address","name":"owner","internalType":"address payable"},{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"blockExpired","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"string","name":"none","internalType":"string"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}]}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"depositCompleted","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"depositCountOf","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"blockExpired","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"}],"name":"depositData","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"string","name":"","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"depositNoneOf","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"depositVault","inputs":[{"type":"address","name":"vault","internalType":"address"},{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"init","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"operators","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeOperator","inputs":[{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setToken","inputs":[{"type":"address","name":"_tokenMARE","internalType":"address"},{"type":"address","name":"_tokenEMAS","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTransporter","inputs":[{"type":"address","name":"_transporter","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"tokenAccepted","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenBalance","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"tokenEMAS","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"tokenMARE","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ITransporter"}],"name":"transporter","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"vaultBalance","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"address","name":"token","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawVault","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]}]
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106101f05760003560e01c80639804dab91161010f578063b77d8052116100a2578063e42b021211610071578063e42b0212146105bb578063eedc966a146105db578063f2fde38b146105fb578063fa9a1a041461060e576101f0565b8063b77d80521461055f578063c01a9cb41461058d578063c4f07601146105a0578063e1c7392a146105b3576101f0565b8063ab3525ba116100de578063ab3525ba146104f6578063ac8a584a14610516578063aedf795e14610529578063b32a01741461054c576101f0565b80639804dab91461049d5780639870d7fe146104b05780639c8dadae146104c3578063aa4efb32146104d6576101f0565b80635a167c2e1161018757806378a251fc1161015657806378a251fc1461040b57806381965082146104365780638456cb59146104565780638da5cb5b1461045e576101f0565b80635a167c2e1461036b5780635adedc21146103cd5780635c975abb146103f8578063715018a614610403576101f0565b80633f4ba83a116101c35780633f4ba83a1461028e57806345bfde27146102965780634eac1638146102c457806351cff8d914610358576101f0565b80630c0e0cef146101f557806313e7c9d81461020a578063152bceca146102425780631da26a8b1461027b575b600080fd5b610208610203366004614ad3565b610621565b005b61022d610218366004614a3f565b60346020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b61026d610250366004614a5b565b603860209081526000928352604080842090915290825290205481565b604051908152602001610239565b610208610289366004614a5b565b6106fd565b6102086107d1565b61022d6102a4366004614b00565b603d60209081526000928352604080842090915290825290205460ff1681565b6103266102d2366004614b2b565b603e602090815260009283526040909220815180830184018051928152908401929093019190912091528054600182015460029092015473ffffffffffffffffffffffffffffffffffffffff909116919083565b6040805173ffffffffffffffffffffffffffffffffffffffff9094168452602084019290925290820152606001610239565b610208610366366004614a3f565b61085c565b610326610379366004614b2b565b603a602090815260009283526040909220815180830184018051928152908401929093019190912091528054600182015460029092015473ffffffffffffffffffffffffffffffffffffffff909116919083565b61026d6103db366004614a5b565b603b60209081526000928352604080842090915290825290205481565b60355460ff1661022d565b610208610a25565b61026d610419366004614a5b565b603f60209081526000928352604080842090915290825290205481565b610449610444366004614a93565b610ab0565b6040516102399190614d58565b610208610b5a565b60335473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610239565b6102086104ab366004614b00565b610be3565b6102086104be366004614a3f565b610f19565b6102086104d1366004614a3f565b611144565b6041546104789073ffffffffffffffffffffffffffffffffffffffff1681565b6042546104789073ffffffffffffffffffffffffffffffffffffffff1681565b610208610524366004614a3f565b61120c565b61022d610537366004614a3f565b60376020526000908152604090205460ff1681565b61020861055a366004614b95565b611459565b61022d61056d366004614b00565b603960209081526000928352604080842090915290825290205460ff1681565b61044961059b366004614a93565b611f31565b6102086105ae366004614b95565b611f5b565b610208612514565b6043546104789073ffffffffffffffffffffffffffffffffffffffff1681565b61026d6105e9366004614a3f565b60366020526000908152604090205481565b610208610609366004614a3f565b612661565b61020861061c366004614a93565b61278e565b60335473ffffffffffffffffffffffffffffffffffffffff1633146106a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260376020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60335473ffffffffffffffffffffffffffffffffffffffff16331461077e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161069e565b6041805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560428054929093169116179055565b60335473ffffffffffffffffffffffffffffffffffffffff163314610852576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161069e565b61085a612b38565b565b60335473ffffffffffffffffffffffffffffffffffffffff1633146108dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161069e565b73ffffffffffffffffffffffffffffffffffffffff81166000818152603660205260408082205490517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529192610994926370a082319060240160206040518083038186803b15801561095657600080fd5b505afa15801561096a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098e9190614bc8565b90612c19565b905060008111610a00576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f546f6b656e476174653a207a65726f206f757420616d6f756e74000000000000604482015260640161069e565b610a2173ffffffffffffffffffffffffffffffffffffffff83163383612c2c565b5050565b60335473ffffffffffffffffffffffffffffffffffffffff163314610aa6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161069e565b61085a6000612d05565b6040602081815260009485528185208152928452808420909252825290208054610ad990614eb8565b80601f0160208091040260200160405190810160405280929190818152602001828054610b0590614eb8565b8015610b525780601f10610b2757610100808354040283529160200191610b52565b820191906000526020600020905b815481529060010190602001808311610b3557829003601f168201915b505050505081565b60335473ffffffffffffffffffffffffffffffffffffffff163314610bdb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161069e565b61085a612d7c565b3360009081526034602052604090205460ff16610c5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f776e65724f70657261746f723a20216f70657261746f720000000000000000604482015260640161069e565b73ffffffffffffffffffffffffffffffffffffffff821660009081526037602052604090205460ff16610ceb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f546f6b656e476174653a204e6f742061636365707420746f6b656e0000000000604482015260640161069e565b60008111610d55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f546f6b656e476174653a207a65726f206f757420616d6f756e74000000000000604482015260640161069e565b73ffffffffffffffffffffffffffffffffffffffff82166000908152603860209081526040808320338452909152902054811115610e15576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f546f6b656e476174653a206578636565646564207661756c742062616c616e6360448201527f6500000000000000000000000000000000000000000000000000000000000000606482015260840161069e565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260366020526040902054610e459082612c19565b73ffffffffffffffffffffffffffffffffffffffff83166000908152603660209081526040808320939093556038815282822033835290522054610e899082612c19565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260386020908152604080832033808552925290912092909255610ec89183612c2c565b60405181815273ffffffffffffffffffffffffffffffffffffffff83169033907f68456fba341f47bb61de8683463da43524ea3048b5cd06a414db6325e23ee3989060200160405180910390a35050565b60335473ffffffffffffffffffffffffffffffffffffffff163314610f9a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161069e565b73ffffffffffffffffffffffffffffffffffffffff811661103d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4f776e65724f70657261746f723a206f70657261746f7220697320746865207a60448201527f65726f2061646472657373000000000000000000000000000000000000000000606482015260840161069e565b73ffffffffffffffffffffffffffffffffffffffff811660009081526034602052604090205460ff16156110cd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4f776e65724f70657261746f723a206f70657261746f72206578697374656400604482015260640161069e565b73ffffffffffffffffffffffffffffffffffffffff811660008181526034602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055517f4c141abccf173677929dea054f218ed87362117834a8869ec9f68d8bdaaea1dc9190a250565b60335473ffffffffffffffffffffffffffffffffffffffff1633146111c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161069e565b604380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60335473ffffffffffffffffffffffffffffffffffffffff16331461128d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161069e565b73ffffffffffffffffffffffffffffffffffffffff8116611330576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4f776e65724f70657261746f723a206f70657261746f7220697320746865207a60448201527f65726f2061646472657373000000000000000000000000000000000000000000606482015260840161069e565b73ffffffffffffffffffffffffffffffffffffffff811660009081526034602052604090205460ff166113e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4f776e65724f70657261746f723a206f70657261746f72206e6f74206578697360448201527f7400000000000000000000000000000000000000000000000000000000000000606482015260840161069e565b73ffffffffffffffffffffffffffffffffffffffff811660008181526034602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055517f6b4be2dd49eba45ba43390fbe7da13e2b965d255db41d6a0fcf6d2e15ac1fccb9190a250565b60355460ff16156114c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161069e565b6000816060015111611534576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f546f6b656e476174653a207a65726f206f757420616d6f756e74000000000000604482015260640161069e565b60208082015173ffffffffffffffffffffffffffffffffffffffff1660009081526037909152604090205460ff166115c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f546f6b656e476174653a204e6f742061636365707420746f6b656e0000000000604482015260640161069e565b805173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461165e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f546f6b656e476174653a2073656e646572206973206e6f74206f776e65720000604482015260640161069e565b60008061166a83612e3c565b606085015160425460208701519395509193509173ffffffffffffffffffffffffffffffffffffffff90811691161480156116d9575060425473ffffffffffffffffffffffffffffffffffffffff90811660009081526038602090815260408083209386168352929052205481115b15611b4a5760415473ffffffffffffffffffffffffffffffffffffffff1660009081526037602052604090205460ff1661176f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f546f6b656e476174653a204e6f742061636365707420746f6b656e0000000000604482015260640161069e565b60425473ffffffffffffffffffffffffffffffffffffffff1660009081526037602052604090205460ff16611800576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f546f6b656e476174653a204e6f742061636365707420746f6b656e0000000000604482015260640161069e565b6000811161186a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f546f6b656e476174653a207a65726f20616d6f756e7400000000000000000000604482015260640161069e565b60415473ffffffffffffffffffffffffffffffffffffffff90811660009081526038602090815260408083209386168352929052205481111561192f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f546f6b656e476174653a206578636565646564207661756c742062616c616e6360448201527f6500000000000000000000000000000000000000000000000000000000000000606482015260840161069e565b60415473ffffffffffffffffffffffffffffffffffffffff166000908152603660205260409020546119619082612c19565b6041805473ffffffffffffffffffffffffffffffffffffffff908116600090815260366020908152604080832095909555925482168152603883528381209186168152915220546119b29082612c19565b60415473ffffffffffffffffffffffffffffffffffffffff90811660009081526038602090815260408083208785168452825280832094909455604254909216815260369091522054611a05908261311c565b6042805473ffffffffffffffffffffffffffffffffffffffff90811660009081526036602090815260408083209590955592548216815260388352838120918616815291522054611a56908261311c565b60425473ffffffffffffffffffffffffffffffffffffffff90811660009081526038602090815260408083208785168452825290912092909255855191860151611aa39291169083613128565b60415460405182815273ffffffffffffffffffffffffffffffffffffffff918216918416907f68456fba341f47bb61de8683463da43524ea3048b5cd06a414db6325e23ee3989060200160405180910390a360425460405182815273ffffffffffffffffffffffffffffffffffffffff9182169184169081907f7ad46311332307812e1e93ce51bd632c5d12d0fec88cd1229b68ffa42dd81d169060200160405180910390a45b60208085015173ffffffffffffffffffffffffffffffffffffffff9081166000908152603883526040808220928616825291909252902054811115611c11576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f546f6b656e476174653a206578636565646564207661756c742062616c616e6360448201527f6500000000000000000000000000000000000000000000000000000000000000606482015260840161069e565b6020808501805173ffffffffffffffffffffffffffffffffffffffff9081166000908152603d84526040808220888352855280822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558051606081018252895184168152818a01518187015280820187905293519092168152603e909352918290206080870151925191929091611cb09190614c2a565b9081526040805160209281900383019020835181547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9182161782558484015160018301559382015160029091015560808701518783018051851660009081528385528381208a51871682528552838120915186168152603f85528381208a519096168152948452828520548552835292208251611d6a939192919091019061485b565b5060208085015173ffffffffffffffffffffffffffffffffffffffff9081166000908152603f835260408082208851909316825291909252902054611db090600161311c565b6020808601805173ffffffffffffffffffffffffffffffffffffffff9081166000908152603f845260408082208a5184168352855280822095909555915116815260369091522054611e029082612c19565b6020808601805173ffffffffffffffffffffffffffffffffffffffff9081166000908152603684526040808220959095559151811682526038835283822090861682529091522054611e549082612c19565b60208086015173ffffffffffffffffffffffffffffffffffffffff9081166000908152603883526040808220878416835290935291909120919091558451604154611ea192169083612c2c565b8173ffffffffffffffffffffffffffffffffffffffff16846020015173ffffffffffffffffffffffffffffffffffffffff16856000015173ffffffffffffffffffffffffffffffffffffffff167f8740282356368705ed3c479bb0ec32e46d7e645e0b2ada9561a0afda16e79588848860800151604051611f23929190614d6b565b60405180910390a450505050565b603c60209081526000938452604080852082529284528284209052825290208054610ad990614eb8565b60355460ff1615611fc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161069e565b6000816060015111612036576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f546f6b656e476174653a207a65726f206f757420616d6f756e74000000000000604482015260640161069e565b60208082015173ffffffffffffffffffffffffffffffffffffffff1660009081526037909152604090205460ff166120ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f546f6b656e476174653a204e6f742061636365707420746f6b656e0000000000604482015260640161069e565b805173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612160576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f546f6b656e476174653a2073656e646572206973206e6f74206f776e65720000604482015260640161069e565b60008061216c836132b9565b6020808601805173ffffffffffffffffffffffffffffffffffffffff9081166000908152603984526040808220878352855280822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558051606080820183528b518516825243828801528b01518183015293519092168152603a90935291829020608088015192519496509294509261220d9190614c2a565b9081526040805160209281900383019020835181547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff918216178255848401516001830155938201516002909101556080860151868301805185166000908152603c85528381208951871682528552838120915186168152603b8552838120895190961681529484528285205485528352922082516122c8939192919091019061485b565b5060208084015173ffffffffffffffffffffffffffffffffffffffff9081166000908152603b83526040808220875190931682529190925290205461230e90600161311c565b6020808501805173ffffffffffffffffffffffffffffffffffffffff9081166000908152603b845260408082208951841683528552808220959095556060880151925190911681526036909252919020546123689161311c565b6020808501805173ffffffffffffffffffffffffffffffffffffffff90811660009081526036845260408082209590955560608801519251821681526038845284812091861681529252919020546123bf9161311c565b6020848101805173ffffffffffffffffffffffffffffffffffffffff90811660009081526038845260408082208784168352909452839020939093556043549051606087015192517f77e5dd8000000000000000000000000000000000000000000000000000000000815290841660048201523360248201523060448201526064810192909252909116906377e5dd8090608401600060405180830381600087803b15801561246d57600080fd5b505af1158015612481573d6000803e3d6000fd5b505050508073ffffffffffffffffffffffffffffffffffffffff16836020015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f79ce84256b3e2e196d3399999d6e3573c49be6aa74bfb9a2407f92268788ae8686606001518760800151604051612507929190614d6b565b60405180910390a4505050565b600054610100900460ff168061252d575060005460ff16155b6125b9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161069e565b600054610100900460ff1615801561261f57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff909116610100171660011790555b6126276134fa565b61262f61360d565b801561265e57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555b50565b60335473ffffffffffffffffffffffffffffffffffffffff1633146126e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161069e565b73ffffffffffffffffffffffffffffffffffffffff8116612785576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161069e565b61265e81612d05565b3360009081526034602052604090205460ff16612807576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f776e65724f70657261746f723a20216f70657261746f720000000000000000604482015260640161069e565b73ffffffffffffffffffffffffffffffffffffffff821660009081526037602052604090205460ff16612896576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f546f6b656e476174653a204e6f742061636365707420746f6b656e0000000000604482015260640161069e565b73ffffffffffffffffffffffffffffffffffffffff831660009081526034602052604090205460ff16612925576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f546f6b656e476174653a20696e76616c6964207661756c740000000000000000604482015260640161069e565b6000811161298f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f546f6b656e476174653a207a65726f206f757420616d6f756e74000000000000604482015260640161069e565b73ffffffffffffffffffffffffffffffffffffffff82166000908152603660205260409020546129bf908261311c565b73ffffffffffffffffffffffffffffffffffffffff808416600090815260366020908152604080832094909455603881528382209287168252919091522054612a08908261311c565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526038602090815260408083208986168452909152908190209390935560435492517f77e5dd800000000000000000000000000000000000000000000000000000000081526004810191909152336024820152306044820152606481018490529116906377e5dd8090608401600060405180830381600087803b158015612aaa57600080fd5b505af1158015612abe573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f7ad46311332307812e1e93ce51bd632c5d12d0fec88cd1229b68ffa42dd81d168460405161250791815260200190565b60355460ff16612ba4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161069e565b603580547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b6000612c258284614e3c565b9392505050565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052612d009084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152613771565b505050565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60355460ff1615612de9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161069e565b603580547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612bef3390565b60008060003084600001518560200151866040015187606001518860800151604051602001612e7096959493929190614c46565b6040516020818303038152906040528051906020012090506000612ead8560a001518660c001518760e00151612ea58661387d565b929190613b4e565b73ffffffffffffffffffffffffffffffffffffffff811660009081526034602052604090205490915060ff16612f3f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f546f6b656e476174653a20636c61696d206e6f74207665726966790000000000604482015260640161069e565b84604001514310612fac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f546f6b656e476174653a20636c61696d20657870697265640000000000000000604482015260640161069e565b60208086015173ffffffffffffffffffffffffffffffffffffffff166000908152603d82526040808220858352909252205460ff1615613048576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f546f6b656e476174653a20636c61696d20636f6d706c65746564000000000000604482015260640161069e565b60208086015173ffffffffffffffffffffffffffffffffffffffff166000908152603e909152604080822060808801519151909161308591614c2a565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff1614613112576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f546f6b656e476174653a206e6f6e652065786973746564000000000000000000604482015260640161069e565b9092509050915091565b6000612c258284614dd3565b8015806131d757506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561319d57600080fd5b505afa1580156131b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131d59190614bc8565b155b613263576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000606482015260840161069e565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052612d009084907f095ea7b30000000000000000000000000000000000000000000000000000000090606401612c7e565b600080600030846000015185602001518660400151876060015188608001516040516020016132ed96959493929190614cd6565b60405160208183030381529060405280519060200120905060006133228560a001518660c001518760e00151612ea58661387d565b73ffffffffffffffffffffffffffffffffffffffff811660009081526034602052604090205490915060ff166133b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f546f6b656e476174653a206465706f736974206e6f7420766572696679000000604482015260640161069e565b84604001514310613421576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f546f6b656e476174653a206465706f7369742065787069726564000000000000604482015260640161069e565b60208086015173ffffffffffffffffffffffffffffffffffffffff166000908152603982526040808220858352909252205460ff16156134bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f546f6b656e476174653a206465706f73697420636f6d706c6574656400000000604482015260640161069e565b60208086015173ffffffffffffffffffffffffffffffffffffffff166000908152603a909152604080822060808801519151909161308591614c2a565b600054610100900460ff1680613513575060005460ff16155b61359f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161069e565b600054610100900460ff1615801561360557600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff909116610100171660011790555b61262f613c61565b600054610100900460ff1680613626575060005460ff16155b6136b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161069e565b600054610100900460ff1615801561371857600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff909116610100171660011790555b603580547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055801561265e57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16905550565b60006137d3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613d759092919063ffffffff16565b805190915015612d0057808060200190518101906137f19190614b79565b612d00576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161069e565b604080518082018252601081527f30313233343536373839616263646566000000000000000000000000000000006020820152815182815260608181018452926000919060208201818036833701905050905060005b6020811015613b4457826004868360208110613918577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916901c60f81c60ff168151811061397d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016826139b0836002614dff565b815181106139e7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535082858260208110613a50577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b825191901a600f16908110613a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff000000000000000000000000000000000000000000000000000000000000001682613ac1836002614dff565b613acc906001614dd3565b81518110613b03577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080613b3c81614f0c565b9150506138d3565b509150505b919050565b6000808590506000613bc66040518060400160405280601a81526020017f19457468657265756d205369676e6564204d6573736167653a0a000000000000815250613b998451613d8c565b60408051600080825260208201818152828401828152606084019283526080840190945288939091613f21565b90506001818051906020012087878760405160008152602001604052604051613c0b949392919093845260ff9290921660208401526040830152606082015260800190565b6020604051602081039080840390855afa158015613c2d573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015198975050505050505050565b600054610100900460ff1680613c7a575060005460ff16155b613d06576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161069e565b600054610100900460ff16158015613d6c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff909116610100171660011790555b61262f33612d05565b6060613d848484600085614688565b949350505050565b606081613dcd575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152613b49565b8160005b8115613df75780613de181614f0c565b9150613df09050600a83614deb565b9150613dd1565b60008167ffffffffffffffff811115613e39577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613e63576020820181803683370190505b509050815b8015613f1857613e79600a87614f45565b613e84906030614dd3565b60f81b82613e93600184614e3c565b81518110613eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350613f04600a87614deb565b955080613f1081614e83565b915050613e68565b50949350505050565b6060600082518451865188518a518c518e51613f3d9190614dd3565b613f479190614dd3565b613f519190614dd3565b613f5b9190614dd3565b613f659190614dd3565b613f6f9190614dd3565b67ffffffffffffffff811115613fae577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613fd8576020820181803683370190505b5090506000805b8a518110156140cd578a8181518110614021577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361405381614f0c565b94508151811061408c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350806140c581614f0c565b915050613fdf565b5060005b89518110156141bf57898181518110614113577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361414581614f0c565b94508151811061417e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350806141b781614f0c565b9150506140d1565b5060005b88518110156142b157888181518110614205577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361423781614f0c565b945081518110614270577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350806142a981614f0c565b9150506141c3565b5060005b87518110156143a3578781815181106142f7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361432981614f0c565b945081518110614362577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508061439b81614f0c565b9150506142b5565b5060005b8651811015614495578681815181106143e9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361441b81614f0c565b945081518110614454577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508061448d81614f0c565b9150506143a7565b5060005b8551811015614587578581815181106144db577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361450d81614f0c565b945081518110614546577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508061457f81614f0c565b915050614499565b5060005b8451811015614679578481815181106145cd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff000000000000000000000000000000000000000000000000000000000000001683836145ff81614f0c565b945081518110614638577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508061467181614f0c565b91505061458b565b50909998505050505050505050565b60608247101561471a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161069e565b843b614782576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161069e565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516147ab9190614c2a565b60006040518083038185875af1925050503d80600081146147e8576040519150601f19603f3d011682016040523d82523d6000602084013e6147ed565b606091505b50915091506147fd828286614808565b979650505050505050565b60608315614817575081612c25565b8251156148275782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069e9190614d58565b82805461486790614eb8565b90600052602060002090601f01602090048101928261488957600085556148cf565b82601f106148a257805160ff19168380011785556148cf565b828001600101855582156148cf579182015b828111156148cf5782518255916020019190600101906148b4565b506148db9291506148df565b5090565b5b808211156148db57600081556001016148e0565b8035613b4981614fe6565b600082601f83011261490f578081fd5b813567ffffffffffffffff81111561492957614929614fb7565b61495a60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601614d84565b81815284602083860101111561496e578283fd5b816020850160208301379081016020019190915292915050565b600061010080838503121561499b578182fd5b6149a481614d84565b9150506149b0826148f4565b81526149be602083016148f4565b60208201526040820135604082015260608201356060820152608082013567ffffffffffffffff8111156149f157600080fd5b6149fd848285016148ff565b608083015250614a0f60a08301614a2e565b60a082015260c082013560c082015260e082013560e082015292915050565b803560ff81168114613b4957600080fd5b600060208284031215614a50578081fd5b8135612c2581614fe6565b60008060408385031215614a6d578081fd5b8235614a7881614fe6565b91506020830135614a8881614fe6565b809150509250929050565b600080600060608486031215614aa7578081fd5b8335614ab281614fe6565b92506020840135614ac281614fe6565b929592945050506040919091013590565b60008060408385031215614ae5578182fd5b8235614af081614fe6565b91506020830135614a8881615008565b60008060408385031215614b12578182fd5b8235614b1d81614fe6565b946020939093013593505050565b60008060408385031215614b3d578182fd5b8235614b4881614fe6565b9150602083013567ffffffffffffffff811115614b63578182fd5b614b6f858286016148ff565b9150509250929050565b600060208284031215614b8a578081fd5b8151612c2581615008565b600060208284031215614ba6578081fd5b813567ffffffffffffffff811115614bbc578182fd5b613d8484828501614988565b600060208284031215614bd9578081fd5b5051919050565b60008151808452614bf8816020860160208601614e53565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60008251614c3c818460208701614e53565b9190910192915050565b600073ffffffffffffffffffffffffffffffffffffffff808916835260e06020840152600560e08401527f436c61696d000000000000000000000000000000000000000000000000000000610100840152610120818916604085015281881660608501528660808501528560a08501528060c0850152614cc881850186614be0565b9a9950505050505050505050565b600073ffffffffffffffffffffffffffffffffffffffff808916835260e06020840152600760e08401527f4465706f73697400000000000000000000000000000000000000000000000000610100840152610120818916604085015281881660608501528660808501528560a08501528060c0850152614cc881850186614be0565b600060208252612c256020830184614be0565b600083825260406020830152613d846040830184614be0565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715614dcb57614dcb614fb7565b604052919050565b60008219821115614de657614de6614f59565b500190565b600082614dfa57614dfa614f88565b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614e3757614e37614f59565b500290565b600082821015614e4e57614e4e614f59565b500390565b60005b83811015614e6e578181015183820152602001614e56565b83811115614e7d576000848401525b50505050565b600081614e9257614e92614f59565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b600281046001821680614ecc57607f821691505b60208210811415614f06577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614f3e57614f3e614f59565b5060010190565b600082614f5457614f54614f88565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461265e57600080fd5b801515811461265e57600080fdfea2646970667358221220b88d2ae724cb3037fafe1896fef6e19a9aff85818d39f3d18848e821d41b487664736f6c63430008020033