Contract 0x67c1d1b99D613edaf30a27ad0ea52EC1dcb28B97 6

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x67da6dd83709de2edb2976ebb42e28d34470aa1ca7dcdf07c0275e63cad027e30x60806040165940592022-12-10 2:12:07298 days 23 hrs ago0x54812dbab593674cd4f1216264895be48b55c5e3 IN  Create: CaskP2P0 CELO0.0007817165
[ Download CSV Export 
Parent Txn Hash Block From To Value
Index Block
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CaskP2P

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 14 : CaskP2P.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@opengsn/contracts/src/BaseRelayRecipient.sol";

import "../interfaces/ICaskP2P.sol";
import "../interfaces/ICaskP2PManager.sol";

contract CaskP2P is
ICaskP2P,
Initializable,
OwnableUpgradeable,
PausableUpgradeable,
BaseRelayRecipient
{
    using SafeERC20 for IERC20Metadata;

    /** @dev contract to manage P2P executions. */
    ICaskP2PManager public p2pManager;

    /** @dev map of P2P ID to P2P info. */
    mapping(bytes32 => P2P) private p2pMap; // p2pId => P2P
    mapping(address => bytes32[]) private userP2Ps; // user => p2pId[]


    /** @dev minimum amount of vault base asset for a P2P. */
    uint256 public minAmount;

    /** @dev minimum period for a P2P. */
    uint32 public minPeriod;

    function initialize() public initializer {
        __Ownable_init();
        __Pausable_init();

        minAmount = 1;
        minPeriod = 86400;
    }
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() initializer {}

    function versionRecipient() public pure override returns(string memory) { return "2.2.0"; }

    function _msgSender() internal view override(ContextUpgradeable, BaseRelayRecipient)
    returns (address sender) {
        sender = BaseRelayRecipient._msgSender();
    }

    function _msgData() internal view override(ContextUpgradeable, BaseRelayRecipient)
    returns (bytes calldata) {
        return BaseRelayRecipient._msgData();
    }

    modifier onlyUser(bytes32 _p2pId) {
        require(_msgSender() == p2pMap[_p2pId].user, "!AUTH");
        _;
    }

    modifier onlyManager() {
        require(_msgSender() == address(p2pManager), "!AUTH");
        _;
    }


    function createP2P(
        address _to,
        uint256 _amount,
        uint256 _totalAmount,
        uint32 _period
    ) external override whenNotPaused returns(bytes32) {
        require(_amount >= minAmount, "!INVALID(amount)");
        require(_period >= minPeriod, "!INVALID(period)");

        bytes32 p2pId = keccak256(abi.encodePacked(_msgSender(), _amount, _period, block.number, block.timestamp));

        uint32 timestamp = uint32(block.timestamp);

        P2P storage p2p = p2pMap[p2pId];
        p2p.user = _msgSender();
        p2p.to = _to;
        p2p.amount = _amount;
        p2p.totalAmount = _totalAmount;
        p2p.period = _period;
        p2p.createdAt = timestamp;
        p2p.processAt = timestamp;
        p2p.status = P2PStatus.Active;

        userP2Ps[_msgSender()].push(p2pId);

        p2pManager.registerP2P(p2pId);

        require(p2p.status == P2PStatus.Active, "!UNPROCESSABLE");
        require(p2p.numPayments == 1, "!UNPROCESSABLE"); // make sure first P2P payment succeeded

        emit P2PCreated(p2pId, p2p.user, p2p.to, _amount, _totalAmount, _period);

        return p2pId;
    }

    function pauseP2P(
        bytes32 _p2pId
    ) external override onlyUser(_p2pId) whenNotPaused {
        P2P storage p2p = p2pMap[_p2pId];
        require(p2p.status == P2PStatus.Active, "!NOT_ACTIVE");

        p2p.status = P2PStatus.Paused;

        emit P2PPaused(_p2pId, p2p.user);
    }

    function resumeP2P(
        bytes32 _p2pId
    ) external override onlyUser(_p2pId) whenNotPaused {
        P2P storage p2p = p2pMap[_p2pId];
        require(p2p.status == P2PStatus.Paused, "!NOT_PAUSED");

        p2p.status = P2PStatus.Active;

        if (p2p.processAt < uint32(block.timestamp)) {
            p2p.processAt = uint32(block.timestamp);
        }

        p2pManager.registerP2P(_p2pId);

        emit P2PResumed(_p2pId, p2p.user);
    }

    function cancelP2P(
        bytes32 _p2pId
    ) external override onlyUser(_p2pId) whenNotPaused {
        P2P storage p2p = p2pMap[_p2pId];
        require(p2p.status == P2PStatus.Active ||
            p2p.status == P2PStatus.Paused, "!INVALID(status)");

        p2p.status = P2PStatus.Canceled;

        emit P2PCanceled(_p2pId, p2p.user);
    }

    function getP2P(
        bytes32 _p2pId
    ) external override view returns (P2P memory) {
        return p2pMap[_p2pId];
    }

    function getUserP2P(
        address _user,
        uint256 _idx
    ) external override view returns (bytes32) {
        return userP2Ps[_user][_idx];
    }

    function getUserP2PCount(
        address _user
    ) external override view returns (uint256) {
        return userP2Ps[_user].length;
    }


    /************************** MANAGER FUNCTIONS **************************/

    function managerCommand(
        bytes32 _p2pId,
        ManagerCommand _command
    ) external override onlyManager {

        P2P storage p2p = p2pMap[_p2pId];

        if (_command == ManagerCommand.Skip) {

            p2p.processAt = p2p.processAt + p2p.period;
            p2p.numSkips += 1;

            emit P2PSkipped(_p2pId, p2p.user);

        } else if (_command == ManagerCommand.Pause) {

            p2p.status = P2PStatus.Paused;

            emit P2PPaused(_p2pId, p2p.user);

        } else if (_command == ManagerCommand.Cancel) {

            p2p.status = P2PStatus.Canceled;

            emit P2PCanceled(_p2pId, p2p.user);

        }
    }

    function managerProcessed(
        bytes32 _p2pId,
        uint256 _amount,
        uint256 _fee
    ) external override onlyManager {
        P2P storage p2p = p2pMap[_p2pId];

        p2p.processAt = p2p.processAt + p2p.period;
        p2p.currentAmount += _amount;
        p2p.numPayments += 1;

        emit P2PProcessed(_p2pId, p2p.user, _amount, _fee);

        if (p2p.totalAmount > 0 && p2p.currentAmount >= p2p.totalAmount) {
            p2p.status = P2PStatus.Complete;
            emit P2PCompleted(_p2pId, p2p.user);
        }

    }

    /************************** ADMIN FUNCTIONS **************************/

    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }

    function setManager(
        address _p2pManager
    ) external onlyOwner {
        p2pManager = ICaskP2PManager(_p2pManager);
    }

    function setTrustedForwarder(
        address _forwarder
    ) external onlyOwner {
        _setTrustedForwarder(_forwarder);
    }

    function setMinAmount(
        uint256 _minAmount
    ) external onlyOwner {
        minAmount = _minAmount;
    }

    function setMinPeriod(
        uint32 _minPeriod
    ) external onlyOwner {
        minPeriod = _minPeriod;
    }
}

