More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 3,315 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw Token | 65187036 | 4 mins ago | IN | 0 POL | 0.00297337 | ||||
Withdraw Token | 65186240 | 33 mins ago | IN | 0 POL | 0.00392504 | ||||
Withdraw Token | 65186205 | 34 mins ago | IN | 0 POL | 0.00359795 | ||||
Withdraw Token | 65186140 | 36 mins ago | IN | 0 POL | 0.00289651 | ||||
Withdraw Token | 65186114 | 37 mins ago | IN | 0 POL | 0.00359795 | ||||
Withdraw Token | 65186002 | 41 mins ago | IN | 0 POL | 0.00297317 | ||||
Withdraw Token | 65185777 | 49 mins ago | IN | 0 POL | 0.00285422 | ||||
Withdraw Token | 65185651 | 54 mins ago | IN | 0 POL | 0.00275823 | ||||
Withdraw Token | 65185537 | 58 mins ago | IN | 0 POL | 0.00325661 | ||||
Withdraw Token | 65185452 | 1 hr ago | IN | 0 POL | 0.00325703 | ||||
Withdraw Token | 65185269 | 1 hr ago | IN | 0 POL | 0.00340708 | ||||
Withdraw Token | 65184929 | 1 hr ago | IN | 0 POL | 0.00275823 | ||||
Withdraw Token | 65184782 | 1 hr ago | IN | 0 POL | 0.00276134 | ||||
Withdraw Token | 65184306 | 1 hr ago | IN | 0 POL | 0.00325746 | ||||
Withdraw Token | 65183853 | 1 hr ago | IN | 0 POL | 0.00339573 | ||||
Withdraw Token | 65183821 | 1 hr ago | IN | 0 POL | 0.00276098 | ||||
Withdraw Token | 65182344 | 2 hrs ago | IN | 0 POL | 0.00275787 | ||||
Deposit Token | 65181011 | 3 hrs ago | IN | 0 POL | 0.00178512 | ||||
Deposit Token | 65180253 | 4 hrs ago | IN | 0 POL | 0.00192293 | ||||
Withdraw Token | 65179957 | 4 hrs ago | IN | 0 POL | 0.00275859 | ||||
Withdraw Token | 65179660 | 4 hrs ago | IN | 0 POL | 0.00381601 | ||||
Deposit Token | 65179323 | 4 hrs ago | IN | 0 POL | 0.00208264 | ||||
Deposit Token | 65179217 | 4 hrs ago | IN | 0 POL | 0.00208264 | ||||
Deposit Token | 65179158 | 4 hrs ago | IN | 0 POL | 0.002048 | ||||
Withdraw Token | 65178856 | 5 hrs ago | IN | 0 POL | 0.00286717 |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xB3a80aF6...1eE39d587 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
ExchangeV1
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import "./libs/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./libs/@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "./interfaces/IExchange.sol"; import "./interfaces/IWETH.sol"; import "./base/IxBaseV1.sol"; import "./FeeWorkerV1.sol"; contract ExchangeV1 is IExchange, IxBaseV1, FeeWorkerV1 { using EnumerableSet for EnumerableSet.AddressSet; using SafeERC20 for IERC20; using SafeERC20 for IERC20Permit; EnumerableSet.AddressSet private _allowedWithdrawers; modifier nonInternalCall() { // solhint-disable-next-line avoid-tx-origin require(tx.origin == msg.sender, "IxBaseV1: internal call not allowed"); _; } constructor(address admin, address forwarder, address manager) IxBaseV1(admin, forwarder) { _setFeeManager(manager, admin); } /** * @notice setFeeManager set fee manager * @param manager addres of new feemanager */ function setFeeManager(address manager) external override nonEIP2771 onlyOwner { // if manager is address(0) then fee recharge will be skipped _setFeeManager(manager, _msgSender()); } /** * @notice registerWithdrawer register withdrawer to whitelist * @param withdrawer address of withdrawer to register */ function registerWithdrawer(address withdrawer) external nonEIP2771 onlyOwner { require(withdrawer != address(0), "withdrawer can not be zero address"); require(_allowedWithdrawers.add(withdrawer), "withdrawer already registered"); emit WithdrawerRegistered(withdrawer, _msgSender()); } /** * @notice unregisterWithdrawer unregister withdrawer from whitelist * @param withdrawer address of withdrawer to unregister */ function unregisterWithdrawer(address withdrawer) external nonEIP2771 onlyOwner { require(_allowedWithdrawers.remove(withdrawer), "withdrawer is not registered"); emit WithdrawerUnregistered(withdrawer, _msgSender()); } /** * @notice getRegisteredWithdrawerCount get number of registered withdrawer */ function getRegisteredWithdrawerCount() external view returns (uint256) { return _allowedWithdrawers.length(); } /** * @notice getRegisteredWithdrawerAt returns registered withdrawer at index * @param index index of registered withdrawer */ function getRegisteredWithdrawerAt(uint256 index) external view returns (address) { return _allowedWithdrawers.at(index); } /** * @notice getRegisteredWithdrawers returns all addresses of registerd withdrawer */ function getRegisteredWithdrawers() external view returns (address[] memory) { return _allowedWithdrawers.values(); } /** * @notice isRegisteredWithdrawer returns whether address is registered * @param withdrawer address to check */ function isRegisteredWithdrawer(address withdrawer) public view returns (bool) { return _allowedWithdrawers.contains(withdrawer); } /** * @notice depositToken deposits token from user's wallet to service's token pool * the contract must be approved before the call * @param token token address to deposit * @param poolGame pool address to deposit token * @param amountGame amount of token to deposit * @param poolPlatform pool address to share deposit token * @param amountPlatform amount of token to share * @param memo memo */ function depositToken( address token, address poolGame, uint256 amountGame, address poolPlatform, uint256 amountPlatform, string calldata memo ) external nonReentrant { require(token != address(0), "token address can not be zero"); require(poolGame != address(0), "pool address can not be zero"); require(amountGame > 0, "amount must be greater than zero"); address user = _msgSender(); IERC20(token).safeTransferFrom(user, poolGame, amountGame); if (amountPlatform > 0) { require(poolPlatform != address(0), "platform pool address can not be zero"); IERC20(token).safeTransferFrom(user, poolPlatform, amountPlatform); } emit Deposited(token, user, poolGame, amountGame, poolPlatform, amountPlatform, memo); } /** * @notice depositTokenWithPermit deposits token from user's wallet to service's token pool * @param token token address to deposit * @param poolGame pool address to deposit token * @param amountGame amount of token to deposit * @param poolPlatform pool address to share deposit token * @param amountPlatform amount of token to share * @param memo memo * @param permission data for permit method */ function depositTokenWithPermit( address token, address poolGame, uint256 amountGame, address poolPlatform, uint256 amountPlatform, string calldata memo, IxTypes.PermitData calldata permission ) external nonReentrant { require(token != address(0), "token address can not be zero"); require(poolGame != address(0), "pool address can not be zero"); require(amountGame > 0, "amount must be greater than zero"); IERC20Permit(token).safePermit( permission.owner, permission.spender, permission.value, permission.deadline, permission.v, permission.r, permission.s ); address user = _msgSender(); IERC20(token).safeTransferFrom(user, poolGame, amountGame); if (amountPlatform > 0) { require(poolPlatform != address(0), "platform pool address can not be zero"); IERC20(token).safeTransferFrom(user, poolPlatform, amountPlatform); } emit Deposited(token, user, poolGame, amountGame, poolPlatform, amountPlatform, memo); } /** * @notice withdrawToken withdraws tokens from service's token pool. * this function is supposed to be used by service platform, * can be called by specific addresses with registered withdrawer only. * @param token token address to withdraw * @param pool pool address to withdraw token * @param user address to withdraw token from pool * @param amount amount of token to withdraw * @param collector collector address to send fee * @param feeAmount amount of fee to send * @param memo memo */ function withdrawToken( address token, address pool, address user, uint256 amount, address collector, uint256 feeAmount, string calldata memo ) external nonReentrant nonEIP2771 nonInternalCall { require(isRegisteredWithdrawer(_msgSender()), "only registered withdrawer can withdraw token"); try this.innerWithdrawToken(token, pool, user, amount, collector, feeAmount) { // success _log(token, pool, user, amount, collector, feeAmount, memo, WithdrawStatus.OK, ""); } catch (bytes memory reason) { // any other errors _log(token, pool, user, amount, collector, feeAmount, memo, WithdrawStatus.ERROR, reason); } _tryRechargeGasFee(msg.sender); } function _log( address token, address pool, address user, uint256 amount, address collector, uint256 feeAmount, string memory memo, WithdrawStatus status, bytes memory reason ) internal { emit Withdrawn(token, pool, user, amount, collector, feeAmount, memo, status, reason); } function innerWithdrawToken( address token, address pool, address user, uint256 amount, address collector, uint256 feeAmount ) external { // this external function can only be called by Exchange itself, // creating an internal transaction. require(msg.sender == address(this), "only can be called by Exchange itself"); require(token != address(0), "token address can not be zero"); // pool is EOA used by service platform, holding a lot of token amount // this contract must be approved by pool address require(pool != address(0), "pool address can not be zero"); require(user != address(0), "user address can not be zero"); require(amount > 0, "amount must be greater than zero"); IERC20(token).safeTransferFrom(pool, user, amount); if (feeAmount > 0) { require(collector != address(0), "fee collector address can not be zero"); IERC20(token).safeTransferFrom(pool, collector, feeAmount); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import "../libs/@openzeppelin/contracts/access/Ownable.sol"; import "../libs/@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "../libs/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../metatx/EIP2771Recipient.sol"; abstract contract IxBaseV1 is Ownable, ReentrancyGuard, EIP2771Recipient { using SafeERC20 for IERC20; event ContractClosed(address indexed owner); event Rescued(address indexed token, address indexed to, uint256 amount); constructor(address admin, address forwarder) EIP2771Recipient(forwarder) { _transferOwnership(admin); } /** * @dev set new trusted forwarder of EIP2771Recipient * nonEIP2771 modifier is needed because of direct access from administrator account * @param forwarder new address of trusted forwarder */ function setTrustedForwarder(address forwarder) external virtual override nonEIP2771 onlyOwner { _setTrustedForwarder(forwarder); } /** * @dev in case of stucked erc20 token or ether, rescue them * nonEIP2771 modifier is needed because of direct access from administrator account */ function rescue(address token, address to) external virtual nonReentrant nonEIP2771 onlyOwner { require(to != address(0), "to address can not be zero"); uint256 amount; if (token == address(0)) { amount = address(this).balance; } else { amount = IERC20(token).balanceOf(address(this)); } if (amount > 0) { if (token == address(0)) { // solhint-disable-next-line avoid-low-level-calls (bool success, ) = to.call{value: amount}(""); require(success, "failed to transfer"); } else { IERC20(token).safeTransfer(to, amount); } emit Rescued(token, to, amount); } } /** * @dev close this contract * expected to be used when this contract is no longer needed, * due to contract upgrade and re-deployment * nonEIP2771 modifier is needed because of direct access from administrator account */ function finalize() external virtual nonEIP2771 onlyOwner { address payable owner = payable(owner()); emit ContractClosed(owner); selfdestruct(owner); } /** * @dev override for EIP-2771 * @return sender the address of sender, one of msg.sender or meta transaction signer */ function _msgSender() internal view virtual override(Context, EIP2771Recipient) returns (address) { return EIP2771Recipient._msgSender(); } /** * @dev override for EIP-2771 * @return calldata the calldata of called function */ function _msgData() internal view virtual override(Context, EIP2771Recipient) returns (bytes calldata) { return EIP2771Recipient._msgData(); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import "./interfaces/IFeeManager.sol"; abstract contract FeeWorkerV1 { address public feeManager; event FeeManagerChanged(address oldManager, address newManager, address changer); /** * @notice _setFeeManager set feemanager * @param manager addres of new feemanager * @param changer address changing feemanger */ function _setFeeManager(address manager, address changer) internal virtual { emit FeeManagerChanged(feeManager, manager, changer); feeManager = manager; } function setFeeManager(address manager) external virtual; function _tryRechargeGasFee(address target) internal virtual { if (feeManager == address(0)) { return; } if (feeManager.code.length <= 0) { revert("trying to call non contract address as fee manager"); } try IFeeManager(feeManager).rechargeGasFee(target) { // solhint-disable-previous-line no-empty-blocks // do nothing } catch (bytes memory reason) { // failed due to configuration (address, gas fee, etd) if (reason.length > 0) { // solhint-disable-next-line no-inline-assembly assembly { revert(add(32, reason), mload(reason)) } } else { revert("revert with no reason"); } } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import "./IxTypes.sol"; interface IExchange { event WithdrawerRegistered(address indexed withdrawer, address indexed owner); event WithdrawerUnregistered(address indexed withdrawer, address indexed owner); event Deposited( address indexed token, address indexed user, address indexed poolGame, uint256 amountGame, address poolPlatform, uint256 amountPlatform, string memo ); event Withdrawn( address indexed token, address indexed pool, address indexed user, uint256 amount, address collector, uint256 fee, string memo, WithdrawStatus status, bytes reason ); /** * OK for success * ERR for require or revert * LOW_ERR for other low level errors like Panic (assert), OOG, etc. */ enum WithdrawStatus { OK, ERROR } /** * a user deposits token from user's wallet to service's token pool * the contract must be approved before the call */ function depositToken( address token, address poolGame, uint256 amountGame, address poolPlatform, uint256 amountPlatform, string calldata memo ) external; /** * a user deposits token from user's wallet to service's token pool */ function depositTokenWithPermit( address token, address poolGame, uint256 amountGame, address poolPlatform, uint256 amountPlatform, string calldata memo, IxTypes.PermitData calldata permission ) external; /** * a user withdraws tokens from service's token pool. * this function is supposed to be used by service platform, * can be called by specific addresses with WITHDRAWER_ROLE only. */ function withdrawToken( address token, address pool, address user, uint256 amount, address collector, uint256 feeAmount, string calldata memo ) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; interface IFeeManager { event ConfigChanged( address weth, address nweWeth, address payer, address newPayer, uint256 threshold, uint256 newThreshold, uint256 amount, uint256 newAmount, address owner ); event RechargerRegistered(address indexed recharger, address owner); event RechargerUnregistered(address indexed recharger, address owner); event GasFeeRecharged(address indexed target, uint256 amount, RechargeStatus indexed status, bytes reason); /** * OK for success * ERR for require or revert * LOW_ERR for other low level errors like Panic (assert), OOG, etc. */ enum RechargeStatus { OK, ERROR } /** * give ETH target address to refill gas fee */ function rechargeGasFee(address target) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; interface IWETH { function deposit() external payable; function withdraw(uint256) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; interface IxTypes { struct PermitData { address owner; address spender; uint256 value; uint256 deadline; uint8 v; bytes32 r; bytes32 s; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { 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 { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; 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)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://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); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; /** * @dev recipient contract for "EIP-2771: Secure Protocol for Native Meta Transactions" */ abstract contract EIP2771Recipient { address private _trustedForwarder; event TrustedForwarderChanged(address previousForwarder, address newForwarder, address changer); /** * @dev revert if called by trusted forwarder. this means meta transaction is not allowed */ modifier nonEIP2771() { require(!isTrustedForwarder(msg.sender), "EIP2771Recipient: meta transaction is not allowed"); _; } constructor(address forwarder) { _setTrustedForwarder(forwarder); } /** * @dev get trusted forwarder address * @return forwarder the address of trusted forwarder */ function getTrustedForwarder() external view returns (address forwarder) { return _trustedForwarder; } /** * @dev check whether the address is trusted forwarder or not * @return true if the address to check is trusted forwarder */ function isTrustedForwarder(address forwarder) public view returns (bool) { return forwarder == _trustedForwarder; } function setTrustedForwarder(address forwarder) external virtual; /** * @dev changes trusted forwarder address and emits the event */ function _setTrustedForwarder(address forwarder) internal { emit TrustedForwarderChanged(_trustedForwarder, forwarder, _msgSender()); _trustedForwarder = forwarder; } function _msgSender() internal view virtual returns (address ret) { if (msg.data.length >= 20 && isTrustedForwarder(msg.sender)) { // solhint-disable-next-line no-inline-assembly assembly { ret := shr(96, calldataload(sub(calldatasize(), 20))) } } else { ret = msg.sender; } } function _msgData() internal view virtual returns (bytes calldata ret) { if (msg.data.length >= 20 && isTrustedForwarder(msg.sender)) { return msg.data[0:msg.data.length - 20]; } else { return msg.data; } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"forwarder","type":"address"},{"internalType":"address","name":"manager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"ContractClosed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"poolGame","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountGame","type":"uint256"},{"indexed":false,"internalType":"address","name":"poolPlatform","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountPlatform","type":"uint256"},{"indexed":false,"internalType":"string","name":"memo","type":"string"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldManager","type":"address"},{"indexed":false,"internalType":"address","name":"newManager","type":"address"},{"indexed":false,"internalType":"address","name":"changer","type":"address"}],"name":"FeeManagerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Rescued","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousForwarder","type":"address"},{"indexed":false,"internalType":"address","name":"newForwarder","type":"address"},{"indexed":false,"internalType":"address","name":"changer","type":"address"}],"name":"TrustedForwarderChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"withdrawer","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"WithdrawerRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"withdrawer","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"WithdrawerUnregistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"collector","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"string","name":"memo","type":"string"},{"indexed":false,"internalType":"enum IExchange.WithdrawStatus","name":"status","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"reason","type":"bytes"}],"name":"Withdrawn","type":"event"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"poolGame","type":"address"},{"internalType":"uint256","name":"amountGame","type":"uint256"},{"internalType":"address","name":"poolPlatform","type":"address"},{"internalType":"uint256","name":"amountPlatform","type":"uint256"},{"internalType":"string","name":"memo","type":"string"}],"name":"depositToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"poolGame","type":"address"},{"internalType":"uint256","name":"amountGame","type":"uint256"},{"internalType":"address","name":"poolPlatform","type":"address"},{"internalType":"uint256","name":"amountPlatform","type":"uint256"},{"internalType":"string","name":"memo","type":"string"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct IxTypes.PermitData","name":"permission","type":"tuple"}],"name":"depositTokenWithPermit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finalize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRegisteredWithdrawerAt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRegisteredWithdrawerCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRegisteredWithdrawers","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTrustedForwarder","outputs":[{"internalType":"address","name":"forwarder","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"collector","type":"address"},{"internalType":"uint256","name":"feeAmount","type":"uint256"}],"name":"innerWithdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"withdrawer","type":"address"}],"name":"isRegisteredWithdrawer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"withdrawer","type":"address"}],"name":"registerWithdrawer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"rescue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"manager","type":"address"}],"name":"setFeeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"setTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"withdrawer","type":"address"}],"name":"unregisterWithdrawer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"collector","type":"address"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"string","name":"memo","type":"string"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c80636dfcc4a5116100ad578063ce1b815f11610071578063ce1b815f1461027d578063d0fb02031461028e578063da742228146102a1578063ec9abacf146102b4578063f2fde38b146102c757600080fd5b80636dfcc4a514610228578063715018a61461023b5780638da5cb5b146102435780638e090f4b14610254578063b2d1d42b1461026757600080fd5b80634bb278f3116100f45780634bb278f3146101b55780634fdf5d1d146101bd578063572b6c05146101d057806357b7a96e146102025780635a7358561461021557600080fd5b8063120acf27146101315780632e3278f0146101465780632e83a734146101645780633bd834101461018f578063472d35b9146101a2575b600080fd5b61014461013f366004611b38565b6102da565b005b61014e61049a565b60405161015b9190611b9e565b60405180910390f35b610177610172366004611beb565b6104ab565b6040516001600160a01b03909116815260200161015b565b61014461019d366004611c4d565b6104be565b6101446101b0366004611ce6565b61073f565b610144610785565b6101446101cb366004611d01565b6107fc565b6101f26101de366004611ce6565b6002546001600160a01b0391821691161490565b604051901515815260200161015b565b610144610210366004611ce6565b610a4a565b610144610223366004611d34565b610b1d565b610144610236366004611ce6565b610cd6565b610144610e0a565b6000546001600160a01b0316610177565b610144610262366004611dd9565b610e1e565b61026f610f7e565b60405190815260200161015b565b6002546001600160a01b0316610177565b600354610177906001600160a01b031681565b6101446102af366004611ce6565b610f8a565b6101f26102c2366004611ce6565b610fc5565b6101446102d5366004611ce6565b610fd2565b33301461033c5760405162461bcd60e51b815260206004820152602560248201527f6f6e6c792063616e2062652063616c6c65642062792045786368616e676520696044820152643a39b2b63360d91b60648201526084015b60405180910390fd5b6001600160a01b0386166103625760405162461bcd60e51b815260040161033390611e62565b6001600160a01b0385166103885760405162461bcd60e51b815260040161033390611e99565b6001600160a01b0384166103de5760405162461bcd60e51b815260206004820152601c60248201527f7573657220616464726573732063616e206e6f74206265207a65726f000000006044820152606401610333565b600083116103fe5760405162461bcd60e51b815260040161033390611ed0565b6104136001600160a01b03871686868661107c565b8015610492576001600160a01b03821661047d5760405162461bcd60e51b815260206004820152602560248201527f66656520636f6c6c6563746f7220616464726573732063616e206e6f74206265604482015264207a65726f60d81b6064820152608401610333565b6104926001600160a01b03871686848461107c565b505050505050565b60606104a660046110ed565b905090565b60006104b8600483611101565b92915050565b6002600154036104e05760405162461bcd60e51b815260040161033390611f05565b60026001819055546001600160a01b0316330361050f5760405162461bcd60e51b815260040161033390611f3c565b32331461056a5760405162461bcd60e51b815260206004820152602360248201527f49784261736556313a20696e7465726e616c2063616c6c206e6f7420616c6c6f6044820152621dd95960ea1b6064820152608401610333565b6105756102c261110d565b6105d75760405162461bcd60e51b815260206004820152602d60248201527f6f6e6c79207265676973746572656420776974686472617765722063616e207760448201526c34ba34323930bb903a37b5b2b760991b6064820152608401610333565b60405163120acf2760e01b81526001600160a01b03808a16600483015280891660248301528088166044830152606482018790528516608482015260a48101849052309063120acf279060c401600060405180830381600087803b15801561063e57600080fd5b505af192505050801561064f575060015b6106d3573d80801561067d576040519150601f19603f3d011682016040523d82523d6000602084013e610682565b606091505b506106cd89898989898989898080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192508b91506111179050565b50610728565b61072888888888888888888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250604080516020810190915281815290935091506111179050565b61073133611181565b505060018055505050505050565b6002546001600160a01b031633036107695760405162461bcd60e51b815260040161033390611f3c565b6107716112e3565b6107828161077d61110d565b61135c565b50565b6002546001600160a01b031633036107af5760405162461bcd60e51b815260040161033390611f3c565b6107b76112e3565b600080546040516001600160a01b039091169182917ff48343a675a177d706e5b7169ad33ece18dad9c5506632062432e344c6c3ab709190a2806001600160a01b0316ff5b60026001540361081e5760405162461bcd60e51b815260040161033390611f05565b60026001819055546001600160a01b0316330361084d5760405162461bcd60e51b815260040161033390611f3c565b6108556112e3565b6001600160a01b0381166108ab5760405162461bcd60e51b815260206004820152601a60248201527f746f20616464726573732063616e206e6f74206265207a65726f0000000000006044820152606401610333565b60006001600160a01b0383166108c257504761092d565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610906573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092a9190611f8d565b90505b8015610a41576001600160a01b0383166109df576000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461098e576040519150601f19603f3d011682016040523d82523d6000602084013e610993565b606091505b50509050806109d95760405162461bcd60e51b81526020600482015260126024820152713330b4b632b2103a37903a3930b739b332b960711b6044820152606401610333565b506109f3565b6109f36001600160a01b03841683836113cd565b816001600160a01b0316836001600160a01b03167f3af790fafda720819b2fc6e15090606e81154e0ac9a92d38ecad006d99d20ecc83604051610a3891815260200190565b60405180910390a35b50506001805550565b6002546001600160a01b03163303610a745760405162461bcd60e51b815260040161033390611f3c565b610a7c6112e3565b610a87600482611402565b610ad35760405162461bcd60e51b815260206004820152601c60248201527f77697468647261776572206973206e6f742072656769737465726564000000006044820152606401610333565b610adb61110d565b6001600160a01b0316816001600160a01b03167ffb29f35f17d6801d4e03ca9629038136f4bf006d5227bff9eaaa4888723f184360405160405180910390a350565b600260015403610b3f5760405162461bcd60e51b815260040161033390611f05565b60026001556001600160a01b038816610b6a5760405162461bcd60e51b815260040161033390611e62565b6001600160a01b038716610b905760405162461bcd60e51b815260040161033390611e99565b60008611610bb05760405162461bcd60e51b815260040161033390611ed0565b610c08610bc06020830183611ce6565b610bd06040840160208501611ce6565b60408401356060850135610bea60a0870160808801611fa6565b6001600160a01b038e16949392919060a088013560c0890135611417565b6000610c1261110d565b9050610c296001600160a01b038a16828a8a61107c565b8415610c6a576001600160a01b038616610c555760405162461bcd60e51b815260040161033390611fc9565b610c6a6001600160a01b038a1682888861107c565b876001600160a01b0316816001600160a01b03168a6001600160a01b03167f77ff40a5a3008c3398de2e8df92ba85ebbd1ed047d761f75e5cb13fd7afb56d98a8a8a8a8a604051610cbf95949392919061200e565b60405180910390a450506001805550505050505050565b6002546001600160a01b03163303610d005760405162461bcd60e51b815260040161033390611f3c565b610d086112e3565b6001600160a01b038116610d695760405162461bcd60e51b815260206004820152602260248201527f776974686472617765722063616e206e6f74206265207a65726f206164647265604482015261737360f01b6064820152608401610333565b610d746004826115ed565b610dc05760405162461bcd60e51b815260206004820152601d60248201527f7769746864726177657220616c726561647920726567697374657265640000006044820152606401610333565b610dc861110d565b6001600160a01b0316816001600160a01b03167f6fcc7908450856abe50f242afba0e65041d8f5a43e673d4ce02a7f5557b6c8dc60405160405180910390a350565b610e126112e3565b610e1c6000611602565b565b600260015403610e405760405162461bcd60e51b815260040161033390611f05565b60026001556001600160a01b038716610e6b5760405162461bcd60e51b815260040161033390611e62565b6001600160a01b038616610e915760405162461bcd60e51b815260040161033390611e99565b60008511610eb15760405162461bcd60e51b815260040161033390611ed0565b6000610ebb61110d565b9050610ed26001600160a01b03891682898961107c565b8315610f13576001600160a01b038516610efe5760405162461bcd60e51b815260040161033390611fc9565b610f136001600160a01b03891682878761107c565b866001600160a01b0316816001600160a01b0316896001600160a01b03167f77ff40a5a3008c3398de2e8df92ba85ebbd1ed047d761f75e5cb13fd7afb56d98989898989604051610f6895949392919061200e565b60405180910390a4505060018055505050505050565b60006104a66004611652565b6002546001600160a01b03163303610fb45760405162461bcd60e51b815260040161033390611f3c565b610fbc6112e3565b6107828161165c565b60006104b86004836116df565b610fda6112e3565b6001600160a01b03811661103f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610333565b61078281611602565b60006014361080159061106557506002546001600160a01b031633145b15611077575060131936013560601c90565b503390565b6040516001600160a01b03808516602483015283166044820152606481018290526110e79085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611701565b50505050565b606060006110fa836117d3565b9392505050565b60006110fa838361182f565b60006104a6611048565b866001600160a01b0316886001600160a01b03168a6001600160a01b03167f0a8aa38a9a9c21f1b98ae1b7476f23c70dc763b9c99b13528769dc838a21d35289898989898960405161116e969594939291906120ad565b60405180910390a4505050505050505050565b6003546001600160a01b03166111945750565b6003546001600160a01b03163b6112085760405162461bcd60e51b815260206004820152603260248201527f747279696e6720746f2063616c6c206e6f6e20636f6e7472616374206164647260448201527132b9b99030b9903332b29036b0b730b3b2b960711b6064820152608401610333565b60035460405163072404fb60e51b81526001600160a01b0383811660048301529091169063e4809f6090602401600060405180830381600087803b15801561124f57600080fd5b505af1925050508015611260575060015b610782573d80801561128e576040519150601f19603f3d011682016040523d82523d6000602084013e611293565b606091505b508051156112a357805181602001fd5b60405162461bcd60e51b81526020600482015260156024820152743932bb32b93a103bb4ba34103737903932b0b9b7b760591b6044820152606401610333565b6112eb61110d565b6001600160a01b03166113066000546001600160a01b031690565b6001600160a01b031614610e1c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610333565b600354604080516001600160a01b039283168152848316602082015291831682820152517fae8f542de9103fbd65d71a3c3a7ee5781e9dd600dccfd8990c5120c9624671d89181900360600190a150600380546001600160a01b0319166001600160a01b0392909216919091179055565b6040516001600160a01b0383166024820152604481018290526113fd90849063a9059cbb60e01b906064016110b0565b505050565b60006110fa836001600160a01b038416611859565b604051623f675f60e91b81526001600160a01b038881166004830152600091908a1690637ecebe0090602401602060405180830381865afa158015611460573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114849190611f8d565b60405163d505accf60e01b81526001600160a01b038a811660048301528981166024830152604482018990526064820188905260ff8716608483015260a4820186905260c48201859052919250908a169063d505accf9060e401600060405180830381600087803b1580156114f857600080fd5b505af115801561150c573d6000803e3d6000fd5b5050604051623f675f60e91b81526001600160a01b038b81166004830152600093508c169150637ecebe0090602401602060405180830381865afa158015611558573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061157c9190611f8d565b9050611589826001612133565b81146115e15760405162461bcd60e51b815260206004820152602160248201527f5361666545524332303a207065726d697420646964206e6f74207375636365656044820152601960fa1b6064820152608401610333565b50505050505050505050565b60006110fa836001600160a01b03841661194c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006104b8825490565b6002547ff7d82a80bb8c6a721c0a30fb15901c346c65599065fc0c076c6300dc0558228b906001600160a01b03168261169361110d565b604080516001600160a01b039485168152928416602084015292168183015290519081900360600190a1600280546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815260018301602052604081205415156110fa565b6000611756826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661199b9092919063ffffffff16565b8051909150156113fd57808060200190518101906117749190612146565b6113fd5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610333565b60608160000180548060200260200160405190810160405280929190818152602001828054801561182357602002820191906000526020600020905b81548152602001906001019080831161180f575b50505050509050919050565b600082600001828154811061184657611846612168565b9060005260206000200154905092915050565b6000818152600183016020526040812054801561194257600061187d60018361217e565b85549091506000906118919060019061217e565b90508181146118f65760008660000182815481106118b1576118b1612168565b90600052602060002001549050808760000184815481106118d4576118d4612168565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061190757611907612191565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506104b8565b60009150506104b8565b6000818152600183016020526040812054611993575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556104b8565b5060006104b8565b60606119aa84846000856119b2565b949350505050565b606082471015611a135760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610333565b6001600160a01b0385163b611a6a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610333565b600080866001600160a01b03168587604051611a8691906121a7565b60006040518083038185875af1925050503d8060008114611ac3576040519150601f19603f3d011682016040523d82523d6000602084013e611ac8565b606091505b5091509150611ad8828286611ae3565b979650505050505050565b60608315611af25750816110fa565b825115611b025782518084602001fd5b8160405162461bcd60e51b815260040161033391906121c3565b80356001600160a01b0381168114611b3357600080fd5b919050565b60008060008060008060c08789031215611b5157600080fd5b611b5a87611b1c565b9550611b6860208801611b1c565b9450611b7660408801611b1c565b935060608701359250611b8b60808801611b1c565b915060a087013590509295509295509295565b6020808252825182820181905260009190848201906040850190845b81811015611bdf5783516001600160a01b031683529284019291840191600101611bba565b50909695505050505050565b600060208284031215611bfd57600080fd5b5035919050565b60008083601f840112611c1657600080fd5b50813567ffffffffffffffff811115611c2e57600080fd5b602083019150836020828501011115611c4657600080fd5b9250929050565b60008060008060008060008060e0898b031215611c6957600080fd5b611c7289611b1c565b9750611c8060208a01611b1c565b9650611c8e60408a01611b1c565b955060608901359450611ca360808a01611b1c565b935060a0890135925060c089013567ffffffffffffffff811115611cc657600080fd5b611cd28b828c01611c04565b999c989b5096995094979396929594505050565b600060208284031215611cf857600080fd5b6110fa82611b1c565b60008060408385031215611d1457600080fd5b611d1d83611b1c565b9150611d2b60208401611b1c565b90509250929050565b600080600080600080600080888a036101a0811215611d5257600080fd5b611d5b8a611b1c565b9850611d6960208b01611b1c565b975060408a01359650611d7e60608b01611b1c565b955060808a0135945060a08a013567ffffffffffffffff811115611da157600080fd5b611dad8c828d01611c04565b90955093505060e060bf1982011215611dc557600080fd5b5060c0890190509295985092959890939650565b600080600080600080600060c0888a031215611df457600080fd5b611dfd88611b1c565b9650611e0b60208901611b1c565b955060408801359450611e2060608901611b1c565b93506080880135925060a088013567ffffffffffffffff811115611e4357600080fd5b611e4f8a828b01611c04565b989b979a50959850939692959293505050565b6020808252601d908201527f746f6b656e20616464726573732063616e206e6f74206265207a65726f000000604082015260600190565b6020808252601c908201527f706f6f6c20616464726573732063616e206e6f74206265207a65726f00000000604082015260600190565b6020808252818101527f616d6f756e74206d7573742062652067726561746572207468616e207a65726f604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526031908201527f45495032373731526563697069656e743a206d657461207472616e73616374696040820152701bdb881a5cc81b9bdd08185b1b1bddd959607a1b606082015260800190565b600060208284031215611f9f57600080fd5b5051919050565b600060208284031215611fb857600080fd5b813560ff811681146110fa57600080fd5b60208082526025908201527f706c6174666f726d20706f6f6c20616464726573732063616e206e6f74206265604082015264207a65726f60d81b606082015260800190565b8581526001600160a01b0385166020820152604081018490526080606082018190528101829052818360a0830137600081830160a090810191909152601f909201601f19160101949350505050565b60005b83811015612078578181015183820152602001612060565b50506000910152565b6000815180845261209981602086016020860161205d565b601f01601f19169290920160200192915050565b86815260018060a01b038616602082015284604082015260c0606082015260006120da60c0830186612081565b600285106120f857634e487b7160e01b600052602160045260246000fd5b84608084015282810360a08401526121108185612081565b9998505050505050505050565b634e487b7160e01b600052601160045260246000fd5b808201808211156104b8576104b861211d565b60006020828403121561215857600080fd5b815180151581146110fa57600080fd5b634e487b7160e01b600052603260045260246000fd5b818103818111156104b8576104b861211d565b634e487b7160e01b600052603160045260246000fd5b600082516121b981846020870161205d565b9190910192915050565b6020815260006110fa602083018461208156fea264697066735822122084de2e1f056caae8b3aca5401a2ca68ec397e7965b4e918788267ec2af1564bf64736f6c63430008110033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.