ETH Price: $3,265.68 (+0.49%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

1 address found via
Transaction Hash
Method
Block
From
To
Withdraw198880782024-05-17 7:02:23251 days ago1715929343IN
0x32b2e954...36e6D52E6
0 ETH0.000167925.16437115
Set Beneficiary198880752024-05-17 7:01:47251 days ago1715929307IN
0x32b2e954...36e6D52E6
0 ETH0.000141744.88126899
Pay Token198825732024-05-16 12:35:23252 days ago1715862923IN
0x32b2e954...36e6D52E6
0 ETH0.00061166.24136027
Pay Native198823962024-05-16 11:59:59252 days ago1715860799IN
0x32b2e954...36e6D52E6
0.001679 ETH0.000268534.28454754
Pay Native198823142024-05-16 11:43:23252 days ago1715859803IN
0x32b2e954...36e6D52E6
0.006738 ETH0.00035875.72317948
Pay Native198821082024-05-16 11:01:47252 days ago1715857307IN
0x32b2e954...36e6D52E6
0.001681 ETH0.000399726.37757605
Pay Native198818302024-05-16 10:05:59252 days ago1715853959IN
0x32b2e954...36e6D52E6
0.006719 ETH0.000281434.49034561
Pay Native198818272024-05-16 10:05:23252 days ago1715853923IN
0x32b2e954...36e6D52E6
0.016803 ETH0.000288694.60701094
Pay Native198818042024-05-16 10:00:47252 days ago1715853647IN
0x32b2e954...36e6D52E6
0.167923 ETH0.000317435.06375214
Pay Native198818002024-05-16 9:59:59252 days ago1715853599IN
0x32b2e954...36e6D52E6
0.033609 ETH0.000327835.23067341
Pay Native198817992024-05-16 9:59:47252 days ago1715853587IN
0x32b2e954...36e6D52E6
0.168059 ETH0.000309924.94388819
Pay Native198817982024-05-16 9:59:35252 days ago1715853575IN
0x32b2e954...36e6D52E6
0.168059 ETH0.000305224.86899132
Pay Native198817962024-05-16 9:59:11252 days ago1715853551IN
0x32b2e954...36e6D52E6
0.168059 ETH0.000307364.90304033
Pay Native198817962024-05-16 9:59:11252 days ago1715853551IN
0x32b2e954...36e6D52E6
0.168059 ETH0.000307454.90445168
Pay Native198817952024-05-16 9:58:59252 days ago1715853539IN
0x32b2e954...36e6D52E6
0.168059 ETH0.000338445.39885158
Pay Native198817932024-05-16 9:58:35252 days ago1715853515IN
0x32b2e954...36e6D52E6
0.067221 ETH0.00031144.96842057
Pay Native198817932024-05-16 9:58:35252 days ago1715853515IN
0x32b2e954...36e6D52E6
0.033609 ETH0.000336595.37141737
Pay Native198817922024-05-16 9:58:23252 days ago1715853503IN
0x32b2e954...36e6D52E6
0.168059 ETH0.000310524.95352427
Pay Native198817902024-05-16 9:57:59252 days ago1715853479IN
0x32b2e954...36e6D52E6
0.006719 ETH0.000314965.02621437
Pay Native198817892024-05-16 9:57:47252 days ago1715853467IN
0x32b2e954...36e6D52E6
0.016803 ETH0.000339475.41642206
Pay Native198817882024-05-16 9:57:35252 days ago1715853455IN
0x32b2e954...36e6D52E6
0.168059 ETH0.000298934.76858724
Pay Native198817862024-05-16 9:57:11252 days ago1715853431IN
0x32b2e954...36e6D52E6
0.016803 ETH0.000282914.51385695
Pay Native198817862024-05-16 9:57:11252 days ago1715853431IN
0x32b2e954...36e6D52E6
0.067221 ETH0.000282914.51385695
Pay Native198817862024-05-16 9:57:11252 days ago1715853431IN
0x32b2e954...36e6D52E6
0.168059 ETH0.000282964.51385695
Pay Native198817862024-05-16 9:57:11252 days ago1715853431IN
0x32b2e954...36e6D52E6
0.006719 ETH0.000282854.51385695
View all transactions

Latest 4 internal transactions

Advanced mode:
Parent Transaction Hash Block
From
To
198880782024-05-17 7:02:23251 days ago1715929343
0x32b2e954...36e6D52E6
43.090861 ETH
197530902024-04-28 10:02:11270 days ago1714298531
0x32b2e954...36e6D52E6
168.951065 ETH
197316842024-04-25 10:08:11273 days ago1714039691
0x32b2e954...36e6D52E6
0.00095 ETH
197315832024-04-25 9:47:47273 days ago1714038467
0x32b2e954...36e6D52E6
0.001 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Payport

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 12 : Payport.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import "@openzeppelin/[email protected]/access/Ownable.sol";
import "@openzeppelin/[email protected]/utils/cryptography/ECDSA.sol";
import "@openzeppelin/[email protected]/utils/cryptography/SignatureChecker.sol";
import "@openzeppelin/[email protected]/token/ERC20/IERC20.sol";
import "@openzeppelin/[email protected]/utils/Address.sol";
import "@openzeppelin/[email protected]/security/ReentrancyGuard.sol";

/**
 * @title Payport
 * @dev Space Nation pay contract
 * @author @SpaceNation
 * @notice Space Nation pay contract
 * @custom:security-contact Jace <[email protected]>
 */
contract Payport is Ownable, ReentrancyGuard {
    event Pay(uint64 indexed _type, uint64 indexed _payId); //1store 0 CHR
    using ECDSA for bytes32;
    address private _beneficiary = 0x3CD1fAcFDcb5E3a935E495AE3552B38e6ace8178;
    uint256 public taxFee = 5;

    mapping(uint32 => address) public tokenAddressFromId;

    address private _cosigner = 0x8b05e8816D48585A7bb3083fC739e8a6Ccff51Fb;
    uint64 private _timestampExpirySeconds = 300;
    mapping(uint64 => bool) private _sigvalue; //orderId=>true
    mapping(uint64 => uint32) private _sales; //goodsId=>100
    mapping(uint64 => bool) private _sigvaluec2c; //orderId=>true
    mapping(uint64 => uint32) private _salesc2c; //goodsId=>100
    bool public _single;

    /**
     * @dev set tax fee
     * @notice set tax fee
     * @param fee the new fee
     */
    function setTaxFee(uint256 fee) external onlyOwner {
        require(fee != 0, "TaxFee_Need_More_Than_0");
        require(fee < 100, "TaxFee_Need_Lee_Than_100");
        taxFee = fee;
    }

    function denominator() private pure returns (uint256) {
        return 100;
    }

    /**
     * @dev setTokenAddressID
     * @notice setTokenAddressID
     * @param tokenaddress the token address
     * @param id the id
     */
    function setTokenAddressID(address tokenaddress, uint32 id)
        external
        onlyOwner
    {
        tokenAddressFromId[id] = tokenaddress;
    }

    /**
     * @dev Sets beneficiary.
     * @notice Sets beneficiary.
     * @param beneficiary the new beneficiary
     */
    function setBeneficiary(address beneficiary) external onlyOwner {
        _beneficiary = beneficiary;
    }

    /**
     * @dev payNative
     * @notice payNative
     * @param value the value
     * @param num32 [tokenAddressId,qty,supply,chainId]
     * @param num64 [orderId,payId,goodsId,timestamp]
     * @param signature the signature
     */
    function payNative(
        uint256 value,
        uint32[4] memory num32,
        uint64[4] memory num64,
        bytes calldata signature
    ) external payable nonReentrant {
        require(msg.value == value, "Invalid_ETH_Value");
        checkPay(value, num32, num64, signature);
        if (_single) {
            Address.sendValue(payable(_beneficiary), value);
        }
        emit Pay(1, num64[1]);
    }

    /**
     * @dev payToken
     * @notice payToken
     * @param value the value
     * @param num32 [tokenAddressId,qty,supply,chainId]
     * @param num64 [orderId,payId,goodsId,timestamp]
     * @param signature the signature
     */
    function payToken(
        uint256 value,
        uint32[4] memory num32,
        uint64[4] memory num64,
        bytes calldata signature
    ) external nonReentrant {
        address tokenAddress = tokenAddressFromId[num32[0]];
        require(tokenAddress != address(0), "Invalid_Token");
        checkPay(value, num32, num64, signature);
        (bool transRes, bytes memory result) = tokenAddress.call(
            abi.encodeWithSignature(
                "transferFrom(address,address,uint256)",
                _msgSender(),
                _beneficiary,
                value
            )
        );
        if (!transRes) {
            assembly {
                revert(add(result, 32), mload(result))
            }
        }
        emit Pay(1, num64[1]);
    }

    /**
     * @dev checkPay
     * @param value the value
     * @param num32 the num32
     * @param num64 the num64
     * @param signature the signature
     */
    function checkPay(
        uint256 value,
        uint32[4] memory num32,
        uint64[4] memory num64,
        bytes calldata signature
    ) private {
        num32[3] = _chainID();
        require(
            matchSigner(
                getCosignDigest(_msgSender(), value, num32, num64, address(0)),
                signature
            ),
            "Invalid_Signature"
        );
        require(
            (_timestampExpirySeconds + num64[3] >= block.timestamp),
            "HAS_Expired"
        );
        require((!_sigvalue[num64[0]]), "HAS_USED");
        _sigvalue[num64[0]] = true;
        if (num32[2] > 0) {
            require(_sales[num64[2]] + num32[1] <= num32[2], "SOLD_OUT");
            _sales[num64[2]] += num32[1];
        }
    }

    /**
     * @dev C2CpayNative
     * @notice C2CpayNative
     * @param value the value
     * @param num32 [tokenAddressId,qty,supply,chainId]
     * @param num64 [orderId,payId,goodsId,timestamp]
     * @param signature the signature
     * @param to the to
     */
    function C2CpayNative(
        uint256 value,
        uint32[4] memory num32,
        uint64[4] memory num64,
        bytes calldata signature,
        address to
    ) external payable nonReentrant {
        require(msg.value == value, "Invalid_ETH_Value");
        checkC2Cpay(value, num32, num64, signature, to);
        uint256 payTaxFee = (value * taxFee) / denominator();
        Address.sendValue(payable(to), value - payTaxFee);
        if (_single) {
            Address.sendValue(payable(_beneficiary), payTaxFee);
        }
        emit Pay(0, num64[1]);
    }

    /**
     * @dev C2CpayToken
     * @notice C2CpayToken
     * @param value the value
     * @param num32 [tokenAddressId,qty,supply,chainId]
     * @param num64 [orderId,payId,goodsId,timestamp]
     * @param signature the signature
     * @param to the to
     */
    function C2CpayToken(
        uint256 value,
        uint32[4] memory num32,
        uint64[4] memory num64,
        bytes calldata signature,
        address to
    ) external nonReentrant {
        address tokenAddress = tokenAddressFromId[num32[0]];
        require(tokenAddress != address(0), "Invalid_Token");
        checkC2Cpay(value, num32, num64, signature, to);
        uint256 payTaxFee = (value * taxFee) / denominator();
        (bool transRes, bytes memory result) = tokenAddress.call(
            abi.encodeWithSignature(
                "transferFrom(address,address,uint256)",
                _msgSender(),
                to,
                value - payTaxFee
            )
        );
        (bool transRes1, bytes memory result1) = tokenAddress.call(
            abi.encodeWithSignature(
                "transferFrom(address,address,uint256)",
                _msgSender(),
                _beneficiary,
                payTaxFee
            )
        );
        if (!transRes || !transRes1) {
            assembly {
                revert(add(result, 32), mload(result))
            }
        }
        emit Pay(0, num64[1]);
    }

    /**
     * @dev checkC2Cpay
     * @param value the value
     * @param num32 the num32
     * @param num64 the num64
     * @param signature the signature
     * @param to the to
     */
    function checkC2Cpay(
        uint256 value,
        uint32[4] memory num32,
        uint64[4] memory num64,
        bytes calldata signature,
        address to
    ) private {
        num32[3] = _chainID();
        require(
            matchSigner(
                getCosignDigest(_msgSender(), value, num32, num64, to),
                signature
            ),
            "Invalid_Signature"
        );
        require(
            (_timestampExpirySeconds + num64[3] >= block.timestamp),
            "HAS_Expired"
        );
        require((!_sigvaluec2c[num64[0]]), "HAS_USED");
        _sigvaluec2c[num64[0]] = true;
        if (num32[2] > 0) {
            require(_salesc2c[num64[2]] + num32[1] <= num32[2], "SOLD_OUT");
            _salesc2c[num64[2]] += num32[1];
        }
    }

    /**
     * @dev Returns data hash for the given MyParams.
     */
    function getCosignDigest(
        address _msgSender,
        uint256 _value,
        uint32[4] memory _num32,
        uint64[4] memory _num64,
        address _to
    ) private pure returns (bytes32) {
        if (_to == address(0)) {
            return
                keccak256(abi.encodePacked(_msgSender, _value, _num32, _num64))
                    .toEthSignedMessageHash();
        } else {
            return
                keccak256(
                    abi.encodePacked(_msgSender, _value, _num32, _num64, _to)
                ).toEthSignedMessageHash();
        }
    }

    function matchSigner(bytes32 hash, bytes memory signature)
        private
        view
        returns (bool)
    {
        return SignatureChecker.isValidSignatureNow(_cosigner, hash, signature);
    }

    /**
     * @dev Returns chain id.
     */
    function _chainID() public view returns (uint32) {
        uint32 chainID;
        assembly {
            chainID := chainid()
        }
        return chainID;
    }

    /**
     * @dev Sets cosigner.
     */
    function setCosigner(address cosigner) external onlyOwner {
        _cosigner = cosigner;
    }

    /**
     * @dev Sets expiry in seconds. This timestamp specifies how long a signature from cosigner is valid for.
     */
    function setTimestampExpirySeconds(uint64 expiry) external onlyOwner {
        _timestampExpirySeconds = expiry;
    }

    function renounceOwnership() public view override onlyOwner {
        revert("Closed_Interface");
    }

    /**
     * @dev Withdraws all ETH from this contract.
     */
    function withdraw() external onlyOwner {
        Address.sendValue(payable(_beneficiary), address(this).balance);
    }

    /**
     * @dev getBalance
     */
    function getBalance() external view onlyOwner returns (uint256) {
        return address(this).balance;
    }

    /**
     * @dev setSingle
     * @param isSingle the isSingle
     */
    function setSingle(bool isSingle) external onlyOwner {
        _single = isSingle;
    }
}

File 2 of 12 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 5 of 12 : SignatureChecker.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/SignatureChecker.sol)