File 2 of 14 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

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

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 3 of 14 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _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);
    }
    uint256[49] private __gap;
}

File 4 of 14 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

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

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

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

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

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

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

File 5 of 14 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

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

File 6 of 14 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 7 of 14 : BaseRelayRecipient.sol
// SPDX-License-Identifier: MIT
// solhint-disable no-inline-assembly
pragma solidity >=0.6.9;

import "./interfaces/IRelayRecipient.sol";

/**
 * A base contract to be inherited by any contract that want to receive relayed transactions
 * A subclass must use "_msgSender()" instead of "msg.sender"
 */
abstract contract BaseRelayRecipient is IRelayRecipient {

    /*
     * Forwarder singleton we accept calls from
     */
    address private _trustedForwarder;

    function trustedForwarder() public virtual view returns (address){
        return _trustedForwarder;
    }

    function _setTrustedForwarder(address _forwarder) internal {
        _trustedForwarder = _forwarder;
    }

    function isTrustedForwarder(address forwarder) public virtual override view returns(bool) {
        return forwarder == _trustedForwarder;
    }

    /**
     * return the sender of this call.
     * if the call came through our trusted forwarder, return the original sender.
     * otherwise, return `msg.sender`.
     * should be used in the contract anywhere instead of msg.sender
     */
    function _msgSender() internal override virtual view returns (address ret) {
        if (msg.data.length >= 20 && isTrustedForwarder(msg.sender)) {
            // At this point we know that the sender is a trusted forwarder,
            // so we trust that the last bytes of msg.data are the verified sender address.
            // extract sender address from the end of msg.data
            assembly {
                ret := shr(96,calldataload(sub(calldatasize(),20)))
            }
        } else {
            ret = msg.sender;
        }
    }

    /**
     * return the msg.data of this call.
     * if the call came through our trusted forwarder, then the real sender was appended as the last 20 bytes
     * of the msg.data - so this method will strip those 20 bytes off.
     * otherwise (if the call was made directly and not through the forwarder), return `msg.data`
     * should be used in the contract instead of msg.data, where this difference matters.
     */
    function _msgData() internal override virtual view returns (bytes calldata ret) {
        if (msg.data.length >= 20 && isTrustedForwarder(msg.sender)) {
            return msg.data[0:msg.data.length-20];
        } else {
            return msg.data;
        }
    }
}

