Contract 0xa368c0ab32dd9bc0500075c0c8397b6b0168e432

Contract Overview

Balance:
0.201502399999999999 MATIC
Txn Hash
Method
Block
From
To
Value [Txn Fee]
0xff80c7040700f568287be5ff839441555c4d4707d857388eed5118b25acb2368Grant Role271858732022-07-15 14:38:49325 days 22 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320 MATIC0.001750938077 34.080193042
0x3a13c22c185d455c45202cf4721a1f471c0d237c9a18e2aefa1e3f0da160ee87Grant Role267281792022-06-13 14:24:25357 days 22 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320 MATIC0.000092478601 1.800000022
0x118238acdc028d13d151aff3b3c958e43eec50d6393346e45b5cbac49d681dbaGrant Role267281792022-06-13 14:24:25357 days 22 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320 MATIC0.000092478601 1.800000022
0xb394edbfb2889b5b9a205dd73563c09cd43f52d2d3342b0d7e3decdf2f6da5cfGrant Role265858262022-06-03 15:28:44367 days 21 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320 MATIC0.0000770655 1.500000013
0x43e53468a1f545d10f821d0de3066c08a5488b8c6d2d560dc76a5aa0fe1d8425Grant Role265858262022-06-03 15:28:44367 days 21 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320 MATIC0.0000770655 1.500000013
0xefedca6bfb85c1f9ad99b81146e4fd28b6a0d9439410357b8cf5b60b5971b1d4Grant Role265821062022-06-03 8:54:51368 days 3 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320 MATIC0.001797774999 34.999999999
0xaf4d9b6aad435f855c3bbab401ba34da14d7b32b4fa2b6578acf01f02eaf813cGrant Role265821052022-06-03 8:54:46368 days 3 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320 MATIC0.001571156111 30.580923594
0x9817664cf51794ac17a44e1ab109b673af63f9ad2844ce220c296b070f1925baGrant Role265821022022-06-03 8:54:31368 days 3 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320 MATIC0.001641164022 31.94355494
0xa5837c86d4e1c245400795a76238d9d795939d8fb38cf9ba6b75ecbc3b5d05f2Transfer259028022022-04-12 10:22:33420 days 2 hrs ago0xd48c57cdaf721fd99b68a876289bb38639f43195 IN  0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320.2 MATIC0.000039459624 1.874121338
0x002a87598bc12c4e467bc5d288d03ed0861907ce1f4086f7894f33ea668a1fb7Grant Role255892982022-03-20 7:00:58443 days 5 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320 MATIC0.000154095 3.000000006
0xec64b77d3ba24780137e6b051ac24ba8194e9d2722960503cbfff05d0b989683Grant Role255892962022-03-20 7:00:48443 days 5 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320 MATIC0.001027539999 19.999999998
0x9e8e9c2d56123f3c01f08bfbbd08823fdd5bb1e9c524e7b7b0a6d3b628d720adGrant Role255892922022-03-20 7:00:28443 days 5 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320 MATIC0.001027299999 19.999999999
0x8457d002237f77283c3f3c09314d619dab1ff1425b592d77aa0c5c11055ef19a0x60806040255892842022-03-20 6:59:48443 days 5 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  Create: Referral0 MATIC0.04204158 20
[ Download CSV Export 
Latest 10 internal transactions
Parent Txn Hash Block From To Value
0x73d5a8deaf32f9905da924efac5592737082d015c3e27d3426c6562645bcf29f277184912022-08-21 17:10:58288 days 19 hrs ago 0x887a3c3d25eb56953124aede7106c65c8b91720c 0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320.000018 MATIC
0x2a3d945236340bd86f3c138802aaa0e70c7e702d1f09541d3d7bb69d655ecda3277184742022-08-21 17:08:08288 days 19 hrs ago 0x887a3c3d25eb56953124aede7106c65c8b91720c 0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320.000011999999999999 MATIC
0x13b8b66ae0449d915deeb73fff2fa34bd1e39d4eddfc76acb36a451ca01b2f6a259155882022-04-13 9:38:23419 days 3 hrs ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa1228 0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320.0000324 MATIC
0x152029b925b6852d4789944f10af1ceb7bc941a8b592ff7567a37e8487f3203b259125192022-04-13 4:12:13419 days 8 hrs ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa1228 0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320.00018 MATIC
0x8723519f7f81eb3ab7188a6a5eef1c34c81e39b50a19f233feb2ee22c1e2ac49259047692022-04-12 14:05:54419 days 22 hrs ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa1228 0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320.00018 MATIC
0x27274b9ec55db6d2f3a1897e1729d8b70910e70b2038f7c0dc773e9b16df11d8259047202022-04-12 14:01:48419 days 22 hrs ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa1228 0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320.00018 MATIC
0xa992b0e86d49e5097de6c27c6e5a5326f4db13a8f726cd9de9987e548ebefaf1259047122022-04-12 14:01:08419 days 22 hrs ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa1228 0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320.00018 MATIC
0x56ff82ea1aaad3a7bafa83a029910df9c4a64b7459389f10f9289815df991038259047002022-04-12 14:00:07419 days 22 hrs ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa1228 0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320.00018 MATIC
0xa24462801bba03e85e9b8e5395b61077b66d3b936e20aa212f9eca94ad672bbf259045702022-04-12 13:43:55419 days 23 hrs ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa1228 0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320.00018 MATIC
0xdc9ce0929edd7bf967c2917e9d4ce9b82d38629fc4492cf701babab86d6e4f60259044892022-04-12 13:35:19419 days 23 hrs ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa1228 0xa368c0ab32dd9bc0500075c0c8397b6b0168e4320.00018 MATIC
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Referral

Compiler Version
v0.8.12+commit.f00d7308

Optimization Enabled:
Yes with 8000 runs

Other Settings:
default evmVersion, MIT license
File 1 of 11 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 2 of 11 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 3 of 11 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.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 Pausable is Context {
    /**
     * @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.
     */
    constructor() {
        _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());
    }
}