pragma solidity ^0.8.0;

import "./ECDSA.sol";
import "../../interfaces/IERC1271.sol";

/**
 * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
 * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like
 * Argent and Gnosis Safe.
 *
 * _Available since v4.1._
 */
library SignatureChecker {
    /**
     * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
     * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.
     *
     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
     * change through time. It could return true at block N and false at block N+1 (or the opposite).
     */
    function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {
        (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);
        return
            (error == ECDSA.RecoverError.NoError && recovered == signer) ||
            isValidERC1271SignatureNow(signer, hash, signature);
    }

    /**
     * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated
     * against the signer smart contract using ERC1271.
     *
     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
     * change through time. It could return true at block N and false at block N+1 (or the opposite).
     */
    function isValidERC1271SignatureNow(
        address signer,
        bytes32 hash,
        bytes memory signature
    ) internal view returns (bool) {
        (bool success, bytes memory result) = signer.staticcall(
            abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)
        );
        return (success &&
            result.length >= 32 &&
            abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));
    }
}

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

pragma solidity ^0.8.0;

import "../Strings.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 ECDSA {
    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", Strings.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));
    }
}

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

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. 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);
    }
}

File 8 of 12 : IERC1271.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC1271 standard signature validation method for
 * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
 *
 * _Available since v4.1._
 */