File 8 of 14 : ICaskP2P.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface ICaskP2P {

    enum P2PStatus {
        None,
        Active,
        Paused,
        Canceled,
        Complete
    }

    enum ManagerCommand {
        None,
        Cancel,
        Skip,
        Pause
    }

    struct P2P {
        address user;
        address to;
        uint256 amount;
        uint256 totalAmount;
        uint256 currentAmount;
        uint256 numPayments;
        uint256 numSkips;
        uint32 period;
        uint32 createdAt;
        uint32 processAt;
        P2PStatus status;
    }

    function createP2P(
        address _to,
        uint256 _amount,
        uint256 _totalAmount,
        uint32 _period
    ) external returns(bytes32);

    function getP2P(bytes32 _p2pId) external view returns (P2P memory);

    function getUserP2P(address _user, uint256 _idx) external view returns (bytes32);

    function getUserP2PCount(address _user) external view returns (uint256);

    function cancelP2P(bytes32 _p2pId) external;

    function pauseP2P(bytes32 _p2pId) external;

    function resumeP2P(bytes32 _p2pId) external;

    function managerCommand(bytes32 _p2pId, ManagerCommand _command) external;

    function managerProcessed(bytes32 _p2pId, uint256 amount, uint256 _fee) external;


    event P2PCreated(bytes32 indexed p2pId, address indexed user, address indexed to,
        uint256 amount, uint256 totalAmount, uint32 period);

    event P2PPaused(bytes32 indexed p2pId, address indexed user);

    event P2PResumed(bytes32 indexed p2pId, address indexed user);

    event P2PSkipped(bytes32 indexed p2pId, address indexed user);

    event P2PProcessed(bytes32 indexed p2pId, address indexed user, uint256 amount, uint256 fee);

    event P2PCanceled(bytes32 indexed p2pId, address indexed user);

    event P2PCompleted(bytes32 indexed p2pId, address indexed user);
}

File 9 of 14 : ICaskP2PManager.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface ICaskP2PManager {

    function registerP2P(bytes32 _p2pId) external;

    /** @dev Emitted when manager parameters are changed. */
    event SetParameters();

}

File 10 of 14 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 11 of 14 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

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

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

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}

File 12 of 14 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

File 13 of 14 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 14 of 14 : IRelayRecipient.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;

/**
 * a contract must implement this interface in order to support relayed transaction.
 * It is better to inherit the BaseRelayRecipient as its implementation.
 */