File 4 of 11 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (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 `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);

    /**
     * @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 5 of 11 : 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 11 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 7 of 11 : 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 8 of 11 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @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] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 9 of 11 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 10 of 11 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 11 of 11 : Referral.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.10;

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

// import "hardhat/console.sol";

/// @title Multi-level referral program
/// @author Thundercore, customized by Romuald Hog
/// @dev All rates are in basis point.
contract Referral is AccessControl, Pausable {
    using SafeERC20 for IERC20;

    /// @notice The struct of account information.
    /// @param referrer The referrer addresss.
    /// @param referredCount The total referral amount of an address.
    /// @param lastActiveTimestamp The last active timestamp of an address.
    struct Account {
        address referrer;
        uint24 referredCount;
        uint32 lastActiveTimestamp;
    }

    /// @notice The struct of referee amount to bonus rate.
    /// @param lowerBound The minial referee amount.
    /// @param rate The bonus rate for each referee amount.
    struct RefereeBonusRate {
        uint16 lowerBound;
        uint16 rate;
    }

    /// @notice The bonus rate for each level.
    /// @dev The max depth is 3.
    uint16[3] public levelRate;

    /// @notice The seconds that a user does not update will be seen as inactive.
    uint24 public secondsUntilInactive;

    /// @notice The flag to enable not paying to inactive uplines.
    bool public onlyRewardActiveReferrers;

    /// @notice The bonus rate mapping to each referree amount. The max depth is 3.
    RefereeBonusRate[3] public refereeBonusRateMap;

    /// @notice Maps users addresses to tokens addresses to credits amount.
    mapping(address => mapping(address => uint256)) private _credits;

    /// @notice Maps users addresses to referrer account information.
    mapping(address => Account) private _accounts;

    /// @notice Role associated to Games smart contracts.
    bytes32 public constant GAME_ROLE = keccak256("GAME_ROLE");

    /// @notice Role associated to the Bank smart contracts.
    bytes32 public constant BANK_ROLE = keccak256("BANK_ROLE");

    /// @notice Emitted after the configuration is set.
    /// @param secondsUntilInactive The seconds that a user does not update will be seen as inactive.
    /// @param onlyRewardActiveReferrers The flag to enable not paying to inactive uplines.
    /// @param levelRate The bonus rate for each level.
    event SetReferral(
        uint24 secondsUntilInactive,
        bool onlyRewardActiveReferrers,
        uint16[3] levelRate
    );

    /// @notice Emitted after a bonus rate configuration is set.
    /// @param lowerBound Number of minimum referee to benefit the bonus rate.
    /// @param rate The bonus rate.
    event SetReferreeBonusRate(uint16 lowerBound, uint16 rate);

    /// @notice Emitted after setting the referrer of a referee.
    /// @param referee The address of the user
    /// @param referrer The address would set as referrer of user
    event RegisteredReferer(address indexed referee, address indexed referrer);

    /// @notice Emitted after referrer's activity.
    /// @param referrer The address of the user.
    /// @param lastActiveTimestamp The last active timestamp of the referrer.
    event SetLastActiveTimestamp(
        address indexed referrer,
        uint32 lastActiveTimestamp
    );

    /// @notice Emitted after adding credit to a referrer.
    /// @param user Address of the referrer.
    /// @param token Address of the token.
    /// @param amount Amount of credited tokens.
    /// @param level The referrer level.
    event AddReferralCredit(
        address indexed user,
        address indexed token,
        uint256 amount,
        uint16 indexed level
    );

    /// @notice Emitted after the referrer withdraw credits.
    /// @param payee Address of the referrer.
    /// @param token Address of the token.
    /// @param amount Amount of credited tokens.
    event WithdrawnReferralCredit(
        address indexed payee,
        address indexed token,
        uint256 amount
    );

    /// @notice Referral level should be at least one, length not exceed 3, and total not exceed 100%.
    error WrongLevelRate();

    /// @notice One of referee bonus rate exceeds 100%.
    /// @param rate The referee bonus rate.
    error WrongRefereeBonusRate(uint16 rate);

    /// @notice Sets the Referral program configuration. c.f. `Referral._setReferral`.
    /// @param _secondsUntilInactive The seconds that a user does not update will be seen as inactive.
    /// @param _onlyRewardActiveReferrers The flag to enable not paying to inactive uplines.
    /// @param _levelRate The bonus rate for each level. The max depth is 3.
    /// @param _refereeBonusRateMap The bonus rate mapping to each referree amount. The max depth is 3.
    constructor(
        uint24 _secondsUntilInactive,
        bool _onlyRewardActiveReferrers,
        uint16[3] memory _levelRate,
        uint16[6] memory _refereeBonusRateMap
    ) {
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        setReferral(
            _secondsUntilInactive,
            _onlyRewardActiveReferrers,
            _levelRate,
            _refereeBonusRateMap
        );
    }

    receive() external payable {}

    /// @notice Gets the bonus rate based on the referred count.
    /// @param referredCount The number of referrees.
    /// @return The bonus rate.
    function _getRefereeBonusRate(uint24 referredCount)
        private
        view
        returns (uint16)
    {
        uint16 rate = refereeBonusRateMap[0].rate;
        uint256 refereeBonusRateMapLength = refereeBonusRateMap.length;
        for (uint8 i = 1; i < refereeBonusRateMapLength; i++) {
            RefereeBonusRate memory refereeBonusRate = refereeBonusRateMap[i];
            if (referredCount < refereeBonusRate.lowerBound) {
                break;
            }
            rate = refereeBonusRate.rate;
        }
        return rate;
    }

    /// @notice Checks whether the referee is one of referrer uplines.
    /// @param referrer Address of the referrer.
    /// @param referee Address of the referee.
    /// @return Whether the referee is already on referrer's upper levels.
    function _isCircularReference(address referrer, address referee)
        private
        view
        returns (bool)
    {
        address parent = referrer;
        uint256 levelRateLength = levelRate.length;
        for (uint8 i; i < levelRateLength; i++) {
            if (parent == address(0)) {
                break;
            }

            if (parent == referee) {
                return true;
            }

            parent = _accounts[parent].referrer;
        }

        return false;
    }

    /// @notice Sets the Referral program configuration.
    /// @param _secondsUntilInactive The seconds that a user does not update will be seen as inactive.
    /// @param _onlyRewardActiveReferrers The flag to enable not paying to inactive uplines.
    /// @param _levelRate The bonus rate for each level. The max depth is 3.
    /// @param _refereeBonusRateMap The bonus rate mapping to each referree amount. The max depth is 3.
    /// @dev The map should be pass as [<lower amount>, <rate>, ....]. For example, you should pass [1, 2500, 5, 5000, 10, 10000].
    ///
    ///  25%     50%     100%
    ///   | ----- | ----- |----->
    ///  1ppl    5ppl    10ppl
    ///
    /// @dev refereeBonusRateMap's lower amount should be ascending
    function setReferral(
        uint24 _secondsUntilInactive,
        bool _onlyRewardActiveReferrers,
        uint16[3] memory _levelRate,
        uint16[6] memory _refereeBonusRateMap
    ) public onlyRole(DEFAULT_ADMIN_ROLE) {
        uint256 levelRateTotal;
        uint256 levelRateLength = _levelRate.length;
        for (uint8 i; i < levelRateLength; i++) {
            levelRateTotal += _levelRate[i];
        }
        if (levelRateTotal > 10000) {
            revert WrongLevelRate();
        }

        secondsUntilInactive = _secondsUntilInactive;
        onlyRewardActiveReferrers = _onlyRewardActiveReferrers;
        levelRate = _levelRate;

        emit SetReferral(
            secondsUntilInactive,
            onlyRewardActiveReferrers,
            levelRate
        );

        uint8 j;
        uint256 refereeBonusRateMapLength = _refereeBonusRateMap.length;
        for (uint8 i; i < refereeBonusRateMapLength; i += 2) {
            uint16 refereeBonusLowerBound = _refereeBonusRateMap[i];
            uint16 refereeBonusRate = _refereeBonusRateMap[i + 1];
            if (refereeBonusRate > 10000) {
                revert WrongRefereeBonusRate(refereeBonusRate);
            }
            refereeBonusRateMap[j] = RefereeBonusRate(
                refereeBonusLowerBound,
                refereeBonusRate
            );
            emit SetReferreeBonusRate(refereeBonusLowerBound, refereeBonusRate);
            j++;
        }
    }

    /// @notice Adds an address as referrer.
    /// @param user Address of the gamer.
    /// @param referrer The address would set as referrer of user.
    function addReferrer(address user, address referrer)
        external
        onlyRole(GAME_ROLE)
    {
        if (referrer == address(0)) {
            // Referrer cannot be 0x0 address
            return;
        } else if (_isCircularReference(referrer, user)) {
            // Referee cannot be one of referrer uplines
            return;
        } else if (_accounts[user].referrer != address(0)) {
            // Address have been registered upline
            return;
        }

        Account storage userAccount = _accounts[user];
        Account storage parentAccount = _accounts[referrer];

        userAccount.referrer = referrer;
        userAccount.lastActiveTimestamp = uint32(block.timestamp);
        parentAccount.referredCount += 1;

        emit RegisteredReferer(user, referrer);
    }

    /// @notice Calculates and allocate referrer(s) credits to uplines.
    /// @param user Address of the gamer to find referrer(s).
    /// @param token The token to allocate.
    /// @param amount The number of tokens allocated for referrer(s).
    function payReferral(
        address user,
        address token,
        uint256 amount
    ) external onlyRole(BANK_ROLE) returns (uint256) {
        uint256 totalReferral;
        Account memory userAccount = _accounts[user];

        if (userAccount.referrer != address(0)) {
            uint256 levelRateLength = levelRate.length;
            for (uint8 i; i < levelRateLength; i++) {
                address parent = userAccount.referrer;
                Account memory parentAccount = _accounts[parent];

                if (parent == address(0)) {
                    break;
                }

                if (
                    !onlyRewardActiveReferrers ||
                    (parentAccount.lastActiveTimestamp + secondsUntilInactive >=
                        block.timestamp)
                ) {
                    uint256 credit = (((amount * levelRate[i]) / 10000) *
                        _getRefereeBonusRate(parentAccount.referredCount)) /
                        10000;
                    totalReferral += credit;

                    _credits[parent][token] += credit;

                    emit AddReferralCredit(parent, token, credit, i + 1);
                }

                userAccount = parentAccount;
            }
        }
        return totalReferral;
    }

    /// @notice Updates referrer's last active timestamp.
    /// @param user Address of the gamer.
    function updateReferrerActivity(address user) external onlyRole(GAME_ROLE) {
        Account storage userAccount = _accounts[user];
        if (userAccount.referredCount > 0) {
            uint32 lastActiveTimestamp = uint32(block.timestamp);
            userAccount.lastActiveTimestamp = lastActiveTimestamp;
            emit SetLastActiveTimestamp(user, lastActiveTimestamp);
        }
    }

    /// @notice Referrer withdraw credits.
    /// @param tokens The tokens addresses.
    function withdrawCredits(address[] calldata tokens) external {
        address payable payee = payable(msg.sender);
        for (uint8 i; i < tokens.length; i++) {
            address token = tokens[i];
            uint256 credit = _credits[payee][token];
            if (credit > 0) {
                _credits[payee][token] = 0;

                if (token == address(0)) {
                    Address.sendValue(payee, credit);
                } else {
                    IERC20(token).safeTransfer(payee, credit);
                }

                emit WithdrawnReferralCredit(payee, token, credit);
            }
        }
    }

    /// @notice Utils function for check whether an address has the referrer.
    /// @param user Address of the gamer.
    /// @return Whether user has a referrer.
    function hasReferrer(address user) external view returns (bool) {
        return _accounts[user].referrer != address(0);
    }

    /// @notice Gets the referrer's token credits.
    /// @param payee Address of the referrer.
    /// @param token Address of the token.
    /// @return The number of tokens available to withdraw.
    function referralCreditOf(address payee, address token)
        external
        view
        returns (uint256)
    {
        return _credits[payee][token];
    }

    /// @notice Gets the referrer's account information.
    /// @param user Address of the referrer.
    /// @return The account information.
    function getReferralAccount(address user)
        external
        view
        returns (Account memory)
    {
        return _accounts[user];
    }
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 8000
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract ABI

[{"inputs":[{"internalType":"uint24","name":"_secondsUntilInactive","type":"uint24"},{"internalType":"bool","name":"_onlyRewardActiveReferrers","type":"bool"},{"internalType":"uint16[3]","name":"_levelRate","type":"uint16[3]"},{"internalType":"uint16[6]","name":"_refereeBonusRateMap","type":"uint16[6]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WrongLevelRate","type":"error"},{"inputs":[{"internalType":"uint16","name":"rate","type":"uint16"}],"name":"WrongRefereeBonusRate","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"uint16","name":"level","type":"uint16"}],"name":"AddReferralCredit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"referee","type":"address"},{"indexed":true,"internalType":"address","name":"referrer","type":"address"}],"name":"RegisteredReferer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"referrer","type":"address"},{"indexed":false,"internalType":"uint32","name":"lastActiveTimestamp","type":"uint32"}],"name":"SetLastActiveTimestamp","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint24","name":"secondsUntilInactive","type":"uint24"},{"indexed":false,"internalType":"bool","name":"onlyRewardActiveReferrers","type":"bool"},{"indexed":false,"internalType":"uint16[3]","name":"levelRate","type":"uint16[3]"}],"name":"SetReferral","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"lowerBound","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"rate","type":"uint16"}],"name":"SetReferreeBonusRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"payee","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawnReferralCredit","type":"event"},{"inputs":[],"name":"BANK_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GAME_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"referrer","type":"address"}],"name":"addReferrer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getReferralAccount","outputs":[{"components":[{"internalType":"address","name":"referrer","type":"address"},{"internalType":"uint24","name":"referredCount","type":"uint24"},{"internalType":"uint32","name":"lastActiveTimestamp","type":"uint32"}],"internalType":"struct Referral.Account","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"hasReferrer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"levelRate","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"onlyRewardActiveReferrers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"payReferral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"refereeBonusRateMap","outputs":[{"internalType":"uint16","name":"lowerBound","type":"uint16"},{"internalType":"uint16","name":"rate","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"payee","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"referralCreditOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"secondsUntilInactive","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint24","name":"_secondsUntilInactive","type":"uint24"},{"internalType":"bool","name":"_onlyRewardActiveReferrers","type":"bool"},{"internalType":"uint16[3]","name":"_levelRate","type":"uint16[3]"},{"internalType":"uint16[6]","name":"_refereeBonusRateMap","type":"uint16[6]"}],"name":"setReferral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"updateReferrerActivity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"withdrawCredits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b5060405162002c2238038062002c2283398101604081905262000034916200077a565b6001805460ff191690556200004b60003362000063565b620000598484848462000073565b50505050620009f3565b6200006f828262000304565b5050565b6000620000818133620003a4565b60006003815b818160ff161015620000d757858160ff1660038110620000ab57620000ab62000844565b6020020151620000c09061ffff168462000870565b925080620000ce816200088b565b91505062000087565b50612710821115620000fc576040516347b2d1a160e01b815260040160405180910390fd5b6003805487151563010000000263ffffffff1990911662ffffff8a16171781556200012c906002908790620005ff565b506003546040805162ffffff83168152630100000090920460ff16151560208084019190915260025461ffff80821685850152601082901c81166060860152911c166080830152517ff00824b816a4531d705cd1029abff952a032e648db7de396f9f0f8c539fc4f2b9160a0908290030190a160006006815b818160ff161015620002f8576000878260ff1660068110620001cb57620001cb62000844565b60200201519050600088620001e2846001620008ae565b60ff1660068110620001f857620001f862000844565b602002015190506127108161ffff1611156200023257604051630f5e2f7f60e21b815261ffff821660048201526024015b60405180910390fd5b60405180604001604052808361ffff1681526020018261ffff1681525060048660ff166003811062000268576200026862000844565b82519101805460209384015161ffff908116620100000263ffffffff1990921693811693909317179055604080518583168152918416928201929092527f93b1de1f3c33ea5943767b6d6cf51236c3832c86fb3ffd41a92f0f807eb6fee6910160405180910390a184620002dc816200088b565b9550505050600281620002f09190620008ae565b9050620001a5565b50505050505050505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200006f576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620003603390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200006f57620003ee816001600160a01b031660146200043f60201b6200111e1760201c565b620004048360206200111e6200043f821b17811c565b6040516020016200041792919062000909565b60408051601f198184030181529082905262461bcd60e51b8252620002299160040162000982565b6060600062000450836002620009b7565b6200045d90600262000870565b6001600160401b03811115620004775762000477620006b3565b6040519080825280601f01601f191660200182016040528015620004a2576020820181803683370190505b509050600360fc1b81600081518110620004c057620004c062000844565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110620004f257620004f262000844565b60200101906001600160f81b031916908160001a905350600062000518846002620009b7565b6200052590600162000870565b90505b6001811115620005a7576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106200055d576200055d62000844565b1a60f81b82828151811062000576576200057662000844565b60200101906001600160f81b031916908160001a90535060049490941c936200059f81620009d9565b905062000528565b508315620005f85760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640162000229565b9392505050565b6001830191839082156200068a5791602002820160005b838211156200065857835183826101000a81548161ffff021916908361ffff160217905550926020019260020160208160010104928301926001030262000616565b8015620006885782816101000a81549061ffff021916905560020160208160010104928301926001030262000658565b505b50620006989291506200069c565b5090565b5b808211156200069857600081556001016200069d565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715620006ee57620006ee620006b3565b60405290565b805161ffff811681146200070757600080fd5b919050565b60405160009060c081016001600160401b0381118282101715620007345762000734620006b3565b60405290508060c08301848111156200074c57600080fd5b835b8181101562000771576200076281620006f4565b8352602092830192016200074e565b50505092915050565b60008060008061016085870312156200079257600080fd5b845162ffffff81168114620007a657600080fd5b809450506020808601518015158114620007bf57600080fd5b9350605f86018713620007d157600080fd5b620007db620006c9565b8060a0880189811115620007ee57600080fd5b604089015b8181101562000815576200080781620006f4565b8452928401928401620007f3565b508195508960bf8a01126200082957600080fd5b620008358a826200070c565b94505050505092959194509250565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082198211156200088657620008866200085a565b500190565b600060ff821660ff811415620008a557620008a56200085a565b60010192915050565b600060ff821660ff84168060ff03821115620008ce57620008ce6200085a565b019392505050565b60005b83811015620008f3578181015183820152602001620008d9565b8381111562000903576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835162000943816017850160208801620008d6565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835162000976816028840160208801620008d6565b01602801949350505050565b6020815260008251806020840152620009a3816040850160208701620008d6565b601f01601f19169190910160400192915050565b6000816000190483118215151615620009d457620009d46200085a565b500290565b600081620009eb57620009eb6200085a565b506000190190565b61221f8062000a036000396000f3fe6080604052600436106101795760003560e01c80635c975abb116100cb578063b94265b81161007f578063d547741f11610059578063d547741f1461057d578063dc12365f1461059d578063e8f08c1b146105d057600080fd5b8063b94265b8146104f7578063c63602a014610517578063ce5cae921461055d57600080fd5b806391d14854116100b057806391d148541461046a578063a217fddf146104ae578063ab400706146104c357600080fd5b80635c975abb146104325780637700f17b1461044a57600080fd5b80632ee7754d1161012d57806336568abe1161010757806336568abe146103a75780633a8e7bdc146103c75780634b7f8ba4146103f757600080fd5b80632ee7754d146102895780632f2ff15d146102aa5780633171b76f146102ca57600080fd5b806318452cd81161015e57806318452cd8146101fc5780632434850f14610237578063248a9ca31461025957600080fd5b806301ffc9a7146101855780630eb71432146101ba57600080fd5b3661018057005b600080fd5b34801561019157600080fd5b506101a56101a0366004611bd5565b6105f0565b60405190151581526020015b60405180910390f35b3480156101c657600080fd5b506101ee7f591fa5458fe051cc8c02c405479bd38e00713c98dbd3db209d982048f1e638fa81565b6040519081526020016101b1565b34801561020857600080fd5b506101a5610217366004611c33565b6001600160a01b0390811660009081526008602052604090205416151590565b34801561024357600080fd5b50610257610252366004611d2f565b610689565b005b34801561026557600080fd5b506101ee610274366004611de4565b60009081526020819052604090206001015490565b34801561029557600080fd5b506003546101a5906301000000900460ff1681565b3480156102b657600080fd5b506102576102c5366004611dfd565b610962565b3480156102d657600080fd5b506103716102e5366004611c33565b6040805160608082018352600080835260208084018290529284018190526001600160a01b039485168152600883528390208351918201845254938416815274010000000000000000000000000000000000000000840462ffffff16918101919091527701000000000000000000000000000000000000000000000090920463ffffffff169082015290565b6040805182516001600160a01b0316815260208084015162ffffff16908201529181015163ffffffff16908201526060016101b1565b3480156103b357600080fd5b506102576103c2366004611dfd565b61098d565b3480156103d357600080fd5b506003546103e39062ffffff1681565b60405162ffffff90911681526020016101b1565b34801561040357600080fd5b50610417610412366004611de4565b610a33565b6040805161ffff9384168152929091166020830152016101b1565b34801561043e57600080fd5b5060015460ff166101a5565b34801561045657600080fd5b506101ee610465366004611e29565b610a58565b34801561047657600080fd5b506101a5610485366004611dfd565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156104ba57600080fd5b506101ee600081565b3480156104cf57600080fd5b506101ee7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa8881565b34801561050357600080fd5b50610257610512366004611e65565b610d35565b34801561052357600080fd5b506101ee610532366004611e65565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205490565b34801561056957600080fd5b50610257610578366004611c33565b610eae565b34801561058957600080fd5b50610257610598366004611dfd565b610fa7565b3480156105a957600080fd5b506105bd6105b8366004611de4565b610fcd565b60405161ffff90911681526020016101b1565b3480156105dc57600080fd5b506102576105eb366004611e8f565b610ffb565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061068357507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60006106958133611368565b60006003815b818160ff1610156106e257858160ff16600381106106bb576106bb611f04565b60200201516106ce9061ffff1684611f62565b9250806106da81611f7a565b91505061069b565b5061271082111561071f576040517f47b2d1a100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600380548715156301000000027fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000090911662ffffff8a1617178155610768906002908790611b2a565b506003546040805162ffffff83168152630100000090920460ff16151560208084019190915260025461ffff80821685850152601082901c81166060860152911c166080830152517ff00824b816a4531d705cd1029abff952a032e648db7de396f9f0f8c539fc4f2b9160a0908290030190a160006006815b818160ff161015610956576000878260ff166006811061080357610803611f04565b60200201519050600088610818846001611f9a565b60ff166006811061082b5761082b611f04565b602002015190506127108161ffff16111561087d576040517f3d78bdfc00000000000000000000000000000000000000000000000000000000815261ffff821660048201526024015b60405180910390fd5b60405180604001604052808361ffff1681526020018261ffff1681525060048660ff16600381106108b0576108b0611f04565b82519101805460209384015161ffff90811662010000027fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000090921693811693909317179055604080518583168152918416928201929092527f93b1de1f3c33ea5943767b6d6cf51236c3832c86fb3ffd41a92f0f807eb6fee6910160405180910390a18461093d81611f7a565b955050505060028161094f9190611f9a565b90506107e1565b50505050505050505050565b60008281526020819052604090206001015461097e8133611368565b610988838361141e565b505050565b6001600160a01b0381163314610a25576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610874565b610a2f82826114da565b5050565b60048160038110610a4357600080fd5b015461ffff8082169250620100009091041682565b60007f591fa5458fe051cc8c02c405479bd38e00713c98dbd3db209d982048f1e638fa610a858133611368565b6001600160a01b0385811660009081526008602090815260408083208151606081018352905494851680825274010000000000000000000000000000000000000000860462ffffff16938201939093527701000000000000000000000000000000000000000000000090940463ffffffff169084015290919015610d2b57600360005b818160ff161015610d285782516001600160a01b0380821660008181526008602090815260409182902082516060810184529054948516815274010000000000000000000000000000000000000000850462ffffff16918101919091527701000000000000000000000000000000000000000000000090930463ffffffff1690830152610b96575050610d28565b6003546301000000900460ff161580610bce575060035460408201514291610bc59162ffffff90911690611fbf565b63ffffffff1610155b15610d12576000612710610be58360200151611577565b61ffff1661271060028760ff1660038110610c0257610c02611f04565b601091828204019190066002029054906101000a900461ffff1661ffff168d610c2b9190611fe7565b610c359190612024565b610c3f9190611fe7565b610c499190612024565b9050610c558188611f62565b96508060076000856001600160a01b03166001600160a01b0316815260200190815260200160002060008d6001600160a01b03166001600160a01b031681526020019081526020016000206000828254610caf9190611f62565b90915550610cc09050846001611f9a565b60ff168b6001600160a01b0316846001600160a01b03167f5529ef3a23da49436a47cbc1306b610f6f0860de4d1ecea8a7913488726044c184604051610d0891815260200190565b60405180910390a4505b9350819050610d2081611f7a565b915050610b08565b50505b5095945050505050565b7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa88610d608133611368565b6001600160a01b038216610d7357505050565b610d7d8284611608565b15610d8757505050565b6001600160a01b038381166000908152600860205260409020541615610dac57505050565b6001600160a01b03838116600090815260086020526040808220928516808352912082547fffffffffff00000000ffffff000000000000000000000000000000000000000016909117770100000000000000000000000000000000000000000000004263ffffffff160217825580546001908290601490610e4b90849074010000000000000000000000000000000000000000900462ffffff1661205f565b92506101000a81548162ffffff021916908362ffffff160217905550836001600160a01b0316856001600160a01b03167ffaf63637882ff2d63ca76881cf92fb857130e36f350c926f9cc884b499b42b7760405160405180910390a35050505050565b7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa88610ed98133611368565b6001600160a01b0382166000908152600860205260409020805474010000000000000000000000000000000000000000900462ffffff16156109885780547fffffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffff16770100000000000000000000000000000000000000000000004263ffffffff81169182029290921783556040519081526001600160a01b038516907f040d3d9ad766cf2f7b2b1276ed725eb6e7e9864c6f19fcd411ccefc4ee432cc59060200160405180910390a250505050565b600082815260208190526040902060010154610fc38133611368565b61098883836114da565b60028160038110610fdd57600080fd5b60109182820401919006600202915054906101000a900461ffff1681565b3360005b60ff811683111561111857600084848360ff1681811061102157611021611f04565b90506020020160208101906110369190611c33565b6001600160a01b038085166000908152600760209081526040808320938516835292905220549091508015611103576001600160a01b038085166000908152600760209081526040808320938616808452939091528120556110a15761109c848261168f565b6110b5565b6110b56001600160a01b03831685836117dc565b816001600160a01b0316846001600160a01b03167f6f8ec2b930fcc8511256f97d7be5b762ce92fd2cb30972b801cff4e4ca0a8eca836040516110fa91815260200190565b60405180910390a35b5050808061111090611f7a565b915050610fff565b50505050565b6060600061112d836002611fe7565b611138906002611f62565b67ffffffffffffffff81111561115057611150611c5f565b6040519080825280601f01601f19166020018201604052801561117a576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106111b1576111b1611f04565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061121457611214611f04565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611250846002611fe7565b61125b906001611f62565b90505b60018111156112f8577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061129c5761129c611f04565b1a60f81b8282815181106112b2576112b2611f04565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936112f18161207d565b905061125e565b508315611361576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610874565b9392505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610a2f576113a4816001600160a01b0316601461111e565b6113af83602061111e565b6040516020016113c09291906120de565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526108749160040161215f565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610a2f576000828152602081815260408083206001600160a01b0385168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556114963390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1615610a2f576000828152602081815260408083206001600160a01b038516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60045460009062010000900461ffff16600360015b818160ff1610156115ff57600060048260ff16600381106115af576115af611f04565b6040805180820190915291015461ffff8082168084526201000090920416602083015290915062ffffff871610156115e757506115ff565b602001519250806115f781611f7a565b91505061158c565b50909392505050565b6000826003825b818160ff161015611683576001600160a01b03831661162d57611683565b846001600160a01b0316836001600160a01b031614156116535760019350505050610683565b6001600160a01b03928316600090815260086020526040902054909216918061167b81611f7a565b91505061160f565b50600095945050505050565b804710156116f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610874565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611746576040519150601f19603f3d011682016040523d82523d6000602084013e61174b565b606091505b5050905080610988576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610874565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908401526109889286929160009161189a918516908490611944565b80519091501561098857808060200190518101906118b891906121b0565b610988576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610874565b6060611953848460008561195b565b949350505050565b6060824710156119ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610874565b6001600160a01b0385163b611a5e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610874565b600080866001600160a01b03168587604051611a7a91906121cd565b60006040518083038185875af1925050503d8060008114611ab7576040519150601f19603f3d011682016040523d82523d6000602084013e611abc565b606091505b5091509150611acc828286611ad7565b979650505050505050565b60608315611ae6575081611361565b825115611af65782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610874919061215f565b600183019183908215611bb05791602002820160005b83821115611b8057835183826101000a81548161ffff021916908361ffff1602179055509260200192600201602081600101049283019260010302611b40565b8015611bae5782816101000a81549061ffff0219169055600201602081600101049283019260010302611b80565b505b50611bbc929150611bc0565b5090565b5b80821115611bbc5760008155600101611bc1565b600060208284031215611be757600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461136157600080fd5b80356001600160a01b0381168114611c2e57600080fd5b919050565b600060208284031215611c4557600080fd5b61136182611c17565b8015158114611c5c57600080fd5b50565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516060810167ffffffffffffffff81118282101715611cb157611cb1611c5f565b60405290565b803561ffff81168114611c2e57600080fd5b600060405160c0810181811067ffffffffffffffff82111715611cee57611cee611c5f565b60405290508060c0830184811115611d0557600080fd5b835b81811015611d2657611d1881611cb7565b835260209283019201611d07565b50505092915050565b6000806000806101608587031215611d4657600080fd5b843562ffffff81168114611d5957600080fd5b9350602085810135611d6a81611c4e565b9350605f86018713611d7b57600080fd5b611d83611c8e565b8060a0880189811115611d9557600080fd5b604089015b81811015611db857611dab81611cb7565b8452928401928401611d9a565b508195508960bf8a0112611dcb57600080fd5b611dd58a82611cc9565b94505050505092959194509250565b600060208284031215611df657600080fd5b5035919050565b60008060408385031215611e1057600080fd5b82359150611e2060208401611c17565b90509250929050565b600080600060608486031215611e3e57600080fd5b611e4784611c17565b9250611e5560208501611c17565b9150604084013590509250925092565b60008060408385031215611e7857600080fd5b611e8183611c17565b9150611e2060208401611c17565b60008060208385031215611ea257600080fd5b823567ffffffffffffffff80821115611eba57600080fd5b818501915085601f830112611ece57600080fd5b813581811115611edd57600080fd5b8660208260051b8501011115611ef257600080fd5b60209290920196919550909350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115611f7557611f75611f33565b500190565b600060ff821660ff811415611f9157611f91611f33565b60010192915050565b600060ff821660ff84168060ff03821115611fb757611fb7611f33565b019392505050565b600063ffffffff808316818516808303821115611fde57611fde611f33565b01949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561201f5761201f611f33565b500290565b60008261205a577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600062ffffff808316818516808303821115611fde57611fde611f33565b60008161208c5761208c611f33565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b60005b838110156120cd5781810151838201526020016120b5565b838111156111185750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516121168160178501602088016120b2565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516121538160288401602088016120b2565b01602801949350505050565b602081526000825180602084015261217e8160408501602087016120b2565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000602082840312156121c257600080fd5b815161136181611c4e565b600082516121df8184602087016120b2565b919091019291505056fea264697066735822122049e4c2a7d944c28446f9a88c840051f3291b3dd14b457aed32180d4faf68fbee64736f6c634300080c00330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017700000000000000000000000000000000000000000000000000000000000000bb800000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000009c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000001388000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000002710

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017700000000000000000000000000000000000000000000000000000000000000bb800000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000009c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000001388000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000002710

-----Decoded View---------------
Arg [0] : _secondsUntilInactive (uint24): 0
Arg [1] : _onlyRewardActiveReferrers (bool): False
Arg [2] : _levelRate (uint16[3]): 6000,3000,1000
Arg [3] : _refereeBonusRateMap (uint16[6]): 1,2500,5,5000,10,10000

-----Encoded View---------------
11 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 0000000000000000000000000000000000000000000000000000000000001770
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000bb8
Arg [4] : 00000000000000000000000000000000000000000000000000000000000003e8
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [6] : 00000000000000000000000000000000000000000000000000000000000009c4
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [8] : 0000000000000000000000000000000000000000000000000000000000001388
Arg [9] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [10] : 0000000000000000000000000000000000000000000000000000000000002710


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading