Contract 0x9246a5F10A79a5a939b0C2a75A3AD196aAfDB43b 4

Contract Overview

Balance:
0.149787012574838001 AVAX

Token:
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x0511248a513363ddf9c3a752d8018b3fb7f01277d1471d440efdcf9ca7c4304eWithdraw107776852022-06-18 1:45:51111 days 5 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX0.001543542 26
0x6320dd326ee88a29f3e05b7782c05be862a9670f2c186a154b37123c7c5c08abWithdraw107776632022-06-18 1:44:14111 days 5 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX0.001258062 26
0x5f48578b74c174108bc7c232c5c32d5df7f53f32af4bafe60eaf65bc738a202bGrant Role107775042022-06-18 1:32:46111 days 5 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX0.001285525
0xf91bceedd5dea0411450d1f87b36b17db3fb27c40114df41602ee973a010e013Grant Role107775012022-06-18 1:32:35111 days 5 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX0.001285525
0xd761a63e6e1c70f31980763eb2af5a195d53357a8d8557c7dd7738d5022f202aDeposit82054252022-04-05 15:23:07184 days 15 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX0.00252682525
0xf63b3ec82a03645dba515868c03024cff377572234b5e1e936c5956290c266f6Set Balance Over...82054112022-04-05 15:22:39184 days 15 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX0.00123625
0x50bfb968ea3e4297d0caa9399bf0d0dbd185ca14ca55e8b08c62d7d128deee42Set House Edge S...82054092022-04-05 15:22:34184 days 15 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX0.001250625
0xfe41f2a979025d47a97cfe9bad9fe7f07e8a8c38dea367e6614bd6b6e3ed2575Set Allowed Toke...82053942022-04-05 15:22:05184 days 15 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX0.00119992525
0xc1eb7709faabe28e814a317e3a196f90cece1a96b529e6d39b9cb2b74fab54fcAdd Token82053902022-04-05 15:21:57184 days 15 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX0.0013925525
0x7d9c82b357379dd52ec2b2daee2e25c5eef67abdffe2ac7624537af2cafe6da9Deposit82053722022-04-05 15:21:18184 days 15 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b19 AVAX0.00145762525
0xfbfc617830cdbe746d58377830a7f1233e884d0d7e6f476e7b5ee91511239964Set Balance Over...82053092022-04-05 15:19:07184 days 15 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX0.0012325
0x02d6e9e9b68dfe250d7b120d1483bede33219cc4c5ab894e2d3b3ad58806e67eSet House Edge S...82053072022-04-05 15:19:03184 days 15 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX0.001244625
0x73073e7a78033ef1d29509d9003cffbf95adc5c3a5743b9df7fccddaf3dee636Set Allowed Toke...82052922022-04-05 15:18:33184 days 15 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX0.00119392525
0x41da16d69a81ee4f332dd839a1199a5c1157a4170ef9976b5ef49329b643ff73Add Token82052892022-04-05 15:18:24184 days 15 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX0.00082292525
0xe5c378cba524a3c875404c6d27fafd7678645dcb9269073d29ae3de4f81b39fbGrant Role82052552022-04-05 15:17:16184 days 15 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX0.001285525
0x22083b288072458c8c9aad6c3ed82995a375368df2b7673bc78a496fb9d2c702Grant Role82052482022-04-05 15:17:02184 days 15 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX0.001285525
0x0f069ed7fbda885fb4df7f315dde2178a66cc697a576794b50ac8f7f150d27f70x60a0604082051242022-04-05 15:12:53184 days 16 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  Create: Bank0 AVAX0.07312657525
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x0511248a513363ddf9c3a752d8018b3fb7f01277d1471d440efdcf9ca7c4304e107776852022-06-18 1:45:51111 days 5 hrs ago 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0x2671ceccc4de126d45bac0b66142e35304411a9e0 AVAX
0x0511248a513363ddf9c3a752d8018b3fb7f01277d1471d440efdcf9ca7c4304e107776852022-06-18 1:45:51111 days 5 hrs ago 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0x2671ceccc4de126d45bac0b66142e35304411a9e0 AVAX
0x6320dd326ee88a29f3e05b7782c05be862a9670f2c186a154b37123c7c5c08ab107776632022-06-18 1:44:14111 days 5 hrs ago 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0x2c305888a456e7004663bc12a74395e637eabcbc19.209760180515830501 AVAX
0x82765d6a6246fdafb8d09e88614d26035fab39c015a5b2a3376ecf1cdef5638c101925692022-05-29 13:33:28130 days 17 hrs ago 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0xd4a0f6a2421bfc43e5b7e8d025e86fe3e14812980.025787397849462365 AVAX
0x82765d6a6246fdafb8d09e88614d26035fab39c015a5b2a3376ecf1cdef5638c101925692022-05-29 13:33:28130 days 17 hrs ago 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0xd544d7b128e9d80895c34285c885e22cb913c83f0 AVAX
0x82765d6a6246fdafb8d09e88614d26035fab39c015a5b2a3376ecf1cdef5638c101925692022-05-29 13:33:28130 days 17 hrs ago 0x64438376290243e4d95ad10d79a772ea8bad0adf0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0.010596 AVAX
0xb4a2970c589d81f34913ae2047404bf6cf697afc96518814ea5daa9162363775101925652022-05-29 13:33:20130 days 17 hrs ago 0x64438376290243e4d95ad10d79a772ea8bad0adf0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX
0xb4a2970c589d81f34913ae2047404bf6cf697afc96518814ea5daa9162363775101925652022-05-29 13:33:20130 days 17 hrs ago 0x64438376290243e4d95ad10d79a772ea8bad0adf0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX
0xcf2739b86c72f23aa3cb79dba8576571e5ef0e21f78eed1ff6a55b4c0dbdb194101925572022-05-29 13:32:56130 days 17 hrs ago 0x64438376290243e4d95ad10d79a772ea8bad0adf0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0.351284607866186808 AVAX
0x8986a470afc60c004e86ad97847fa0e87a0d1a00f29497c514ef38ad2b5f3c2a101925532022-05-29 13:32:48130 days 17 hrs ago 0x64438376290243e4d95ad10d79a772ea8bad0adf0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX
0x8986a470afc60c004e86ad97847fa0e87a0d1a00f29497c514ef38ad2b5f3c2a101925532022-05-29 13:32:48130 days 17 hrs ago 0x64438376290243e4d95ad10d79a772ea8bad0adf0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX
0xf239b2355748d808a8b5ecc13638bc8aba4ad56c3f500af86803fd32794acf5e101925502022-05-29 13:32:26130 days 17 hrs ago 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0xd4a0f6a2421bfc43e5b7e8d025e86fe3e14812980.025683512847456139 AVAX
0xf239b2355748d808a8b5ecc13638bc8aba4ad56c3f500af86803fd32794acf5e101925502022-05-29 13:32:26130 days 17 hrs ago 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0xd544d7b128e9d80895c34285c885e22cb913c83f0 AVAX
0xf239b2355748d808a8b5ecc13638bc8aba4ad56c3f500af86803fd32794acf5e101925502022-05-29 13:32:26130 days 17 hrs ago 0x64438376290243e4d95ad10d79a772ea8bad0adf0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0.010553313820972404 AVAX
0x279b62053de356d2da19cd84f8feee2c93bb40e13ebd0588c57d076af1531321101925472022-05-29 13:32:14130 days 17 hrs ago 0x64438376290243e4d95ad10d79a772ea8bad0adf0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX
0x279b62053de356d2da19cd84f8feee2c93bb40e13ebd0588c57d076af1531321101925472022-05-29 13:32:14130 days 17 hrs ago 0x64438376290243e4d95ad10d79a772ea8bad0adf0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX
0x337c0ab13dbebdf53998a0915553d079c03431536a5c91741ffbdf38123a8388101925392022-05-29 13:31:47130 days 17 hrs ago 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0xd4a0f6a2421bfc43e5b7e8d025e86fe3e14812980.025719522483549819 AVAX
0x337c0ab13dbebdf53998a0915553d079c03431536a5c91741ffbdf38123a8388101925392022-05-29 13:31:47130 days 17 hrs ago 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0xd544d7b128e9d80895c34285c885e22cb913c83f0 AVAX
0x337c0ab13dbebdf53998a0915553d079c03431536a5c91741ffbdf38123a8388101925392022-05-29 13:31:47130 days 17 hrs ago 0x64438376290243e4d95ad10d79a772ea8bad0adf0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0.010568110122106626 AVAX
0xd7e12e558fe25694de67504b7a136f385163c86a280388b08c8b53af3d79c83e101925372022-05-29 13:31:30130 days 17 hrs ago 0x64438376290243e4d95ad10d79a772ea8bad0adf0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX
0xd7e12e558fe25694de67504b7a136f385163c86a280388b08c8b53af3d79c83e101925372022-05-29 13:31:30130 days 17 hrs ago 0x64438376290243e4d95ad10d79a772ea8bad0adf0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX
0xa4eea2a2e854d1cc1f6b92b1410e89d9173d17aaa9863ec91da430acbb5fbe56101925292022-05-29 13:30:51130 days 17 hrs ago 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0xd4a0f6a2421bfc43e5b7e8d025e86fe3e14812980.025755582607047589 AVAX
0xa4eea2a2e854d1cc1f6b92b1410e89d9173d17aaa9863ec91da430acbb5fbe56101925292022-05-29 13:30:51130 days 17 hrs ago 0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0xd544d7b128e9d80895c34285c885e22cb913c83f0 AVAX
0xa4eea2a2e854d1cc1f6b92b1410e89d9173d17aaa9863ec91da430acbb5fbe56101925292022-05-29 13:30:51130 days 17 hrs ago 0x64438376290243e4d95ad10d79a772ea8bad0adf0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0.010582927168433398 AVAX
0xa81112357d8bb2007c97fce89d985909616ef06875a4f3273278ac9912b1d86b101925252022-05-29 13:30:25130 days 17 hrs ago 0x64438376290243e4d95ad10d79a772ea8bad0adf0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b0 AVAX
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Bank

