Contract 0x1B2C5b8312708029E8f63484CeECB2ba5cAA1228

Contract Overview

Balance:
0 MATIC
Txn Hash
Method
Block
From
To
Value [Txn Fee]
0x5757629e040d4b1d0a377d37bdd625db345eebe7933945814fe337cfacbd2e75Harvest Dividend...265829472022-06-03 10:21:09298 days 1 hr ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa12280 MATIC0.00008089875 1.87500001
0xaef64aa2ac05eec10958f4e68d361545277c214c5c215aa8a8cf5f1f0d97f2d3Grant Role265829382022-06-03 10:20:24298 days 1 hr ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa12280 MATIC0.000076995 1.500000009
0x59e913c927f05fce9a8b8ad216c2a63943b2cc58977d480b62558f1b96a95e97Distribute Token...265828812022-06-03 10:15:38298 days 1 hr ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa12280 MATIC0.0001159475 2.500000009
0x47d42b0b116a6d6181c829815e9bcacab19f6954383e8fc8d98077d15a3544c2Withdraw265828202022-06-03 10:10:32298 days 1 hr ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa12280 MATIC0.001437660944 32.887131294
0xca879741e96e84b47ca29e4375ec8fdab594103578e698717be6bd8fae21f891Set Balance Over...255895862022-03-20 7:30:23373 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa12280 MATIC0.000988799999 19.999999998
0x3f0a519e44a74a382aabc1c44315a16b7045369d93348c12d64027b88cba4b79Set Cash In Hous...255895852022-03-20 7:30:18373 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa12280 MATIC0.000658339999 19.999999999
0x241cff29519dca4f94f24943488737f8c62d8a9ac87f95a8be657b0e0ec6d08bSet House Edge S...255895842022-03-20 7:30:13373 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa12280 MATIC0.001000939999 19.999999999
0x1f26f5592e5ae50e4ad99da2e4bd7f9d4ae69633e6dfbf2f570729afc1be3bd8Set Allowed Toke...255895742022-03-20 7:29:23373 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa12280 MATIC0.000960159999 19.999999998
0xcf9c85b836cc64185d74d6f68d83a63b8ae7c9bb08772a76e215d51cac9e000eAdd Token255895722022-03-20 7:29:13373 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa12280 MATIC0.001114599999 19.999999997
0xcb3eff3cbe1db3d900ff0cda114d5d7044c3a2cb3739069768caad5a5c17ad57Deposit255894862022-03-20 7:16:41373 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa122880 MATIC0.0011682 20
0x67de8b8e9726290757acca8610da2391be2f7e1e6533a3355ccc18eb29c0b916Set Balance Over...255894752022-03-20 7:15:46373 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa12280 MATIC0.000409836 8.330000001
0xbeb0f774396a1ea6a01ccd9e695c112fade2b80d128b1649128e7f3b8f5e09a9Set Cash In Hous...255894742022-03-20 7:15:41373 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa12280 MATIC0.00065354 20.000000001
0xfbf8d7eee5962abfcb70293b36e13161d9f0adc8e6b42924e4a9d38151a4530dSet House Edge S...255894722022-03-20 7:15:31373 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa12280 MATIC0.00099614 20
0x156d6a1892cbb268dd794034968ddcf304e36997ce36ea84a033ffaea9dcdebdSet Allowed Toke...255894562022-03-20 7:14:11373 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa12280 MATIC0.00095536 20
0xb137dd1fb1e3e096ae5670f5c98b145c36ea5a12d9133021176ee79ef31097cbAdd Token255894542022-03-20 7:14:01373 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa12280 MATIC0.00065878 20
0xe67a75a53a8db46e8e73531842a55ab33764064884abe1b1757175867bb21b34Grant Role255892942022-03-20 7:00:38373 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa12280 MATIC0.000128385 2.500000016
0x0a141204acc5d0bb1e99bff9b8b16420696e9f31cdd801932e71d8526f4b44d1Grant Role255892902022-03-20 7:00:18373 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0x1b2c5b8312708029e8f63484ceecb2ba5caa12280 MATIC0.001026839999 19.999999999
0x49d895202de4139e95c6713d54f5e07fca9ded4cc308a083d31609ac766d95690x60a06040255892852022-03-20 6:59:53373 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  Create: Bank0 MATIC0.06061642 20
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x5757629e040d4b1d0a377d37bdd625db345eebe7933945814fe337cfacbd2e75265829472022-06-03 10:21:09298 days 1 hr ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280x2c305888a456e7004663bc12a74395e637eabcbc1.223741313013882899 MATIC
0x59e913c927f05fce9a8b8ad216c2a63943b2cc58977d480b62558f1b96a95e97265828812022-06-03 10:15:38298 days 1 hr ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa1228 0x8343f2dc53e55dbbe626b9d8b4fbbb4e37dc218b0.388514018908001847 MATIC
0x59e913c927f05fce9a8b8ad216c2a63943b2cc58977d480b62558f1b96a95e97265828812022-06-03 10:15:38298 days 1 hr ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280x2c305888a456e7004663bc12a74395e637eabcbc0.954430284539112364 MATIC
0x47d42b0b116a6d6181c829815e9bcacab19f6954383e8fc8d98077d15a3544c2265828202022-06-03 10:10:32298 days 1 hr ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280x2c305888a456e7004663bc12a74395e637eabcbc75.55623189530236599 MATIC
0x51dbf60edd0ba78426a0d80e9697ab856fc91d47a3f60e553d6cef34a94835ac265663472022-06-02 7:24:10299 days 4 hrs ago 0x32ea799ca500d4f61c82fd20ea1d8946c8630459 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280.01 MATIC
0xdd36c2dd676ba9947a2df34a742bb24828348796924834eec9d48dc44937f32e265663272022-06-02 7:22:29299 days 4 hrs ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280x2c305888a456e7004663bc12a74395e637eabcbc0.004996969696969697 MATIC
0xdd36c2dd676ba9947a2df34a742bb24828348796924834eec9d48dc44937f32e265663272022-06-02 7:22:29299 days 4 hrs ago 0x32ea799ca500d4f61c82fd20ea1d8946c8630459 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280.0003 MATIC
0x5085b6cf8c73ccac9539a257e378eb4348a0b26ab8bc3c0915bb7caff216c06b265608032022-06-01 21:35:43299 days 14 hrs ago 0x32ea799ca500d4f61c82fd20ea1d8946c8630459 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280.01 MATIC
0x63b3c08aceb1109e4eec07cd8fdffc87917699592971754e6fe1d8401c58f7dc265607972022-06-01 21:34:43299 days 14 hrs ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280x2c305888a456e7004663bc12a74395e637eabcbc0.097 MATIC
0x63b3c08aceb1109e4eec07cd8fdffc87917699592971754e6fe1d8401c58f7dc265607972022-06-01 21:34:43299 days 14 hrs ago 0x31f065188a348a17cc10e6f6e85f236c80fc118f 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280.003 MATIC
0x7e947c568722c1c3ba3bf4698130d35f200db9bd2f97dfeba603411e3baf1986265607902022-06-01 21:33:33299 days 14 hrs ago 0x31f065188a348a17cc10e6f6e85f236c80fc118f 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280.1 MATIC
0x0adaad78cc526bddba8f1002b38b2fce5e7c3d3d5eab8fdaf2016b92d9fa398f265607792022-06-01 21:31:43299 days 14 hrs ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280x2c305888a456e7004663bc12a74395e637eabcbc0.010095918367346939 MATIC
0x0adaad78cc526bddba8f1002b38b2fce5e7c3d3d5eab8fdaf2016b92d9fa398f265607792022-06-01 21:31:43299 days 14 hrs ago 0x32ea799ca500d4f61c82fd20ea1d8946c8630459 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280.0003 MATIC
0xd003a3780496178fd8b8e0fa2ba83d32607c4a618935f36c605e165f9dbd7f0e265607262022-06-01 21:26:17299 days 14 hrs ago 0x32ea799ca500d4f61c82fd20ea1d8946c8630459 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280.01 MATIC
0xd6111724e41736805ea4d32c28fa64903ea595083a133023dcfee020c64a5943265607062022-06-01 21:24:37299 days 14 hrs ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280x2c305888a456e7004663bc12a74395e637eabcbc0.013958536585365854 MATIC
0xd6111724e41736805ea4d32c28fa64903ea595083a133023dcfee020c64a5943265607062022-06-01 21:24:37299 days 14 hrs ago 0x32ea799ca500d4f61c82fd20ea1d8946c8630459 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280.0003 MATIC
0xecb063a2bcf8fe499707daf64b4ceedb8f207ab6ee4bc7cd38dceda27287b521265606982022-06-01 21:23:56299 days 14 hrs ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280x2c305888a456e7004663bc12a74395e637eabcbc0.013958536585365854 MATIC
0xecb063a2bcf8fe499707daf64b4ceedb8f207ab6ee4bc7cd38dceda27287b521265606982022-06-01 21:23:56299 days 14 hrs ago 0x32ea799ca500d4f61c82fd20ea1d8946c8630459 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280.0003 MATIC
0x29031244a0a354180a9963ccaec8479677d691b6b1614741b418a1cd862220cd265606352022-06-01 21:18:40299 days 14 hrs ago 0x32ea799ca500d4f61c82fd20ea1d8946c8630459 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280.01 MATIC
0x877d8454c23202c4814c505dc3ccc0f520d7e2cf713a36e683cd6b0b3442afc5265605672022-06-01 21:12:19299 days 14 hrs ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280x2c305888a456e7004663bc12a74395e637eabcbc0.291 MATIC
0x877d8454c23202c4814c505dc3ccc0f520d7e2cf713a36e683cd6b0b3442afc5265605672022-06-01 21:12:19299 days 14 hrs ago 0x32ea799ca500d4f61c82fd20ea1d8946c8630459 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280.003 MATIC
0xa64fba728110ac24579249f5665a74f58701a3be4aedb1ea4caefa2fdb9cb683265605432022-06-01 21:08:19299 days 14 hrs ago 0x32ea799ca500d4f61c82fd20ea1d8946c8630459 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280.01 MATIC
0x001f424cc0ac6ed41c54d205149ec1aff0a6f4e23196dbd5c2422d9be1805923265605352022-06-01 21:06:59299 days 14 hrs ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280x2c305888a456e7004663bc12a74395e637eabcbc0.015826315789473684 MATIC
0x001f424cc0ac6ed41c54d205149ec1aff0a6f4e23196dbd5c2422d9be1805923265605352022-06-01 21:06:59299 days 14 hrs ago 0x32ea799ca500d4f61c82fd20ea1d8946c8630459 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280.0003 MATIC
0x8abf8f5397d77f99e04035f725d04aadfd3645abdcdc6cbd1a8ab68c0308e995265605182022-06-01 21:04:09299 days 14 hrs ago 0x1b2c5b8312708029e8f63484ceecb2ba5caa12280x2c305888a456e7004663bc12a74395e637eabcbc0.017244444444444444 MATIC
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Bank

Compiler Version
v0.8.12+commit.f00d7308

Optimization Enabled:
Yes with 8000 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 12 : 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 12 : 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 12 : 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 4 of 12 : 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 5 of 12 : 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 12 : 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 12 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 8 of 12 : 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 12 : 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 12 : 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 12 : Bank.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.10;

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

import {IReferral} from "./IReferral.sol";

// import "hardhat/console.sol";

/// @title BetSwirl's Bank
/// @author Romuald Hog
/// @notice The Bank contract holds the casino's funds,
/// whitelist the games betting tokens,
/// define the max bet amount based on a risk,
/// payout the bet profit to user and collect the loss bet amount from the game's contract,
/// split and allocate the house edge taken from each bet (won or loss),
/// manage the tokens balance overflow to dynamically send overflowed tokens to the treasury and team.
/// The admin role is transfered to a Timelock that execute administrative tasks,
/// only the Games could payout the bet profit from the bank, and send the loss bet amount to the bank.
/// @dev All rates are in basis point.
contract Bank is AccessControl {
    using SafeERC20 for IERC20;

    /// @notice Token's house edge allocations struct.
    /// The games house edge is split into several allocations, that are different if the bet is won (payout) or loss (cash-in).
    /// The allocated amounts stays in the bank until authorized parties withdraw. They are subtracted from the balance.
    /// @param dividend Rate to be allocated as staking rewards, on bet payout.
    /// @param referral Rate to be allocated to the referrers, on bet payout.
    /// @param treasury Rate to be allocated to the treasury, on bet payout.
    /// @param team Rate to be allocated to the team, on bet payout.
    /// @param cashInDividend Rate to be allocated as staking rewards, on bet cash in.
    /// @param cashInReferral Rate to be allocated to the referrers, on bet cash in.
    /// @param cashInTreasury Rate to be allocated to the treasury, on bet cash in.
    /// @param cashInTeam Rate to be allocated to the team, on bet cash in.
    /// @param dividendAmount The number of tokens to be sent as staking rewards.
    /// @param treasuryAmount The number of tokens to be sent to the treasury.
    /// @param teamAmount The number of tokens to be sent to the team.
    struct HouseEdgeSplit {
        uint16 dividend;
        uint16 referral;
        uint16 treasury;
        uint16 team;
        uint16 cashInDividend;
        uint16 cashInReferral;
        uint16 cashInTreasury;
        uint16 cashInTeam;
        uint256 dividendAmount;
        uint256 treasuryAmount;
        uint256 teamAmount;
    }

    /// @notice Token's balance overflow struct.
    /// When the bank overflow threshold amount is reached on a token balance,
    /// the bank sends a percentage to the treasury and team, and the new token's balance reference is set.
    /// @param thresholdRate Threshold rate for the token's balance reference.
    /// @param toTreasury Rate to be allocated to the treasury.
    /// @param toTeam Rate to be allocated to the team.
    struct BalanceOverflow {
        uint16 thresholdRate;
        uint16 toTreasury;
        uint16 toTeam;
    }

    /// @notice Token struct.
    /// List of tokens to bet on games.
    /// @param allowed Whether the token is allowed for bets.
    /// @param houseEdgeSplit House edge allocations.
    /// @param balanceReference Balance reference used to manage the bank overflow.
    /// @param balanceOverflow Balance overflow management configuration.
    struct Token {
        bool allowed;
        HouseEdgeSplit houseEdgeSplit;
        uint256 balanceReference;
        BalanceOverflow balanceOverflow;
    }

    /// @notice Token's metadata struct. It contains additional information from the ERC20 token.
    /// @dev Only used on the `getTokens` getter for the front-end.
    /// @param decimals Number of token's decimals.
    /// @param tokenAddress Contract address of the token.
    /// @param name Name of the token.
    /// @param symbol Symbol of the token.
    /// @param token Token data.
    struct TokenMetadata {
        uint8 decimals;
        address tokenAddress;
        string name;
        string symbol;
        Token token;
    }

    /// @notice Defines the maximum bank payout, used to calculate the max bet amount.
    uint16 public balanceRisk = 200;

    /// @notice Number of tokens added.
    uint16 private _tokensCount;

    /// @notice Treasury multi-sig wallet.
    address payable public immutable treasury;

    /// @notice Team wallet.
    address payable public teamWallet;

    /// @notice Referral program contract.
    IReferral public referralProgram;

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

    /// @notice Role associated to SwirlMaster smart contract.
    bytes32 public constant SWIRLMASTER_ROLE = keccak256("SWIRLMASTER_ROLE");

    /// @notice Maps tokens addresses to token configuration.
    mapping(address => Token) private _tokens;

    /// @notice Maps tokens indexes to token address.
    mapping(uint16 => address) private _tokensList;

    /// @notice Emitted after the team wallet is set.
    /// @param teamWallet The team wallet address.
    event SetTeamWallet(address teamWallet);

    /// @notice Emitted after the referral program is set.
    /// @param referralProgram The referral program address.
    event SetReferralProgram(address referralProgram);

    /// @notice Emitted after the balance risk is set.
    /// @param balanceRisk Rate defining the balance risk.
    event SetBalanceRisk(uint16 balanceRisk);

    /// @notice Emitted after a token is added.
    /// @param token Address of the token.
    event AddToken(address token);

    /// @notice Emitted after a token is allowed.
    /// @param token Address of the token.
    /// @param allowed Whether the token is allowed for betting.
    event SetAllowedToken(address indexed token, bool allowed);

    /// @notice Emitted after a token deposit.
    /// @param token Address of the token.
    /// @param amount The number of token deposited.
    event Deposit(address indexed token, uint256 amount);

    /// @notice Emitted after a token withdrawal.
    /// @param token Address of the token.
    /// @param amount The number of token withdrawn.
    event Withdraw(address indexed token, uint256 amount);

    /// @notice Emitted after the token's house edge allocations for bet payout is set.
    /// @param token Address of the token.
    /// @param dividend Rate to be allocated as staking rewards, on bet payout.
    /// @param referral Rate to be allocated to the referrers, on bet payout.
    /// @param treasury Rate to be allocated to the treasury, on bet payout.
    /// @param team Rate to be allocated to the team, on bet payout.
    event SetTokenHouseEdgeSplit(
        address indexed token,
        uint16 dividend,
        uint16 referral,
        uint16 treasury,
        uint16 team
    );

    /// @notice Emitted after the token's house edge allocations for bet amount cash-in is set.
    /// @param token Address of the token.
    /// @param cashInDividend Rate to be allocated as staking rewards, on bet cash in.
    /// @param cashInReferral Rate to be allocated to the referrers, on bet cash in.
    /// @param cashInTreasury Rate to be allocated to the treasury, on bet cash in.
    /// @param cashInTeam Rate to be allocated to the team, on bet cash in.
    event SetCashInTokenHouseEdgeSplit(
        address indexed token,
        uint16 cashInDividend,
        uint16 cashInReferral,
        uint16 cashInTreasury,
        uint16 cashInTeam
    );

    /// @notice Emitted after the token's treasury and team allocations are distributed.
    /// @param token Address of the token.
    /// @param treasuryAmount The number of tokens sent to the treasury.
    /// @param teamAmount The number of tokens sent to the team.
    event HouseEdgeDistribution(
        address indexed token,
        uint256 treasuryAmount,
        uint256 teamAmount
    );

    /// @notice Emitted after the token's dividend allocation is distributed.
    /// @param token Address of the token.
    /// @param amount The number of tokens sent to the SwirlMaster.
    event HarvestDividend(address indexed token, uint256 amount);

    /// @notice Emitted after the token's balance overflow management configuration is set.
    /// @param token Address of the token.
    /// @param thresholdRate Threshold rate for the token's balance reference.
    /// @param toTreasury Rate to be allocated to the treasury.
    /// @param toTeam Rate to be allocated to the team.
    event SetBalanceOverflow(
        address indexed token,
        uint16 thresholdRate,
        uint16 toTreasury,
        uint16 toTeam
    );

    /// @notice Emitted after the token's bank overflow amount is distributed to the treasury and team.
    /// @param token Address of the token.
    /// @param amountToTreasury The number of tokens sent to the treasury.
    /// @param amountToTeam The number of tokens sent to the team.
    event BankOverflowTransfer(
        address indexed token,
        uint256 amountToTreasury,
        uint256 amountToTeam
    );

    /// @notice Emitted after the token's balance reference is set.
    /// This happends on deposit, withdraw and when the bank overflow threashold is reached.
    /// @param token Address of the token.
    /// @param balanceReference New balance reference used to determine the bank overflow.
    event SetBalanceReference(address indexed token, uint256 balanceReference);

    /// @notice Emitted after the token's house edge is allocated.
    /// @param token Address of the token.
    /// @param dividend The number of tokens allocated as staking rewards.
    /// @param referral The number of tokens allocated to the referrers.
    /// @param treasury The number of tokens allocated to the treasury.
    /// @param team The number of tokens allocated to the team.
    event AllocateHouseEdgeAmount(
        address indexed token,
        uint256 dividend,
        uint256 referral,
        uint256 treasury,
        uint256 team
    );

    /// @notice Emitted after the bet profit amount is sent to the user.
    /// @param token Address of the token.
    /// @param newBalance New token balance.
    /// @param profit Bet profit amount sent.
    event Payout(address indexed token, uint256 newBalance, uint256 profit);

    /// @notice Emitted after the bet amount is collected from the game smart contract.
    /// @param token Address of the token.
    /// @param newBalance New token balance.
    /// @param amount Bet amount collected.
    event CashIn(address indexed token, uint256 newBalance, uint256 amount);

    /// @notice Reverting error when trying to add an existing token.
    /// @param token Address of the token.
    error TokenExists(address token);
    /// @notice Reverting error when setting the house edge allocations, but the sum isn't 100%.
    /// @param splitSum Sum of the house edge allocations rates.
    error WrongHouseEdgeSplit(uint16 splitSum);
    /// @notice Reverting error when setting wrong balance overflow management configuration.
    error WrongBalanceOverflow();

    /// @notice Initialize the contract's admin role to the deployer, and state variables.
    /// @param treasuryAddress Treasury multi-sig wallet.
    /// @param teamWalletAddress Team wallet.
    constructor(
        address payable treasuryAddress,
        address payable teamWalletAddress,
        IReferral referralProgramAddress
    ) {
        // The ownership should then be transfered to the Timelock.
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);

        treasury = treasuryAddress;
        setTeamWallet(teamWalletAddress);
        setReferralProgram(referralProgramAddress);
    }

    /// @notice Transfers a specific amount of token to an address.
    /// Uses native transfer or ERC20 transfer depending on the token.
    /// @dev The 0x address is considered the gas token.
    /// @param user Address of destination.
    /// @param token Address of the token.
    /// @param amount Number of tokens.
    function _safeTransfer(
        address payable user,
        address token,
        uint256 amount
    ) private {
        if (_isGasToken(token)) {
            Address.sendValue(user, amount);
        } else {
            IERC20(token).safeTransfer(user, amount);
        }
    }

    /// @notice Splits the house edge fees and allocates them as dividends, for referrers, to the treasury and team.
    /// If the user has no referrer, the referral allocation is allocated evenly among the other allocations.
    /// @param user Address of the gamer.
    /// @param token Address of the token.
    /// @param fees Bet amount or bet profit fees.
    /// @param tokenHouseEdge To update the house edge allocations amounts.
    /// @param dividend Rate to be allocated as staking rewards.
    /// @param referral Rate to be allocated to the referrers.
    /// @param _treasury Rate to be allocated to the treasury.
    /// @param team Rate to be allocated to the team.
    function _allocateHouseEdge(
        address user,
        address token,
        uint256 fees,
        HouseEdgeSplit storage tokenHouseEdge,
        uint16 dividend,
        uint16 referral,
        uint16 _treasury,
        uint16 team
    ) private {
        uint256 referralAllocation = (fees * referral) / 10000;
        uint256 referralAmount;
        if (referralAllocation != 0 && address(referralProgram) != address(0)) {
            referralAmount = referralProgram.payReferral(
                user,
                token,
                referralAllocation
            );
            referralAllocation -= referralAmount;
        }

        uint256 referralAllocationRestPerSplit = (referralAllocation -
            (referralAllocation % 3)) / 3;
        uint256 dividendAmount = ((fees * dividend) / 10000) +
            referralAllocationRestPerSplit;
        uint256 treasuryAmount = ((fees * _treasury) / 10000) +
            referralAllocationRestPerSplit;
        uint256 teamAmount = ((fees * team) / 10000) +
            referralAllocationRestPerSplit;

        tokenHouseEdge.dividendAmount += dividendAmount;
        tokenHouseEdge.treasuryAmount += treasuryAmount;
        tokenHouseEdge.teamAmount += teamAmount;

        emit AllocateHouseEdgeAmount(
            token,
            dividendAmount,
            referralAmount,
            treasuryAmount,
            teamAmount
        );

        if (referralAmount != 0) {
            _safeTransfer(
                payable(address(referralProgram)),
                token,
                referralAmount
            );
        }
    }

    /// @notice Sets the new token's balance reference.
    /// @param token Address of the token.
    /// @param newReference Balance amount corresponding to the new reference.
    function _setBalanceReference(address token, uint256 newReference) private {
        _tokens[token].balanceReference = newReference;
        emit SetBalanceReference(token, newReference);
    }

    /// @notice Check if the token has the 0x address.
    /// @param token Address of the token.
    /// @return Whether the token's address is the 0x address.
    function _isGasToken(address token) private pure returns (bool) {
        return token == address(0);
    }

    /// @notice Deposit funds in the bank to allow gamers to win more.
    /// It is also setting the new balance reference, used to manage the bank overflow.
    /// ERC20 token allowance should be given prior to deposit.
    /// @param token Address of the token.
    /// @param amount Number of tokens.
    function deposit(address token, uint256 amount)
        external
        payable
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        uint256 balance = getBalance(token);
        if (_isGasToken(token)) {
            _setBalanceReference(token, balance);
            amount = msg.value;
        } else {
            _setBalanceReference(token, balance + amount);
            IERC20(token).safeTransferFrom(msg.sender, address(this), amount);
        }
        emit Deposit(token, amount);
    }

    /// @notice Withdraw funds from the bank to migrate.
    /// It is also setting the new balance reference, used to manage the bank overflow.
    /// @param token Address of the token.
    /// @param amount Number of tokens.
    function withdraw(address token, uint256 amount)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        _setBalanceReference(token, getBalance(token) - amount);
        _safeTransfer(payable(msg.sender), token, amount);
        emit Withdraw(token, amount);
    }

    /// @notice Sets the new balance risk.
    /// @param _balanceRisk Risk rate.
    function setBalanceRisk(uint16 _balanceRisk)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        balanceRisk = _balanceRisk;
        emit SetBalanceRisk(_balanceRisk);
    }

    /// @notice Adds a new token that'll be enabled for the games' betting.
    /// Token shouldn't exist yet.
    /// @param token Address of the token.
    function addToken(address token) external onlyRole(DEFAULT_ADMIN_ROLE) {
        if (_tokensCount > 0) {
            for (uint16 i; i < _tokensCount; i++) {
                if (_tokensList[i] == token) {
                    revert TokenExists(token);
                }
            }
        }
        _tokensList[_tokensCount] = token;
        _tokensCount += 1;
        emit AddToken(token);
    }

    /// @notice Changes the token's bet permission on an already added token.
    /// @param token Address of the token.
    /// @param allowed Whether the token is enabled for bets.
    function setAllowedToken(address token, bool allowed)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        _tokens[token].allowed = allowed;
        emit SetAllowedToken(token, allowed);
    }

    /// @notice Sets the token's house edge allocations for bet payout.
    /// @param token Address of the token.
    /// @param dividend Rate to be allocated as staking rewards, on bet payout.
    /// @param referral Rate to be allocated to the referrers, on bet payout.
    /// @param _treasury Rate to be allocated to the treasury, on bet payout.
    /// @param team Rate to be allocated to the team, on bet payout.
    /// @dev `dividend`, `referral`, `_treasury` and `team` rates sum must equals 10000.
    function setHouseEdgeSplit(
        address token,
        uint16 dividend,
        uint16 referral,
        uint16 _treasury,
        uint16 team
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        uint16 splitSum = dividend + team + _treasury + referral;
        if (splitSum != 10000) {
            revert WrongHouseEdgeSplit(splitSum);
        }

        HouseEdgeSplit storage tokenHouseEdge = _tokens[token].houseEdgeSplit;
        tokenHouseEdge.dividend = dividend;
        tokenHouseEdge.referral = referral;
        tokenHouseEdge.treasury = _treasury;
        tokenHouseEdge.team = team;

        emit SetTokenHouseEdgeSplit(token, dividend, referral, _treasury, team);
    }

    /// @notice Sets the token's house edge allocations for bet amount cash-in.
    /// @param token Address of the token.
    /// @param cashInDividend Rate to be allocated as staking rewards, on bet cash in.
    /// @param cashInReferral Rate to be allocated to the referrers, on bet cash in.
    /// @param cashInTreasury Rate to be allocated to the treasury, on bet cash in.
    /// @param cashInTeam Rate to be allocated to the team, on bet cash in.
    /// @dev `cashInDividend`, `cashInReferral`, `cashInTreasury` and `cashInTeam` rates sum must equals 10000.
    function setCashInHouseEdgeSplit(
        address token,
        uint16 cashInDividend,
        uint16 cashInReferral,
        uint16 cashInTreasury,
        uint16 cashInTeam
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        uint16 splitSum = cashInDividend +
            cashInTeam +
            cashInTreasury +
            cashInReferral;
        if (splitSum != 10000) {
            revert WrongHouseEdgeSplit(splitSum);
        }

        HouseEdgeSplit storage tokenHouseEdge = _tokens[token].houseEdgeSplit;
        tokenHouseEdge.cashInDividend = cashInDividend;
        tokenHouseEdge.cashInReferral = cashInReferral;
        tokenHouseEdge.cashInTreasury = cashInTreasury;
        tokenHouseEdge.cashInTeam = cashInTeam;

        emit SetCashInTokenHouseEdgeSplit(
            token,
            cashInDividend,
            cashInReferral,
            cashInTreasury,
            cashInTeam
        );
    }

    /// @notice Distributes the token's treasury and team allocations amounts.
    /// @param token Address of the token.
    function distributeTokenHouseEdgeSplit(address token)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        HouseEdgeSplit storage tokenHouseEdge = _tokens[token].houseEdgeSplit;
        uint256 treasuryAmount = tokenHouseEdge.treasuryAmount;
        uint256 teamAmount = tokenHouseEdge.teamAmount;
        tokenHouseEdge.treasuryAmount = 0;
        tokenHouseEdge.teamAmount = 0;
        _safeTransfer(treasury, token, treasuryAmount);
        _safeTransfer(teamWallet, token, teamAmount);
        emit HouseEdgeDistribution(token, treasuryAmount, teamAmount);
    }

    /// @notice Sets the token's balance overflow management configuration.
    /// The threshold shouldn't exceed 100% to be able to calculate the overflowed amount.
    /// The treasury and team rates sum shouldn't exceed 100% to allow the bank balance to grow organically.
    /// @param token Address of the token.
    /// @param thresholdRate Threshold rate for the token's balance reference.
    /// @param toTreasury Rate to be allocated to the treasury.
    /// @param toTeam Rate to be allocated to the team.
    function setBalanceOverflow(
        address token,
        uint16 thresholdRate,
        uint16 toTreasury,
        uint16 toTeam
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        if (thresholdRate > 10000 || (toTreasury + toTeam) > 10000) {
            revert WrongBalanceOverflow();
        }

        _tokens[token].balanceOverflow = BalanceOverflow(
            thresholdRate,
            toTreasury,
            toTeam
        );
        emit SetBalanceOverflow(token, thresholdRate, toTreasury, toTeam);
    }

    /// @notice Harvests tokens dividends.
    /// @return The list of tokens addresses and amount harvested.
    function harvestDividends()
        external
        onlyRole(SWIRLMASTER_ROLE)
        returns (address[] memory, uint256[] memory)
    {
        address[] memory tokens = new address[](_tokensCount);
        uint256[] memory amounts = new uint256[](_tokensCount);

        for (uint16 i; i < _tokensCount; i++) {
            address tokenAddress = _tokensList[i];
            Token storage token = _tokens[tokenAddress];
            uint256 dividendAmount = token.houseEdgeSplit.dividendAmount;
            if (dividendAmount > 0) {
                token.houseEdgeSplit.dividendAmount = 0;
                _safeTransfer(
                    payable(msg.sender),
                    tokenAddress,
                    dividendAmount
                );
                emit HarvestDividend(tokenAddress, dividendAmount);
                tokens[i] = tokenAddress;
                amounts[i] = dividendAmount;
            }
        }

        return (tokens, amounts);
    }

    /// @notice Payouts a winning bet, and allocate the house edge fee.
    /// @param user Address of the gamer.
    /// @param token Address of the token.
    /// @param profit Number of tokens to be sent to the gamer.
    /// @param fees Bet amount and bet profit fees amount.
    function payout(
        address payable user,
        address token,
        uint256 profit,
        uint256 fees
    ) external payable onlyRole(GAME_ROLE) {
        HouseEdgeSplit storage tokenHouseEdge = _tokens[token].houseEdgeSplit;
        _allocateHouseEdge(
            user,
            token,
            fees,
            tokenHouseEdge,
            tokenHouseEdge.dividend,
            tokenHouseEdge.referral,
            tokenHouseEdge.treasury,
            tokenHouseEdge.team
        );

        // Pay the user
        _safeTransfer(user, token, profit);

        emit Payout(token, getBalance(token), profit);
    }

    /// @notice Accounts a loss bet, allocate the house edge fee, and manage the balance overflow.
    /// @dev In case of an ERC20, the bet amount should be transfered prior to this tx.
    /// @dev In case of the gas token, the bet amount is sent along with this tx.
    /// @param user Address of the gamer.
    /// @param tokenAddress Address of the token.
    /// @param amount Loss bet amount.
    /// @param fees Bet amount fees amount.
    function cashIn(
        address user,
        address tokenAddress,
        uint256 amount,
        uint256 fees
    ) external payable onlyRole(GAME_ROLE) {
        Token storage token = _tokens[tokenAddress];
        _allocateHouseEdge(
            user,
            tokenAddress,
            fees,
            token.houseEdgeSplit,
            token.houseEdgeSplit.cashInDividend,
            token.houseEdgeSplit.cashInReferral,
            token.houseEdgeSplit.cashInTreasury,
            token.houseEdgeSplit.cashInTeam
        );

        uint256 tokenBalance = getBalance(tokenAddress);
        BalanceOverflow memory balanceOverflow = token.balanceOverflow;
        uint256 overflow = (token.balanceReference +
            ((tokenBalance * balanceOverflow.thresholdRate) / 10000));
        if (tokenBalance > overflow) {
            uint256 diff = tokenBalance - token.balanceReference;
            uint256 overflowAmountToTreasury = ((diff *
                balanceOverflow.toTreasury) / 10000);
            uint256 overflowAmountToTeam = ((diff * balanceOverflow.toTeam) /
                10000);
            _setBalanceReference(
                tokenAddress,
                tokenBalance - overflowAmountToTreasury - overflowAmountToTeam
            );

            uint256 treasuryAmount = token.houseEdgeSplit.treasuryAmount;
            uint256 teamAmount = token.houseEdgeSplit.teamAmount;
            token.houseEdgeSplit.treasuryAmount = 0;
            token.houseEdgeSplit.teamAmount = 0;

            _safeTransfer(
                treasury,
                tokenAddress,
                treasuryAmount + overflowAmountToTreasury
            );
            _safeTransfer(
                teamWallet,
                tokenAddress,
                teamAmount + overflowAmountToTeam
            );
            emit BankOverflowTransfer(
                tokenAddress,
                treasuryAmount + overflowAmountToTreasury,
                teamAmount + overflowAmountToTeam
            );
        }

        emit CashIn(
            tokenAddress,
            getBalance(tokenAddress),
            _isGasToken(tokenAddress) ? msg.value : amount
        );
    }

    /// @dev For the front-end
    function getTokens() external view returns (TokenMetadata[] memory) {
        TokenMetadata[] memory tokens = new TokenMetadata[](_tokensCount);
        for (uint16 i; i < _tokensCount; i++) {
            address tokenAddress = _tokensList[i];
            Token memory token = _tokens[tokenAddress];
            if (_isGasToken(tokenAddress)) {
                tokens[i] = TokenMetadata({
                    decimals: 18,
                    tokenAddress: tokenAddress,
                    name: "ETH",
                    symbol: "ETH",
                    token: token
                });
            } else {
                IERC20Metadata erc20Metadata = IERC20Metadata(tokenAddress);
                tokens[i] = TokenMetadata({
                    decimals: erc20Metadata.decimals(),
                    tokenAddress: tokenAddress,
                    name: erc20Metadata.name(),
                    symbol: erc20Metadata.symbol(),
                    token: token
                });
            }
        }
        return tokens;
    }

    /// @notice Calculates the max bet amount based on the token balance, the balance risk, and the game multiplier.
    /// @param token Address of the token.
    /// @param multiplier The bet amount leverage determines the user's profit amount. 10000 = 100% = no profit.
    /// @return Maximum bet amount for the token.
    /// @dev The multiplier should be at least 10000.
    function getMaxBetAmount(address token, uint256 multiplier)
        external
        view
        returns (uint256)
    {
        return (getBalance(token) * balanceRisk) / multiplier;
    }

    /// @notice Gets the token's house edge allocation configuration.
    /// @param token Address of the token.
    /// @return Token's house edge allocations struct.
    function getTokenHouseEdgeSplit(address token)
        external
        view
        returns (HouseEdgeSplit memory)
    {
        return _tokens[token].houseEdgeSplit;
    }

    /// @notice Gets the token's allow status used on the games smart contracts.
    /// @param token Address of the token.
    /// @return Whether the token is enabled for bets.
    function isAllowedToken(address token) external view returns (bool) {
        return _tokens[token].allowed;
    }

    function tokensCount() external view returns (uint16) {
        return _tokensCount;
    }

    /// @notice Sets the new team wallet.
    /// @param _teamWallet The team wallet address.
    function setTeamWallet(address payable _teamWallet)
        public
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        teamWallet = _teamWallet;
        emit SetTeamWallet(teamWallet);
    }

    /// @notice Sets the new referral program.
    /// @param _referralProgram The referral program address.
    function setReferralProgram(IReferral _referralProgram)
        public
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        referralProgram = _referralProgram;
        emit SetReferralProgram(address(referralProgram));
    }

    /// @notice Gets the token's balance.
    /// The token's house edge allocation amounts are subtracted from the balance.
    /// @param token Address of the token.
    /// @return Whether the token is enabled for bets.
    function getBalance(address token) public view returns (uint256) {
        uint256 balance;
        if (_isGasToken(token)) {
            balance = address(this).balance;
        } else {
            balance = IERC20(token).balanceOf(address(this));
        }
        HouseEdgeSplit memory tokenHouseEdgeSplit = _tokens[token]
            .houseEdgeSplit;
        return
            balance -
            tokenHouseEdgeSplit.dividendAmount -
            tokenHouseEdgeSplit.treasuryAmount -
            tokenHouseEdgeSplit.teamAmount;
    }
}