abstract contract IRelayRecipient {

    /**
     * return if the forwarder is trusted to forward relayed transactions to us.
     * the forwarder is required to verify the sender's signature, and verify
     * the call is not a replay.
     */
    function isTrustedForwarder(address forwarder) public virtual view returns(bool);

    /**
     * return the sender of this call.
     * if the call came through our trusted forwarder, then the real sender is appended as the last 20 bytes
     * of the msg.data.
     * otherwise, return `msg.sender`
     * should be used in the contract anywhere instead of msg.sender
     */
    function _msgSender() internal virtual view returns (address);

    /**
     * return the msg.data of this call.
     * if the call came through our trusted forwarder, then the real sender was appended as the last 20 bytes
     * of the msg.data - so this method will strip those 20 bytes off.
     * otherwise (if the call was made directly and not through the forwarder), return `msg.data`
     * should be used in the contract instead of msg.data, where this difference matters.
     */
    function _msgData() internal virtual view returns (bytes calldata);

    function versionRecipient() external virtual view returns (string memory);
}

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

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"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":"bytes32","name":"p2pId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"P2PCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"p2pId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"P2PCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"p2pId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalAmount","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"period","type":"uint32"}],"name":"P2PCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"p2pId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"P2PPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"p2pId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"P2PProcessed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"p2pId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"P2PResumed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"p2pId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"P2PSkipped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"bytes32","name":"_p2pId","type":"bytes32"}],"name":"cancelP2P","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_totalAmount","type":"uint256"},{"internalType":"uint32","name":"_period","type":"uint32"}],"name":"createP2P","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_p2pId","type":"bytes32"}],"name":"getP2P","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"currentAmount","type":"uint256"},{"internalType":"uint256","name":"numPayments","type":"uint256"},{"internalType":"uint256","name":"numSkips","type":"uint256"},{"internalType":"uint32","name":"period","type":"uint32"},{"internalType":"uint32","name":"createdAt","type":"uint32"},{"internalType":"uint32","name":"processAt","type":"uint32"},{"internalType":"enum ICaskP2P.P2PStatus","name":"status","type":"uint8"}],"internalType":"struct ICaskP2P.P2P","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"getUserP2P","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserP2PCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_p2pId","type":"bytes32"},{"internalType":"enum ICaskP2P.ManagerCommand","name":"_command","type":"uint8"}],"name":"managerCommand","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_p2pId","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"managerProcessed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minPeriod","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"p2pManager","outputs":[{"internalType":"contract ICaskP2PManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_p2pId","type":"bytes32"}],"name":"pauseP2P","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_p2pId","type":"bytes32"}],"name":"resumeP2P","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_p2pManager","type":"address"}],"name":"setManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minAmount","type":"uint256"}],"name":"setMinAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_minPeriod","type":"uint32"}],"name":"setMinPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_forwarder","type":"address"}],"name":"setTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"versionRecipient","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"}]

60806040523480156200001157600080fd5b50600054610100900460ff166200002f5760005460ff161562000039565b62000039620000de565b620000a15760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b600054610100900460ff16158015620000c4576000805461ffff19166101011790555b8015620000d7576000805461ff00191690555b5062000102565b6000620000f630620000fc60201b620014481760201c565b15905090565b3b151590565b611adc80620001126000396000f3fe608060405234801561001057600080fd5b506004361061018e5760003560e01c8063897b0637116100de578063b30f8a1311610097578063da74222811610071578063da74222814610372578063ded6da0114610385578063f2fde38b14610398578063ffd49c84146103ab57600080fd5b8063b30f8a1314610323578063c453824f1461034c578063d0ebdbe71461035f57600080fd5b8063897b0637146102b05780638da5cb5b146102c35780639b2cb5d8146102d4578063a0b029a9146102dd578063a80cfd51146102fd578063aa2f79be1461031057600080fd5b80635c975abb1161014b578063715018a611610125578063715018a6146102735780637da0a8771461027b5780638129fc1c146102a05780638456cb59146102a857600080fd5b80635c975abb1461024257806361e6c40a1461024d5780636537eace1461026057600080fd5b806317380c34146101935780631b6f39d7146101a85780633f4ba83a146101ce578063486ff0cd146101d6578063572b6c05146101fd5780635ba581cd1461022f575b600080fd5b6101a66101a13660046116d4565b6103d0565b005b6101bb6101b6366004611709565b61059f565b6040519081526020015b60405180910390f35b6101a66105dc565b60408051808201825260058152640322e322e360dc1b602082015290516101c59190611733565b61021f61020b366004611788565b6097546001600160a01b0391821691161490565b60405190151581526020016101c5565b6101a661023d3660046117aa565b61062f565b60655460ff1661021f565b6101bb61025b3660046117f2565b61080d565b6101a661026e3660046116d4565b610b8a565b6101a6610cb3565b6097546001600160a01b03165b6040516001600160a01b0390911681526020016101c5565b6101a6610d06565b6101a6610de6565b6101a66102be3660046116d4565b610e37565b6033546001600160a01b0316610288565b6101bb609b5481565b6102f06102eb3660046116d4565b610e85565b6040516101c59190611870565b609854610288906001600160a01b031681565b6101a661031e3660046116d4565b610fbc565b6101bb610331366004611788565b6001600160a01b03166000908152609a602052604090205490565b6101a661035a36600461192a565b6110dd565b6101a661036d366004611788565b611142565b6101a6610380366004611788565b6111ad565b6101a6610393366004611945565b611214565b6101a66103a6366004611788565b611391565b609c546103bb9063ffffffff1681565b60405163ffffffff90911681526020016101c5565b60008181526099602052604090205481906001600160a01b03166103f261144e565b6001600160a01b0316146104215760405162461bcd60e51b815260040161041890611971565b60405180910390fd5b60655460ff16156104445760405162461bcd60e51b815260040161041890611990565b600082815260996020526040902060026007820154600160601b900460ff16600481111561047457610474611838565b146104af5760405162461bcd60e51b815260206004820152600b60248201526a085393d517d4105554d15160aa1b6044820152606401610418565b60078101805460ff60601b1916600160601b179081905563ffffffff428116600160401b909204161015610503576007810180546bffffffff00000000000000001916600160401b4263ffffffff16021790555b609854604051630d64dffd60e21b8152600481018590526001600160a01b03909116906335937ff490602401600060405180830381600087803b15801561054957600080fd5b505af115801561055d573d6000803e3d6000fd5b505082546040516001600160a01b0390911692508591507f90c8a0ae7f3edae1d7211626fda3659920bf9f37e7b6a4a24b01030a832b8fd190600090a3505050565b6001600160a01b0382166000908152609a602052604081208054839081106105c9576105c96119ba565b9060005260206000200154905092915050565b6105e461144e565b6001600160a01b03166105ff6033546001600160a01b031690565b6001600160a01b0316146106255760405162461bcd60e51b8152600401610418906119d0565b61062d61145d565b565b6098546001600160a01b031661064361144e565b6001600160a01b0316146106695760405162461bcd60e51b815260040161041890611971565b6000828152609960205260409020600282600381111561068b5761068b611838565b141561072a5760078101546106b09063ffffffff80821691600160401b900416611a1b565b8160070160086101000a81548163ffffffff021916908363ffffffff16021790555060018160060160008282546106e79190611a43565b909155505080546040516001600160a01b039091169084907fe98881c5e1c5fc67607a3f2e92bba431ee626fadd3dbdfaa1d5858c424fb7e7790600090a3505050565b600382600381111561073e5761073e611838565b14156107975760078101805460ff60601b1916600160611b17905580546040516001600160a01b039091169084907fec20a78248e90cc1381729a407ac4b26bd962380aab6b8a498e767c26c0f495490600090a3505050565b60018260038111156107ab576107ab611838565b1415610808576007810180546003919060ff60601b1916600160601b835b021790555080546040516001600160a01b039091169084907fdc7a5f3d2133ce8a7112247032e67648de955ec683416a76ee9ea018e7ece3fe90600090a35b505050565b600061081b60655460ff1690565b156108385760405162461bcd60e51b815260040161041890611990565b609b5484101561087d5760405162461bcd60e51b815260206004820152601060248201526f21494e56414c494428616d6f756e742960801b6044820152606401610418565b609c5463ffffffff90811690831610156108cc5760405162461bcd60e51b815260206004820152601060248201526f21494e56414c494428706572696f642960801b6044820152606401610418565b60006108d661144e565b60405160609190911b6bffffffffffffffffffffffff191660208201526034810186905260e084901b6001600160e01b031916605482015243605882015242607882015260980160408051601f198184030181529181528151602092830120600081815260999093529120909150429061094e61144e565b81546001600160a01b03199081166001600160a01b03928316178355600183018054909116918a16919091179055600281018790556003810186905560078101805463ffffffff87811667ffffffffffffffff1990921691909117640100000000918516918202176cffffffffff00000000000000001916600160401b9190910260ff60601b191617600160601b179055609a60006109eb61144e565b6001600160a01b0390811682526020808301939093526040918201600090812080546001810182559082529390209092018590556098549051630d64dffd60e21b8152600481018690529116906335937ff490602401600060405180830381600087803b158015610a5b57600080fd5b505af1158015610a6f573d6000803e3d6000fd5b5060019250610a7c915050565b6007820154600160601b900460ff166004811115610a9c57610a9c611838565b14610ada5760405162461bcd60e51b815260206004820152600e60248201526d21554e50524f4345535341424c4560901b6044820152606401610418565b8060050154600114610b1f5760405162461bcd60e51b815260206004820152600e60248201526d21554e50524f4345535341424c4560901b6044820152606401610418565b60018101548154604080518a8152602081018a905263ffffffff89168183015290516001600160a01b03938416939092169186917fc306823dfef6d5d873e71870af06b7f6e7c919637db106e3e2b5c8d1e6f0bd0e919081900360600190a450909695505050505050565b60008181526099602052604090205481906001600160a01b0316610bac61144e565b6001600160a01b031614610bd25760405162461bcd60e51b815260040161041890611971565b60655460ff1615610bf55760405162461bcd60e51b815260040161041890611990565b600082815260996020526040902060016007820154600160601b900460ff166004811115610c2557610c25611838565b14610c605760405162461bcd60e51b815260206004820152600b60248201526a214e4f545f41435449564560a81b6044820152606401610418565b60078101805460ff60601b1916600160611b17905580546040516001600160a01b039091169084907fec20a78248e90cc1381729a407ac4b26bd962380aab6b8a498e767c26c0f495490600090a3505050565b610cbb61144e565b6001600160a01b0316610cd66033546001600160a01b031690565b6001600160a01b031614610cfc5760405162461bcd60e51b8152600401610418906119d0565b61062d60006114f6565b600054610100900460ff16610d215760005460ff1615610d25565b303b155b610d885760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610418565b600054610100900460ff16158015610daa576000805461ffff19166101011790555b610db2611548565b610dba61157f565b6001609b55609c805463ffffffff1916620151801790558015610de3576000805461ff00191690555b50565b610dee61144e565b6001600160a01b0316610e096033546001600160a01b031690565b6001600160a01b031614610e2f5760405162461bcd60e51b8152600401610418906119d0565b61062d6115b6565b610e3f61144e565b6001600160a01b0316610e5a6033546001600160a01b031690565b6001600160a01b031614610e805760405162461bcd60e51b8152600401610418906119d0565b609b55565b610ee26040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290529061014082015290565b60008281526099602090815260409182902082516101608101845281546001600160a01b03908116825260018301541692810192909252600281015492820192909252600382015460608201526004808301546080830152600583015460a0830152600683015460c0830152600783015463ffffffff80821660e085015264010000000082048116610100850152600160401b820416610120840152919291610140840191600160601b90910460ff1690811115610fa257610fa2611838565b6004811115610fb357610fb3611838565b90525092915050565b60008181526099602052604090205481906001600160a01b0316610fde61144e565b6001600160a01b0316146110045760405162461bcd60e51b815260040161041890611971565b60655460ff16156110275760405162461bcd60e51b815260040161041890611990565b600082815260996020526040902060016007820154600160601b900460ff16600481111561105757611057611838565b1480611082575060026007820154600160601b900460ff16600481111561108057611080611838565b145b6110c15760405162461bcd60e51b815260206004820152601060248201526f21494e56414c4944287374617475732960801b6044820152606401610418565b6007810180546003919060ff60601b1916600160601b836107c9565b6110e561144e565b6001600160a01b03166111006033546001600160a01b031690565b6001600160a01b0316146111265760405162461bcd60e51b8152600401610418906119d0565b609c805463ffffffff191663ffffffff92909216919091179055565b61114a61144e565b6001600160a01b03166111656033546001600160a01b031690565b6001600160a01b03161461118b5760405162461bcd60e51b8152600401610418906119d0565b609880546001600160a01b0319166001600160a01b0392909216919091179055565b6111b561144e565b6001600160a01b03166111d06033546001600160a01b031690565b6001600160a01b0316146111f65760405162461bcd60e51b8152600401610418906119d0565b609780546001600160a01b0319166001600160a01b03831617905550565b6098546001600160a01b031661122861144e565b6001600160a01b03161461124e5760405162461bcd60e51b815260040161041890611971565b6000838152609960205260409020600781015461127b9063ffffffff80821691600160401b900416611a1b565b8160070160086101000a81548163ffffffff021916908363ffffffff160217905550828160040160008282546112b19190611a43565b9250508190555060018160050160008282546112cd9190611a43565b9091555050805460408051858152602081018590526001600160a01b039092169186917f502ad10f9f6152a1a8763fddc9bab46f67f6acf78ef795b586774e9bae329247910160405180910390a36000816003015411801561133757508060030154816004015410155b1561138b5760078101805460ff60601b1916600160621b17905580546040516001600160a01b039091169085907ff5c7f3c79bb644866beab12f4e904c0f8b7b56e318ebceb77c2b13d0a710482690600090a35b50505050565b61139961144e565b6001600160a01b03166113b46033546001600160a01b031690565b6001600160a01b0316146113da5760405162461bcd60e51b8152600401610418906119d0565b6001600160a01b03811661143f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610418565b610de3816114f6565b3b151590565b600061145861160f565b905090565b60655460ff166114a65760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610418565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6114d961144e565b6040516001600160a01b03909116815260200160405180910390a1565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661156f5760405162461bcd60e51b815260040161041890611a5b565b611577611643565b61062d61166a565b600054610100900460ff166115a65760405162461bcd60e51b815260040161041890611a5b565b6115ae611643565b61062d6116a1565b60655460ff16156115d95760405162461bcd60e51b815260040161041890611990565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586114d961144e565b60006014361080159061162c57506097546001600160a01b031633145b1561163e575060131936013560601c90565b503390565b600054610100900460ff1661062d5760405162461bcd60e51b815260040161041890611a5b565b600054610100900460ff166116915760405162461bcd60e51b815260040161041890611a5b565b61062d61169c61144e565b6114f6565b600054610100900460ff166116c85760405162461bcd60e51b815260040161041890611a5b565b6065805460ff19169055565b6000602082840312156116e657600080fd5b5035919050565b80356001600160a01b038116811461170457600080fd5b919050565b6000806040838503121561171c57600080fd5b611725836116ed565b946020939093013593505050565b600060208083528351808285015260005b8181101561176057858101830151858201604001528201611744565b81811115611772576000604083870101525b50601f01601f1916929092016040019392505050565b60006020828403121561179a57600080fd5b6117a3826116ed565b9392505050565b600080604083850312156117bd57600080fd5b823591506020830135600481106117d357600080fd5b809150509250929050565b803563ffffffff8116811461170457600080fd5b6000806000806080858703121561180857600080fd5b611811856116ed565b9350602085013592506040850135915061182d606086016117de565b905092959194509250565b634e487b7160e01b600052602160045260246000fd5b6005811061186c57634e487b7160e01b600052602160045260246000fd5b9052565b81516001600160a01b031681526101608101602083015161189c60208401826001600160a01b03169052565b5060408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e08301516118e660e084018263ffffffff169052565b506101008381015163ffffffff81168483015250506101208381015163ffffffff8116848301525050610140808401516119228285018261184e565b505092915050565b60006020828403121561193c57600080fd5b6117a3826117de565b60008060006060848603121561195a57600080fd5b505081359360208301359350604090920135919050565b60208082526005908201526404282aaa8960db1b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff808316818516808303821115611a3a57611a3a611a05565b01949350505050565b60008219821115611a5657611a56611a05565b500190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220ce86db3c2896e03e42de3e795065ba1f5f1d9c7c681a82ed6b8e28f5414a89e864736f6c63430008090033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.