Compiler Version
v0.8.13+commit.abaa5c0e

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.
    /// 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 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;
        uint256 dividendAmount;
        uint256 treasuryAmount;
        uint256 teamAmount;
    }

    /// @notice Token's balance overflow struct.
    /// @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 public 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) public tokens;

    /// @notice Maps tokens indexes to token address.
    mapping(uint16 => address) public 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 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 Manages the balance overflow.
    /// 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 tokenAddress Address of the token.
    function _manageBalanceOverflow(address tokenAddress) private {
        Token storage token = tokens[tokenAddress];

        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
            );
        }
    }

    /// @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 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, 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 tokenAddress Address of the token.
    /// @param amount Loss bet amount.
    function cashIn(address tokenAddress, uint256 amount)
        external
        payable
        onlyRole(GAME_ROLE)
    {
        _manageBalanceOverflow(tokenAddress);

        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;
    }

    /// @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":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":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","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":"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":"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":"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":[{"internalType":"address","name":"","type":"address"}],"name":"tokens","outputs":[{"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":"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"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensCount","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"tokensList","outputs":[{"internalType":"address","name":"","type":"address"}],"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"}]

60a06040526001805461ffff191660c81790553480156200001f57600080fd5b50604051620038de380380620038de833981016040819052620000429162000479565b6200004f6000336200007b565b6001600160a01b03831660805262000067826200008b565b6200007281620000ff565b50505062000647565b6200008782826200015c565b5050565b6000620000998133620001fc565b60018054600160201b600160c01b0319166401000000006001600160a01b038581168202929092179283905560405192041681527fc6a5dd316fe9d0339f2769deab7e31f64c8f5b101ffd85dfc9a83dbeaf2e69da906020015b60405180910390a15050565b60006200010d8133620001fc565b600280546001600160a01b0319166001600160a01b0384169081179091556040519081527f678edf136de423322d705b75c3157ecfde496e1ad82aef725aa6deb9d94d4de290602001620000f3565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000087576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001b83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000875762000246816001600160a01b03166014620002a060201b62001b081760201c565b6200025c83602062001b08620002a0821b17811c565b6040516020016200026f92919062000500565b60408051601f198184030181529082905262461bcd60e51b8252620002979160040162000579565b60405180910390fd5b60606000620002b1836002620005c4565b620002be906002620005e6565b6001600160401b03811115620002d857620002d862000601565b6040519080825280601f01601f19166020018201604052801562000303576020820181803683370190505b509050600360fc1b8160008151811062000321576200032162000617565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811062000353576200035362000617565b60200101906001600160f81b031916908160001a905350600062000379846002620005c4565b62000386906001620005e6565b90505b600181111562000408576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110620003be57620003be62000617565b1a60f81b828281518110620003d757620003d762000617565b60200101906001600160f81b031916908160001a90535060049490941c9362000400816200062d565b905062000389565b508315620004595760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640162000297565b9392505050565b6001600160a01b03811681146200047657600080fd5b50565b6000806000606084860312156200048f57600080fd5b83516200049c8162000460565b6020850151909350620004af8162000460565b6040850151909250620004c28162000460565b809150509250925092565b60005b83811015620004ea578181015183820152602001620004d0565b83811115620004fa576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516200053a816017850160208801620004cd565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516200056d816028840160208801620004cd565b01602801949350505050565b60208152600082518060208401526200059a816040850160208701620004cd565b601f01601f19169190910160400192915050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615620005e157620005e1620005ae565b500290565b60008219821115620005fc57620005fc620005ae565b500190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816200063f576200063f620005ae565b506000190190565b60805161326d620006716000396000818161044c01528181610b840152612239015261326d6000f3fe6080604052600436106102195760003560e01c80638aaa22841161011d578063cdc42344116100b0578063d7d18c8c1161007f578063f3fef3a311610064578063f3fef3a314610831578063f6ae220414610851578063f8b2cb4f1461088557600080fd5b8063d7d18c8c14610670578063e48603391461075457600080fd5b8063cdc42344146105da578063d1bf5768146105fa578063d48bfca714610630578063d547741f1461065057600080fd5b8063a7fd00f0116100ec578063a7fd00f01461052b578063aa6ca8081461054b578063ab4007061461056d578063cbe230c3146105a157600080fd5b80638aaa22841461049157806391d14854146104b1578063a217fddf146104f5578063a64ed8ba1461050a57600080fd5b80633138809d116101b057806346cee3991161017f578063599270441161016457806359927044146103fa57806361d027b31461043a578063802ad8fb1461046e57600080fd5b806346cee399146103b957806347e7ef24146103e757600080fd5b80633138809d1461034657806336568abe14610359578063384feaac146103795780633e32a3811461039957600080fd5b8063248a9ca3116101ec578063248a9ca3146102a8578063278b39de146102e65780632a22b7fc146103065780632f2ff15d1461032657600080fd5b806301ffc9a71461021e5780630f1e80e7146102535780631525ff7d146102755780631f61502314610295575b600080fd5b34801561022a57600080fd5b5061023e61023936600461292a565b6108a5565b60405190151581526020015b60405180910390f35b34801561025f57600080fd5b5061027361026e366004612983565b61093e565b005b34801561028157600080fd5b506102736102903660046129b6565b6109b3565b6102736102a33660046129d3565b610a32565b3480156102b457600080fd5b506102d86102c3366004612a19565b60009081526020819052604090206001015490565b60405190815260200161024a565b3480156102f257600080fd5b506102d8610301366004612a32565b610b0f565b34801561031257600080fd5b506102736103213660046129b6565b610b3f565b34801561033257600080fd5b50610273610341366004612a5e565b610c15565b610273610354366004612a32565b610c40565b34801561036557600080fd5b50610273610374366004612a5e565b610cdd565b34801561038557600080fd5b50610273610394366004612a8e565b610d88565b3480156103a557600080fd5b506102736103b43660046129b6565b610ed8565b3480156103c557600080fd5b506001546103d49061ffff1681565b60405161ffff909116815260200161024a565b6102736103f5366004612a32565b610f4a565b34801561040657600080fd5b506001546104229064010000000090046001600160a01b031681565b6040516001600160a01b03909116815260200161024a565b34801561044657600080fd5b506104227f000000000000000000000000000000000000000000000000000000000000000081565b34801561047a57600080fd5b50610483610ff4565b60405161024a929190612ae4565b34801561049d57600080fd5b506102736104ac366004612b76565b6111ed565b3480156104bd57600080fd5b5061023e6104cc366004612a5e565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561050157600080fd5b506102d8600081565b34801561051657600080fd5b506001546103d49062010000900461ffff1681565b34801561053757600080fd5b50610273610546366004612ba4565b61126f565b34801561055757600080fd5b506105606113f6565b60405161024a9190612c63565b34801561057957600080fd5b506102d87f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa8881565b3480156105ad57600080fd5b5061023e6105bc3660046129b6565b6001600160a01b031660009081526003602052604090205460ff1690565b3480156105e657600080fd5b50600254610422906001600160a01b031681565b34801561060657600080fd5b50610422610615366004612983565b6004602052600090815260409020546001600160a01b031681565b34801561063c57600080fd5b5061027361064b3660046129b6565b6117bf565b34801561065c57600080fd5b5061027361066b366004612a5e565b61192d565b34801561067c57600080fd5b5061074761068b3660046129b6565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810191909152506001600160a01b0316600090815260036020818152604092839020835160e081018552600182015461ffff8082168352620100008204811694830194909452640100000000810484169582019590955266010000000000009094049091166060840152600281015460808401529081015460a08301526004015460c082015290565b60405161024a9190612dcd565b34801561076057600080fd5b5061082161076f3660046129b6565b6003602081815260009283526040928390208054845160e081018652600183015461ffff8082168352620100008083048216848801526401000000008084048316858b015266010000000000009093048216606080860191909152600287015460808601529786015460a0850152600486015460c0850152600586015489519889018a52600690960154808316895290810482169688019690965294049093169484019490945260ff90931692909184565b60405161024a9493929190612e26565b34801561083d57600080fd5b5061027361084c366004612a32565b611953565b34801561085d57600080fd5b506102d87f39780592ddb1e73f2a037f166ec57ba042082746f5c0b9fe56ea386e00369a9881565b34801561089157600080fd5b506102d86108a03660046129b6565b6119bd565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061093857507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b600061094a8133611d4b565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff84169081179091556040519081527fdac35c35ebd0ba62bd95fa8546ffff4f63446e54e615de1db75616324212b8cd906020015b60405180910390a15050565b60006109bf8133611d4b565b600180547fffffffffffffffff0000000000000000000000000000000000000000ffffffff166401000000006001600160a01b038581168202929092179283905560405192041681527fc6a5dd316fe9d0339f2769deab7e31f64c8f5b101ffd85dfc9a83dbeaf2e69da906020016109a7565b7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa88610a5d8133611d4b565b6001600160a01b03841660009081526003602052604090206001018054610ab190879087908690859061ffff8082169162010000810482169164010000000082048116916601000000000000900416611de3565b610abc86868661203a565b846001600160a01b03167f634235fcf5af0adbca1a405ec65f6f6c08f55e1f379c2c45cd10f23cb29e0e31610af0876119bd565b60408051918252602082018890520160405180910390a2505050505050565b600154600090829061ffff16610b24856119bd565b610b2e9190612eef565b610b389190612f5b565b9392505050565b6000610b4b8133611d4b565b6001600160a01b038216600090815260036020819052604082209081018054600483018054928590559390935560019091019190610baa7f0000000000000000000000000000000000000000000000000000000000000000868461203a565b600154610bc99064010000000090046001600160a01b0316868361203a565b60408051838152602081018390526001600160a01b038716917f0146f1701c23c89f761280798d36d6c4e3acb349438456f5da8f83a2f5dd8cdc91015b60405180910390a25050505050565b600082815260208190526040902060010154610c318133611d4b565b610c3b8383612066565b505050565b7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa88610c6b8133611d4b565b610c7483612122565b826001600160a01b03167f812b76b477469edc716929cbf7ed54e3d9c1a68d8b9f8290dbabcda54d96fcbe610ca8856119bd565b6001600160a01b03861615610cbd5784610cbf565b345b604080519283526020830191909152015b60405180910390a2505050565b6001600160a01b0381163314610d7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b610d8482826122ef565b5050565b6000610d948133611d4b565b6127108461ffff161180610db65750612710610db08385612f6f565b61ffff16115b15610ded576040517fa28c907300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516060808201835261ffff87811680845287821660208086018281528985168789018181526001600160a01b038f166000818152600386528b902099516006909a018054945192518916640100000000027fffffffffffffffffffffffffffffffffffffffffffffffffffff0000ffffffff938a1662010000027fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000009096169b9099169a909a1793909317169590951790965586519283528201529384015290917f4b481214fcdec41d9a7a06a45d5d931dada21892e48b04779c52d1c69d1e5f9f9101610c06565b6000610ee48133611d4b565b600280547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384169081179091556040519081527f678edf136de423322d705b75c3157ecfde496e1ad82aef725aa6deb9d94d4de2906020016109a7565b6000610f568133611d4b565b6000610f61846119bd565b90506001600160a01b038416610f8357610f7b848261238c565b349250610fab565b610f9684610f918584612f95565b61238c565b610fab6001600160a01b0385163330866123e8565b836001600160a01b03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c84604051610fe691815260200190565b60405180910390a250505050565b6060807f39780592ddb1e73f2a037f166ec57ba042082746f5c0b9fe56ea386e00369a986110228133611d4b565b60015460009062010000900461ffff1667ffffffffffffffff81111561104a5761104a612fad565b604051908082528060200260200182016040528015611073578160200160208202803683370190505b5060015490915060009062010000900461ffff1667ffffffffffffffff81111561109f5761109f612fad565b6040519080825280602002602001820160405280156110c8578160200160208202803683370190505b50905060005b60015461ffff62010000909104811690821610156111e25761ffff81166000908152600460209081526040808320546001600160a01b03168084526003909252909120600281015480156111cc576000600283015561112e33848361203a565b826001600160a01b03167fca64dbcaf91abfb066e7a5163f1d135f8f48f2cbdb0395e3b35cc278ebbd340b8260405161116991815260200190565b60405180910390a282868561ffff168151811061118857611188612fdc565b60200260200101906001600160a01b031690816001600160a01b03168152505080858561ffff16815181106111bf576111bf612fdc565b6020026020010181815250505b50505080806111da9061300b565b9150506110ce565b509093509150509091565b60006111f98133611d4b565b6001600160a01b03831660008181526003602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527fe589eb036e62c07e307aa4d441bd39c81e8bd86f349eaacb0caa06b1477f7f9a9101610cd0565b600061127b8133611d4b565b600084846112898589612f6f565b6112939190612f6f565b61129d9190612f6f565b90508061ffff16612710146112e4576040517f6104384400000000000000000000000000000000000000000000000000000000815261ffff82166004820152602401610d71565b6001600160a01b038716600081815260036020908152604091829020600101805461ffff8b81167fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000009092168217620100008c8316908102919091177fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff166401000000008c84169081027fffffffffffffffffffffffffffffffffffffffffffffffff0000ffffffffffff16919091176601000000000000938c169384021785558651938452948301529381019290925260608201929092529091907f01573e473e8842c25da06b37c286cdd7bf1c828e796ab47f7eec894ac9fbbee39060800160405180910390a25050505050505050565b60015460609060009062010000900461ffff1667ffffffffffffffff81111561142157611421612fad565b60405190808252806020026020018201604052801561145a57816020015b61144761287c565b81526020019060019003908161143f5790505b50905060005b60015461ffff62010000909104811690821610156117b95761ffff8181166000908152600460208181526040808420546001600160a01b0316808552600380845294829020825160808082018552825460ff1615158252845160e0810186526001840154808b168252620100008082048c16838a01526401000000008083048d16848a015266010000000000009092048c166060808501919091526002870154948401949094529985015460a08301529784015460c08201528287015260058301548286015284518082018652600690930154808a16845297880489169583019590955294909504909516908401528101919091528161161e576040518060a00160405280601260ff168152602001836001600160a01b031681526020016040518060400160405280600381526020017f455448000000000000000000000000000000000000000000000000000000000081525081526020016040518060400160405280600381526020017f4554480000000000000000000000000000000000000000000000000000000000815250815260200182815250848461ffff168151811061160e5761160e612fdc565b60200260200101819052506117a4565b60008290506040518060a00160405280826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561166c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611690919061302c565b60ff168152602001846001600160a01b03168152602001826001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa1580156116e5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261170d919081019061304f565b8152602001826001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015611750573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611778919081019061304f565b815260200183815250858561ffff168151811061179757611797612fdc565b6020026020010181905250505b505080806117b19061300b565b915050611460565b50919050565b60006117cb8133611d4b565b60015462010000900461ffff161561186f5760005b60015461ffff620100009091048116908216101561186d5761ffff81166000908152600460205260409020546001600160a01b0380851691160361185b576040517ff49f09990000000000000000000000000000000000000000000000000000000081526001600160a01b0384166004820152602401610d71565b806118658161300b565b9150506117e0565b505b60018054620100009081900461ffff908116600090815260046020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038716179055825483926002926118d5928592900416612f6f565b92506101000a81548161ffff021916908361ffff1602179055507fe473c74f34be27c1464d6624f14a0d7fd4e301cbfa29c3eba425d378c8a7ebe0826040516109a791906001600160a01b0391909116815260200190565b6000828152602081905260409020600101546119498133611d4b565b610c3b83836122ef565b600061195f8133611d4b565b611977838361196d866119bd565b610f9191906130f1565b61198233848461203a565b826001600160a01b03167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436483604051610cd091815260200190565b6000806001600160a01b0383166119d5575047611a59565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015611a32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a569190613108565b90505b6001600160a01b038316600090815260036020818152604092839020835160e081018552600182015461ffff80821683526201000082048116948301949094526401000000008104841695820195909552660100000000000090940490911660608401526002810154608084018190529181015460a0840181905260049091015460c0840181905291611aec90856130f1565b611af691906130f1565b611b0091906130f1565b949350505050565b60606000611b17836002612eef565b611b22906002612f95565b67ffffffffffffffff811115611b3a57611b3a612fad565b6040519080825280601f01601f191660200182016040528015611b64576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611b9b57611b9b612fdc565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611bfe57611bfe612fdc565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611c3a846002612eef565b611c45906001612f95565b90505b6001811115611ce2577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611c8657611c86612fdc565b1a60f81b828281518110611c9c57611c9c612fdc565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611cdb81613121565b9050611c48565b508315610b38576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610d71565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610d8457611d87816001600160a01b03166014611b08565b611d92836020611b08565b604051602001611da3929190613156565b60408051601f19818403018152908290527f08c379a0000000000000000000000000000000000000000000000000000000008252610d71916004016131d7565b6000612710611df661ffff861689612eef565b611e009190612f5b565b905060008115801590611e1d57506002546001600160a01b031615155b15611ec9576002546040517f7700f17b0000000000000000000000000000000000000000000000000000000081526001600160a01b038c811660048301528b811660248301526044820185905290911690637700f17b906064016020604051808303816000875af1158015611e96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eba9190613108565b9050611ec681836130f1565b91505b60006003611ed781856131ea565b611ee190856130f1565b611eeb9190612f5b565b9050600081612710611f0161ffff8b168d612eef565b611f0b9190612f5b565b611f159190612f95565b9050600082612710611f2b61ffff8a168e612eef565b611f359190612f5b565b611f3f9190612f95565b9050600083612710611f5561ffff8a168f612eef565b611f5f9190612f5b565b611f699190612f95565b9050828b6001016000828254611f7f9190612f95565b92505081905550818b6002016000828254611f9a9190612f95565b92505081905550808b6003016000828254611fb59190612f95565b90915550506040805184815260208101879052908101839052606081018290526001600160a01b038e16907f0b5a4c9121a83120fc7b30f195ddd2c279ec4510cfc8f051380851e8f0686f499060800160405180910390a2841561202a5760025461202a906001600160a01b03168e8761203a565b5050505050505050505050505050565b6001600160a01b03821661205257610c3b838261249f565b610c3b6001600160a01b03831684836125ec565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610d84576000828152602081815260408083206001600160a01b0385168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556120de3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6001600160a01b038116600090815260036020526040812090612144836119bd565b60408051606081018252600685015461ffff8082168084526201000083048216602085015264010000000090920416928201929092529192506000906127109061218e9085612eef565b6121989190612f5b565b84600501546121a79190612f95565b9050808311156122e85760008460050154846121c391906130f1565b90506000612710846020015161ffff16836121de9190612eef565b6121e89190612f5b565b90506000612710856040015161ffff16846122039190612eef565b61220d9190612f5b565b905061221e888261196d858a6130f1565b600387018054600489018054600093849055929055906122687f00000000000000000000000000000000000000000000000000000000000000008b6122638786612f95565b61203a565b60015461228b9064010000000090046001600160a01b03168b6122638685612f95565b6001600160a01b038a167f6842359a4c3b5f98197bd29d5a317cd8c919e10ef467c746b9b256e99157b08e6122c08685612f95565b6122ca8685612f95565b6040805192835260208301919091520160405180910390a250505050505b5050505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1615610d84576000828152602081815260408083206001600160a01b038516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b03821660008181526003602052604090819020600501839055517f492a63a7d96d749f455133f12ab1ea15a7dd0a5d5f6ae04694244a2761df3f8c906123dc9084815260200190565b60405180910390a25050565b6040516001600160a01b03808516602483015283166044820152606481018290526124999085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612635565b50505050565b80471015612509576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610d71565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612556576040519150601f19603f3d011682016040523d82523d6000602084013e61255b565b606091505b5050905080610c3b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610d71565b6040516001600160a01b038316602482015260448101829052610c3b9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612435565b600061268a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166127349092919063ffffffff16565b805190915015610c3b57808060200190518101906126a891906131fe565b610c3b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610d71565b6060611b008484600085856001600160a01b0385163b6127b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d71565b600080866001600160a01b031685876040516127cc919061321b565b60006040518083038185875af1925050503d8060008114612809576040519150601f19603f3d011682016040523d82523d6000602084013e61280e565b606091505b509150915061281e828286612829565b979650505050505050565b60608315612838575081610b38565b8251156128485782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7191906131d7565b6040518060a00160405280600060ff16815260200160006001600160a01b03168152602001606081526020016060815260200161292560408051608080820183526000808352835160e08101855281815260208181018390529481018290526060810182905291820181905260a0820181905260c08201529091820190815260006020808301829052604080516060810182528381529182018390528181019290925291015290565b905290565b60006020828403121561293c57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610b3857600080fd5b803561ffff8116811461297e57600080fd5b919050565b60006020828403121561299557600080fd5b610b388261296c565b6001600160a01b03811681146129b357600080fd5b50565b6000602082840312156129c857600080fd5b8135610b388161299e565b600080600080608085870312156129e957600080fd5b84356129f48161299e565b93506020850135612a048161299e565b93969395505050506040820135916060013590565b600060208284031215612a2b57600080fd5b5035919050565b60008060408385031215612a4557600080fd5b8235612a508161299e565b946020939093013593505050565b60008060408385031215612a7157600080fd5b823591506020830135612a838161299e565b809150509250929050565b60008060008060808587031215612aa457600080fd5b8435612aaf8161299e565b9350612abd6020860161296c565b9250612acb6040860161296c565b9150612ad96060860161296c565b905092959194509250565b604080825283519082018190526000906020906060840190828701845b82811015612b265781516001600160a01b031684529284019290840190600101612b01565b5050508381038285015284518082528583019183019060005b81811015612b5b57835183529284019291840191600101612b3f565b5090979650505050505050565b80151581146129b357600080fd5b60008060408385031215612b8957600080fd5b8235612b948161299e565b91506020830135612a8381612b68565b600080600080600060a08688031215612bbc57600080fd5b8535612bc78161299e565b9450612bd56020870161296c565b9350612be36040870161296c565b9250612bf16060870161296c565b9150612bff6080870161296c565b90509295509295909350565b60005b83811015612c26578181015183820152602001612c0e565b838111156124995750506000910152565b60008151808452612c4f816020860160208601612c0b565b601f01601f19169290920160200192915050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015612dbf577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0898403018552815161020060ff82511685526001600160a01b03898301511689860152878201518189870152612ceb82870182612c37565b91505060608083015186830382880152612d058382612c37565b925050608080840151935083511515818801525089830151612d7560a088018261ffff808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c08301525050565b508883015161018087015290910151805161ffff9081166101a0870152602082015181166101c08701526040820151166101e0860152909588019593505090860190600101612c8a565b509098975050505050505050565b60e08101610938828461ffff808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c08301525050565b84151581526101808101612e88602083018661ffff808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c08301525050565b6101008201849052825161ffff9081166101208401526020840151811661014084015260408401511661016083015295945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612f2757612f27612ec0565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082612f6a57612f6a612f2c565b500490565b600061ffff808316818516808303821115612f8c57612f8c612ec0565b01949350505050565b60008219821115612fa857612fa8612ec0565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600061ffff80831681810361302257613022612ec0565b6001019392505050565b60006020828403121561303e57600080fd5b815160ff81168114610b3857600080fd5b60006020828403121561306157600080fd5b815167ffffffffffffffff8082111561307957600080fd5b818401915084601f83011261308d57600080fd5b81518181111561309f5761309f612fad565b604051601f8201601f19908116603f011681019083821181831017156130c7576130c7612fad565b816040528281528760208487010111156130e057600080fd5b61281e836020830160208801612c0b565b60008282101561310357613103612ec0565b500390565b60006020828403121561311a57600080fd5b5051919050565b60008161313057613130612ec0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161318e816017850160208801612c0b565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516131cb816028840160208801612c0b565b01602801949350505050565b602081526000610b386020830184612c37565b6000826131f9576131f9612f2c565b500690565b60006020828403121561321057600080fd5b8151610b3881612b68565b6000825161322d818460208701612c0b565b919091019291505056fea26469706673582212208b1a3edb3956dd4ae4936082440d982f804abdf1d6c96fd91c9518aaa8d7451e64736f6c634300080d00330000000000000000000000002c305888a456e7004663bc12a74395e637eabcbc0000000000000000000000001c6bf7fb1518cd320553c11047fed4bd181b558b000000000000000000000000d544d7b128e9d80895c34285c885e22cb913c83f

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

0000000000000000000000002c305888a456e7004663bc12a74395e637eabcbc0000000000000000000000001c6bf7fb1518cd320553c11047fed4bd181b558b000000000000000000000000d544d7b128e9d80895c34285c885e22cb913c83f

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

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000002c305888a456e7004663bc12a74395e637eabcbc
Arg [1] : 0000000000000000000000001c6bf7fb1518cd320553c11047fed4bd181b558b
Arg [2] : 000000000000000000000000d544d7b128e9d80895c34285c885e22cb913c83f


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