File 12 of 12 : IReferral.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.10;

/// @notice Referral interface
/// @author Romuald Hog.
interface IReferral {
    /// @notice Adds an address as referrer.
    /// @param user The address of the user.
    /// @param referrer The address would set as referrer of user.
    function addReferrer(address user, address referrer) external;

    /// @notice Updates referrer's last active timestamp.
    /// @param user The address would like to update active time.
    function updateReferrerActivity(address user) external;

    /// @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 returns (uint256);

    /// @notice Utils function for check whether an address has the referrer.
    /// @param user The address of the user.
    /// @return Whether user has a referrer.
    function hasReferrer(address user) external view returns (bool);
}

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":"address payable","name":"treasuryAddress","type":"address"},{"internalType":"address payable","name":"teamWalletAddress","type":"address"},{"internalType":"contract IReferral","name":"referralProgramAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"TokenExists","type":"error"},{"inputs":[],"name":"WrongBalanceOverflow","type":"error"},{"inputs":[{"internalType":"uint16","name":"splitSum","type":"uint16"}],"name":"WrongHouseEdgeSplit","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"AddToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"dividend","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"referral","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"treasury","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"team","type":"uint256"}],"name":"AllocateHouseEdgeAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountToTreasury","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountToTeam","type":"uint256"}],"name":"BankOverflowTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CashIn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"HarvestDividend","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"treasuryAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"teamAmount","type":"uint256"}],"name":"HouseEdgeDistribution","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"profit","type":"uint256"}],"name":"Payout","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":"token","type":"address"},{"indexed":false,"internalType":"bool","name":"allowed","type":"bool"}],"name":"SetAllowedToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint16","name":"thresholdRate","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"toTreasury","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"toTeam","type":"uint16"}],"name":"SetBalanceOverflow","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"balanceReference","type":"uint256"}],"name":"SetBalanceReference","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"balanceRisk","type":"uint16"}],"name":"SetBalanceRisk","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint16","name":"cashInDividend","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"cashInReferral","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"cashInTreasury","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"cashInTeam","type":"uint16"}],"name":"SetCashInTokenHouseEdgeSplit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"referralProgram","type":"address"}],"name":"SetReferralProgram","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"teamWallet","type":"address"}],"name":"SetTeamWallet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint16","name":"dividend","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"referral","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"treasury","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"team","type":"uint16"}],"name":"SetTokenHouseEdgeSplit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"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":[],"name":"SWIRLMASTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"addToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"balanceRisk","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"fees","type":"uint256"}],"name":"cashIn","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"distributeTokenHouseEdgeSplit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"multiplier","type":"uint256"}],"name":"getMaxBetAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"address","name":"token","type":"address"}],"name":"getTokenHouseEdgeSplit","outputs":[{"components":[{"internalType":"uint16","name":"dividend","type":"uint16"},{"internalType":"uint16","name":"referral","type":"uint16"},{"internalType":"uint16","name":"treasury","type":"uint16"},{"internalType":"uint16","name":"team","type":"uint16"},{"internalType":"uint16","name":"cashInDividend","type":"uint16"},{"internalType":"uint16","name":"cashInReferral","type":"uint16"},{"internalType":"uint16","name":"cashInTreasury","type":"uint16"},{"internalType":"uint16","name":"cashInTeam","type":"uint16"},{"internalType":"uint256","name":"dividendAmount","type":"uint256"},{"internalType":"uint256","name":"treasuryAmount","type":"uint256"},{"internalType":"uint256","name":"teamAmount","type":"uint256"}],"internalType":"struct Bank.HouseEdgeSplit","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokens","outputs":[{"components":[{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"components":[{"internalType":"bool","name":"allowed","type":"bool"},{"components":[{"internalType":"uint16","name":"dividend","type":"uint16"},{"internalType":"uint16","name":"referral","type":"uint16"},{"internalType":"uint16","name":"treasury","type":"uint16"},{"internalType":"uint16","name":"team","type":"uint16"},{"internalType":"uint16","name":"cashInDividend","type":"uint16"},{"internalType":"uint16","name":"cashInReferral","type":"uint16"},{"internalType":"uint16","name":"cashInTreasury","type":"uint16"},{"internalType":"uint16","name":"cashInTeam","type":"uint16"},{"internalType":"uint256","name":"dividendAmount","type":"uint256"},{"internalType":"uint256","name":"treasuryAmount","type":"uint256"},{"internalType":"uint256","name":"teamAmount","type":"uint256"}],"internalType":"struct Bank.HouseEdgeSplit","name":"houseEdgeSplit","type":"tuple"},{"internalType":"uint256","name":"balanceReference","type":"uint256"},{"components":[{"internalType":"uint16","name":"thresholdRate","type":"uint16"},{"internalType":"uint16","name":"toTreasury","type":"uint16"},{"internalType":"uint16","name":"toTeam","type":"uint16"}],"internalType":"struct Bank.BalanceOverflow","name":"balanceOverflow","type":"tuple"}],"internalType":"struct Bank.Token","name":"token","type":"tuple"}],"internalType":"struct Bank.TokenMetadata[]","name":"","type":"tuple[]"}],"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":[],"name":"harvestDividends","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","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":"address","name":"token","type":"address"}],"name":"isAllowedToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"user","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"profit","type":"uint256"},{"internalType":"uint256","name":"fees","type":"uint256"}],"name":"payout","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"referralProgram","outputs":[{"internalType":"contract IReferral","name":"","type":"address"}],"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":[{"internalType":"address","name":"token","type":"address"},{"internalType":"bool","name":"allowed","type":"bool"}],"name":"setAllowedToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint16","name":"thresholdRate","type":"uint16"},{"internalType":"uint16","name":"toTreasury","type":"uint16"},{"internalType":"uint16","name":"toTeam","type":"uint16"}],"name":"setBalanceOverflow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_balanceRisk","type":"uint16"}],"name":"setBalanceRisk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint16","name":"cashInDividend","type":"uint16"},{"internalType":"uint16","name":"cashInReferral","type":"uint16"},{"internalType":"uint16","name":"cashInTreasury","type":"uint16"},{"internalType":"uint16","name":"cashInTeam","type":"uint16"}],"name":"setCashInHouseEdgeSplit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint16","name":"dividend","type":"uint16"},{"internalType":"uint16","name":"referral","type":"uint16"},{"internalType":"uint16","name":"_treasury","type":"uint16"},{"internalType":"uint16","name":"team","type":"uint16"}],"name":"setHouseEdgeSplit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IReferral","name":"_referralProgram","type":"address"}],"name":"setReferralProgram","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_teamWallet","type":"address"}],"name":"setTeamWallet","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":[],"name":"teamWallet","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensCount","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a06040526001805461ffff191660c81790553480156200001f57600080fd5b5060405162003ad538038062003ad5833981016040819052620000429162000479565b6200004f6000336200007b565b6001600160a01b03831660805262000067826200008b565b6200007281620000ff565b50505062000647565b6200008782826200015c565b5050565b6000620000998133620001fc565b60018054600160201b600160c01b0319166401000000006001600160a01b038581168202929092179283905560405192041681527fc6a5dd316fe9d0339f2769deab7e31f64c8f5b101ffd85dfc9a83dbeaf2e69da906020015b60405180910390a15050565b60006200010d8133620001fc565b600280546001600160a01b0319166001600160a01b0384169081179091556040519081527f678edf136de423322d705b75c3157ecfde496e1ad82aef725aa6deb9d94d4de290602001620000f3565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000087576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001b83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000875762000246816001600160a01b03166014620002a060201b62001f181760201c565b6200025c83602062001f18620002a0821b17811c565b6040516020016200026f92919062000500565b60408051601f198184030181529082905262461bcd60e51b8252620002979160040162000579565b60405180910390fd5b60606000620002b1836002620005c4565b620002be906002620005e6565b6001600160401b03811115620002d857620002d862000601565b6040519080825280601f01601f19166020018201604052801562000303576020820181803683370190505b509050600360fc1b8160008151811062000321576200032162000617565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811062000353576200035362000617565b60200101906001600160f81b031916908160001a905350600062000379846002620005c4565b62000386906001620005e6565b90505b600181111562000408576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110620003be57620003be62000617565b1a60f81b828281518110620003d757620003d762000617565b60200101906001600160f81b031916908160001a90535060049490941c9362000400816200062d565b905062000389565b508315620004595760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640162000297565b9392505050565b6001600160a01b03811681146200047657600080fd5b50565b6000806000606084860312156200048f57600080fd5b83516200049c8162000460565b6020850151909350620004af8162000460565b6040850151909250620004c28162000460565b809150509250925092565b60005b83811015620004ea578181015183820152602001620004d0565b83811115620004fa576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516200053a816017850160208801620004cd565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516200056d816028840160208801620004cd565b01602801949350505050565b60208152600082518060208401526200059a816040850160208701620004cd565b601f01601f19169190910160400192915050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615620005e157620005e1620005ae565b500290565b60008219821115620005fc57620005fc620005ae565b500190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816200063f576200063f620005ae565b506000190190565b608051613464620006716000396000818161043101528181610b4e0152610dbd01526134646000f3fe6080604052600436106101fe5760003560e01c8063802ad8fb1161011d578063aec68ee1116100b0578063d547741f1161007f578063f3fef3a311610064578063f3fef3a31461079d578063f6ae2204146107bd578063f8b2cb4f146107f157600080fd5b8063d547741f1461061d578063d7d18c8c1461063d57600080fd5b8063aec68ee114610584578063cbe230c3146105a4578063cdc42344146105dd578063d48bfca7146105fd57600080fd5b8063a64ed8ba116100ec578063a64ed8ba146104ef578063a7fd00f01461050e578063aa6ca8081461052e578063ab4007061461055057600080fd5b8063802ad8fb146104535780638aaa22841461047657806391d1485414610496578063a217fddf146104da57600080fd5b80632f2ff15d1161019557806346cee3991161016457806346cee3991461039e57806347e7ef24146103cc57806359927044146103df57806361d027b31461041f57600080fd5b80632f2ff15d1461031e57806336568abe1461033e578063384feaac1461035e5780633e32a3811461037e57600080fd5b80631f615023116101d15780631f6150231461028d578063248a9ca3146102a0578063278b39de146102de5780632a22b7fc146102fe57600080fd5b806301ffc9a7146102035780630f1e80e7146102385780631525ff7d1461025a57806319454ba51461027a575b600080fd5b34801561020f57600080fd5b5061022361021e366004612b8d565b610811565b60405190151581526020015b60405180910390f35b34801561024457600080fd5b50610258610253366004612be6565b6108aa565b005b34801561026657600080fd5b50610258610275366004612c19565b61091f565b610258610288366004612c36565b61099e565b61025861029b366004612c36565b610c6b565b3480156102ac57600080fd5b506102d06102bb366004612c7c565b60009081526020819052604090206001015490565b60405190815260200161022f565b3480156102ea57600080fd5b506102d06102f9366004612c95565b610d48565b34801561030a57600080fd5b50610258610319366004612c19565b610d78565b34801561032a57600080fd5b50610258610339366004612cc1565b610e4e565b34801561034a57600080fd5b50610258610359366004612cc1565b610e79565b34801561036a57600080fd5b50610258610379366004612cf1565b610f24565b34801561038a57600080fd5b50610258610399366004612c19565b611074565b3480156103aa57600080fd5b506001546103b99061ffff1681565b60405161ffff909116815260200161022f565b6102586103da366004612c95565b6110e6565b3480156103eb57600080fd5b506001546104079064010000000090046001600160a01b031681565b6040516001600160a01b03909116815260200161022f565b34801561042b57600080fd5b506104077f000000000000000000000000000000000000000000000000000000000000000081565b34801561045f57600080fd5b5061046861118b565b60405161022f929190612d47565b34801561048257600080fd5b50610258610491366004612dd9565b611384565b3480156104a257600080fd5b506102236104b1366004612cc1565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156104e657600080fd5b506102d0600081565b3480156104fb57600080fd5b5060015462010000900461ffff166103b9565b34801561051a57600080fd5b50610258610529366004612e07565b61140f565b34801561053a57600080fd5b50610543611597565b60405161022f9190612f8a565b34801561055c57600080fd5b506102d07f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa8881565b34801561059057600080fd5b5061025861059f366004612e07565b6119bc565b3480156105b057600080fd5b506102236105bf366004612c19565b6001600160a01b031660009081526003602052604090205460ff1690565b3480156105e957600080fd5b50600254610407906001600160a01b031681565b34801561060957600080fd5b50610258610618366004612c19565b611b7c565b34801561062957600080fd5b50610258610638366004612cc1565b611ceb565b34801561064957600080fd5b50610790610658366004612c19565b6040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101829052610140810191909152506001600160a01b0316600090815260036020818152604092839020835161016081018552600182015461ffff808216835262010000820481169483019490945264010000000081048416958201959095526601000000000000850483166060820152680100000000000000008504831660808201526a01000000000000000000008504831660a08201526c010000000000000000000000008504831660c08201526e01000000000000000000000000000090940490911660e08401526002810154610100840152908101546101208301526004015461014082015290565b60405161022f91906130a7565b3480156107a957600080fd5b506102586107b8366004612c95565b611d11565b3480156107c957600080fd5b506102d07f39780592ddb1e73f2a037f166ec57ba042082746f5c0b9fe56ea386e00369a9881565b3480156107fd57600080fd5b506102d061080c366004612c19565b611d71565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806108a457507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60006108b6813361215b565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff84169081179091556040519081527fdac35c35ebd0ba62bd95fa8546ffff4f63446e54e615de1db75616324212b8cd906020015b60405180910390a15050565b600061092b813361215b565b600180547fffffffffffffffff0000000000000000000000000000000000000000ffffffff166401000000006001600160a01b038581168202929092179283905560405192041681527fc6a5dd316fe9d0339f2769deab7e31f64c8f5b101ffd85dfc9a83dbeaf2e69da90602001610913565b7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa886109c9813361215b565b6001600160a01b0384166000908152600360205260409020600181018054610a3f9188918891879161ffff6801000000000000000082048116916a010000000000000000000081048216916c0100000000000000000000000082048116916e0100000000000000000000000000009004166121f3565b6000610a4a86611d71565b60408051606081018252600685015461ffff80821680845262010000830482166020850152640100000000909204169282019290925291925060009061271090610a9490856130e5565b610a9e9190613151565b8460050154610aad9190613165565b905080831115610bfd576000846005015484610ac9919061317d565b90506000612710846020015161ffff1683610ae491906130e5565b610aee9190613151565b90506000612710856040015161ffff1684610b0991906130e5565b610b139190613151565b9050610b338b82610b24858a61317d565b610b2e919061317d565b61244a565b60038701805460048901805460009384905592905590610b7d7f00000000000000000000000000000000000000000000000000000000000000008e610b788786613165565b6124a6565b600154610ba09064010000000090046001600160a01b03168e610b788685613165565b6001600160a01b038d167f6842359a4c3b5f98197bd29d5a317cd8c919e10ef467c746b9b256e99157b08e610bd58685613165565b610bdf8685613165565b6040805192835260208301919091520160405180910390a250505050505b876001600160a01b03167f812b76b477469edc716929cbf7ed54e3d9c1a68d8b9f8290dbabcda54d96fcbe610c318a611d71565b6001600160a01b038b1615610c465789610c48565b345b6040805192835260208301919091520160405180910390a2505050505050505050565b7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa88610c96813361215b565b6001600160a01b03841660009081526003602052604090206001018054610cea90879087908690859061ffff80821691620100008104821691640100000000820481169166010000000000009004166121f3565b610cf58686866124a6565b846001600160a01b03167f634235fcf5af0adbca1a405ec65f6f6c08f55e1f379c2c45cd10f23cb29e0e31610d2987611d71565b60408051918252602082018890520160405180910390a2505050505050565b600154600090829061ffff16610d5d85611d71565b610d6791906130e5565b610d719190613151565b9392505050565b6000610d84813361215b565b6001600160a01b038216600090815260036020819052604082209081018054600483018054928590559390935560019091019190610de37f000000000000000000000000000000000000000000000000000000000000000086846124a6565b600154610e029064010000000090046001600160a01b031686836124a6565b60408051838152602081018390526001600160a01b038716917f0146f1701c23c89f761280798d36d6c4e3acb349438456f5da8f83a2f5dd8cdc91015b60405180910390a25050505050565b600082815260208190526040902060010154610e6a813361215b565b610e7483836124d2565b505050565b6001600160a01b0381163314610f16576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b610f20828261258e565b5050565b6000610f30813361215b565b6127108461ffff161180610f525750612710610f4c8385613194565b61ffff16115b15610f89576040517fa28c907300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516060808201835261ffff87811680845287821660208086018281528985168789018181526001600160a01b038f166000818152600386528b902099516006909a018054945192518916640100000000027fffffffffffffffffffffffffffffffffffffffffffffffffffff0000ffffffff938a1662010000027fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000009096169b9099169a909a1793909317169590951790965586519283528201529384015290917f4b481214fcdec41d9a7a06a45d5d931dada21892e48b04779c52d1c69d1e5f9f9101610e3f565b6000611080813361215b565b600280547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384169081179091556040519081527f678edf136de423322d705b75c3157ecfde496e1ad82aef725aa6deb9d94d4de290602001610913565b60006110f2813361215b565b60006110fd84611d71565b90506001600160a01b03841661111f57611117848261244a565b349250611142565b61112d84610b2e8584613165565b6111426001600160a01b03851633308661262b565b836001600160a01b03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c8460405161117d91815260200190565b60405180910390a250505050565b6060807f39780592ddb1e73f2a037f166ec57ba042082746f5c0b9fe56ea386e00369a986111b9813361215b565b60015460009062010000900461ffff1667ffffffffffffffff8111156111e1576111e16131ba565b60405190808252806020026020018201604052801561120a578160200160208202803683370190505b5060015490915060009062010000900461ffff1667ffffffffffffffff811115611236576112366131ba565b60405190808252806020026020018201604052801561125f578160200160208202803683370190505b50905060005b60015461ffff62010000909104811690821610156113795761ffff81166000908152600460209081526040808320546001600160a01b031680845260039092529091206002810154801561136357600060028301556112c53384836124a6565b826001600160a01b03167fca64dbcaf91abfb066e7a5163f1d135f8f48f2cbdb0395e3b35cc278ebbd340b8260405161130091815260200190565b60405180910390a282868561ffff168151811061131f5761131f6131e9565b60200260200101906001600160a01b031690816001600160a01b03168152505080858561ffff1681518110611356576113566131e9565b6020026020010181815250505b505050808061137190613218565b915050611265565b509093509150509091565b6000611390813361215b565b6001600160a01b03831660008181526003602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527fe589eb036e62c07e307aa4d441bd39c81e8bd86f349eaacb0caa06b1477f7f9a91015b60405180910390a2505050565b600061141b813361215b565b600084846114298589613194565b6114339190613194565b61143d9190613194565b90508061ffff1661271014611484576040517f6104384400000000000000000000000000000000000000000000000000000000815261ffff82166004820152602401610f0d565b6001600160a01b038716600081815260036020908152604091829020600101805461ffff8b81167fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000009092168217620100008c8316908102919091177fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff166401000000008c84169081027fffffffffffffffffffffffffffffffffffffffffffffffff0000ffffffffffff16919091176601000000000000938c169384021785558651938452948301529381019290925260608201929092529091907f01573e473e8842c25da06b37c286cdd7bf1c828e796ab47f7eec894ac9fbbee3906080015b60405180910390a25050505050505050565b60015460609060009062010000900461ffff1667ffffffffffffffff8111156115c2576115c26131ba565b6040519080825280602002602001820160405280156115fb57816020015b6115e8612abf565b8152602001906001900390816115e05790505b50905060005b60015461ffff62010000909104811690821610156119b65761ffff8181166000908152600460208181526040808420546001600160a01b0316808552600380845294829020825160808082018552825460ff16151582528451610160810186526001840154808b168252620100008082048c16838a01526401000000008083048d16848a0152660100000000000083048d166060808601919091526801000000000000000084048e16958501959095526a010000000000000000000083048d1660a08501526c0100000000000000000000000083048d1660c08501526e0100000000000000000000000000009092048c1660e0840152600286015461010084015299850154610120830152978401546101408201528287015260058301548286015284518082018652600690930154808a16845297880489169583019590955294909504909516908401528101919091528161181b576040518060a00160405280601260ff168152602001836001600160a01b031681526020016040518060400160405280600381526020017f455448000000000000000000000000000000000000000000000000000000000081525081526020016040518060400160405280600381526020017f4554480000000000000000000000000000000000000000000000000000000000815250815260200182815250848461ffff168151811061180b5761180b6131e9565b60200260200101819052506119a1565b60008290506040518060a00160405280826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611869573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061188d919061323a565b60ff168152602001846001600160a01b03168152602001826001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa1580156118e2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261190a919081019061325d565b8152602001826001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801561194d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611975919081019061325d565b815260200183815250858561ffff1681518110611994576119946131e9565b6020026020010181905250505b505080806119ae90613218565b915050611601565b50919050565b60006119c8813361215b565b600084846119d68589613194565b6119e09190613194565b6119ea9190613194565b90508061ffff1661271014611a31576040517f6104384400000000000000000000000000000000000000000000000000000000815261ffff82166004820152602401610f0d565b6001600160a01b03871660008181526003602090815260409182902060010180547fffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff166801000000000000000061ffff8c81169182027fffffffffffffffffffffffffffffffffffffffff0000ffffffffffffffffffff16929092176a01000000000000000000008c8416908102919091177fffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffff166c010000000000000000000000008c85169081027fffffffffffffffffffffffffffffffff0000ffffffffffffffffffffffffffff16919091176e010000000000000000000000000000948c1694850217855586519283529482015293840192909252606083019190915291907f7f4e3e60c548f30727686d7329d49d12a3f28a8dc1931aae01b34ee2b0212d2190608001611585565b6000611b88813361215b565b60015462010000900461ffff1615611c2d5760005b60015461ffff6201000090910481169082161015611c2b5761ffff81166000908152600460205260409020546001600160a01b0384811691161415611c19576040517ff49f09990000000000000000000000000000000000000000000000000000000081526001600160a01b0384166004820152602401610f0d565b80611c2381613218565b915050611b9d565b505b60018054620100009081900461ffff908116600090815260046020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03871617905582548392600292611c93928592900416613194565b92506101000a81548161ffff021916908361ffff1602179055507fe473c74f34be27c1464d6624f14a0d7fd4e301cbfa29c3eba425d378c8a7ebe08260405161091391906001600160a01b0391909116815260200190565b600082815260208190526040902060010154611d07813361215b565b610e74838361258e565b6000611d1d813361215b565b611d2b8383610b2486611d71565b611d363384846124a6565b826001600160a01b03167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243648360405161140291815260200190565b6000806001600160a01b038316611d89575047611e0d565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015611de6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e0a91906132ff565b90505b6001600160a01b038316600090815260036020818152604092839020835161016081018552600182015461ffff808216835262010000820481169483019490945264010000000081048416958201959095526601000000000000850483166060820152680100000000000000008504831660808201526a01000000000000000000008504831660a08201526c010000000000000000000000008504831660c08201526e01000000000000000000000000000090940490911660e084015260028101546101008401819052918101546101208401819052600490910154610140840181905291611efc908561317d565b611f06919061317d565b611f10919061317d565b949350505050565b60606000611f278360026130e5565b611f32906002613165565b67ffffffffffffffff811115611f4a57611f4a6131ba565b6040519080825280601f01601f191660200182016040528015611f74576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611fab57611fab6131e9565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061200e5761200e6131e9565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600061204a8460026130e5565b612055906001613165565b90505b60018111156120f2577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110612096576120966131e9565b1a60f81b8282815181106120ac576120ac6131e9565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936120eb81613318565b9050612058565b508315610d71576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610f0d565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610f2057612197816001600160a01b03166014611f18565b6121a2836020611f18565b6040516020016121b392919061334d565b60408051601f19818403018152908290527f08c379a0000000000000000000000000000000000000000000000000000000008252610f0d916004016133ce565b600061271061220661ffff8616896130e5565b6122109190613151565b90506000811580159061222d57506002546001600160a01b031615155b156122d9576002546040517f7700f17b0000000000000000000000000000000000000000000000000000000081526001600160a01b038c811660048301528b811660248301526044820185905290911690637700f17b906064016020604051808303816000875af11580156122a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122ca91906132ff565b90506122d6818361317d565b91505b600060036122e781856133e1565b6122f1908561317d565b6122fb9190613151565b905060008161271061231161ffff8b168d6130e5565b61231b9190613151565b6123259190613165565b905060008261271061233b61ffff8a168e6130e5565b6123459190613151565b61234f9190613165565b905060008361271061236561ffff8a168f6130e5565b61236f9190613151565b6123799190613165565b9050828b600101600082825461238f9190613165565b92505081905550818b60020160008282546123aa9190613165565b92505081905550808b60030160008282546123c59190613165565b90915550506040805184815260208101879052908101839052606081018290526001600160a01b038e16907f0b5a4c9121a83120fc7b30f195ddd2c279ec4510cfc8f051380851e8f0686f499060800160405180910390a2841561243a5760025461243a906001600160a01b03168e876124a6565b5050505050505050505050505050565b6001600160a01b03821660008181526003602052604090819020600501839055517f492a63a7d96d749f455133f12ab1ea15a7dd0a5d5f6ae04694244a2761df3f8c9061249a9084815260200190565b60405180910390a25050565b6001600160a01b0382166124be57610e7483826126e2565b610e746001600160a01b038316848361282f565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610f20576000828152602081815260408083206001600160a01b0385168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561254a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1615610f20576000828152602081815260408083206001600160a01b038516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6040516001600160a01b03808516602483015283166044820152606481018290526126dc9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612878565b50505050565b8047101561274c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610f0d565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612799576040519150601f19603f3d011682016040523d82523d6000602084013e61279e565b606091505b5050905080610e74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610f0d565b6040516001600160a01b038316602482015260448101829052610e749084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612678565b60006128cd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166129779092919063ffffffff16565b805190915015610e7457808060200190518101906128eb91906133f5565b610e74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610f0d565b6060611f108484600085856001600160a01b0385163b6129f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610f0d565b600080866001600160a01b03168587604051612a0f9190613412565b60006040518083038185875af1925050503d8060008114612a4c576040519150601f19603f3d011682016040523d82523d6000602084013e612a51565b606091505b5091509150612a61828286612a6c565b979650505050505050565b60608315612a7b575081610d71565b825115612a8b5782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0d91906133ce565b6040518060a00160405280600060ff16815260200160006001600160a01b031681526020016060815260200160608152602001612b886040805160808082018352600080835283516101608101855281815260208181018390529481018290526060810182905291820181905260a0820181905260c0820181905260e08201819052610100820181905261012082018190526101408201529091820190815260006020808301829052604080516060810182528381529182018390528181019290925291015290565b905290565b600060208284031215612b9f57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610d7157600080fd5b803561ffff81168114612be157600080fd5b919050565b600060208284031215612bf857600080fd5b610d7182612bcf565b6001600160a01b0381168114612c1657600080fd5b50565b600060208284031215612c2b57600080fd5b8135610d7181612c01565b60008060008060808587031215612c4c57600080fd5b8435612c5781612c01565b93506020850135612c6781612c01565b93969395505050506040820135916060013590565b600060208284031215612c8e57600080fd5b5035919050565b60008060408385031215612ca857600080fd5b8235612cb381612c01565b946020939093013593505050565b60008060408385031215612cd457600080fd5b823591506020830135612ce681612c01565b809150509250929050565b60008060008060808587031215612d0757600080fd5b8435612d1281612c01565b9350612d2060208601612bcf565b9250612d2e60408601612bcf565b9150612d3c60608601612bcf565b905092959194509250565b604080825283519082018190526000906020906060840190828701845b82811015612d895781516001600160a01b031684529284019290840190600101612d64565b5050508381038285015284518082528583019183019060005b81811015612dbe57835183529284019291840191600101612da2565b5090979650505050505050565b8015158114612c1657600080fd5b60008060408385031215612dec57600080fd5b8235612df781612c01565b91506020830135612ce681612dcb565b600080600080600060a08688031215612e1f57600080fd5b8535612e2a81612c01565b9450612e3860208701612bcf565b9350612e4660408701612bcf565b9250612e5460608701612bcf565b9150612e6260808701612bcf565b90509295509295909350565b60005b83811015612e89578181015183820152602001612e71565b838111156126dc5750506000910152565b60008151808452612eb2816020860160208601612e6e565b601f01601f19169290920160200192915050565b805161ffff1682526020810151612ee3602084018261ffff169052565b506040810151612ef9604084018261ffff169052565b506060810151612f0f606084018261ffff169052565b506080810151612f25608084018261ffff169052565b5060a0810151612f3b60a084018261ffff169052565b5060c0810151612f5160c084018261ffff169052565b5060e0810151612f6760e084018261ffff169052565b506101008181015190830152610120808201519083015261014090810151910152565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015613099577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0898403018552815161028060ff82511685526001600160a01b0389830151168986015287820151818987015261301282870182612e9a565b9150506060808301518683038288015261302c8382612e9a565b92505060808084015193508351151581880152508983015161305160a0880182612ec6565b508289015161020087015290910151805161ffff9081166102208701528982015181166102408701529088015116610260909401939093529386019390860190600101612fb1565b509098975050505050505050565b61016081016108a48284612ec6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561311d5761311d6130b6565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261316057613160613122565b500490565b60008219821115613178576131786130b6565b500190565b60008282101561318f5761318f6130b6565b500390565b600061ffff8083168185168083038211156131b1576131b16130b6565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600061ffff80831681811415613230576132306130b6565b6001019392505050565b60006020828403121561324c57600080fd5b815160ff81168114610d7157600080fd5b60006020828403121561326f57600080fd5b815167ffffffffffffffff8082111561328757600080fd5b818401915084601f83011261329b57600080fd5b8151818111156132ad576132ad6131ba565b604051601f8201601f19908116603f011681019083821181831017156132d5576132d56131ba565b816040528281528760208487010111156132ee57600080fd5b612a61836020830160208801612e6e565b60006020828403121561331157600080fd5b5051919050565b600081613327576133276130b6565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613385816017850160208801612e6e565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516133c2816028840160208801612e6e565b01602801949350505050565b602081526000610d716020830184612e9a565b6000826133f0576133f0613122565b500690565b60006020828403121561340757600080fd5b8151610d7181612dcb565b60008251613424818460208701612e6e565b919091019291505056fea26469706673582212208fcd64e5e0bb1db8a0b1b795afae0bb629f6f4caeda5f6f5ba267054a269112364736f6c634300080c00330000000000000000000000002c305888a456e7004663bc12a74395e637eabcbc0000000000000000000000008343f2dc53e55dbbe626b9d8b4fbbb4e37dc218b000000000000000000000000a368c0ab32dd9bc0500075c0c8397b6b0168e432

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

0000000000000000000000002c305888a456e7004663bc12a74395e637eabcbc0000000000000000000000008343f2dc53e55dbbe626b9d8b4fbbb4e37dc218b000000000000000000000000a368c0ab32dd9bc0500075c0c8397b6b0168e432

-----Decoded View---------------
Arg [0] : treasuryAddress (address): 0x2c305888a456e7004663bc12a74395e637eabcbc
Arg [1] : teamWalletAddress (address): 0x8343f2dc53e55dbbe626b9d8b4fbbb4e37dc218b
Arg [2] : referralProgramAddress (address): 0xa368c0ab32dd9bc0500075c0c8397b6b0168e432

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000002c305888a456e7004663bc12a74395e637eabcbc
Arg [1] : 0000000000000000000000008343f2dc53e55dbbe626b9d8b4fbbb4e37dc218b
Arg [2] : 000000000000000000000000a368c0ab32dd9bc0500075c0c8397b6b0168e432


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