Sepolia Testnet

Contract

0x5D0DfE47EA361fE4303d64aF05A981c9DA665387
Source Code Source Code

Overview

ETH Balance

0 ETH

More Info

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Amount

There are no matching entries

Please try again later

Advanced mode:
Parent Transaction Hash Method Block
From
To
Amount
View All Internal Transactions
Loading...
Loading
Loading...
Loading

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SAClientERC20

Compiler Version
v0.8.19+commit.7dd6d404

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.0;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "./utils/ISAPHandler.sol";
import "./utils/IBlackList.sol";

contract SAClientERC20 is OwnableUpgradeable, PausableUpgradeable {
    event SATransaction(address indexed saDest, uint216 amount, address indexed token, bytes ciphertext);
    event NormalAddressTransaction(address indexed saSrc, uint216 amount, address indexed token);
    error FailedToWithdrawEth(address target, uint256 value);

    struct Account {
        bool exist;
        uint32 nonce;
        uint216 balance;
    }

    struct FeeParameter {
        uint24 rate; // 1feeRate = 1/1,000,000
        uint96 cap;
        uint96 floor;
    }

    struct RelayerRequest {
        address saSrc;
        address dest;
        address token;
        uint216 amount; 
        uint32 nonce;
        address relayerWallet;
        uint216 gas;
        bytes32 r;
        bytes32 s;
        uint8 v;
        uint256 expireTime;
    }

    address payable public feeReceiver;
    IBlackList blackList;
    mapping(address => mapping(uint256 => mapping(address => FeeParameter))) public feeParam; // feeParam[contractAddress][actionId][tokenAddress] = FeeParameter
    mapping(address => mapping(address => uint256)) public beneficiaryBalance; // balance for transaction fee and relayer, beneficiaryBalance[roleWallet][tokenAddress] = amount
    mapping(address => mapping(address => Account)) public saAccount; // saAccount[sa][token] = Account
    mapping(address => bool) internal exemptList; // Address list of fee exemption
    
    address internal constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
    address internal constant THIS_CONTRACT = 0x0000000000000000000000000000000000000001;
    uint256 internal constant ACTION_EOAtoSA = 1;
    uint256 internal constant ACTION_SAtoEOA = 2;
    uint256 internal constant ACTION_SAtoSA = 3;

    function setFee(address contractAddress, uint256 actionId, address tokenAddress, uint24 rate, uint96 cap, uint96 floor) external onlyOwner {
        _setFee(contractAddress, actionId, tokenAddress, rate, cap, floor);
    }

    function _setFee(address contractAddress, uint256 actionId, address tokenAddress, uint24 rate, uint96 cap, uint96 floor) internal {
        feeParam[contractAddress][actionId][tokenAddress].rate = rate;
        feeParam[contractAddress][actionId][tokenAddress].cap = cap;
        feeParam[contractAddress][actionId][tokenAddress].floor = floor;
    }

    function setFeeReceiver(address payable receiver) external onlyOwner {
        feeReceiver = receiver;
    }

    function setExempt(address exemptAddr, bool isExempt) external onlyOwner {
        exemptList[exemptAddr] = isExempt;
    }

    function setBlackList(address blackListAddress) external onlyOwner {
        blackList = IBlackList(blackListAddress);
    }

    function collectFee(address token) external whenNotPaused {
        _collectFee(token);
    }

    function _collectFee(address token) internal {
        uint256 balance = beneficiaryBalance[msg.sender][token];
        if (balance > 0) {
            beneficiaryBalance[msg.sender][token] = 0;
            if (token == NATIVE_TOKEN) {
                (bool sent, ) = msg.sender.call{value: balance}("");
                if (!sent) revert FailedToWithdrawEth(msg.sender, balance);
            } else {
                SafeERC20Upgradeable.safeTransfer(IERC20Upgradeable(token), msg.sender, balance);
            }
        }
    }

    function collectFeeBatch(address[] calldata tokens) external whenNotPaused {
        for (uint256 i = 0; i < tokens.length; i++) {
            address token = tokens[i];
            _collectFee(token);
        }
    }

    function _calcFee(address contractAddress, uint256 actionId, address tokenAddress, uint216 amount) internal view returns (uint216 fee) {
        FeeParameter storage fParam = feeParam[contractAddress][actionId][tokenAddress];
        require(fParam.cap > 0, "Token not allowed");
        fee = (amount * fParam.rate) / 1000000;
        uint96 cap = fParam.cap;
        uint96 floor = fParam.floor;
        if (fee < floor) {
            fee = floor;
        } else if (fee > cap) {
            fee = cap;
        }
    }

    function calcFee(address contractAddress, uint256 actionId, address tokenAddress, uint216 amount) external view returns (uint216 fee) {
        return _calcFee(contractAddress, actionId, tokenAddress, amount);
    }
    
    function transferEOAtoSA(address saDest, address token, uint216 amount, bytes calldata keyCipher) external payable whenNotPaused {
        _transferEOAtoSA(saDest, token, amount);
        emit SATransaction(saDest, amount, token, keyCipher);
    }

    function transferEOAtoExistingSA(address saDest, address token, uint216 amount) external payable whenNotPaused {
        _transferEOAtoSA(saDest, token, amount);
        emit SATransaction(saDest, amount, token, bytes(""));
    }

    function _transferEOAtoSA(address saDest, address token, uint216 amount) internal {
        uint216 fee = _calcFee(THIS_CONTRACT, ACTION_EOAtoSA, token, amount);
        uint216 total = amount + fee;
        if (token == NATIVE_TOKEN) {
            // Sending native token
            require(msg.value >= total, "Not enough token sended to SA");
            uint256 restAmount = msg.value - uint256(amount);
            if (restAmount > 0) beneficiaryBalance[feeReceiver][token] += restAmount;
        } else {
            // Sending contract token
            require(IERC20Upgradeable(token).balanceOf(msg.sender) >= total, "Not enough token in wallet");
            uint256 balanceBefore = IERC20Upgradeable(token).balanceOf(address(this));
            SafeERC20Upgradeable.safeTransferFrom(IERC20Upgradeable(token), msg.sender, address(this), total);
            uint256 balanceAfter = IERC20Upgradeable(token).balanceOf(address(this));
            require(balanceAfter - balanceBefore == total, "Balance mismatch after transfer");
            if (fee > 0) beneficiaryBalance[feeReceiver][token] += fee;
        }
        saAccount[saDest][token].exist = true;
        saAccount[saDest][token].balance += amount;
        require(!blackList.isProhibited(msg.sender), "Sender address prohitbited");
    }

    function transferContractToSA(address saDest, address token, uint216 amount, bytes calldata keyCipher) external payable whenNotPaused {
        _transferContractToSA(saDest, token, amount);
        emit SATransaction(saDest, amount, token, keyCipher);
    }

    function transferContractToExistingSA(address saDest, address token, uint216 amount) external payable whenNotPaused {
        _transferContractToSA(saDest, token, amount);
        emit SATransaction(saDest, amount, token, bytes(""));
    }

    function _transferContractToSA(address saDest, address token, uint216 amount) internal {
        // Transfer from a exempted contract, so no fee will be charged.
        require(exemptList[msg.sender], "Not from a exempted contract");
        if (token == NATIVE_TOKEN) {
            // Sending native token
            require(msg.value == amount, "Incorrect amount sended to SA");
        } else {
            // Sending contract token
            require(IERC20Upgradeable(token).balanceOf(msg.sender) >= amount, "Not enough token in wallet");
            uint256 balanceBefore = IERC20Upgradeable(token).balanceOf(address(this));
            SafeERC20Upgradeable.safeTransferFrom(IERC20Upgradeable(token), msg.sender, address(this), amount);
            uint256 balanceAfter = IERC20Upgradeable(token).balanceOf(address(this));
            require(balanceAfter - balanceBefore == amount, "Balance mismatch after transfer");
        }
        saAccount[saDest][token].exist = true;
        saAccount[saDest][token].balance += amount;
    }

    function transferSAtoEOA(RelayerRequest calldata relayerRequest) external whenNotPaused {
        _verifySASig(relayerRequest, ACTION_SAtoEOA);
        _transferToEVMAddr(_calcFee(THIS_CONTRACT, ACTION_SAtoEOA, relayerRequest.token, relayerRequest.amount), relayerRequest);
        require(!blackList.isProhibited(relayerRequest.dest), "Receiver address prohitbited");
    }

    function transferSAtoSA(RelayerRequest calldata relayerRequest, bytes calldata keyCipher) external whenNotPaused {
        _verifySASig(relayerRequest, ACTION_SAtoSA); // TODO: Add keyCipher into signature
        _transferSAtoSA(relayerRequest);
        emit SATransaction(relayerRequest.dest, relayerRequest.amount, relayerRequest.token, keyCipher);
    }

    function transferSAtoExistingSA(RelayerRequest calldata relayerRequest) external whenNotPaused {
        _verifySASig(relayerRequest, ACTION_SAtoSA);
        _transferSAtoSA(relayerRequest);
        emit SATransaction(relayerRequest.dest, relayerRequest.amount, relayerRequest.token, bytes(""));
    }

    function transferSAToHandler(RelayerRequest calldata relayerRequest, uint256 actionId, bytes calldata paramData) external payable whenNotPaused {
        // combine r and s together to avoid Stack too deep error
        _verifySASig(relayerRequest, actionId, paramData);
        _transferToEVMAddr(_calcFee(relayerRequest.dest, actionId, relayerRequest.token, relayerRequest.amount), relayerRequest);
        ISAPHandler(payable(relayerRequest.dest)).handle{value: msg.value}(actionId, relayerRequest.token, relayerRequest.amount, paramData);
    }

    function _verifySASig(RelayerRequest calldata relayerRequest, uint256 actionId, bytes memory paramData) internal {
        bytes32 hash = ECDSAUpgradeable.toEthSignedMessageHash(abi.encode(
            block.chainid, address(this), relayerRequest.dest, actionId, relayerRequest.token, relayerRequest.amount, paramData,
            relayerRequest.nonce, relayerRequest.relayerWallet, relayerRequest.gas, relayerRequest.expireTime));
        address addressRecover = ecrecover(hash, relayerRequest.v, relayerRequest.r, relayerRequest.s);
        require(addressRecover == relayerRequest.saSrc && addressRecover != address(0), "Fail to verify signature");
        require(saAccount[relayerRequest.saSrc][relayerRequest.token].nonce == relayerRequest.nonce, "Incorrect nonce");
        require(block.timestamp <= relayerRequest.expireTime, "Request expired");
        saAccount[relayerRequest.saSrc][relayerRequest.token].nonce += 1;
    }

    function _verifySASig(RelayerRequest calldata relayerRequest, uint256 actionId) internal {
        _verifySASig(relayerRequest, actionId, "");
    }

    function _transferSAtoSA(RelayerRequest calldata relayerRequest) internal {
        uint216 fee = _calcFee(THIS_CONTRACT, ACTION_SAtoSA, relayerRequest.token, relayerRequest.amount);
        uint216 total = relayerRequest.amount + fee + relayerRequest.gas;
        require(saAccount[relayerRequest.saSrc][relayerRequest.token].balance >= total, "Not enough token in SA balance");

        saAccount[relayerRequest.saSrc][relayerRequest.token].balance -= total;
        if (fee > 0) beneficiaryBalance[feeReceiver][relayerRequest.token] += fee;
        saAccount[relayerRequest.dest][relayerRequest.token].exist = true;
        saAccount[relayerRequest.dest][relayerRequest.token].balance += relayerRequest.amount;
        if (relayerRequest.gas > 0) beneficiaryBalance[relayerRequest.relayerWallet][relayerRequest.token] += relayerRequest.gas;
    }

    function _transferToEVMAddr(uint216 fee, RelayerRequest calldata relayerRequest) internal {
        uint216 total = relayerRequest.amount + relayerRequest.gas + fee;
        require(saAccount[relayerRequest.saSrc][relayerRequest.token].balance >= total, "Not enough token in SA balance");

        saAccount[relayerRequest.saSrc][relayerRequest.token].balance -= total;
        if (relayerRequest.token == NATIVE_TOKEN) {
            (bool sent, ) = payable(relayerRequest.dest).call{value: relayerRequest.amount}("");
            if (!sent) revert FailedToWithdrawEth(relayerRequest.dest, relayerRequest.amount);
        } else {
            uint256 balanceBefore = IERC20Upgradeable(relayerRequest.token).balanceOf(address(this));
            SafeERC20Upgradeable.safeTransfer(IERC20Upgradeable(relayerRequest.token), relayerRequest.dest, relayerRequest.amount);
            uint256 balanceAfter = IERC20Upgradeable(relayerRequest.token).balanceOf(address(this));
            require(balanceBefore - balanceAfter == relayerRequest.amount, "Balance mismatch after transfer");
        }
        if (relayerRequest.gas > 0) beneficiaryBalance[relayerRequest.relayerWallet][relayerRequest.token] += relayerRequest.gas;
        if (fee > 0) beneficiaryBalance[feeReceiver][relayerRequest.token] += fee;
        emit NormalAddressTransaction(relayerRequest.saSrc, relayerRequest.amount, relayerRequest.token);
    }

    function getSA(address sa, address token) external view returns (uint32 nonce, uint216 balance) {
        Account storage saInfo = saAccount[sa][token];
        return (saInfo.nonce, saInfo.balance);
    }

    function existSA(address sa, address[] calldata tokens) external view returns (bool isExist) {
        for (uint256 i = 0; i < tokens.length; i++) {
            address token = tokens[i];
            if (saAccount[sa][token].exist) return true;
        }
        return false;
    }

    function getFeeParam(address contractAddress, uint256 actionId, address tokenAddress)
    external view returns (uint24 rate, uint96 cap, uint96 floor) {
        FeeParameter storage fParam = feeParam[contractAddress][actionId][tokenAddress];
        rate = fParam.rate;
        cap = fParam.cap;
        floor = fParam.floor;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    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 onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _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. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        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);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @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 __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20PermitUpgradeable {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../extensions/IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
    using AddressUpgradeable for address;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20Upgradeable 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(IERC20Upgradeable token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20PermitUpgradeable 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(IERC20Upgradeable token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)

pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../StringsUpgradeable.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSAUpgradeable {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32")
            mstore(0x1c, hash)
            message := keccak256(0x00, 0x3c)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, "\x19\x01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            data := keccak256(ptr, 0x42)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Data with intended validator, created from a
     * `validator` and `data` according to the version 0 of EIP-191.
     *
     * See {recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x00", validator, data));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library MathUpgradeable {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMathUpgradeable {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/MathUpgradeable.sol";
import "./math/SignedMathUpgradeable.sol";

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = MathUpgradeable.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, MathUpgradeable.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IBlackList {
    function isProhibited(address addr) external view returns (bool);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface ISAPHandler {
    function handle(uint256 actionId, address token, uint216 amount, bytes calldata paramData) external payable;
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"FailedToWithdrawEth","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"saSrc","type":"address"},{"indexed":false,"internalType":"uint216","name":"amount","type":"uint216"},{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"NormalAddressTransaction","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"saDest","type":"address"},{"indexed":false,"internalType":"uint216","name":"amount","type":"uint216"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bytes","name":"ciphertext","type":"bytes"}],"name":"SATransaction","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"beneficiaryBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"actionId","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint216","name":"amount","type":"uint216"}],"name":"calcFee","outputs":[{"internalType":"uint216","name":"fee","type":"uint216"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"collectFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"collectFeeBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sa","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"existSA","outputs":[{"internalType":"bool","name":"isExist","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"feeParam","outputs":[{"internalType":"uint24","name":"rate","type":"uint24"},{"internalType":"uint96","name":"cap","type":"uint96"},{"internalType":"uint96","name":"floor","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeReceiver","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"actionId","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"getFeeParam","outputs":[{"internalType":"uint24","name":"rate","type":"uint24"},{"internalType":"uint96","name":"cap","type":"uint96"},{"internalType":"uint96","name":"floor","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sa","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"getSA","outputs":[{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"uint216","name":"balance","type":"uint216"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"saAccount","outputs":[{"internalType":"bool","name":"exist","type":"bool"},{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"uint216","name":"balance","type":"uint216"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"blackListAddress","type":"address"}],"name":"setBlackList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"exemptAddr","type":"address"},{"internalType":"bool","name":"isExempt","type":"bool"}],"name":"setExempt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"actionId","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint24","name":"rate","type":"uint24"},{"internalType":"uint96","name":"cap","type":"uint96"},{"internalType":"uint96","name":"floor","type":"uint96"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"receiver","type":"address"}],"name":"setFeeReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"saDest","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint216","name":"amount","type":"uint216"}],"name":"transferContractToExistingSA","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"saDest","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint216","name":"amount","type":"uint216"},{"internalType":"bytes","name":"keyCipher","type":"bytes"}],"name":"transferContractToSA","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"saDest","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint216","name":"amount","type":"uint216"}],"name":"transferEOAtoExistingSA","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"saDest","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint216","name":"amount","type":"uint216"},{"internalType":"bytes","name":"keyCipher","type":"bytes"}],"name":"transferEOAtoSA","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"saSrc","type":"address"},{"internalType":"address","name":"dest","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint216","name":"amount","type":"uint216"},{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"address","name":"relayerWallet","type":"address"},{"internalType":"uint216","name":"gas","type":"uint216"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"uint256","name":"expireTime","type":"uint256"}],"internalType":"struct SAClientERC20.RelayerRequest","name":"relayerRequest","type":"tuple"},{"internalType":"uint256","name":"actionId","type":"uint256"},{"internalType":"bytes","name":"paramData","type":"bytes"}],"name":"transferSAToHandler","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"saSrc","type":"address"},{"internalType":"address","name":"dest","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint216","name":"amount","type":"uint216"},{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"address","name":"relayerWallet","type":"address"},{"internalType":"uint216","name":"gas","type":"uint216"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"uint256","name":"expireTime","type":"uint256"}],"internalType":"struct SAClientERC20.RelayerRequest","name":"relayerRequest","type":"tuple"}],"name":"transferSAtoEOA","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"saSrc","type":"address"},{"internalType":"address","name":"dest","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint216","name":"amount","type":"uint216"},{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"address","name":"relayerWallet","type":"address"},{"internalType":"uint216","name":"gas","type":"uint216"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"uint256","name":"expireTime","type":"uint256"}],"internalType":"struct SAClientERC20.RelayerRequest","name":"relayerRequest","type":"tuple"}],"name":"transferSAtoExistingSA","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"saSrc","type":"address"},{"internalType":"address","name":"dest","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint216","name":"amount","type":"uint216"},{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"address","name":"relayerWallet","type":"address"},{"internalType":"uint216","name":"gas","type":"uint216"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"uint256","name":"expireTime","type":"uint256"}],"internalType":"struct SAClientERC20.RelayerRequest","name":"relayerRequest","type":"tuple"},{"internalType":"bytes","name":"keyCipher","type":"bytes"}],"name":"transferSAtoSA","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50613332806100206000396000f3fe6080604052600436106101815760003560e01c80638da5cb5b116100d1578063be3bda131161008a578063df029eaa11610064578063df029eaa146105a7578063ef1096dc146105ba578063efdcd974146105da578063f2fde38b146105fa57600080fd5b8063be3bda1314610549578063cd2213e814610581578063d8e4119c1461059457600080fd5b80638da5cb5b146104125780639fc3fe0d146104445780639fde54f514610464578063a24325d314610484578063a2ab6af6146104e3578063b3f006741461052957600080fd5b80635627a9221161013e57806369b59e751161011857806369b59e751461039d578063715018a6146103bd57806372700241146103d2578063762b9539146103f257600080fd5b80635627a9221461032157806358ed851b146103655780635c975abb1461038557600080fd5b806304c39a231461018657806322990c6a1461019b5780633cd609c31461023a5780633d3048711461024d5780634591bbcd1461027d5780635390a0911461029d575b600080fd5b610199610194366004612a40565b61061a565b005b3480156101a757600080fd5b5061020a6101b6366004612a87565b6001600160a01b039283166000908152609960209081526040808320948352938152838220929094168152925290205462ffffff8116916001600160601b0363010000008304811692600160781b90041690565b6040805162ffffff90941684526001600160601b0392831660208501529116908201526060015b60405180910390f35b610199610248366004612a40565b61067c565b34801561025957600080fd5b5061026d610268366004612b0e565b61068f565b6040519015158152602001610231565b34801561028957600080fd5b50610199610298366004612b63565b610720565b3480156102a957600080fd5b506102f66102b8366004612ba5565b609b60209081526000928352604080842090915290825290205460ff811690610100810463ffffffff1690600160281b90046001600160d81b031683565b60408051931515845263ffffffff90921660208401526001600160d81b031690820152606001610231565b34801561032d57600080fd5b5061034161033c366004612ba5565b61077f565b6040805163ffffffff90931683526001600160d81b03909116602083015201610231565b34801561037157600080fd5b50610199610380366004612bf5565b6107c9565b34801561039157600080fd5b5060655460ff1661026d565b3480156103a957600080fd5b506101996103b8366004612c70565b610856565b3480156103c957600080fd5b5061019961086a565b3480156103de57600080fd5b506101996103ed366004612c70565b61087e565b3480156103fe57600080fd5b5061019961040d366004612ca6565b6108a8565b34801561041e57600080fd5b506033546001600160a01b03165b6040516001600160a01b039091168152602001610231565b34801561045057600080fd5b5061019961045f366004612d05565b6109cb565b34801561047057600080fd5b5061019961047f366004612d5c565b610a49565b34801561049057600080fd5b5061020a61049f366004612a87565b609960209081526000938452604080852082529284528284209052825290205462ffffff8116906001600160601b0363010000008204811691600160781b90041683565b3480156104ef57600080fd5b5061051b6104fe366004612ba5565b609a60209081526000928352604080842090915290825290205481565b604051908152602001610231565b34801561053557600080fd5b5060975461042c906001600160a01b031681565b34801561055557600080fd5b50610569610564366004612d8a565b610a7c565b6040516001600160d81b039091168152602001610231565b61019961058f366004612ddb565b610a95565b6101996105a2366004612e39565b610bb5565b6101996105b5366004612e39565b610c0c565b3480156105c657600080fd5b506101996105d5366004612ca6565b610c1f565b3480156105e657600080fd5b506101996105f5366004612c70565b610cb2565b34801561060657600080fd5b50610199610615366004612c70565b610cdc565b610622610d52565b61062d838383610d98565b816001600160a01b0316836001600160a01b03166000805160206132dd833981519152836040518060200160405280600081525060405161066f929190612f03565b60405180910390a3505050565b610684610d52565b61062d8383836110d9565b6000805b828110156107135760008484838181106106af576106af612f27565b90506020020160208101906106c49190612c70565b6001600160a01b038088166000908152609b602090815260408083209385168352929052205490915060ff161561070057600192505050610719565b508061070b81612f53565b915050610693565b50600090505b9392505050565b610728610d52565b60005b8181101561077a57600083838381811061074757610747612f27565b905060200201602081019061075c9190612c70565b90506107678161154b565b508061077281612f53565b91505061072b565b505050565b6001600160a01b038281166000908152609b6020908152604080832093851683529290522054610100810463ffffffff1690600160281b90046001600160d81b03165b9250929050565b6107d1611638565b6001600160a01b038681166000908152609960209081526040808320898452825280832093881683529290522080546001600160601b03838116600160781b026bffffffffffffffffffffffff60781b199186166301000000026effffffffffffffffffffffffffffff1990931662ffffff8816179290921716179055505050505050565b61085e610d52565b6108678161154b565b50565b610872611638565b61087c6000611692565b565b610886611638565b609880546001600160a01b0319166001600160a01b0392909216919091179055565b6108b0610d52565b6108bb8160026116e4565b6108f06108ea600160026108d56060860160408701612c70565b6108e56080870160608801612f6c565b6116fe565b82611812565b6098546001600160a01b03166320dbd9386109116040840160208501612c70565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015610955573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109799190612f87565b156108675760405162461bcd60e51b815260206004820152601c60248201527f526563656976657220616464726573732070726f68697462697465640000000060448201526064015b60405180910390fd5b6109d3610d52565b6109de8360036116e4565b6109e783611dfd565b6109f76060840160408501612c70565b6001600160a01b0316610a106040850160208601612c70565b6001600160a01b03166000805160206132dd833981519152610a386080870160608801612f6c565b858560405161066f93929190612fcd565b610a51611638565b6001600160a01b03919091166000908152609c60205260409020805460ff1916911515919091179055565b6000610a8a858585856116fe565b90505b949350505050565b610a9d610d52565b610ade848484848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061222492505050565b610b1b610b15610af46040870160208801612c70565b85610b056060890160408a01612c70565b6108e560808a0160608b01612f6c565b85611812565b610b2b6040850160208601612c70565b6001600160a01b031663079a84523485610b4b6060890160408a01612c70565b610b5b60808a0160608b01612f6c565b87876040518763ffffffff1660e01b8152600401610b7d959493929190612ff2565b6000604051808303818588803b158015610b9657600080fd5b505af1158015610baa573d6000803e3d6000fd5b505050505050505050565b610bbd610d52565b610bc88585856110d9565b836001600160a01b0316856001600160a01b03166000805160206132dd833981519152858585604051610bfd93929190612fcd565b60405180910390a35050505050565b610c14610d52565b610bc8858585610d98565b610c27610d52565b610c328160036116e4565b610c3b81611dfd565b610c4b6060820160408301612c70565b6001600160a01b0316610c646040830160208401612c70565b6001600160a01b03166000805160206132dd833981519152610c8c6080850160608601612f6c565b60408051602081018252600081529051610ca7929190612f03565b60405180910390a350565b610cba611638565b609780546001600160a01b0319166001600160a01b0392909216919091179055565b610ce4611638565b6001600160a01b038116610d495760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109c2565b61086781611692565b60655460ff161561087c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016109c2565b336000908152609c602052604090205460ff16610df75760405162461bcd60e51b815260206004820152601c60248201527f4e6f742066726f6d2061206578656d7074656420636f6e74726163740000000060448201526064016109c2565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03831601610e7957806001600160d81b03163414610e745760405162461bcd60e51b815260206004820152601d60248201527f496e636f727265637420616d6f756e742073656e64656420746f20534100000060448201526064016109c2565b61105d565b6040516370a0823160e01b81523360048201526001600160d81b038216906001600160a01b038416906370a0823190602401602060405180830381865afa158015610ec8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eec919061302c565b1015610f3a5760405162461bcd60e51b815260206004820152601a60248201527f4e6f7420656e6f75676820746f6b656e20696e2077616c6c657400000000000060448201526064016109c2565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa5919061302c565b9050610fbc833330856001600160d81b031661256a565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015611003573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611027919061302c565b90506001600160d81b03831661103d8383613045565b1461105a5760405162461bcd60e51b81526004016109c290613058565b50505b6001600160a01b038381166000908152609b60209081526040808320938616835292905220805460ff19166001178082558291906005906110b09084906001600160d81b03600160281b9091041661308f565b92506101000a8154816001600160d81b0302191690836001600160d81b03160217905550505050565b60006110e860018085856116fe565b905060006110f6828461308f565b905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b038516016111d957806001600160d81b03163410156111765760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420656e6f75676820746f6b656e2073656e64656420746f20534100000060448201526064016109c2565b600061118b6001600160d81b03851634613045565b905080156111d3576097546001600160a01b039081166000908152609a60209081526040808320938916835292905290812080548392906111cd9084906130b6565b90915550505b50611415565b6040516370a0823160e01b81523360048201526001600160d81b038216906001600160a01b038616906370a0823190602401602060405180830381865afa158015611228573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124c919061302c565b101561129a5760405162461bcd60e51b815260206004820152601a60248201527f4e6f7420656e6f75676820746f6b656e20696e2077616c6c657400000000000060448201526064016109c2565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa1580156112e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611305919061302c565b905061131c853330856001600160d81b031661256a565b6040516370a0823160e01b81523060048201526000906001600160a01b038716906370a0823190602401602060405180830381865afa158015611363573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611387919061302c565b90506001600160d81b03831661139d8383613045565b146113ba5760405162461bcd60e51b81526004016109c290613058565b6001600160d81b03841615611412576097546001600160a01b039081166000908152609a60209081526040808320938a16835292905290812080546001600160d81b038716929061140c9084906130b6565b90915550505b50505b6001600160a01b038581166000908152609b60209081526040808320938816835292905220805460ff19166001178082558491906005906114689084906001600160d81b03600160281b9091041661308f565b82546001600160d81b039182166101009390930a92830291909202199091161790555060985460405163041b7b2760e31b81523360048201526001600160a01b03909116906320dbd93890602401602060405180830381865afa1580156114d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114f79190612f87565b156115445760405162461bcd60e51b815260206004820152601a60248201527f53656e64657220616464726573732070726f686974626974656400000000000060448201526064016109c2565b5050505050565b336000908152609a602090815260408083206001600160a01b0385168452909152902054801561163457336000908152609a602090815260408083206001600160a01b038616808552925282209190915573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed190161162957604051600090339083908381818185875af1925050503d80600081146115f9576040519150601f19603f3d011682016040523d82523d6000602084013e6115fe565b606091505b505090508061077a57604051630cd9003760e01b8152336004820152602481018390526044016109c2565b6116348233836125db565b5050565b6033546001600160a01b0316331461087c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109c2565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611634828260405180602001604052806000815250612224565b6001600160a01b038481166000908152609960209081526040808320878452825280832093861683529290529081208054630100000090046001600160601b031661177f5760405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08185b1b1bddd959607a1b60448201526064016109c2565b8054620f4240906117959062ffffff16856130c9565b61179f91906130fb565b81549092506001600160601b0363010000008204811691600160781b9004166001600160d81b0384168111156117e057806001600160601b03169350611807565b816001600160601b0316846001600160d81b0316111561180757816001600160601b031693505b505050949350505050565b60008261182560e0840160c08501612f6c565b6118356080850160608601612f6c565b61183f919061308f565b611849919061308f565b90506001600160d81b038116609b60006118666020860186612c70565b6001600160a01b03166001600160a01b03168152602001908152602001600020600084604001602081019061189b9190612c70565b6001600160a01b03168152602081019190915260400160002054600160281b90046001600160d81b031610156119135760405162461bcd60e51b815260206004820152601e60248201527f4e6f7420656e6f75676820746f6b656e20696e2053412062616c616e6365000060448201526064016109c2565b80609b60006119256020860186612c70565b6001600160a01b03166001600160a01b03168152602001908152602001600020600084604001602081019061195a9190612c70565b6001600160a01b0316815260208101919091526040016000208054600590611993908490600160281b90046001600160d81b031661312f565b92506101000a8154816001600160d81b0302191690836001600160d81b0316021790555073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b03168260400160208101906119e89190612c70565b6001600160a01b031603611ad1576000611a086040840160208501612c70565b6001600160a01b0316611a216080850160608601612f6c565b6001600160d81b031660405160006040518083038185875af1925050503d8060008114611a6a576040519150601f19603f3d011682016040523d82523d6000602084013e611a6f565b606091505b5050905080611acb57611a886040840160208501612c70565b611a986080850160608601612f6c565b604051630cd9003760e01b81526001600160a01b0390921660048301526001600160d81b031660248201526044016109c2565b50611c51565b6000611ae36060840160408501612c70565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015611b29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b4d919061302c565b9050611b90611b626060850160408601612c70565b611b726040860160208701612c70565b611b826080870160608801612f6c565b6001600160d81b03166125db565b6000611ba26060850160408601612c70565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015611be8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c0c919061302c565b9050611c1e6080850160608601612f6c565b6001600160d81b0316611c318284613045565b14611c4e5760405162461bcd60e51b81526004016109c290613058565b50505b6000611c6360e0840160c08501612f6c565b6001600160d81b03161115611d0957611c8260e0830160c08401612f6c565b6001600160d81b0316609a6000611c9f60c0860160a08701612c70565b6001600160a01b03166001600160a01b031681526020019081526020016000206000846040016020810190611cd49190612c70565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254611d0391906130b6565b90915550505b6001600160d81b03831615611d85576097546001600160a01b03166000908152609a60205260408082206001600160d81b038616929091611d509060608701908701612c70565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254611d7f91906130b6565b90915550505b611d956060830160408401612c70565b6001600160a01b0316611dab6020840184612c70565b6001600160a01b03167fb1a3aeb391a0162ebb845ef6be3d229bd9543a09c0e411dadee01d7b8c7837b0611de56080860160608701612f6c565b6040516001600160d81b03909116815260200161066f565b6000611e16600160036108d56060860160408701612c70565b90506000611e2a60e0840160c08501612f6c565b82611e3b6080860160608701612f6c565b611e45919061308f565b611e4f919061308f565b90506001600160d81b038116609b6000611e6c6020870187612c70565b6001600160a01b03166001600160a01b031681526020019081526020016000206000856040016020810190611ea19190612c70565b6001600160a01b03168152602081019190915260400160002054600160281b90046001600160d81b03161015611f195760405162461bcd60e51b815260206004820152601e60248201527f4e6f7420656e6f75676820746f6b656e20696e2053412062616c616e6365000060448201526064016109c2565b80609b6000611f2b6020870187612c70565b6001600160a01b03166001600160a01b031681526020019081526020016000206000856040016020810190611f609190612c70565b6001600160a01b0316815260208101919091526040016000208054600590611f99908490600160281b90046001600160d81b031661312f565b92506101000a8154816001600160d81b0302191690836001600160d81b031602179055506000826001600160d81b0316111561203c576097546001600160a01b03166000908152609a60205260408082206001600160d81b0385169290916120079060608801908801612c70565b6001600160a01b03166001600160a01b03168152602001908152602001600020600082825461203691906130b6565b90915550505b6001609b60006120526040870160208801612c70565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008560400160208101906120879190612c70565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790556120bf6080840160608501612f6c565b609b60006120d36040870160208801612c70565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008560400160208101906121089190612c70565b6001600160a01b0316815260208101919091526040016000208054600590612141908490600160281b90046001600160d81b031661308f565b92506101000a8154816001600160d81b0302191690836001600160d81b0316021790555060008360c001602081019061217a9190612f6c565b6001600160d81b0316111561077a5761219960e0840160c08501612f6c565b6001600160d81b0316609a60006121b660c0870160a08801612c70565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008560400160208101906121eb9190612c70565b6001600160a01b03166001600160a01b03168152602001908152602001600020600082825461221a91906130b6565b9091555050505050565b60006122c4463061223b6040880160208901612c70565b8661224c60608a0160408b01612c70565b61225c60808b0160608c01612f6c565b8861226d60a08d0160808e0161314f565b61227d60c08e0160a08f01612c70565b8d60c00160208101906122909190612f6c565b8e61014001356040516020016122b09b9a99989796959493929190613175565b60405160208183030381529060405261260b565b905060006001826122dd610140880161012089016131fc565b6040805160008152602081018083529390935260ff9091169082015260e08701356060820152610100870135608082015260a0016020604051602081039080840390855afa158015612333573d6000803e3d6000fd5b5050604051601f190151915061234e90506020860186612c70565b6001600160a01b0316816001600160a01b031614801561237657506001600160a01b03811615155b6123c25760405162461bcd60e51b815260206004820152601860248201527f4661696c20746f20766572696679207369676e6174757265000000000000000060448201526064016109c2565b6123d260a086016080870161314f565b63ffffffff16609b60006123e96020890189612c70565b6001600160a01b03166001600160a01b03168152602001908152602001600020600087604001602081019061241e9190612c70565b6001600160a01b03168152602081019190915260400160002054610100900463ffffffff16146124825760405162461bcd60e51b815260206004820152600f60248201526e496e636f7272656374206e6f6e636560881b60448201526064016109c2565b8461014001354211156124c95760405162461bcd60e51b815260206004820152600f60248201526e14995c5d595cdd08195e1c1a5c9959608a1b60448201526064016109c2565b6001609b60006124dc6020890189612c70565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008760400160208101906125119190612c70565b6001600160a01b0316815260208101919091526040016000208054600190612545908490610100900463ffffffff1661321f565b92506101000a81548163ffffffff021916908363ffffffff1602179055505050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526125d59085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612646565b50505050565b6040516001600160a01b03831660248201526044810182905261077a90849063a9059cbb60e01b9060640161259e565b6000612617825161271b565b8260405160200161262992919061323c565b604051602081830303815290604052805190602001209050919050565b600061269b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166127ae9092919063ffffffff16565b90508051600014806126bc5750808060200190518101906126bc9190612f87565b61077a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109c2565b60606000612728836127bd565b600101905060008167ffffffffffffffff81111561274857612748613297565b6040519080825280601f01601f191660200182016040528015612772576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461277c57509392505050565b6060610a8d8484600085612896565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106127fc5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612828576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061284657662386f26fc10000830492506010015b6305f5e100831061285e576305f5e100830492506008015b612710831061287257612710830492506004015b60648310612884576064830492506002015b600a8310612890576001015b92915050565b6060824710156128f75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109c2565b600080866001600160a01b0316858760405161291391906132ad565b60006040518083038185875af1925050503d8060008114612950576040519150601f19603f3d011682016040523d82523d6000602084013e612955565b606091505b509150915061296687838387612971565b979650505050505050565b606083156129e05782516000036129d9576001600160a01b0385163b6129d95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109c2565b5081610a8d565b610a8d83838151156129f55781518083602001fd5b8060405162461bcd60e51b81526004016109c291906132c9565b6001600160a01b038116811461086757600080fd5b80356001600160d81b0381168114612a3b57600080fd5b919050565b600080600060608486031215612a5557600080fd5b8335612a6081612a0f565b92506020840135612a7081612a0f565b9150612a7e60408501612a24565b90509250925092565b600080600060608486031215612a9c57600080fd5b8335612aa781612a0f565b9250602084013591506040840135612abe81612a0f565b809150509250925092565b60008083601f840112612adb57600080fd5b50813567ffffffffffffffff811115612af357600080fd5b6020830191508360208260051b85010111156107c257600080fd5b600080600060408486031215612b2357600080fd5b8335612b2e81612a0f565b9250602084013567ffffffffffffffff811115612b4a57600080fd5b612b5686828701612ac9565b9497909650939450505050565b60008060208385031215612b7657600080fd5b823567ffffffffffffffff811115612b8d57600080fd5b612b9985828601612ac9565b90969095509350505050565b60008060408385031215612bb857600080fd5b8235612bc381612a0f565b91506020830135612bd381612a0f565b809150509250929050565b80356001600160601b0381168114612a3b57600080fd5b60008060008060008060c08789031215612c0e57600080fd5b8635612c1981612a0f565b9550602087013594506040870135612c3081612a0f565b9350606087013562ffffff81168114612c4857600080fd5b9250612c5660808801612bde565b9150612c6460a08801612bde565b90509295509295509295565b600060208284031215612c8257600080fd5b813561071981612a0f565b60006101608284031215612ca057600080fd5b50919050565b60006101608284031215612cb957600080fd5b6107198383612c8d565b60008083601f840112612cd557600080fd5b50813567ffffffffffffffff811115612ced57600080fd5b6020830191508360208285010111156107c257600080fd5b60008060006101808486031215612d1b57600080fd5b612d258585612c8d565b925061016084013567ffffffffffffffff811115612d4257600080fd5b612b5686828701612cc3565b801515811461086757600080fd5b60008060408385031215612d6f57600080fd5b8235612d7a81612a0f565b91506020830135612bd381612d4e565b60008060008060808587031215612da057600080fd5b8435612dab81612a0f565b9350602085013592506040850135612dc281612a0f565b9150612dd060608601612a24565b905092959194509250565b6000806000806101a08587031215612df257600080fd5b612dfc8686612c8d565b9350610160850135925061018085013567ffffffffffffffff811115612e2157600080fd5b612e2d87828801612cc3565b95989497509550505050565b600080600080600060808688031215612e5157600080fd5b8535612e5c81612a0f565b94506020860135612e6c81612a0f565b9350612e7a60408701612a24565b9250606086013567ffffffffffffffff811115612e9657600080fd5b612ea288828901612cc3565b969995985093965092949392505050565b60005b83811015612ece578181015183820152602001612eb6565b50506000910152565b60008151808452612eef816020860160208601612eb3565b601f01601f19169290920160200192915050565b6001600160d81b0383168152604060208201819052600090610a8d90830184612ed7565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612f6557612f65612f3d565b5060010190565b600060208284031215612f7e57600080fd5b61071982612a24565b600060208284031215612f9957600080fd5b815161071981612d4e565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160d81b0384168152604060208201819052600090610a8a9083018486612fa4565b8581526001600160a01b03851660208201526001600160d81b03841660408201526080606082018190526000906129669083018486612fa4565b60006020828403121561303e57600080fd5b5051919050565b8181038181111561289057612890612f3d565b6020808252601f908201527f42616c616e6365206d69736d61746368206166746572207472616e7366657200604082015260600190565b6001600160d81b038181168382160190808211156130af576130af612f3d565b5092915050565b8082018082111561289057612890612f3d565b6001600160d81b038281168282168181028316929181158285048214176130f2576130f2612f3d565b50505092915050565b60006001600160d81b038381168061312357634e487b7160e01b600052601260045260246000fd5b92169190910492915050565b6001600160d81b038281168282160390808211156130af576130af612f3d565b60006020828403121561316157600080fd5b813563ffffffff8116811461071957600080fd5b8b81526001600160a01b038b811660208301528a81166040830152606082018a905288811660808301526001600160d81b0388811660a084015261016060c0840181905260009290916131ca8584018b612ed7565b63ffffffff9990991660e086015296166101008401525050919092166101208201526101400152979650505050505050565b60006020828403121561320e57600080fd5b813560ff8116811461071957600080fd5b63ffffffff8181168382160190808211156130af576130af612f3d565b7f19457468657265756d205369676e6564204d6573736167653a0a00000000000081526000835161327481601a850160208801612eb3565b83519083019061328b81601a840160208801612eb3565b01601a01949350505050565b634e487b7160e01b600052604160045260246000fd5b600082516132bf818460208701612eb3565b9190910192915050565b6020815260006107196020830184612ed756fecb208517ce6623369603eefdd3d201e39b39fb29ec84a590b911b118e4582ec1a2646970667358221220e063b7c6740fd50d213b5babeb7e967f5f9a7d9862f1898eeab496fc4fe20b5764736f6c63430008130033

Deployed Bytecode

0x6080604052600436106101815760003560e01c80638da5cb5b116100d1578063be3bda131161008a578063df029eaa11610064578063df029eaa146105a7578063ef1096dc146105ba578063efdcd974146105da578063f2fde38b146105fa57600080fd5b8063be3bda1314610549578063cd2213e814610581578063d8e4119c1461059457600080fd5b80638da5cb5b146104125780639fc3fe0d146104445780639fde54f514610464578063a24325d314610484578063a2ab6af6146104e3578063b3f006741461052957600080fd5b80635627a9221161013e57806369b59e751161011857806369b59e751461039d578063715018a6146103bd57806372700241146103d2578063762b9539146103f257600080fd5b80635627a9221461032157806358ed851b146103655780635c975abb1461038557600080fd5b806304c39a231461018657806322990c6a1461019b5780633cd609c31461023a5780633d3048711461024d5780634591bbcd1461027d5780635390a0911461029d575b600080fd5b610199610194366004612a40565b61061a565b005b3480156101a757600080fd5b5061020a6101b6366004612a87565b6001600160a01b039283166000908152609960209081526040808320948352938152838220929094168152925290205462ffffff8116916001600160601b0363010000008304811692600160781b90041690565b6040805162ffffff90941684526001600160601b0392831660208501529116908201526060015b60405180910390f35b610199610248366004612a40565b61067c565b34801561025957600080fd5b5061026d610268366004612b0e565b61068f565b6040519015158152602001610231565b34801561028957600080fd5b50610199610298366004612b63565b610720565b3480156102a957600080fd5b506102f66102b8366004612ba5565b609b60209081526000928352604080842090915290825290205460ff811690610100810463ffffffff1690600160281b90046001600160d81b031683565b60408051931515845263ffffffff90921660208401526001600160d81b031690820152606001610231565b34801561032d57600080fd5b5061034161033c366004612ba5565b61077f565b6040805163ffffffff90931683526001600160d81b03909116602083015201610231565b34801561037157600080fd5b50610199610380366004612bf5565b6107c9565b34801561039157600080fd5b5060655460ff1661026d565b3480156103a957600080fd5b506101996103b8366004612c70565b610856565b3480156103c957600080fd5b5061019961086a565b3480156103de57600080fd5b506101996103ed366004612c70565b61087e565b3480156103fe57600080fd5b5061019961040d366004612ca6565b6108a8565b34801561041e57600080fd5b506033546001600160a01b03165b6040516001600160a01b039091168152602001610231565b34801561045057600080fd5b5061019961045f366004612d05565b6109cb565b34801561047057600080fd5b5061019961047f366004612d5c565b610a49565b34801561049057600080fd5b5061020a61049f366004612a87565b609960209081526000938452604080852082529284528284209052825290205462ffffff8116906001600160601b0363010000008204811691600160781b90041683565b3480156104ef57600080fd5b5061051b6104fe366004612ba5565b609a60209081526000928352604080842090915290825290205481565b604051908152602001610231565b34801561053557600080fd5b5060975461042c906001600160a01b031681565b34801561055557600080fd5b50610569610564366004612d8a565b610a7c565b6040516001600160d81b039091168152602001610231565b61019961058f366004612ddb565b610a95565b6101996105a2366004612e39565b610bb5565b6101996105b5366004612e39565b610c0c565b3480156105c657600080fd5b506101996105d5366004612ca6565b610c1f565b3480156105e657600080fd5b506101996105f5366004612c70565b610cb2565b34801561060657600080fd5b50610199610615366004612c70565b610cdc565b610622610d52565b61062d838383610d98565b816001600160a01b0316836001600160a01b03166000805160206132dd833981519152836040518060200160405280600081525060405161066f929190612f03565b60405180910390a3505050565b610684610d52565b61062d8383836110d9565b6000805b828110156107135760008484838181106106af576106af612f27565b90506020020160208101906106c49190612c70565b6001600160a01b038088166000908152609b602090815260408083209385168352929052205490915060ff161561070057600192505050610719565b508061070b81612f53565b915050610693565b50600090505b9392505050565b610728610d52565b60005b8181101561077a57600083838381811061074757610747612f27565b905060200201602081019061075c9190612c70565b90506107678161154b565b508061077281612f53565b91505061072b565b505050565b6001600160a01b038281166000908152609b6020908152604080832093851683529290522054610100810463ffffffff1690600160281b90046001600160d81b03165b9250929050565b6107d1611638565b6001600160a01b038681166000908152609960209081526040808320898452825280832093881683529290522080546001600160601b03838116600160781b026bffffffffffffffffffffffff60781b199186166301000000026effffffffffffffffffffffffffffff1990931662ffffff8816179290921716179055505050505050565b61085e610d52565b6108678161154b565b50565b610872611638565b61087c6000611692565b565b610886611638565b609880546001600160a01b0319166001600160a01b0392909216919091179055565b6108b0610d52565b6108bb8160026116e4565b6108f06108ea600160026108d56060860160408701612c70565b6108e56080870160608801612f6c565b6116fe565b82611812565b6098546001600160a01b03166320dbd9386109116040840160208501612c70565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015610955573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109799190612f87565b156108675760405162461bcd60e51b815260206004820152601c60248201527f526563656976657220616464726573732070726f68697462697465640000000060448201526064015b60405180910390fd5b6109d3610d52565b6109de8360036116e4565b6109e783611dfd565b6109f76060840160408501612c70565b6001600160a01b0316610a106040850160208601612c70565b6001600160a01b03166000805160206132dd833981519152610a386080870160608801612f6c565b858560405161066f93929190612fcd565b610a51611638565b6001600160a01b03919091166000908152609c60205260409020805460ff1916911515919091179055565b6000610a8a858585856116fe565b90505b949350505050565b610a9d610d52565b610ade848484848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061222492505050565b610b1b610b15610af46040870160208801612c70565b85610b056060890160408a01612c70565b6108e560808a0160608b01612f6c565b85611812565b610b2b6040850160208601612c70565b6001600160a01b031663079a84523485610b4b6060890160408a01612c70565b610b5b60808a0160608b01612f6c565b87876040518763ffffffff1660e01b8152600401610b7d959493929190612ff2565b6000604051808303818588803b158015610b9657600080fd5b505af1158015610baa573d6000803e3d6000fd5b505050505050505050565b610bbd610d52565b610bc88585856110d9565b836001600160a01b0316856001600160a01b03166000805160206132dd833981519152858585604051610bfd93929190612fcd565b60405180910390a35050505050565b610c14610d52565b610bc8858585610d98565b610c27610d52565b610c328160036116e4565b610c3b81611dfd565b610c4b6060820160408301612c70565b6001600160a01b0316610c646040830160208401612c70565b6001600160a01b03166000805160206132dd833981519152610c8c6080850160608601612f6c565b60408051602081018252600081529051610ca7929190612f03565b60405180910390a350565b610cba611638565b609780546001600160a01b0319166001600160a01b0392909216919091179055565b610ce4611638565b6001600160a01b038116610d495760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109c2565b61086781611692565b60655460ff161561087c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016109c2565b336000908152609c602052604090205460ff16610df75760405162461bcd60e51b815260206004820152601c60248201527f4e6f742066726f6d2061206578656d7074656420636f6e74726163740000000060448201526064016109c2565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03831601610e7957806001600160d81b03163414610e745760405162461bcd60e51b815260206004820152601d60248201527f496e636f727265637420616d6f756e742073656e64656420746f20534100000060448201526064016109c2565b61105d565b6040516370a0823160e01b81523360048201526001600160d81b038216906001600160a01b038416906370a0823190602401602060405180830381865afa158015610ec8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eec919061302c565b1015610f3a5760405162461bcd60e51b815260206004820152601a60248201527f4e6f7420656e6f75676820746f6b656e20696e2077616c6c657400000000000060448201526064016109c2565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa5919061302c565b9050610fbc833330856001600160d81b031661256a565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015611003573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611027919061302c565b90506001600160d81b03831661103d8383613045565b1461105a5760405162461bcd60e51b81526004016109c290613058565b50505b6001600160a01b038381166000908152609b60209081526040808320938616835292905220805460ff19166001178082558291906005906110b09084906001600160d81b03600160281b9091041661308f565b92506101000a8154816001600160d81b0302191690836001600160d81b03160217905550505050565b60006110e860018085856116fe565b905060006110f6828461308f565b905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b038516016111d957806001600160d81b03163410156111765760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420656e6f75676820746f6b656e2073656e64656420746f20534100000060448201526064016109c2565b600061118b6001600160d81b03851634613045565b905080156111d3576097546001600160a01b039081166000908152609a60209081526040808320938916835292905290812080548392906111cd9084906130b6565b90915550505b50611415565b6040516370a0823160e01b81523360048201526001600160d81b038216906001600160a01b038616906370a0823190602401602060405180830381865afa158015611228573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124c919061302c565b101561129a5760405162461bcd60e51b815260206004820152601a60248201527f4e6f7420656e6f75676820746f6b656e20696e2077616c6c657400000000000060448201526064016109c2565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa1580156112e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611305919061302c565b905061131c853330856001600160d81b031661256a565b6040516370a0823160e01b81523060048201526000906001600160a01b038716906370a0823190602401602060405180830381865afa158015611363573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611387919061302c565b90506001600160d81b03831661139d8383613045565b146113ba5760405162461bcd60e51b81526004016109c290613058565b6001600160d81b03841615611412576097546001600160a01b039081166000908152609a60209081526040808320938a16835292905290812080546001600160d81b038716929061140c9084906130b6565b90915550505b50505b6001600160a01b038581166000908152609b60209081526040808320938816835292905220805460ff19166001178082558491906005906114689084906001600160d81b03600160281b9091041661308f565b82546001600160d81b039182166101009390930a92830291909202199091161790555060985460405163041b7b2760e31b81523360048201526001600160a01b03909116906320dbd93890602401602060405180830381865afa1580156114d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114f79190612f87565b156115445760405162461bcd60e51b815260206004820152601a60248201527f53656e64657220616464726573732070726f686974626974656400000000000060448201526064016109c2565b5050505050565b336000908152609a602090815260408083206001600160a01b0385168452909152902054801561163457336000908152609a602090815260408083206001600160a01b038616808552925282209190915573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed190161162957604051600090339083908381818185875af1925050503d80600081146115f9576040519150601f19603f3d011682016040523d82523d6000602084013e6115fe565b606091505b505090508061077a57604051630cd9003760e01b8152336004820152602481018390526044016109c2565b6116348233836125db565b5050565b6033546001600160a01b0316331461087c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109c2565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611634828260405180602001604052806000815250612224565b6001600160a01b038481166000908152609960209081526040808320878452825280832093861683529290529081208054630100000090046001600160601b031661177f5760405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08185b1b1bddd959607a1b60448201526064016109c2565b8054620f4240906117959062ffffff16856130c9565b61179f91906130fb565b81549092506001600160601b0363010000008204811691600160781b9004166001600160d81b0384168111156117e057806001600160601b03169350611807565b816001600160601b0316846001600160d81b0316111561180757816001600160601b031693505b505050949350505050565b60008261182560e0840160c08501612f6c565b6118356080850160608601612f6c565b61183f919061308f565b611849919061308f565b90506001600160d81b038116609b60006118666020860186612c70565b6001600160a01b03166001600160a01b03168152602001908152602001600020600084604001602081019061189b9190612c70565b6001600160a01b03168152602081019190915260400160002054600160281b90046001600160d81b031610156119135760405162461bcd60e51b815260206004820152601e60248201527f4e6f7420656e6f75676820746f6b656e20696e2053412062616c616e6365000060448201526064016109c2565b80609b60006119256020860186612c70565b6001600160a01b03166001600160a01b03168152602001908152602001600020600084604001602081019061195a9190612c70565b6001600160a01b0316815260208101919091526040016000208054600590611993908490600160281b90046001600160d81b031661312f565b92506101000a8154816001600160d81b0302191690836001600160d81b0316021790555073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b03168260400160208101906119e89190612c70565b6001600160a01b031603611ad1576000611a086040840160208501612c70565b6001600160a01b0316611a216080850160608601612f6c565b6001600160d81b031660405160006040518083038185875af1925050503d8060008114611a6a576040519150601f19603f3d011682016040523d82523d6000602084013e611a6f565b606091505b5050905080611acb57611a886040840160208501612c70565b611a986080850160608601612f6c565b604051630cd9003760e01b81526001600160a01b0390921660048301526001600160d81b031660248201526044016109c2565b50611c51565b6000611ae36060840160408501612c70565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015611b29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b4d919061302c565b9050611b90611b626060850160408601612c70565b611b726040860160208701612c70565b611b826080870160608801612f6c565b6001600160d81b03166125db565b6000611ba26060850160408601612c70565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015611be8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c0c919061302c565b9050611c1e6080850160608601612f6c565b6001600160d81b0316611c318284613045565b14611c4e5760405162461bcd60e51b81526004016109c290613058565b50505b6000611c6360e0840160c08501612f6c565b6001600160d81b03161115611d0957611c8260e0830160c08401612f6c565b6001600160d81b0316609a6000611c9f60c0860160a08701612c70565b6001600160a01b03166001600160a01b031681526020019081526020016000206000846040016020810190611cd49190612c70565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254611d0391906130b6565b90915550505b6001600160d81b03831615611d85576097546001600160a01b03166000908152609a60205260408082206001600160d81b038616929091611d509060608701908701612c70565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254611d7f91906130b6565b90915550505b611d956060830160408401612c70565b6001600160a01b0316611dab6020840184612c70565b6001600160a01b03167fb1a3aeb391a0162ebb845ef6be3d229bd9543a09c0e411dadee01d7b8c7837b0611de56080860160608701612f6c565b6040516001600160d81b03909116815260200161066f565b6000611e16600160036108d56060860160408701612c70565b90506000611e2a60e0840160c08501612f6c565b82611e3b6080860160608701612f6c565b611e45919061308f565b611e4f919061308f565b90506001600160d81b038116609b6000611e6c6020870187612c70565b6001600160a01b03166001600160a01b031681526020019081526020016000206000856040016020810190611ea19190612c70565b6001600160a01b03168152602081019190915260400160002054600160281b90046001600160d81b03161015611f195760405162461bcd60e51b815260206004820152601e60248201527f4e6f7420656e6f75676820746f6b656e20696e2053412062616c616e6365000060448201526064016109c2565b80609b6000611f2b6020870187612c70565b6001600160a01b03166001600160a01b031681526020019081526020016000206000856040016020810190611f609190612c70565b6001600160a01b0316815260208101919091526040016000208054600590611f99908490600160281b90046001600160d81b031661312f565b92506101000a8154816001600160d81b0302191690836001600160d81b031602179055506000826001600160d81b0316111561203c576097546001600160a01b03166000908152609a60205260408082206001600160d81b0385169290916120079060608801908801612c70565b6001600160a01b03166001600160a01b03168152602001908152602001600020600082825461203691906130b6565b90915550505b6001609b60006120526040870160208801612c70565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008560400160208101906120879190612c70565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790556120bf6080840160608501612f6c565b609b60006120d36040870160208801612c70565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008560400160208101906121089190612c70565b6001600160a01b0316815260208101919091526040016000208054600590612141908490600160281b90046001600160d81b031661308f565b92506101000a8154816001600160d81b0302191690836001600160d81b0316021790555060008360c001602081019061217a9190612f6c565b6001600160d81b0316111561077a5761219960e0840160c08501612f6c565b6001600160d81b0316609a60006121b660c0870160a08801612c70565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008560400160208101906121eb9190612c70565b6001600160a01b03166001600160a01b03168152602001908152602001600020600082825461221a91906130b6565b9091555050505050565b60006122c4463061223b6040880160208901612c70565b8661224c60608a0160408b01612c70565b61225c60808b0160608c01612f6c565b8861226d60a08d0160808e0161314f565b61227d60c08e0160a08f01612c70565b8d60c00160208101906122909190612f6c565b8e61014001356040516020016122b09b9a99989796959493929190613175565b60405160208183030381529060405261260b565b905060006001826122dd610140880161012089016131fc565b6040805160008152602081018083529390935260ff9091169082015260e08701356060820152610100870135608082015260a0016020604051602081039080840390855afa158015612333573d6000803e3d6000fd5b5050604051601f190151915061234e90506020860186612c70565b6001600160a01b0316816001600160a01b031614801561237657506001600160a01b03811615155b6123c25760405162461bcd60e51b815260206004820152601860248201527f4661696c20746f20766572696679207369676e6174757265000000000000000060448201526064016109c2565b6123d260a086016080870161314f565b63ffffffff16609b60006123e96020890189612c70565b6001600160a01b03166001600160a01b03168152602001908152602001600020600087604001602081019061241e9190612c70565b6001600160a01b03168152602081019190915260400160002054610100900463ffffffff16146124825760405162461bcd60e51b815260206004820152600f60248201526e496e636f7272656374206e6f6e636560881b60448201526064016109c2565b8461014001354211156124c95760405162461bcd60e51b815260206004820152600f60248201526e14995c5d595cdd08195e1c1a5c9959608a1b60448201526064016109c2565b6001609b60006124dc6020890189612c70565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008760400160208101906125119190612c70565b6001600160a01b0316815260208101919091526040016000208054600190612545908490610100900463ffffffff1661321f565b92506101000a81548163ffffffff021916908363ffffffff1602179055505050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526125d59085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612646565b50505050565b6040516001600160a01b03831660248201526044810182905261077a90849063a9059cbb60e01b9060640161259e565b6000612617825161271b565b8260405160200161262992919061323c565b604051602081830303815290604052805190602001209050919050565b600061269b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166127ae9092919063ffffffff16565b90508051600014806126bc5750808060200190518101906126bc9190612f87565b61077a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109c2565b60606000612728836127bd565b600101905060008167ffffffffffffffff81111561274857612748613297565b6040519080825280601f01601f191660200182016040528015612772576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461277c57509392505050565b6060610a8d8484600085612896565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106127fc5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612828576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061284657662386f26fc10000830492506010015b6305f5e100831061285e576305f5e100830492506008015b612710831061287257612710830492506004015b60648310612884576064830492506002015b600a8310612890576001015b92915050565b6060824710156128f75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109c2565b600080866001600160a01b0316858760405161291391906132ad565b60006040518083038185875af1925050503d8060008114612950576040519150601f19603f3d011682016040523d82523d6000602084013e612955565b606091505b509150915061296687838387612971565b979650505050505050565b606083156129e05782516000036129d9576001600160a01b0385163b6129d95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109c2565b5081610a8d565b610a8d83838151156129f55781518083602001fd5b8060405162461bcd60e51b81526004016109c291906132c9565b6001600160a01b038116811461086757600080fd5b80356001600160d81b0381168114612a3b57600080fd5b919050565b600080600060608486031215612a5557600080fd5b8335612a6081612a0f565b92506020840135612a7081612a0f565b9150612a7e60408501612a24565b90509250925092565b600080600060608486031215612a9c57600080fd5b8335612aa781612a0f565b9250602084013591506040840135612abe81612a0f565b809150509250925092565b60008083601f840112612adb57600080fd5b50813567ffffffffffffffff811115612af357600080fd5b6020830191508360208260051b85010111156107c257600080fd5b600080600060408486031215612b2357600080fd5b8335612b2e81612a0f565b9250602084013567ffffffffffffffff811115612b4a57600080fd5b612b5686828701612ac9565b9497909650939450505050565b60008060208385031215612b7657600080fd5b823567ffffffffffffffff811115612b8d57600080fd5b612b9985828601612ac9565b90969095509350505050565b60008060408385031215612bb857600080fd5b8235612bc381612a0f565b91506020830135612bd381612a0f565b809150509250929050565b80356001600160601b0381168114612a3b57600080fd5b60008060008060008060c08789031215612c0e57600080fd5b8635612c1981612a0f565b9550602087013594506040870135612c3081612a0f565b9350606087013562ffffff81168114612c4857600080fd5b9250612c5660808801612bde565b9150612c6460a08801612bde565b90509295509295509295565b600060208284031215612c8257600080fd5b813561071981612a0f565b60006101608284031215612ca057600080fd5b50919050565b60006101608284031215612cb957600080fd5b6107198383612c8d565b60008083601f840112612cd557600080fd5b50813567ffffffffffffffff811115612ced57600080fd5b6020830191508360208285010111156107c257600080fd5b60008060006101808486031215612d1b57600080fd5b612d258585612c8d565b925061016084013567ffffffffffffffff811115612d4257600080fd5b612b5686828701612cc3565b801515811461086757600080fd5b60008060408385031215612d6f57600080fd5b8235612d7a81612a0f565b91506020830135612bd381612d4e565b60008060008060808587031215612da057600080fd5b8435612dab81612a0f565b9350602085013592506040850135612dc281612a0f565b9150612dd060608601612a24565b905092959194509250565b6000806000806101a08587031215612df257600080fd5b612dfc8686612c8d565b9350610160850135925061018085013567ffffffffffffffff811115612e2157600080fd5b612e2d87828801612cc3565b95989497509550505050565b600080600080600060808688031215612e5157600080fd5b8535612e5c81612a0f565b94506020860135612e6c81612a0f565b9350612e7a60408701612a24565b9250606086013567ffffffffffffffff811115612e9657600080fd5b612ea288828901612cc3565b969995985093965092949392505050565b60005b83811015612ece578181015183820152602001612eb6565b50506000910152565b60008151808452612eef816020860160208601612eb3565b601f01601f19169290920160200192915050565b6001600160d81b0383168152604060208201819052600090610a8d90830184612ed7565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612f6557612f65612f3d565b5060010190565b600060208284031215612f7e57600080fd5b61071982612a24565b600060208284031215612f9957600080fd5b815161071981612d4e565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160d81b0384168152604060208201819052600090610a8a9083018486612fa4565b8581526001600160a01b03851660208201526001600160d81b03841660408201526080606082018190526000906129669083018486612fa4565b60006020828403121561303e57600080fd5b5051919050565b8181038181111561289057612890612f3d565b6020808252601f908201527f42616c616e6365206d69736d61746368206166746572207472616e7366657200604082015260600190565b6001600160d81b038181168382160190808211156130af576130af612f3d565b5092915050565b8082018082111561289057612890612f3d565b6001600160d81b038281168282168181028316929181158285048214176130f2576130f2612f3d565b50505092915050565b60006001600160d81b038381168061312357634e487b7160e01b600052601260045260246000fd5b92169190910492915050565b6001600160d81b038281168282160390808211156130af576130af612f3d565b60006020828403121561316157600080fd5b813563ffffffff8116811461071957600080fd5b8b81526001600160a01b038b811660208301528a81166040830152606082018a905288811660808301526001600160d81b0388811660a084015261016060c0840181905260009290916131ca8584018b612ed7565b63ffffffff9990991660e086015296166101008401525050919092166101208201526101400152979650505050505050565b60006020828403121561320e57600080fd5b813560ff8116811461071957600080fd5b63ffffffff8181168382160190808211156130af576130af612f3d565b7f19457468657265756d205369676e6564204d6573736167653a0a00000000000081526000835161327481601a850160208801612eb3565b83519083019061328b81601a840160208801612eb3565b01601a01949350505050565b634e487b7160e01b600052604160045260246000fd5b600082516132bf818460208701612eb3565b9190910192915050565b6020815260006107196020830184612ed756fecb208517ce6623369603eefdd3d201e39b39fb29ec84a590b911b118e4582ec1a2646970667358221220e063b7c6740fd50d213b5babeb7e967f5f9a7d9862f1898eeab496fc4fe20b5764736f6c63430008130033

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
0x5D0DfE47EA361fE4303d64aF05A981c9DA665387
Loading...
Loading
Loading...
Loading

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.