interface IERC1271 {
    /**
     * @dev Should return whether the signature provided is valid for the provided data
     * @param hash      Hash of the data to be signed
     * @param signature Signature byte array associated with _data
     */
    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}

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

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    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 = Math.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(SignedMath.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, Math.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));
    }
}

File 10 of 12 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

File 11 of 12 : SignedMath.sol
// 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 SignedMath {
    /**
     * @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);
        }
    }
}

File 12 of 12 : Math.sol
// 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 Math {
    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);
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"_type","type":"uint64"},{"indexed":true,"internalType":"uint64","name":"_payId","type":"uint64"}],"name":"Pay","type":"event"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint32[4]","name":"num32","type":"uint32[4]"},{"internalType":"uint64[4]","name":"num64","type":"uint64[4]"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"address","name":"to","type":"address"}],"name":"C2CpayNative","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint32[4]","name":"num32","type":"uint32[4]"},{"internalType":"uint64[4]","name":"num64","type":"uint64[4]"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"address","name":"to","type":"address"}],"name":"C2CpayToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"_chainID","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_single","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint32[4]","name":"num32","type":"uint32[4]"},{"internalType":"uint64[4]","name":"num64","type":"uint64[4]"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"payNative","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint32[4]","name":"num32","type":"uint32[4]"},{"internalType":"uint64[4]","name":"num64","type":"uint64[4]"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"payToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"beneficiary","type":"address"}],"name":"setBeneficiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"cosigner","type":"address"}],"name":"setCosigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"isSingle","type":"bool"}],"name":"setSingle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"setTaxFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"expiry","type":"uint64"}],"name":"setTimestampExpirySeconds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenaddress","type":"address"},{"internalType":"uint32","name":"id","type":"uint32"}],"name":"setTokenAddressID","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"taxFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"tokenAddressFromId","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052600280546001600160a01b031916733cd1facfdcb5e3a935e495ae3552b38e6ace817817905560056003819055805475012c8b05e8816d48585a7bb3083fc739e8a6ccff51fb6001600160e01b031990911617905534801561006557600080fd5b5061006f33610078565b600180556100c8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611afc806100d76000396000f3fe6080604052600436106101145760003560e01c8063715eeb12116100a0578063a071dcf411610064578063a071dcf4146102e9578063beab7131146102ff578063c4081a4c14610320578063ce2b0ec014610340578063f2fde38b1461036057600080fd5b8063715eeb121461025b578063812e498f1461026e5780638339bd6f146102815780638da5cb5b146102ab5780639e21ecb0146102c957600080fd5b80633ccfd60b116100e75780633ccfd60b146101a35780634465af00146101b85780634dec4681146101d85780635e39efc914610226578063715018a61461024657600080fd5b8063020451381461011957806312065fe01461013b5780631c31f710146101635780633cbbdb7714610183575b600080fd5b34801561012557600080fd5b50610139610134366004611568565b610380565b005b34801561014757600080fd5b506101506103aa565b6040519081526020015b60405180910390f35b34801561016f57600080fd5b5061013961017e366004611568565b6103b9565b34801561018f57600080fd5b5061013961019e3660046116c8565b6103e3565b3480156101af57600080fd5b50610139610556565b3480156101c457600080fd5b506101396101d336600461173a565b610576565b3480156101e457600080fd5b5061020e6101f33660046117bc565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161015a565b34801561023257600080fd5b506101396102413660046117d7565b6107cf565b34801561025257600080fd5b5061013961080b565b6101396102693660046116c8565b61084e565b61013961027c36600461173a565b6108fb565b34801561028d57600080fd5b50600a5461029b9060ff1681565b604051901515815260200161015a565b3480156102b757600080fd5b506000546001600160a01b031661020e565b3480156102d557600080fd5b506101396102e436600461180a565b6109d9565b3480156102f557600080fd5b5061015060035481565b34801561030b57600080fd5b5060405163ffffffff4616815260200161015a565b34801561032c57600080fd5b5061013961033b366004611833565b6109f4565b34801561034c57600080fd5b5061013961035b36600461184c565b610aa1565b34801561036c57600080fd5b5061013961037b366004611568565b610ad6565b610388610b4f565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b60006103b4610b4f565b504790565b6103c1610b4f565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6103eb610ba9565b835163ffffffff166000908152600460205260409020546001600160a01b03168061044d5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b22faa37b5b2b760991b60448201526064015b60405180910390fd5b61045a8686868686610c02565b6000806001600160a01b038316336002546040516001600160a01b03928316602482015291166044820152606481018a905260840160408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b179052516104c4919061188b565b6000604051808303816000865af19150503d8060008114610501576040519150601f19603f3d011682016040523d82523d6000602084013e610506565b606091505b50915091508161051857805160208201fd5b60208601516040516001600160401b0390911690600190600080516020611aa783398151915290600090a350505061054f60018055565b5050505050565b61055e610b4f565b600254610574906001600160a01b031647610e64565b565b61057e610ba9565b845163ffffffff166000908152600460205260409020546001600160a01b0316806105db5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b22faa37b5b2b760991b6044820152606401610444565b6105e9878787878787610f82565b600060646003546105fa908a6118bd565b61060491906118d4565b90506000806001600160a01b038416338661061f868e6118f6565b6040516001600160a01b039384166024820152929091166044830152606482015260840160408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b17905251610678919061188b565b6000604051808303816000865af19150503d80600081146106b5576040519150601f19603f3d011682016040523d82523d6000602084013e6106ba565b606091505b5091509150600080856001600160a01b03166106d33390565b6002546040516001600160a01b039283166024820152911660448201526064810187905260840160408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b1790525161072f919061188b565b6000604051808303816000865af19150503d806000811461076c576040519150601f19603f3d011682016040523d82523d6000602084013e610771565b606091505b5091509150831580610781575081155b1561078e57825160208401fd5b60208a01516040516001600160401b0390911690600090600080516020611aa7833981519152908290a35050505050506107c760018055565b505050505050565b6107d7610b4f565b63ffffffff16600090815260046020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b610813610b4f565b60405162461bcd60e51b815260206004820152601060248201526f436c6f7365645f496e7465726661636560801b6044820152606401610444565b610856610ba9565b8434146108995760405162461bcd60e51b8152602060048201526011602482015270496e76616c69645f4554485f56616c756560781b6044820152606401610444565b6108a68585858585610c02565b600a5460ff16156108c7576002546108c7906001600160a01b031686610e64565b60208301516040516001600160401b0390911690600190600080516020611aa783398151915290600090a361054f60018055565b610903610ba9565b8534146109465760405162461bcd60e51b8152602060048201526011602482015270496e76616c69645f4554485f56616c756560781b6044820152606401610444565b610954868686868686610f82565b6000606460035461096590896118bd565b61096f91906118d4565b90506109848261097f838a6118f6565b610e64565b600a5460ff16156109a5576002546109a5906001600160a01b031682610e64565b60208501516040516001600160401b0390911690600090600080516020611aa7833981519152908290a3506107c760018055565b6109e1610b4f565b600a805460ff1916911515919091179055565b6109fc610b4f565b80600003610a4c5760405162461bcd60e51b815260206004820152601760248201527f5461784665655f4e6565645f4d6f72655f5468616e5f300000000000000000006044820152606401610444565b60648110610a9c5760405162461bcd60e51b815260206004820152601860248201527f5461784665655f4e6565645f4c65655f5468616e5f31303000000000000000006044820152606401610444565b600355565b610aa9610b4f565b600580546001600160401b03909216600160a01b0267ffffffffffffffff60a01b19909216919091179055565b610ade610b4f565b6001600160a01b038116610b435760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610444565b610b4c816111e4565b50565b6000546001600160a01b031633146105745760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610444565b600260015403610bfb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610444565b6002600155565b4663ffffffff166060850152610c5b610c1f338787876000611234565b83838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506112d392505050565b610c9b5760405162461bcd60e51b8152602060048201526011602482015270496e76616c69645f5369676e617475726560781b6044820152606401610444565b60608301516005544291610cbe91600160a01b90046001600160401b0316611909565b6001600160401b03161015610d035760405162461bcd60e51b815260206004820152600b60248201526a121054d7d15e1c1a5c995960aa1b6044820152606401610444565b82516001600160401b031660009081526006602052604090205460ff1615610d585760405162461bcd60e51b8152602060048201526008602482015267121054d7d554d15160c21b6044820152606401610444565b82516001600160401b031660009081526006602052604090819020805460ff1916600117905584015163ffffffff161561054f57604080850151602080870151868401516001600160401b0316600090815260079092529290205463ffffffff91821692610dc892909116611930565b63ffffffff161115610e075760405162461bcd60e51b815260206004820152600860248201526714d3d31117d3d55560c21b6044820152606401610444565b6020808501516040808601516001600160401b0316600090815260079093528220805491929091610e3f90849063ffffffff16611930565b92506101000a81548163ffffffff021916908363ffffffff1602179055505050505050565b80471015610eb45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610444565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610f01576040519150601f19603f3d011682016040523d82523d6000602084013e610f06565b606091505b5050905080610f7d5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610444565b505050565b4663ffffffff166060860152610fda610f9e3388888886611234565b84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506112d392505050565b61101a5760405162461bcd60e51b8152602060048201526011602482015270496e76616c69645f5369676e617475726560781b6044820152606401610444565b6060840151600554429161103d91600160a01b90046001600160401b0316611909565b6001600160401b031610156110825760405162461bcd60e51b815260206004820152600b60248201526a121054d7d15e1c1a5c995960aa1b6044820152606401610444565b83516001600160401b031660009081526008602052604090205460ff16156110d75760405162461bcd60e51b8152602060048201526008602482015267121054d7d554d15160c21b6044820152606401610444565b83516001600160401b031660009081526008602052604090819020805460ff1916600117905585015163ffffffff16156107c757604080860151602080880151878401516001600160401b0316600090815260099092529290205463ffffffff9182169261114792909116611930565b63ffffffff1611156111865760405162461bcd60e51b815260206004820152600860248201526714d3d31117d3d55560c21b6044820152606401610444565b6020808601516040808701516001600160401b03166000908152600990935282208054919290916111be90849063ffffffff16611930565b92506101000a81548163ffffffff021916908363ffffffff160217905550505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006001600160a01b0382166112ae576112a78686868660405160200161125e94939291906119a8565b604051602081830303815290604052805190602001207f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c91909152603c902090565b90506112ca565b6112a7868686868660405160200161125e9594939291906119e9565b95945050505050565b6005546000906112ed906001600160a01b031684846112f6565b90505b92915050565b60008060006113058585611357565b9092509050600081600481111561131e5761131e611a3d565b14801561133c5750856001600160a01b0316826001600160a01b0316145b8061134d575061134d86868661139c565b9695505050505050565b600080825160410361138d5760208301516040840151606085015160001a61138187828585611488565b94509450505050611395565b506000905060025b9250929050565b6000806000856001600160a01b0316631626ba7e60e01b86866040516024016113c6929190611a53565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611404919061188b565b600060405180830381855afa9150503d806000811461143f576040519150601f19603f3d011682016040523d82523d6000602084013e611444565b606091505b509150915081801561145857506020815110155b801561134d57508051630b135d3f60e11b9061147d9083016020908101908401611a8d565b149695505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156114bf5750600090506003611543565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611513573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661153c57600060019250925050611543565b9150600090505b94509492505050565b80356001600160a01b038116811461156357600080fd5b919050565b60006020828403121561157a57600080fd5b6112ed8261154c565b604051608081016001600160401b03811182821017156115b357634e487b7160e01b600052604160045260246000fd5b60405290565b803563ffffffff8116811461156357600080fd5b600082601f8301126115de57600080fd5b6115e6611583565b8060808401858111156115f857600080fd5b845b818110156116195761160b816115b9565b8452602093840193016115fa565b509095945050505050565b80356001600160401b038116811461156357600080fd5b600082601f83011261164c57600080fd5b611654611583565b80608084018581111561166657600080fd5b845b818110156116195761167981611624565b845260209384019301611668565b60008083601f84011261169957600080fd5b5081356001600160401b038111156116b057600080fd5b60208301915083602082850101111561139557600080fd5b600080600080600061014086880312156116e157600080fd5b853594506116f287602088016115cd565b93506117018760a0880161163b565b92506101208601356001600160401b0381111561171d57600080fd5b61172988828901611687565b969995985093965092949392505050565b600080600080600080610160878903121561175457600080fd5b8635955061176588602089016115cd565b94506117748860a0890161163b565b93506101208701356001600160401b0381111561179057600080fd5b61179c89828a01611687565b90945092506117b09050610140880161154c565b90509295509295509295565b6000602082840312156117ce57600080fd5b6112ed826115b9565b600080604083850312156117ea57600080fd5b6117f38361154c565b9150611801602084016115b9565b90509250929050565b60006020828403121561181c57600080fd5b8135801515811461182c57600080fd5b9392505050565b60006020828403121561184557600080fd5b5035919050565b60006020828403121561185e57600080fd5b6112ed82611624565b60005b8381101561188257818101518382015260200161186a565b50506000910152565b6000825161189d818460208701611867565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176112f0576112f06118a7565b6000826118f157634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156112f0576112f06118a7565b6001600160401b03818116838216019080821115611929576119296118a7565b5092915050565b63ffffffff818116838216019080821115611929576119296118a7565b8060005b600481101561197657815163ffffffff16845260209384019390910190600101611951565b50505050565b8060005b60048110156119765781516001600160401b0316845260209384019390910190600101611980565b6bffffffffffffffffffffffff198560601b1681528360148201526119d0603482018461194d565b6119dd60b482018361197c565b61013401949350505050565b60006bffffffffffffffffffffffff19808860601b168352866014840152611a14603484018761194d565b611a2160b484018661197c565b60609390931b9092166101348201526101480195945050505050565b634e487b7160e01b600052602160045260246000fd5b8281526040602082015260008251806040840152611a78816060850160208701611867565b601f01601f1916919091016060019392505050565b600060208284031215611a9f57600080fd5b505191905056febbbcd8f6c9ba6f5fa5e71961ef9506c6eb51de06f5f677aa3b70f7e1154cbffda26469706673582212205d4de3228af332cf683c9891b06e3547675ba1394a3790d49e626df4d0eac5c364736f6c63430008130033

Deployed Bytecode

0x6080604052600436106101145760003560e01c8063715eeb12116100a0578063a071dcf411610064578063a071dcf4146102e9578063beab7131146102ff578063c4081a4c14610320578063ce2b0ec014610340578063f2fde38b1461036057600080fd5b8063715eeb121461025b578063812e498f1461026e5780638339bd6f146102815780638da5cb5b146102ab5780639e21ecb0146102c957600080fd5b80633ccfd60b116100e75780633ccfd60b146101a35780634465af00146101b85780634dec4681146101d85780635e39efc914610226578063715018a61461024657600080fd5b8063020451381461011957806312065fe01461013b5780631c31f710146101635780633cbbdb7714610183575b600080fd5b34801561012557600080fd5b50610139610134366004611568565b610380565b005b34801561014757600080fd5b506101506103aa565b6040519081526020015b60405180910390f35b34801561016f57600080fd5b5061013961017e366004611568565b6103b9565b34801561018f57600080fd5b5061013961019e3660046116c8565b6103e3565b3480156101af57600080fd5b50610139610556565b3480156101c457600080fd5b506101396101d336600461173a565b610576565b3480156101e457600080fd5b5061020e6101f33660046117bc565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161015a565b34801561023257600080fd5b506101396102413660046117d7565b6107cf565b34801561025257600080fd5b5061013961080b565b6101396102693660046116c8565b61084e565b61013961027c36600461173a565b6108fb565b34801561028d57600080fd5b50600a5461029b9060ff1681565b604051901515815260200161015a565b3480156102b757600080fd5b506000546001600160a01b031661020e565b3480156102d557600080fd5b506101396102e436600461180a565b6109d9565b3480156102f557600080fd5b5061015060035481565b34801561030b57600080fd5b5060405163ffffffff4616815260200161015a565b34801561032c57600080fd5b5061013961033b366004611833565b6109f4565b34801561034c57600080fd5b5061013961035b36600461184c565b610aa1565b34801561036c57600080fd5b5061013961037b366004611568565b610ad6565b610388610b4f565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b60006103b4610b4f565b504790565b6103c1610b4f565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6103eb610ba9565b835163ffffffff166000908152600460205260409020546001600160a01b03168061044d5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b22faa37b5b2b760991b60448201526064015b60405180910390fd5b61045a8686868686610c02565b6000806001600160a01b038316336002546040516001600160a01b03928316602482015291166044820152606481018a905260840160408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b179052516104c4919061188b565b6000604051808303816000865af19150503d8060008114610501576040519150601f19603f3d011682016040523d82523d6000602084013e610506565b606091505b50915091508161051857805160208201fd5b60208601516040516001600160401b0390911690600190600080516020611aa783398151915290600090a350505061054f60018055565b5050505050565b61055e610b4f565b600254610574906001600160a01b031647610e64565b565b61057e610ba9565b845163ffffffff166000908152600460205260409020546001600160a01b0316806105db5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b22faa37b5b2b760991b6044820152606401610444565b6105e9878787878787610f82565b600060646003546105fa908a6118bd565b61060491906118d4565b90506000806001600160a01b038416338661061f868e6118f6565b6040516001600160a01b039384166024820152929091166044830152606482015260840160408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b17905251610678919061188b565b6000604051808303816000865af19150503d80600081146106b5576040519150601f19603f3d011682016040523d82523d6000602084013e6106ba565b606091505b5091509150600080856001600160a01b03166106d33390565b6002546040516001600160a01b039283166024820152911660448201526064810187905260840160408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b1790525161072f919061188b565b6000604051808303816000865af19150503d806000811461076c576040519150601f19603f3d011682016040523d82523d6000602084013e610771565b606091505b5091509150831580610781575081155b1561078e57825160208401fd5b60208a01516040516001600160401b0390911690600090600080516020611aa7833981519152908290a35050505050506107c760018055565b505050505050565b6107d7610b4f565b63ffffffff16600090815260046020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b610813610b4f565b60405162461bcd60e51b815260206004820152601060248201526f436c6f7365645f496e7465726661636560801b6044820152606401610444565b610856610ba9565b8434146108995760405162461bcd60e51b8152602060048201526011602482015270496e76616c69645f4554485f56616c756560781b6044820152606401610444565b6108a68585858585610c02565b600a5460ff16156108c7576002546108c7906001600160a01b031686610e64565b60208301516040516001600160401b0390911690600190600080516020611aa783398151915290600090a361054f60018055565b610903610ba9565b8534146109465760405162461bcd60e51b8152602060048201526011602482015270496e76616c69645f4554485f56616c756560781b6044820152606401610444565b610954868686868686610f82565b6000606460035461096590896118bd565b61096f91906118d4565b90506109848261097f838a6118f6565b610e64565b600a5460ff16156109a5576002546109a5906001600160a01b031682610e64565b60208501516040516001600160401b0390911690600090600080516020611aa7833981519152908290a3506107c760018055565b6109e1610b4f565b600a805460ff1916911515919091179055565b6109fc610b4f565b80600003610a4c5760405162461bcd60e51b815260206004820152601760248201527f5461784665655f4e6565645f4d6f72655f5468616e5f300000000000000000006044820152606401610444565b60648110610a9c5760405162461bcd60e51b815260206004820152601860248201527f5461784665655f4e6565645f4c65655f5468616e5f31303000000000000000006044820152606401610444565b600355565b610aa9610b4f565b600580546001600160401b03909216600160a01b0267ffffffffffffffff60a01b19909216919091179055565b610ade610b4f565b6001600160a01b038116610b435760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610444565b610b4c816111e4565b50565b6000546001600160a01b031633146105745760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610444565b600260015403610bfb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610444565b6002600155565b4663ffffffff166060850152610c5b610c1f338787876000611234565b83838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506112d392505050565b610c9b5760405162461bcd60e51b8152602060048201526011602482015270496e76616c69645f5369676e617475726560781b6044820152606401610444565b60608301516005544291610cbe91600160a01b90046001600160401b0316611909565b6001600160401b03161015610d035760405162461bcd60e51b815260206004820152600b60248201526a121054d7d15e1c1a5c995960aa1b6044820152606401610444565b82516001600160401b031660009081526006602052604090205460ff1615610d585760405162461bcd60e51b8152602060048201526008602482015267121054d7d554d15160c21b6044820152606401610444565b82516001600160401b031660009081526006602052604090819020805460ff1916600117905584015163ffffffff161561054f57604080850151602080870151868401516001600160401b0316600090815260079092529290205463ffffffff91821692610dc892909116611930565b63ffffffff161115610e075760405162461bcd60e51b815260206004820152600860248201526714d3d31117d3d55560c21b6044820152606401610444565b6020808501516040808601516001600160401b0316600090815260079093528220805491929091610e3f90849063ffffffff16611930565b92506101000a81548163ffffffff021916908363ffffffff1602179055505050505050565b80471015610eb45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610444565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610f01576040519150601f19603f3d011682016040523d82523d6000602084013e610f06565b606091505b5050905080610f7d5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610444565b505050565b4663ffffffff166060860152610fda610f9e3388888886611234565b84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506112d392505050565b61101a5760405162461bcd60e51b8152602060048201526011602482015270496e76616c69645f5369676e617475726560781b6044820152606401610444565b6060840151600554429161103d91600160a01b90046001600160401b0316611909565b6001600160401b031610156110825760405162461bcd60e51b815260206004820152600b60248201526a121054d7d15e1c1a5c995960aa1b6044820152606401610444565b83516001600160401b031660009081526008602052604090205460ff16156110d75760405162461bcd60e51b8152602060048201526008602482015267121054d7d554d15160c21b6044820152606401610444565b83516001600160401b031660009081526008602052604090819020805460ff1916600117905585015163ffffffff16156107c757604080860151602080880151878401516001600160401b0316600090815260099092529290205463ffffffff9182169261114792909116611930565b63ffffffff1611156111865760405162461bcd60e51b815260206004820152600860248201526714d3d31117d3d55560c21b6044820152606401610444565b6020808601516040808701516001600160401b03166000908152600990935282208054919290916111be90849063ffffffff16611930565b92506101000a81548163ffffffff021916908363ffffffff160217905550505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006001600160a01b0382166112ae576112a78686868660405160200161125e94939291906119a8565b604051602081830303815290604052805190602001207f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c91909152603c902090565b90506112ca565b6112a7868686868660405160200161125e9594939291906119e9565b95945050505050565b6005546000906112ed906001600160a01b031684846112f6565b90505b92915050565b60008060006113058585611357565b9092509050600081600481111561131e5761131e611a3d565b14801561133c5750856001600160a01b0316826001600160a01b0316145b8061134d575061134d86868661139c565b9695505050505050565b600080825160410361138d5760208301516040840151606085015160001a61138187828585611488565b94509450505050611395565b506000905060025b9250929050565b6000806000856001600160a01b0316631626ba7e60e01b86866040516024016113c6929190611a53565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611404919061188b565b600060405180830381855afa9150503d806000811461143f576040519150601f19603f3d011682016040523d82523d6000602084013e611444565b606091505b509150915081801561145857506020815110155b801561134d57508051630b135d3f60e11b9061147d9083016020908101908401611a8d565b149695505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156114bf5750600090506003611543565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611513573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661153c57600060019250925050611543565b9150600090505b94509492505050565b80356001600160a01b038116811461156357600080fd5b919050565b60006020828403121561157a57600080fd5b6112ed8261154c565b604051608081016001600160401b03811182821017156115b357634e487b7160e01b600052604160045260246000fd5b60405290565b803563ffffffff8116811461156357600080fd5b600082601f8301126115de57600080fd5b6115e6611583565b8060808401858111156115f857600080fd5b845b818110156116195761160b816115b9565b8452602093840193016115fa565b509095945050505050565b80356001600160401b038116811461156357600080fd5b600082601f83011261164c57600080fd5b611654611583565b80608084018581111561166657600080fd5b845b818110156116195761167981611624565b845260209384019301611668565b60008083601f84011261169957600080fd5b5081356001600160401b038111156116b057600080fd5b60208301915083602082850101111561139557600080fd5b600080600080600061014086880312156116e157600080fd5b853594506116f287602088016115cd565b93506117018760a0880161163b565b92506101208601356001600160401b0381111561171d57600080fd5b61172988828901611687565b969995985093965092949392505050565b600080600080600080610160878903121561175457600080fd5b8635955061176588602089016115cd565b94506117748860a0890161163b565b93506101208701356001600160401b0381111561179057600080fd5b61179c89828a01611687565b90945092506117b09050610140880161154c565b90509295509295509295565b6000602082840312156117ce57600080fd5b6112ed826115b9565b600080604083850312156117ea57600080fd5b6117f38361154c565b9150611801602084016115b9565b90509250929050565b60006020828403121561181c57600080fd5b8135801515811461182c57600080fd5b9392505050565b60006020828403121561184557600080fd5b5035919050565b60006020828403121561185e57600080fd5b6112ed82611624565b60005b8381101561188257818101518382015260200161186a565b50506000910152565b6000825161189d818460208701611867565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176112f0576112f06118a7565b6000826118f157634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156112f0576112f06118a7565b6001600160401b03818116838216019080821115611929576119296118a7565b5092915050565b63ffffffff818116838216019080821115611929576119296118a7565b8060005b600481101561197657815163ffffffff16845260209384019390910190600101611951565b50505050565b8060005b60048110156119765781516001600160401b0316845260209384019390910190600101611980565b6bffffffffffffffffffffffff198560601b1681528360148201526119d0603482018461194d565b6119dd60b482018361197c565b61013401949350505050565b60006bffffffffffffffffffffffff19808860601b168352866014840152611a14603484018761194d565b611a2160b484018661197c565b60609390931b9092166101348201526101480195945050505050565b634e487b7160e01b600052602160045260246000fd5b8281526040602082015260008251806040840152611a78816060850160208701611867565b601f01601f1916919091016060019392505050565b600060208284031215611a9f57600080fd5b505191905056febbbcd8f6c9ba6f5fa5e71961ef9506c6eb51de06f5f677aa3b70f7e1154cbffda26469706673582212205d4de3228af332cf683c9891b06e3547675ba1394a3790d49e626df4d0eac5c364736f6c63430008130033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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