AVAX Price: $22.45 (+5.05%)
Gas: 6.8 nAVAX
 

Overview

AVAX Balance

Avalanche C-Chain LogoAvalanche C-Chain LogoAvalanche C-Chain Logo0 AVAX

AVAX Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Renounce Role275298882023-03-16 22:29:27768 days ago1679005767IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011870326
Set APR Bonus275298652023-03-16 22:28:40768 days ago1679005720IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011585826
Grant Role275298282023-03-16 22:27:26768 days ago1679005646IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0030782926
Renounce Role275297862023-03-16 22:25:57768 days ago1679005557IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011870326
Set APR275297652023-03-16 22:25:15768 days ago1679005515IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011568726
Grant Role275297002023-03-16 22:22:57768 days ago1679005377IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0030782926
Renounce Role253605502023-01-24 16:38:52819 days ago1674578332IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011870326
Renounce Role253605452023-01-24 16:38:42819 days ago1674578322IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011870326
Set APR Bonus253603472023-01-24 16:32:02819 days ago1674577922IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011588926
Set APR253603422023-01-24 16:31:52819 days ago1674577912IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0016020926
Claim For253603242023-01-24 16:31:16819 days ago1674577876IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0050177726.5
Set APR Bonus253603112023-01-24 16:30:50819 days ago1674577850IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011598326
Set APR Bonus253602822023-01-24 16:29:52819 days ago1674577792IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011598326
Set APR253602582023-01-24 16:29:04819 days ago1674577744IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011568726
Claim For253602392023-01-24 16:28:26819 days ago1674577706IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0051984927.425
Set APR253602042023-01-24 16:27:13819 days ago1674577633IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011581126
Set APR253601742023-01-24 16:26:13819 days ago1674577573IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011581126
Set APR253601432023-01-24 16:25:11819 days ago1674577511IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011581126
Claim For253601172023-01-24 16:24:18819 days ago1674577458IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0044510826.8818
Set APR253601062023-01-24 16:23:56819 days ago1674577436IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011581126
Set APR253599122023-01-24 16:17:24819 days ago1674577044IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011581126
Set APR253598652023-01-24 16:15:51819 days ago1674576951IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011581126
Set APR253598222023-01-24 16:14:23819 days ago1674576863IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011581126
Claim For253597682023-01-24 16:12:33819 days ago1674576753IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.006382626.5
Set APR253596082023-01-24 16:07:13819 days ago1674576433IN
XPower: ODIN MoE Treasury v5b
0 AVAX0.0011581126
View all transactions

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x98B25c74...f1d37B302
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
MoeTreasury

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, GNU GPLv3 license

Contract Source Code (Solidity)

/**
 *Submitted for verification at snowscan.xyz on 2022-11-17
*/

// SPDX-License-Identifier: GPL-3.0
// Sources flattened with hardhat v2.12.2 https://hardhat.org
// File @openzeppelin/contracts/access/[email protected]
// 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 @openzeppelin/contracts/access/[email protected]
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerable is IAccessControl {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}
// File @openzeppelin/contracts/utils/[email protected]
// 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 @openzeppelin/contracts/utils/[email protected]
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // 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);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}
// File @openzeppelin/contracts/utils/introspection/[email protected]
// 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 @openzeppelin/contracts/utils/introspection/[email protected]
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

/**
 * @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 @openzeppelin/contracts/access/[email protected]
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;


/**
 * @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);
        _;
    }

    /**
     * @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 `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @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.
     *
     * May emit a {RoleGranted} event.
     */
    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.
     *
     * May emit a {RoleRevoked} event.
     */
    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`.
     *
     * May emit a {RoleRevoked} event.
     */
    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.
     *
     * May emit a {RoleGranted} event.
     *
     * [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.
     *
     * May emit a {RoleGranted} event.
     */
    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.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}
// File @openzeppelin/contracts/utils/structs/[email protected]
// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 *  Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.
 *  See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 *  In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}
// File @openzeppelin/contracts/access/[email protected]
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)

pragma solidity ^0.8.0;

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
    using EnumerableSet for EnumerableSet.AddressSet;

    mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;

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

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {
        return _roleMembers[role].at(index);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {
        return _roleMembers[role].length();
    }

    /**
     * @dev Overload {_grantRole} to track enumerable memberships
     */
    function _grantRole(bytes32 role, address account) internal virtual override {
        super._grantRole(role, account);
        _roleMembers[role].add(account);
    }

    /**
     * @dev Overload {_revokeRole} to track enumerable memberships
     */
    function _revokeRole(bytes32 role, address account) internal virtual override {
        super._revokeRole(role, account);
        _roleMembers[role].remove(account);
    }
}
// File contracts/Supervised.sol
pragma solidity ^0.8.0;

abstract contract Supervised is AccessControlEnumerable {
    constructor() {
        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
    }

    /** returns true if this contract implements the interface defined by interfaceId */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return super.supportsInterface(interfaceId);
    }
}

abstract contract XPowerSupervised is Supervised {
    /** role grants right to change treasury's share per mint */
    bytes32 public constant TREASURY_SHARE_ROLE = keccak256("TREASURY_SHARE_ROLE");
    bytes32 public constant TREASURY_SHARE_ADMIN_ROLE = keccak256("TREASURY_SHARE_ADMIN_ROLE");
    /** role grants right to change mining-difficulty parametrization */
    bytes32 public constant MINING_DIFFICULTY_ROLE = keccak256("MINING_DIFFICULTY_ROLE");
    bytes32 public constant MINING_DIFFICULTY_ADMIN_ROLE = keccak256("MINING_DIFFICULTY_ADMIN_ROLE");

    constructor() {
        _setRoleAdmin(TREASURY_SHARE_ROLE, TREASURY_SHARE_ADMIN_ROLE);
        _grantRole(TREASURY_SHARE_ADMIN_ROLE, msg.sender);
        _setRoleAdmin(MINING_DIFFICULTY_ROLE, MINING_DIFFICULTY_ADMIN_ROLE);
        _grantRole(MINING_DIFFICULTY_ADMIN_ROLE, msg.sender);
    }
}

abstract contract MoeTreasurySupervised is Supervised {
    /** role grants right to change APR parametrization */
    bytes32 public constant APR_ROLE = keccak256("APR_ROLE");
    bytes32 public constant APR_ADMIN_ROLE = keccak256("APR_ADMIN_ROLE");
    /** role grants right to change APR bonus parametrization */
    bytes32 public constant APR_BONUS_ROLE = keccak256("APR_BONUS_ROLE");
    bytes32 public constant APR_BONUS_ADMIN_ROLE = keccak256("APR_BONUS_ADMIN_ROLE");

    constructor() {
        _setRoleAdmin(APR_ROLE, APR_ADMIN_ROLE);
        _grantRole(APR_ADMIN_ROLE, msg.sender);
        _setRoleAdmin(APR_BONUS_ROLE, APR_BONUS_ADMIN_ROLE);
        _grantRole(APR_BONUS_ADMIN_ROLE, msg.sender);
    }
}

abstract contract MoeMigratableSupervised is Supervised {
    /** role grants right to seal MOE migration */
    bytes32 public constant MOE_SEAL_ROLE = keccak256("MOE_SEAL_ROLE");
    bytes32 public constant MOE_SEAL_ADMIN_ROLE = keccak256("MOE_SEAL_ADMIN_ROLE");

    constructor() {
        _setRoleAdmin(MOE_SEAL_ROLE, MOE_SEAL_ADMIN_ROLE);
        _grantRole(MOE_SEAL_ADMIN_ROLE, msg.sender);
    }
}

abstract contract SovMigratableSupervised is Supervised {
    /** role grants right to seal SOV migration */
    bytes32 public constant SOV_SEAL_ROLE = keccak256("SOV_SEAL_ROLE");
    bytes32 public constant SOV_SEAL_ADMIN_ROLE = keccak256("SOV_SEAL_ADMIN_ROLE");

    constructor() {
        _setRoleAdmin(SOV_SEAL_ROLE, SOV_SEAL_ADMIN_ROLE);
        _grantRole(SOV_SEAL_ADMIN_ROLE, msg.sender);
    }
}

abstract contract NftMigratableSupervised is Supervised {
    /** role grants right to seal NFT migration */
    bytes32 public constant NFT_SEAL_ROLE = keccak256("NFT_SEAL_ROLE");
    bytes32 public constant NFT_SEAL_ADMIN_ROLE = keccak256("NFT_SEAL_ADMIN_ROLE");

    constructor() {
        _setRoleAdmin(NFT_SEAL_ROLE, NFT_SEAL_ADMIN_ROLE);
        _grantRole(NFT_SEAL_ADMIN_ROLE, msg.sender);
    }
}

abstract contract URIMalleableSupervised is Supervised {
    /** role grants right to change metadata URIs */
    bytes32 public constant URI_DATA_ROLE = keccak256("URI_DATA_ROLE");
    bytes32 public constant URI_DATA_ADMIN_ROLE = keccak256("URI_DATA_ADMIN_ROLE");

    constructor() {
        _setRoleAdmin(URI_DATA_ROLE, URI_DATA_ADMIN_ROLE);
        _grantRole(URI_DATA_ADMIN_ROLE, msg.sender);
    }
}
// File @openzeppelin/contracts/token/ERC20/[email protected]
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}
// File @openzeppelin/contracts/token/ERC20/extensions/[email protected]
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

/**
 * @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 @openzeppelin/contracts/token/ERC20/[email protected]
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}
// File @openzeppelin/contracts/token/ERC20/extensions/[email protected]
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)

pragma solidity ^0.8.0;
/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20Burnable is Context, ERC20 {
    /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) public virtual {
        _burn(_msgSender(), amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) public virtual {
        _spendAllowance(account, _msgSender(), amount);
        _burn(account, amount);
    }
}
// File contracts/Migratable.sol
// solhint-disable not-rely-on-time
pragma solidity ^0.8.0;

/**
 * Allows migration of tokens from an old contract upto a certain deadline.
 * Further, it is possible to close down the migration window earlier than
 * the specified deadline.
 */
abstract contract Migratable is ERC20, ERC20Burnable, Supervised {
    /** old contract to migrate from */
    ERC20Burnable private _token;
    /** timestamp of migration deadline */
    uint256 private _deadlineBy;
    /** flag to control migration */
    bool private _migratable = true;
    /** number of migrated tokens */
    uint256 private _migratedTotal = 0;

    /** @param base address of old contract */
    /** @param deadlineIn seconds to end-of-migration */
    constructor(address base, uint256 deadlineIn) {
        _deadlineBy = block.timestamp + deadlineIn;
        _token = ERC20Burnable(base);
    }

    /** import amount from old contract */
    function migrate(uint256 oldAmount) public virtual {
        uint256 newAmount = _premigrate(oldAmount);
        _mint(msg.sender, newAmount);
    }

    /** preimport amount from old contract w/o minting new tokens */
    function _premigrate(uint256 oldAmount) internal returns (uint256) {
        require(_migratable, "migration sealed");
        uint256 timestamp = block.timestamp;
        require(_deadlineBy >= timestamp, "deadline passed");
        uint256 myAllowance = _token.allowance(msg.sender, address(this));
        require(oldAmount <= myAllowance, "insufficient allowance");
        uint256 oldBalance = _token.balanceOf(msg.sender);
        require(oldAmount <= oldBalance, "insufficient balance");
        _token.burnFrom(msg.sender, oldAmount);
        uint256 newBalance = _token.balanceOf(msg.sender);
        require(newBalance + oldAmount == oldBalance, "invalid balance");
        require(decimals() >= _token.decimals(), "invalid decimals");
        uint8 deltaExponent = decimals() - _token.decimals();
        uint256 newAmount = oldAmount * 10 ** deltaExponent;
        _incrementCounter(newAmount);
        return newAmount;
    }

    /** @return number of migrated tokens */
    function migrated() public view returns (uint256) {
        return _migratedTotal;
    }

    /** seal migration (manually) */
    function seal() public virtual onlyRole(0x0) {
        _migratable = false;
    }

    /** track migration counter */
    function _incrementCounter(uint256 amount) internal {
        _migratedTotal += amount;
    }

    /** returns true if this contract implements the interface defined by interfaceId */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return
            interfaceId == type(IERC20).interfaceId ||
            interfaceId == type(IERC20Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }
}

/**
 * Allows migration of MOE tokens from an old contract upto a certain deadline.
 */
abstract contract MoeMigratable is Migratable, MoeMigratableSupervised {
    /** seal migration (manually) */
    function seal() public override onlyRole(MOE_SEAL_ROLE) {
        super.seal();
    }

    /** returns true if this contract implements the interface defined by interfaceId */
    function supportsInterface(bytes4 interfaceId) public view virtual override(Migratable, Supervised) returns (bool) {
        return super.supportsInterface(interfaceId);
    }
}

/**
 * Allows migration of SOV tokens from an old contract upto a certain deadline.
 */
abstract contract SovMigratable is Migratable, SovMigratableSupervised {
    /** proof-of-work tokens */
    ERC20 private _moe;

    /** @param moe address of MOE tokens */
    /** @param base address of old contract */
    /** @param deadlineIn seconds to end-of-migration */
    constructor(address moe, address base, uint256 deadlineIn) Migratable(base, deadlineIn) {
        _moe = ERC20(moe);
    }

    /** import amount from old contract */
    function migrate(uint256 oldAmount) public override {
        uint256 newAmount = _premigrate(oldAmount);
        _moe.transferFrom(msg.sender, (address)(this), oldAmount);
        _mint(msg.sender, newAmount);
    }

    /** seal migration (manually) */
    function seal() public override onlyRole(SOV_SEAL_ROLE) {
        super.seal();
    }

    /** returns true if this contract implements the interface defined by interfaceId */
    function supportsInterface(bytes4 interfaceId) public view virtual override(Migratable, Supervised) returns (bool) {
        return super.supportsInterface(interfaceId);
    }
}
// File @openzeppelin/contracts/access/[email protected]
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
// File contracts/XPower.sol
// solhint-disable not-rely-on-time
// solhint-disable no-empty-blocks
pragma solidity ^0.8.0;


/**
 * Abstract base class for the XPower THOR, LOKI and ODIN proof-of-work tokens.
 * It verifies, that the nonce & the block-hash do result in a positive amount,
 * (as specified by the sub-classes). After the verification, the corresponding
 * amount of tokens are minted for the beneficiary (plus the treasury).
 */
abstract contract XPower is ERC20, ERC20Burnable, MoeMigratable, XPowerSupervised, Ownable {
    using EnumerableSet for EnumerableSet.UintSet;
    /** set of nonce-hashes already minted for */
    EnumerableSet.UintSet private _hashes;
    /** map from block-hashes to timestamps */
    mapping(bytes32 => uint256) internal _timestamps;
    /** anchor for difficulty calculation */
    uint256 private immutable _timestamp;
    /** parametrization of treasury-share */
    uint256[] private _share = [0, 0, 2, 1, 0, 0];
    /** parametrization of mining-difficulty */
    uint256[] private _rigor = [0, 0, 4, 1, 0, 0];

    /** @param symbol short token symbol */
    /** @param moeBase address of old contract */
    /** @param deadlineIn seconds to end-of-migration */
    constructor(
        string memory symbol,
        address moeBase,
        uint256 deadlineIn
    )
        // ERC20 constructor: name, symbol
        ERC20("XPower", symbol)
        // Migratable: old contract, rel. deadline [seconds]
        Migratable(moeBase, deadlineIn)
    {
        _timestamp = 0x6215621e; // 2022-02-22T22:22:22Z
    }

    /** emitted on caching most recent block-hash */
    event Init(bytes32 blockHash, uint256 timestamp);

    /** cache most recent block-hash */
    function init() public {
        bytes32 blockHash = blockhash(block.number - 1);
        require(blockHash > 0, "invalid block-hash");
        uint256 timestamp = block.timestamp;
        require(timestamp > 0, "invalid timestamp");
        _timestamps[blockHash] = timestamp;
        emit Init(blockHash, timestamp);
    }

    /** mint tokens for beneficiary, interval, block-hash and nonce */
    function mint(address to, bytes32 blockHash, uint256 nonce) public {
        // get current interval (in hours)
        uint256 interval = _interval();
        // check block-hash to be recent
        _requireRecent(blockHash, interval);
        // calculate nonce-hash for to, interval, block-hash & nonce
        bytes32 nonceHash = _hashOf(to, interval, blockHash, nonce);
        require(!_hashes.contains(uint256(nonceHash)), "duplicate nonce-hash");
        // calculate amount of tokens for nonce-hash
        uint256 amount = _amountOf(nonceHash);
        require(amount > 0, "empty nonce-hash");
        // ensure unique nonce-hash (to be used once)
        _hashes.add(uint256(nonceHash));
        // mint tokens for owner (i.e. project treasury)
        uint256 treasure = treasuryShare(amount);
        if (treasure > 0) _mint(owner(), treasure);
        // mint tokens for beneficiary (e.g. nonce provider)
        _mint(to, amount);
    }

    /** @return treasury-share for given amount */
    function treasuryShare(uint256 amount) public view returns (uint256) {
        return ((amount + _share[5] - _share[4]) * _share[3]) / _share[2] + _share[1] - _share[0];
    }

    /** @return treasury-share parameters */
    function getTreasuryShare() public view returns (uint256[] memory) {
        return _share;
    }

    /** set treasury-share parameters */
    function setTreasuryShare(uint256[] memory array) public onlyRole(TREASURY_SHARE_ROLE) {
        require(array.length == 6, "invalid array.length");
        _share = array;
    }

    /** @return mining-difficulty for given timestamp */
    function miningDifficulty(uint256 timestamp) public view returns (uint256) {
        uint256 dt = timestamp - _timestamp;
        return (100 * (dt + _rigor[5] - _rigor[4]) * _rigor[3]) / (_rigor[2] * 365_25 days) + _rigor[1] - _rigor[0];
    }

    /** @return mining-difficulty parameters */
    function getMiningDifficulty() public view returns (uint256[] memory) {
        return _rigor;
    }

    /** set mining-difficulty parameters */
    function setMiningDifficulty(uint256[] memory array) public onlyRole(MINING_DIFFICULTY_ROLE) {
        require(array.length == 6, "invalid array.length");
        _rigor = array;
    }

    /** check whether block-hash has recently been cached or is recent */
    function _requireRecent(bytes32 blockHash, uint256 interval) internal view {
        require(blockHash > 0, "invalid block-hash");
        uint256 timestamp = _timestamps[blockHash];
        if (timestamp / (1 hours) != interval) {
            for (uint256 i = 1; i <= 256; i++) {
                if (block.number >= i && blockhash(block.number - i) == blockHash) {
                    return; // block-hash is within the last 256 blocks
                }
            }
            revert("expired block-hash");
        }
    }

    /** @return current interval (in hours) */
    function _interval() internal view returns (uint256) {
        uint256 interval = block.timestamp / (1 hours);
        require(interval > 0, "invalid interval");
        return interval;
    }

    /** @return hash of beneficiary, interval, block-hash & nonce */
    function _hashOf(
        address to,
        uint256 interval,
        bytes32 blockHash,
        uint256 nonce
    ) internal view virtual returns (bytes32) {
        return keccak256(abi.encode(symbol(), to, interval, blockHash, nonce));
    }

    /** @return amount for provided nonce-hash */
    function _amountOf(bytes32 nonceHash) internal view virtual returns (uint256);

    /** @return leading zeros of provided nonce-hash */
    function _zerosOf(bytes32 nonceHash) internal pure returns (uint8) {
        uint8 counter = 0;
        for (uint8 i = 0; i < 32; i++) {
            bytes1 b = nonceHash[i];
            if (b == 0x00) {
                counter += 2;
                continue;
            }
            if (
                b == 0x01 ||
                b == 0x02 ||
                b == 0x03 ||
                b == 0x04 ||
                b == 0x05 ||
                b == 0x06 ||
                b == 0x07 ||
                b == 0x08 ||
                b == 0x09 ||
                b == 0x0a ||
                b == 0x0b ||
                b == 0x0c ||
                b == 0x0d ||
                b == 0x0e ||
                b == 0x0f
            ) {
                counter += 1;
                break;
            }
            break;
        }
        return counter;
    }

    /** returns true if this contract implements the interface defined by interfaceId */
    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override(MoeMigratable, Supervised) returns (bool) {
        return super.supportsInterface(interfaceId);
    }
}

/**
 * Allow mining & minting for THOR proof-of-work tokens, where the rewarded
 * amount equals to *only* |leading-zeros(nonce-hash) - difficulty|.
 */
contract XPowerThor is XPower {
    /** @param moeBase address of old contract */
    /** @param deadlineIn seconds to end-of-migration */
    constructor(address moeBase, uint256 deadlineIn) XPower("THOR", moeBase, deadlineIn) {}

    /** @return amount for provided nonce-hash */
    function _amountOf(bytes32 nonceHash) internal view override returns (uint256) {
        uint256 difficulty = miningDifficulty(block.timestamp);
        uint256 zeros = _zerosOf(nonceHash);
        if (zeros > difficulty) {
            return (zeros - difficulty) * 10 ** decimals();
        }
        return 0;
    }
}

/**
 * Allow mining & minting for LOKI proof-of-work tokens, where the rewarded
 * amount equals to 2 ^ |leading-zeros(nonce-hash) - difficulty| - 1.
 */
contract XPowerLoki is XPower {
    /** @param moeBase address of old contract */
    /** @param deadlineIn seconds to end-of-migration */
    constructor(address moeBase, uint256 deadlineIn) XPower("LOKI", moeBase, deadlineIn) {}

    /** @return amount for provided nonce-hash */
    function _amountOf(bytes32 nonceHash) internal view override returns (uint256) {
        uint256 difficulty = miningDifficulty(block.timestamp);
        uint256 zeros = _zerosOf(nonceHash);
        if (zeros > difficulty) {
            return (2 ** (zeros - difficulty) - 1) * 10 ** decimals();
        }
        return 0;
    }
}

/**
 * Allow mining & minting for ODIN proof-of-work tokens, where the rewarded
 * amount equals to 16 ^ |leading-zeros(nonce-hash) - difficulty| - 1.
 */
contract XPowerOdin is XPower {
    /** @param moeBase address of old contract */
    /** @param deadlineIn seconds to end-of-migration */
    constructor(address moeBase, uint256 deadlineIn) XPower("ODIN", moeBase, deadlineIn) {}

    /** @return amount for provided nonce-hash */
    function _amountOf(bytes32 nonceHash) internal view override returns (uint256) {
        uint256 difficulty = miningDifficulty(block.timestamp);
        uint256 zeros = _zerosOf(nonceHash);
        if (zeros > difficulty) {
            return (16 ** (zeros - difficulty) - 1) * 10 ** decimals();
        }
        return 0;
    }
}
// File contracts/APower.sol
// solhint-disable no-empty-blocks
pragma solidity ^0.8.0;


/**
 * Abstract base class for the APower aTHOR, aLOKI and aODIN tokens, where only
 * the owner of the contract i.e the MoeTreasury is entitled to mint them.
 */
abstract contract APower is ERC20, ERC20Burnable, SovMigratable, Ownable {
    /** (burnable) proof-of-work tokens */
    XPower private _moe;

    /** @param symbol short token symbol */
    /** @param moeLink address of XPower tokens */
    /** @param sovBase address of old contract */
    /** @param deadlineIn seconds to end-of-migration */
    constructor(
        string memory symbol,
        address moeLink,
        address sovBase,
        uint256 deadlineIn
    )
        // ERC20 constructor: name, symbol
        ERC20("APower", symbol)
        // Migratable: XPower, old APower & rel. deadline [seconds]
        SovMigratable(moeLink, sovBase, deadlineIn)
    {
        _moe = XPower(moeLink);
    }

    /** mint amount of tokens for beneficiary (after wrapping XPower) */
    function mint(address to, uint256 amount) public onlyOwner {
        _moe.transferFrom(owner(), (address)(this), amount);
        _mint(to, amount);
    }

    /** burn amount of tokens from caller (and then unwrap XPower) */
    function burn(uint256 amount) public override {
        super.burn(amount);
        _moe.transfer(msg.sender, amount);
    }

    /**
     * burn amount of tokens from account, deducting from the caller's
     * allowance (and then unwrap XPower)
     */
    function burnFrom(address account, uint256 amount) public override {
        super.burnFrom(account, amount);
        _moe.transfer(account, amount);
    }
}

contract APowerThor is APower {
    /** @param moeLink address of XPower tokens */
    /** @param sovBase address of old contract */
    /** @param deadlineIn seconds to end-of-migration */
    constructor(address moeLink, address sovBase, uint256 deadlineIn) APower("aTHOR", moeLink, sovBase, deadlineIn) {}
}

contract APowerLoki is APower {
    /** @param moeLink address of XPower tokens */
    /** @param sovBase address of old contract */
    /** @param deadlineIn seconds to end-of-migration */
    constructor(address moeLink, address sovBase, uint256 deadlineIn) APower("aLOKI", moeLink, sovBase, deadlineIn) {}
}

contract APowerOdin is APower {
    /** @param moeLink address of XPower tokens */
    /** @param sovBase address of old contract */
    /** @param deadlineIn seconds to end-of-migration */
    constructor(address moeLink, address sovBase, uint256 deadlineIn) APower("aODIN", moeLink, sovBase, deadlineIn) {}
}
// File @openzeppelin/contracts/utils/[email protected]
// OpenZeppelin Contracts (last updated v4.7.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
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
// File @openzeppelin/contracts/token/ERC1155/[email protected]
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}
// File @openzeppelin/contracts/token/ERC1155/[email protected]
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}
// File @openzeppelin/contracts/token/ERC1155/extensions/[email protected]
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}
// File @openzeppelin/contracts/token/ERC1155/[email protected]
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.0;


/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
    using Address for address;

    // Mapping from token ID to account balances
    mapping(uint256 => mapping(address => uint256)) private _balances;

    // Mapping from account to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;

    /**
     * @dev See {_setURI}.
     */
    constructor(string memory uri_) {
        _setURI(uri_);
    }

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

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) public view virtual override returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
        require(account != address(0), "ERC1155: address zero is not a valid owner");
        return _balances[id][account];
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
        public
        view
        virtual
        override
        returns (uint256[] memory)
    {
        require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            batchBalances[i] = balanceOf(accounts[i], ids[i]);
        }

        return batchBalances;
    }

    /**
     * @dev See {IERC1155-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC1155-isApprovedForAll}.
     */
    function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[account][operator];
    }

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not token owner nor approved"
        );
        _safeTransferFrom(from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not token owner nor approved"
        );
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }
        _balances[id][to] += amount;

        emit TransferSingle(operator, from, to, id, amount);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
            _balances[id][to] += amount;
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        _balances[id][to] += amount;
        emit TransferSingle(operator, address(0), to, id, amount);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] += amounts[i];
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `amount` tokens of token type `id`.
     */
    function _burn(
        address from,
        uint256 id,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }

        emit TransferSingle(operator, from, address(0), id, amount);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(
        address from,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        for (uint256 i = 0; i < ids.length; i++) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
        }

        emit TransferBatch(operator, from, address(0), ids, amounts);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC1155: setting approval status for self");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `ids` and `amounts` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155Receiver.onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }
}
// File @openzeppelin/contracts/token/ERC1155/extensions/[email protected]
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/extensions/ERC1155Burnable.sol)

pragma solidity ^0.8.0;

/**
 * @dev Extension of {ERC1155} that allows token holders to destroy both their
 * own tokens and those that they have been approved to use.
 *
 * _Available since v3.1._
 */
abstract contract ERC1155Burnable is ERC1155 {
    function burn(
        address account,
        uint256 id,
        uint256 value
    ) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not token owner nor approved"
        );

        _burn(account, id, value);
    }

    function burnBatch(
        address account,
        uint256[] memory ids,
        uint256[] memory values
    ) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not token owner nor approved"
        );

        _burnBatch(account, ids, values);
    }
}
// File contracts/NftMigratable.sol
// solhint-disable not-rely-on-time
pragma solidity ^0.8.0;

/**
 * Allows migration of NFTs from an old contract; batch migration is also
 * possible. Further, manually sealing the migration is possible too.
 */
abstract contract NftMigratable is ERC1155, ERC1155Burnable, NftMigratableSupervised {
    /** old contract to migrate from */
    ERC1155Burnable private _token;
    /** timestamp of migration deadline */
    uint256 private _deadlineBy;
    /** flag to control migration */
    bool private _migratable = true;

    /** @param base address of old contract */
    /** @param deadlineIn seconds to end-of-migration */
    constructor(address base, uint256 deadlineIn) {
        _deadlineBy = block.timestamp + deadlineIn;
        _token = ERC1155Burnable(base);
    }

    /** import NFT from old contract */
    function migrate(uint256 nftId, uint256 amount) public {
        require(_migratable, "migration sealed");
        uint256 timestamp = block.timestamp;
        require(_deadlineBy >= timestamp, "deadline passed");
        _token.burn(msg.sender, nftId, amount);
        require(amount > 0, "non-positive amount");
        _mint(msg.sender, nftId, amount, "");
    }

    /** batch import NFTs from old contract */
    function migrateBatch(uint256[] memory nftIds, uint256[] memory amounts) public {
        require(_migratable, "migration sealed");
        uint256 timestamp = block.timestamp;
        require(_deadlineBy >= timestamp, "deadline passed");
        _token.burnBatch(msg.sender, nftIds, amounts);
        for (uint256 i = 0; i < amounts.length; i++) {
            require(amounts[i] > 0, "non-positive amount");
        }
        _mintBatch(msg.sender, nftIds, amounts, "");
    }

    /** seal migration (manually) */
    function seal() public onlyRole(NFT_SEAL_ROLE) {
        _migratable = false;
    }

    /** returns true if this contract implements the interface defined by interfaceId */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, Supervised) returns (bool) {
        return super.supportsInterface(interfaceId);
    }
}
// File contracts/URIMalleable.sol
pragma solidity ^0.8.0;
/**
 * Allows changing of the NFT's URI (by the URI_DATA_ROLE), where the URI
 * should e.g. redirect permanently (301) to a corresponding IPFS address.
 */
abstract contract URIMalleable is ERC1155, URIMalleableSupervised {
    /** set a new URI for all token types */
    function setURI(string memory newuri) public onlyRole(URI_DATA_ROLE) {
        _setURI(newuri);
    }

    /** returns true if this contract implements the interface defined by interfaceId */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, Supervised) returns (bool) {
        return super.supportsInterface(interfaceId);
    }
}
// File @openzeppelin/contracts/token/ERC1155/extensions/[email protected]
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)

pragma solidity ^0.8.0;

/**
 * @dev Extension of ERC1155 that adds tracking of total supply per id.
 *
 * Useful for scenarios where Fungible and Non-fungible tokens have to be
 * clearly identified. Note: While a totalSupply of 1 might mean the
 * corresponding is an NFT, there is no guarantees that no other token with the
 * same id are not going to be minted.
 */
abstract contract ERC1155Supply is ERC1155 {
    mapping(uint256 => uint256) private _totalSupply;

    /**
     * @dev Total amount of tokens in with a given id.
     */
    function totalSupply(uint256 id) public view virtual returns (uint256) {
        return _totalSupply[id];
    }

    /**
     * @dev Indicates whether any token exist with a given id, or not.
     */
    function exists(uint256 id) public view virtual returns (bool) {
        return ERC1155Supply.totalSupply(id) > 0;
    }

    /**
     * @dev See {ERC1155-_beforeTokenTransfer}.
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual override {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);

        if (from == address(0)) {
            for (uint256 i = 0; i < ids.length; ++i) {
                _totalSupply[ids[i]] += amounts[i];
            }
        }

        if (to == address(0)) {
            for (uint256 i = 0; i < ids.length; ++i) {
                uint256 id = ids[i];
                uint256 amount = amounts[i];
                uint256 supply = _totalSupply[id];
                require(supply >= amount, "ERC1155: burn amount exceeds totalSupply");
                unchecked {
                    _totalSupply[id] = supply - amount;
                }
            }
        }
    }
}
// File contracts/XPowerNftBase.sol
// solhint-disable not-rely-on-time
// solhint-disable no-empty-blocks
pragma solidity ^0.8.0;

/**
 * Abstract base NFT class: publicly *not* minteable (nor burneable).
 */
abstract contract XPowerNftBase is ERC1155, ERC1155Burnable, ERC1155Supply, URIMalleable, NftMigratable, Ownable {
    /** contract name */
    string public name;
    /** contract symbol */
    string public symbol;

    /** NFT levels: UNIT, ..., YOTTA *or* higher! */
    uint256 public constant UNIT = 0;
    uint256 public constant KILO = 3;
    uint256 public constant MEGA = 6;
    uint256 public constant GIGA = 9;
    uint256 public constant TERA = 12;
    uint256 public constant PETA = 15;
    uint256 public constant EXA = 18;
    uint256 public constant ZETTA = 21;
    uint256 public constant YOTTA = 24;

    /** @param nftBase address of old contract */
    /** @param uri meta-data URI */
    /** @param deadlineIn seconds to end-of-migration */
    constructor(
        string memory nftName,
        string memory nftSymbol,
        string memory nftUri,
        address nftBase,
        uint256 deadlineIn
    )
        // ERC1155 constructor: meta-data URI
        ERC1155(nftUri)
        // MigratableNft: old contract, rel. deadline [seconds]
        NftMigratable(nftBase, deadlineIn)
    {
        name = nftName;
        symbol = nftSymbol;
    }

    /** @return nft-id composed of (year, level) */
    function idBy(uint256 anno, uint256 level) public pure returns (uint256) {
        require(level % 3 == 0, "non-ternary level");
        require(level < 100, "invalid level");
        require(anno > 1970, "invalid year");
        return anno * 100 + level;
    }

    /** @return nft-ids composed of [(year, level) for level in levels] */
    function idsBy(uint256 anno, uint256[] memory levels) public pure returns (uint256[] memory) {
        uint256[] memory ids = new uint256[](levels.length);
        for (uint256 i = 0; i < levels.length; i++) {
            ids[i] = idBy(anno, levels[i]);
        }
        return ids;
    }

    /** @return denomination of level (1, 1'000, 1'000'000, ...) */
    function denominationOf(uint256 level) public pure returns (uint256) {
        require(level % 3 == 0, "non-ternary level");
        require(level < 100, "invalid level");
        return 10 ** level;
    }

    /** @return level of nft-id (0, 3, 6, ...) */
    function levelOf(uint256 nftId) public pure returns (uint256) {
        uint256 level = nftId % 100;
        require(level % 3 == 0, "non-ternary level");
        require(level < 100, "invalid level");
        return level;
    }

    /** @return year of nft-id (2021, 2022, ...) */
    function yearOf(uint256 nftId) public pure returns (uint256) {
        uint256 anno = nftId / 100;
        require(anno > 1970, "invalid year");
        return anno;
    }

    /** @return current number of years since anno domini */
    function year() public view returns (uint256) {
        uint256 anno = 1970 + (100 * block.timestamp) / (365_25 days);
        require(anno > 1970, "invalid year");
        return anno;
    }

    /** called before any token transfer; includes (batched) minting and burning */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory nftIds,
        uint256[] memory amounts,
        bytes memory data
    ) internal override(ERC1155, ERC1155Supply) {
        ERC1155Supply._beforeTokenTransfer(operator, from, to, nftIds, amounts, data);
    }

    /** returns true if this contract implements the interface defined by interfaceId */
    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override(ERC1155, URIMalleable, NftMigratable) returns (bool) {
        return super.supportsInterface(interfaceId);
    }
}
// File contracts/XPowerNftStaked.sol
// solhint-disable no-empty-blocks
// solhint-disable not-rely-on-time
pragma solidity ^0.8.0;

/**
 * Abstract base class for staked XPowerNft(s): Contract owner only is allowed
 * to mint and burn XPowerNftStaked tokens.
 */
abstract contract XPowerNftStaked is XPowerNftBase {
    /** map of mints: account => nft-id => accumulator [seconds] */
    mapping(address => mapping(uint256 => uint256)) private _mints;
    /** map of burns: account => nft-id => accumulator [seconds] */
    mapping(address => mapping(uint256 => uint256)) private _burns;
    /** map of total mints: nft-id => accumulator [seconds] */
    mapping(uint256 => uint256) private _mintsTotal;
    /** map of total burns: nft-id => accumulator [seconds] */
    mapping(uint256 => uint256) private _burnsTotal;

    /** @param pptName NFT name */
    /** @param pptSymbol NFT symbol */
    /** @param pptUri meta-data URI */
    /** @param pptBase address of old contract */
    /** @param deadlineIn seconds to end-of-migration */
    constructor(
        string memory pptName,
        string memory pptSymbol,
        string memory pptUri,
        address pptBase,
        uint256 deadlineIn
    ) XPowerNftBase(pptName, pptSymbol, pptUri, pptBase, deadlineIn) {}

    /** transfer tokens (and reset age) */
    function safeTransferFrom(
        address from,
        address to,
        uint256 nftId,
        uint256 amount,
        bytes memory data
    ) public override {
        _pushBurn(from, nftId, amount);
        _pushMint(to, nftId, amount);
        super.safeTransferFrom(from, to, nftId, amount, data);
    }

    /** batch transfer tokens (and reset age) */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory nftIds,
        uint256[] memory amounts,
        bytes memory data
    ) public override {
        _pushBurnBatch(from, nftIds, amounts);
        _pushMintBatch(to, nftIds, amounts);
        super.safeBatchTransferFrom(from, to, nftIds, amounts, data);
    }

    /** mint particular amount of staked NFTs for given address and nft-id */
    function mint(address to, uint256 nftId, uint256 amount) public onlyOwner {
        _pushMint(to, nftId, amount);
        _mint(to, nftId, amount, "");
    }

    /** mint particular amounts of staked NFTs for given address and nft-ids */
    function mintBatch(address to, uint256[] memory nftIds, uint256[] memory amounts) public onlyOwner {
        _pushMintBatch(to, nftIds, amounts);
        _mintBatch(to, nftIds, amounts, "");
    }

    /** burn particular amount of staked NFTs for given address and nft-id */
    function burn(address from, uint256 nftId, uint256 amount) public override onlyOwner {
        _pushBurn(from, nftId, amount);
        _burn(from, nftId, amount);
    }

    /** burn particular amounts of staked NFTs for given address and nft-ids */
    function burnBatch(address from, uint256[] memory nftIds, uint256[] memory amounts) public override onlyOwner {
        _pushBurnBatch(from, nftIds, amounts);
        _burnBatch(from, nftIds, amounts);
    }

    /** @return age seconds over all stakes for given address and nft-id */
    function ageOf(address account, uint256 nftId) public view returns (uint256) {
        uint256 mints = _mints[account][nftId];
        uint256 burns = _burns[account][nftId];
        if (mints > burns) {
            uint256 balance = balanceOf(account, nftId);
            uint256 difference = mints - burns;
            return balance * block.timestamp - difference;
        }
        return 0;
    }

    /** @return age seconds totalled over all stakes for given nft-id */
    function totalAgeOf(uint256 nftId) public view returns (uint256) {
        uint256 mintsTotal = _mintsTotal[nftId];
        uint256 burnsTotal = _burnsTotal[nftId];
        if (mintsTotal > burnsTotal) {
            uint256 supply = totalSupply(nftId);
            uint256 difference = mintsTotal - burnsTotal;
            return supply * block.timestamp - difference;
        }
        return 0;
    }

    /** remember mint action */
    function _pushMint(address account, uint256 nftId, uint256 amount) internal {
        require(amount > 0, "non-positive amount");
        _mints[account][nftId] += amount * block.timestamp;
        _mintsTotal[nftId] += amount * block.timestamp;
    }

    /** remember mint actions */
    function _pushMintBatch(address account, uint256[] memory nftIds, uint256[] memory amounts) internal {
        assert(nftIds.length == amounts.length);
        for (uint256 i = 0; i < nftIds.length; i++) {
            _pushMint(account, nftIds[i], amounts[i]);
        }
    }

    /** remember burn action */
    function _pushBurn(address account, uint256 nftId, uint256 amount) internal {
        require(amount > 0, "non-positive amount");
        _burns[account][nftId] += amount * block.timestamp;
        _burnsTotal[nftId] += amount * block.timestamp;
    }

    /** remember burn actions */
    function _pushBurnBatch(address account, uint256[] memory nftIds, uint256[] memory amounts) internal {
        assert(nftIds.length == amounts.length);
        for (uint256 i = 0; i < nftIds.length; i++) {
            _pushBurn(account, nftIds[i], amounts[i]);
        }
    }
}

/**
 * Staked NFT class for THOR tokens.
 */
contract XPowerThorNftStaked is XPowerNftStaked {
    constructor(
        string memory pptUri,
        address pptBase,
        uint256 deadlineIn
    ) XPowerNftStaked("XPower Thor", "THORPPT", pptUri, pptBase, deadlineIn) {}
}

/**
 * Staked NFT class for LOKI tokens.
 */
contract XPowerLokiNftStaked is XPowerNftStaked {
    constructor(
        string memory pptUri,
        address pptBase,
        uint256 deadlineIn
    ) XPowerNftStaked("XPower Loki", "LOKIPPT", pptUri, pptBase, deadlineIn) {}
}

/**
 * Staked NFT class for ODIN tokens.
 */
contract XPowerOdinNftStaked is XPowerNftStaked {
    constructor(
        string memory pptUri,
        address pptBase,
        uint256 deadlineIn
    ) XPowerNftStaked("XPower Odin", "ODINPPT", pptUri, pptBase, deadlineIn) {}
}
// File contracts/MoeTreasury.sol
// solhint-disable no-empty-blocks
pragma solidity ^0.8.0;


/**
 * Treasury to claim (MoE) tokens for staked XPowerNft(s).
 */
contract MoeTreasury is MoeTreasurySupervised {
    /** (burnable) *aged* XPower tokens */
    APower private _sov;
    /** (burnable) proof-of-work tokens */
    XPower private _moe;
    /** staked proof-of-work NFTs */
    XPowerNftStaked private _ppt;
    /** parametrization of APR: (nft.level+[5]-[4])*[3]/[2]+[1]-[0] */
    uint256[] private _apr = [0, 0, 3, 1000, 0, 0];
    /** parametrization of APR bonus: (age.year+[5]-[4])*[3]/[2]+[1]-[0] */
    uint256[] private _bonus = [0, 0, 1, 10, 0, 0];
    /** map of rewards claimed: account => nft-id => amount */
    mapping(address => mapping(uint256 => uint256)) private _claimed;
    /** map of rewards claimed total: nft-id => amount */
    mapping(uint256 => uint256) private _claimedTotal;

    /** @param sovLink address of contract for APower tokens */
    /** @param moeLink address of contract for XPower tokens */
    /** @param pptLink address of contract for staked NFTs */
    constructor(address sovLink, address moeLink, address pptLink) {
        _sov = APower(sovLink);
        _moe = XPower(moeLink);
        _ppt = XPowerNftStaked(pptLink);
    }

    /** @return balance of available tokens */
    function balance() public view returns (uint256) {
        address self = (address)(this);
        return _moe.balanceOf(self);
    }

    /** emitted on claiming NFT reward */
    event Claim(address account, uint256 nftId, uint256 amount);

    /** claim APower tokens for given account and nft-id */
    function claimFor(address account, uint256 nftId) public {
        uint256 amount = claimableFor(account, nftId);
        require(amount > 0, "nothing claimable");
        _claimed[account][nftId] += amount;
        _claimedTotal[nftId] += amount;
        _moe.increaseAllowance((address)(_sov), amount);
        _sov.mint(account, amount);
        emit Claim(account, nftId, amount);
    }

    /** emitted on claiming NFT rewards */
    event ClaimBatch(address account, uint256[] nftIds, uint256[] amounts);

    /** claim APower tokens for given account and nft-ids */
    function claimForBatch(address account, uint256[] memory nftIds) public {
        uint256[] memory amounts = claimableForBatch(account, nftIds);
        for (uint256 i = 0; i < nftIds.length; i++) {
            require(amounts[i] > 0, "nothing claimable");
            _claimed[account][nftIds[i]] += amounts[i];
            _claimedTotal[nftIds[i]] += amounts[i];
        }
        for (uint256 i = 0; i < nftIds.length; i++) {
            _moe.increaseAllowance((address)(_sov), amounts[i]);
            _sov.mint(account, amounts[i]);
        }
        emit ClaimBatch(account, nftIds, amounts);
    }

    /** @return claimed amount of tokens for given account and nft-id */
    function claimedFor(address account, uint256 nftId) public view returns (uint256) {
        return _claimed[account][nftId];
    }

    /** @return claimed total amount of tokens for nft-id */
    function totalClaimedFor(uint256 nftId) public view returns (uint256) {
        return _claimedTotal[nftId];
    }

    /** @return claimed amount of tokens for given account and nft-ids */
    function claimedForBatch(address account, uint256[] memory nftIds) public view returns (uint256[] memory) {
        uint256[] memory claimed = new uint256[](nftIds.length);
        for (uint256 i = 0; i < nftIds.length; i++) {
            claimed[i] = claimedFor(account, nftIds[i]);
        }
        return claimed;
    }

    /** @return claimed total amount of tokens for given nft-ids */
    function totalClaimedForBatch(uint256[] memory nftIds) public view returns (uint256[] memory) {
        uint256[] memory claimedTotal = new uint256[](nftIds.length);
        for (uint256 i = 0; i < nftIds.length; i++) {
            claimedTotal[i] = totalClaimedFor(nftIds[i]);
        }
        return claimedTotal;
    }

    /** @return claimable amount of tokens for given account and nft-id */
    function claimableFor(address account, uint256 nftId) public view returns (uint256) {
        uint256 claimed = claimedFor(account, nftId);
        uint256 reward = rewardOf(account, nftId);
        if (reward > claimed) {
            return reward - claimed;
        }
        return 0;
    }

    /** @return claimable total amount of tokens for given nft-id */
    function totalClaimableFor(uint256 nftId) public view returns (uint256) {
        uint256 claimedTotal = totalClaimedFor(nftId);
        uint256 rewardTotal = totalRewardOf(nftId);
        if (rewardTotal > claimedTotal) {
            return rewardTotal - claimedTotal;
        }
        return 0;
    }

    /** @return claimable amount of tokens for given account and nft-ids */
    function claimableForBatch(address account, uint256[] memory nftIds) public view returns (uint256[] memory) {
        uint256[] memory claimed = claimedForBatch(account, nftIds);
        uint256[] memory rewards = rewardOfBatch(account, nftIds);
        uint256[] memory pending = new uint256[](nftIds.length);
        for (uint256 i = 0; i < nftIds.length; i++) {
            if (rewards[i] > claimed[i]) {
                pending[i] = rewards[i] - claimed[i];
            } else {
                pending[i] = 0;
            }
        }
        return pending;
    }

    /** @return claimable total amount of tokens for given nft-ids */
    function totalClaimableForBatch(uint256[] memory nftIds) public view returns (uint256[] memory) {
        uint256[] memory claimedTotal = totalClaimedForBatch(nftIds);
        uint256[] memory rewardsTotal = totalRewardOfBatch(nftIds);
        uint256[] memory pendingTotal = new uint256[](nftIds.length);
        for (uint256 i = 0; i < nftIds.length; i++) {
            if (rewardsTotal[i] > claimedTotal[i]) {
                pendingTotal[i] = rewardsTotal[i] - claimedTotal[i];
            } else {
                pendingTotal[i] = 0;
            }
        }
        return pendingTotal;
    }

    /** @return reward of tokens for given account and nft-id */
    function rewardOf(address account, uint256 nftId) public view returns (uint256) {
        uint256 age = _ageOf(account, nftId);
        uint256 denomination = _denominationOf(_levelOf(nftId));
        uint256 apr = aprOf(nftId);
        uint256 aprBonus = aprBonusOf(nftId);
        uint256 reward = (apr * age * denomination) / (1_000 * 365_25 days);
        uint256 rewardBonus = (aprBonus * age * denomination) / (1_000 * 365_25 days);
        return (reward + rewardBonus) * 10 ** _moe.decimals();
    }

    /** @return reward total of tokens for given nft-id */
    function totalRewardOf(uint256 nftId) public view returns (uint256) {
        uint256 age = _totalAgeOf(nftId);
        uint256 denomination = _denominationOf(_levelOf(nftId));
        uint256 apr = aprOf(nftId);
        uint256 aprBonus = aprBonusOf(nftId);
        uint256 reward = (apr * age * denomination) / (1_000 * 365_25 days);
        uint256 rewardBonus = (aprBonus * age * denomination) / (1_000 * 365_25 days);
        return (reward + rewardBonus) * 10 ** _moe.decimals();
    }

    /** @return reward of tokens for given account and nft-ids */
    function rewardOfBatch(address account, uint256[] memory nftIds) public view returns (uint256[] memory) {
        uint256[] memory rewards = new uint256[](nftIds.length);
        for (uint256 i = 0; i < nftIds.length; i++) {
            rewards[i] = rewardOf(account, nftIds[i]);
        }
        return rewards;
    }

    /** @return reward total of tokens for given nft-ids */
    function totalRewardOfBatch(uint256[] memory nftIds) public view returns (uint256[] memory) {
        uint256[] memory rewardsTotal = new uint256[](nftIds.length);
        for (uint256 i = 0; i < nftIds.length; i++) {
            rewardsTotal[i] = totalRewardOf(nftIds[i]);
        }
        return rewardsTotal;
    }

    /** @return apr i.e. annual percentage rate (per nft.level) */
    function aprOf(uint256 nftId) public view returns (uint256) {
        uint256 level = _ppt.levelOf(nftId);
        return ((level + _apr[5] - _apr[4]) * _apr[3]) / _apr[2] + _apr[1] - _apr[0];
    }

    /** @return apr-parameters */
    function getAPR() public view returns (uint256[] memory) {
        return _apr;
    }

    /** set apr-parameters */
    function setAPR(uint256[] memory array) public onlyRole(APR_ROLE) {
        require(array.length == 6, "invalid array.length");
        _apr = array;
    }

    /** @return apr-bonus i.e. annual percentage rate (per nft.year) */
    function aprBonusOf(uint256 nftId) public view returns (uint256) {
        uint256 nowYear = _ppt.year();
        uint256 nftYear = _ppt.yearOf(nftId);
        uint256 ageYear = nowYear > nftYear ? nowYear - nftYear : 0;
        return ((ageYear + _bonus[5] - _bonus[4]) * _bonus[3]) / _bonus[2] + _bonus[1] - _bonus[0];
    }

    /** @return apr-bonus parameters */
    function getAPRBonus() public view returns (uint256[] memory) {
        return _bonus;
    }

    /** set apr-bonus parameters */
    function setAPRBonus(uint256[] memory array) public onlyRole(APR_BONUS_ROLE) {
        require(array.length == 6, "invalid array.length");
        _bonus = array;
    }

    /** @return age seconds for given account and nft-id */
    function _ageOf(address account, uint256 nftId) internal view returns (uint256) {
        return _ppt.ageOf(account, nftId); // nft.balance * nft.average-age
    }

    /** @return age total seconds for given nft-id */
    function _totalAgeOf(uint256 nftId) internal view returns (uint256) {
        return _ppt.totalAgeOf(nftId); // nft.supply * nft.average-age
    }

    /** @return denomination value for given nft-level */
    function _denominationOf(uint256 nftLevel) internal view returns (uint256) {
        return _ppt.denominationOf(nftLevel); // 1, 1K, 1M, 1G, ...
    }

    /** @return level for given nft-id */
    function _levelOf(uint256 nftId) internal view returns (uint256) {
        return _ppt.levelOf(nftId); // 0, 3, 6, 9, ...
    }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"sovLink","type":"address"},{"internalType":"address","name":"moeLink","type":"address"},{"internalType":"address","name":"pptLink","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"nftIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"ClaimBatch","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"},{"inputs":[],"name":"APR_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"APR_BONUS_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"APR_BONUS_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"APR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"aprBonusOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"aprOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"claimFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"nftIds","type":"uint256[]"}],"name":"claimForBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"claimableFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"nftIds","type":"uint256[]"}],"name":"claimableForBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"claimedFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"nftIds","type":"uint256[]"}],"name":"claimedForBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAPR","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAPRBonus","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":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"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":"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":"account","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"rewardOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"nftIds","type":"uint256[]"}],"name":"rewardOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"array","type":"uint256[]"}],"name":"setAPR","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"array","type":"uint256[]"}],"name":"setAPRBonus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"totalClaimableFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"nftIds","type":"uint256[]"}],"name":"totalClaimableForBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"totalClaimedFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"nftIds","type":"uint256[]"}],"name":"totalClaimedForBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"totalRewardOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"nftIds","type":"uint256[]"}],"name":"totalRewardOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102065760003560e01c80636cf822061161011a578063a6628d59116100ad578063ca15c8731161007c578063ca15c873146104a9578063cc1bf6cc146104bc578063d542ea06146104cf578063d547741f146104e2578063d8850eb9146104f557600080fd5b8063a6628d5914610466578063b086708814610486578063b69ef8a814610499578063c89d5b8b146104a157600080fd5b806378029031116100e957806378029031146103f95780639010d07c1461042057806391d148541461044b578063a217fddf1461045e57600080fd5b80636cf82206146103ad5780636f98045c146103c05780637368df02146103d3578063750e2d9d146103e657600080fd5b80633111e8ca1161019d5780635bc52c281161016c5780635bc52c28146103455780636301e4cb1461035857806364f0383c1461036b57806365c54f0f1461037e5780636b2c3bc8146103a557600080fd5b80633111e8ca146102f9578063342852e41461030c57806336568abe1461031f5780634a022eea1461033257600080fd5b806313dcff0d116101d957806313dcff0d14610289578063248a9ca3146102b05780632f2ff15d146102d35780632fb5ae7c146102e657600080fd5b806301ffc9a71461020b578063069fe57d146102335780630de056591461025457806310237a4714610269575b600080fd5b61021e610219366004612016565b61051c565b60405190151581526020015b60405180910390f35b61024661024136600461205c565b61052d565b60405190815260200161022a565b61026761026236600461205c565b610555565b005b61027c610277366004612137565b610738565b60405161022a91906121c0565b6102467f38a1e363a5fc827cc1f19eefcb90a6754e498f53da57f75398e199d1045ef06c81565b6102466102be3660046121d3565b60009081526020819052604090206001015490565b6102676102e13660046121ec565b6107e8565b6102676102f4366004612218565b610812565b610267610307366004612218565b610897565b61026761031a366004612137565b61091c565b61026761032d3660046121ec565b610c14565b6102466103403660046121d3565b610c92565b61024661035336600461205c565b610e01565b61027c610366366004612218565b610e44565b6102466103793660046121d3565b610ef2565b6102467f50b36571f3d13a5d9b68f1821be5b7ebf7ed496f52cbd5580a50a4268d9de83481565b61027c611025565b61027c6103bb366004612137565b61107d565b61027c6103ce366004612218565b611125565b61027c6103e1366004612218565b6111d9565b61027c6103f4366004612137565b611320565b6102467fdaabf8964b9830a81b0736b3375be617d37f38486a126e0d01431ba9e3a8ac0381565b61043361042e36600461224d565b61146a565b6040516001600160a01b03909116815260200161022a565b61021e6104593660046121ec565b611482565b610246600081565b6102466104743660046121d3565b60009081526008602052604090205490565b6102466104943660046121d3565b6114ab565b6102466116a7565b61027c611720565b6102466104b73660046121d3565b611776565b6102466104ca36600461205c565b61178d565b6102466104dd3660046121d3565b6118bd565b6102676104f03660046121ec565b6118fd565b6102467fa15c42ede2a8d74ea78c0d1ab0919be187f5aa2661d0e5a43e8154cfda67a0a681565b6000610527826119bb565b92915050565b6001600160a01b03919091166000908152600760209081526040808320938352929052205490565b60006105618383610e01565b9050600081116105ac5760405162461bcd60e51b81526020600482015260116024820152706e6f7468696e6720636c61696d61626c6560781b60448201526064015b60405180910390fd5b6001600160a01b0383166000908152600760209081526040808320858452909152812080548392906105df908490612285565b909155505060008281526008602052604081208054839290610602908490612285565b9091555050600354600254604051633950935160e01b81526001600160a01b039182166004820152602481018490529116906339509351906044016020604051808303816000875af115801561065c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106809190612298565b506002546040516340c10f1960e01b81526001600160a01b03858116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b1580156106cf57600080fd5b505af11580156106e3573d6000803e3d6000fd5b5050604080516001600160a01b0387168152602081018690529081018490527f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf7925060600190505b60405180910390a1505050565b60606000825167ffffffffffffffff81111561075657610756612086565b60405190808252806020026020018201604052801561077f578160200160208202803683370190505b50905060005b83518110156107e0576107b1858583815181106107a4576107a46122ba565b602002602001015161052d565b8282815181106107c3576107c36122ba565b6020908102919091010152806107d8816122d0565b915050610785565b509392505050565b600082815260208190526040902060010154610803816119e0565b61080d83836119ed565b505050565b7fa15c42ede2a8d74ea78c0d1ab0919be187f5aa2661d0e5a43e8154cfda67a0a661083c816119e0565b81516006146108845760405162461bcd60e51b81526020600482015260146024820152730d2dcecc2d8d2c840c2e4e4c2f25cd8cadccee8d60631b60448201526064016105a3565b815161080d906006906020850190611fb6565b7f38a1e363a5fc827cc1f19eefcb90a6754e498f53da57f75398e199d1045ef06c6108c1816119e0565b81516006146109095760405162461bcd60e51b81526020600482015260146024820152730d2dcecc2d8d2c840c2e4e4c2f25cd8cadccee8d60631b60448201526064016105a3565b815161080d906005906020850190611fb6565b60006109288383611320565b905060005b8251811015610a7f57600082828151811061094a5761094a6122ba565b6020026020010151116109935760405162461bcd60e51b81526020600482015260116024820152706e6f7468696e6720636c61696d61626c6560781b60448201526064016105a3565b8181815181106109a5576109a56122ba565b602002602001015160076000866001600160a01b03166001600160a01b0316815260200190815260200160002060008584815181106109e6576109e66122ba565b602002602001015181526020019081526020016000206000828254610a0b9190612285565b92505081905550818181518110610a2457610a246122ba565b602002602001015160086000858481518110610a4257610a426122ba565b602002602001015181526020019081526020016000206000828254610a679190612285565b90915550819050610a77816122d0565b91505061092d565b5060005b8251811015610be05760035460025483516001600160a01b03928316926339509351921690859085908110610aba57610aba6122ba565b60200260200101516040518363ffffffff1660e01b8152600401610af39291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af1158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b369190612298565b5060025482516001600160a01b03909116906340c10f19908690859085908110610b6257610b626122ba565b60200260200101516040518363ffffffff1660e01b8152600401610b9b9291906001600160a01b03929092168252602082015260400190565b600060405180830381600087803b158015610bb557600080fd5b505af1158015610bc9573d6000803e3d6000fd5b505050508080610bd8906122d0565b915050610a83565b507fcd6b542d20d27ca1f4e7d7a0ee6e7c8719b0f413323169dca8cfe49df665f58a83838360405161072b939291906122e9565b6001600160a01b0381163314610c845760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016105a3565b610c8e8282611a0f565b5050565b600480546040516336af181960e11b815291820183905260009182916001600160a01b031690636d5e303290602401602060405180830381865afa158015610cde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d029190612329565b90506005600081548110610d1857610d186122ba565b90600052602060002001546005600181548110610d3757610d376122ba565b90600052602060002001546005600281548110610d5657610d566122ba565b90600052602060002001546005600381548110610d7557610d756122ba565b90600052602060002001546005600481548110610d9457610d946122ba565b906000526020600020015460058081548110610db257610db26122ba565b906000526020600020015486610dc89190612285565b610dd29190612342565b610ddc9190612355565b610de6919061236c565b610df09190612285565b610dfa9190612342565b9392505050565b600080610e0e848461052d565b90506000610e1c858561178d565b905081811115610e3957610e308282612342565b92505050610527565b506000949350505050565b60606000825167ffffffffffffffff811115610e6257610e62612086565b604051908082528060200260200182016040528015610e8b578160200160208202803683370190505b50905060005b8351811015610eeb57610ebc848281518110610eaf57610eaf6122ba565b6020026020010151610ef2565b828281518110610ece57610ece6122ba565b602090810291909101015280610ee3816122d0565b915050610e91565b5092915050565b600080610efe83611a31565b90506000610f13610f0e85611aa2565b611ad6565b90506000610f2085610c92565b90506000610f2d866114ab565b905060006502dec1f42c0084610f438786612355565b610f4d9190612355565b610f57919061236c565b905060006502dec1f42c0085610f6d8886612355565b610f779190612355565b610f81919061236c565b9050600360009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffa919061238e565b61100590600a612495565b61100f8284612285565b6110199190612355565b98975050505050505050565b6060600680548060200260200160405190810160405280929190818152602001828054801561107357602002820191906000526020600020905b81548152602001906001019080831161105f575b5050505050905090565b60606000825167ffffffffffffffff81111561109b5761109b612086565b6040519080825280602002602001820160405280156110c4578160200160208202803683370190505b50905060005b83518110156107e0576110f6858583815181106110e9576110e96122ba565b602002602001015161178d565b828281518110611108576111086122ba565b60209081029190910101528061111d816122d0565b9150506110ca565b60606000825167ffffffffffffffff81111561114357611143612086565b60405190808252806020026020018201604052801561116c578160200160208202803683370190505b50905060005b8351811015610eeb576111aa848281518110611190576111906122ba565b602002602001015160009081526008602052604090205490565b8282815181106111bc576111bc6122ba565b6020908102919091010152806111d1816122d0565b915050611172565b606060006111e683611125565b905060006111f384610e44565b90506000845167ffffffffffffffff81111561121157611211612086565b60405190808252806020026020018201604052801561123a578160200160208202803683370190505b50905060005b85518110156113175783818151811061125b5761125b6122ba565b6020026020010151838281518110611275576112756122ba565b602002602001015111156112e457838181518110611295576112956122ba565b60200260200101518382815181106112af576112af6122ba565b60200260200101516112c19190612342565b8282815181106112d3576112d36122ba565b602002602001018181525050611305565b60008282815181106112f8576112f86122ba565b6020026020010181815250505b8061130f816122d0565b915050611240565b50949350505050565b6060600061132e8484610738565b9050600061133c858561107d565b90506000845167ffffffffffffffff81111561135a5761135a612086565b604051908082528060200260200182016040528015611383578160200160208202803683370190505b50905060005b8551811015611460578381815181106113a4576113a46122ba565b60200260200101518382815181106113be576113be6122ba565b6020026020010151111561142d578381815181106113de576113de6122ba565b60200260200101518382815181106113f8576113f86122ba565b602002602001015161140a9190612342565b82828151811061141c5761141c6122ba565b60200260200101818152505061144e565b6000828281518110611441576114416122ba565b6020026020010181815250505b80611458816122d0565b915050611389565b5095945050505050565b6000828152600160205260408120610dfa9083611b0a565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60048054604080516379934b8b60e11b8152905160009384936001600160a01b03169263f326971692818301926020928290030181865afa1580156114f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115189190612329565b60048054604051632a84ade960e11b81529182018690529192506000916001600160a01b0316906355095bd290602401602060405180830381865afa158015611565573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115899190612329565b9050600081831161159b5760006115a5565b6115a58284612342565b905060066000815481106115bb576115bb6122ba565b906000526020600020015460066001815481106115da576115da6122ba565b906000526020600020015460066002815481106115f9576115f96122ba565b90600052602060002001546006600381548110611618576116186122ba565b90600052602060002001546006600481548110611637576116376122ba565b90600052602060002001546006600581548110611656576116566122ba565b90600052602060002001548661166c9190612285565b6116769190612342565b6116809190612355565b61168a919061236c565b6116949190612285565b61169e9190612342565b95945050505050565b6003546040516370a0823160e01b8152306004820181905260009290916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156116f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171a9190612329565b91505090565b60606005805480602002602001604051908101604052809291908181526020018280548015611073576020028201919060005260206000209081548152602001906001019080831161105f575050505050905090565b600081815260016020526040812061052790611b16565b60008061179a8484611b20565b905060006117aa610f0e85611aa2565b905060006117b785610c92565b905060006117c4866114ab565b905060006502dec1f42c00846117da8786612355565b6117e49190612355565b6117ee919061236c565b905060006502dec1f42c00856118048886612355565b61180e9190612355565b611818919061236c565b9050600360009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561186d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611891919061238e565b61189c90600a612495565b6118a68284612285565b6118b09190612355565b9998505050505050505050565b60008181526008602052604081205460006118d784610ef2565b9050818111156118f3576118eb8282612342565b949350505050565b5060009392505050565b600082815260208190526040902060010154611918816119e0565b61080d8383611a0f565b61192c8282611482565b610c8e576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556119623390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610dfa836001600160a01b038416611b9b565b60006001600160e01b03198216635a05180f60e01b1480610527575061052782611bea565b6119ea8133611c1f565b50565b6119f78282611922565b600082815260016020526040902061080d90826119a6565b611a198282611c83565b600082815260016020526040902061080d9082611ce8565b600480546040516301c6172360e41b81529182018390526000916001600160a01b0390911690631c617230906024015b602060405180830381865afa158015611a7e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105279190612329565b600480546040516336af181960e11b81529182018390526000916001600160a01b0390911690636d5e303290602401611a61565b600480546040516329cd827d60e01b81529182018390526000916001600160a01b03909116906329cd827d90602401611a61565b6000610dfa8383611cfd565b6000610527825490565b6004805460405163a62c779960e01b81526001600160a01b0385811693820193909352602481018490526000929091169063a62c779990604401602060405180830381865afa158015611b77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dfa9190612329565b6000818152600183016020526040812054611be257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610527565b506000610527565b60006001600160e01b03198216637965db0b60e01b148061052757506301ffc9a760e01b6001600160e01b0319831614610527565b611c298282611482565b610c8e57611c41816001600160a01b03166014611d27565b611c4c836020611d27565b604051602001611c5d9291906124c8565b60408051601f198184030181529082905262461bcd60e51b82526105a39160040161253d565b611c8d8282611482565b15610c8e576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610dfa836001600160a01b038416611ec3565b6000826000018281548110611d1457611d146122ba565b9060005260206000200154905092915050565b60606000611d36836002612355565b611d41906002612285565b67ffffffffffffffff811115611d5957611d59612086565b6040519080825280601f01601f191660200182016040528015611d83576020820181803683370190505b509050600360fc1b81600081518110611d9e57611d9e6122ba565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611dcd57611dcd6122ba565b60200101906001600160f81b031916908160001a9053506000611df1846002612355565b611dfc906001612285565b90505b6001811115611e74576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611e3057611e306122ba565b1a60f81b828281518110611e4657611e466122ba565b60200101906001600160f81b031916908160001a90535060049490941c93611e6d81612570565b9050611dff565b508315610dfa5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105a3565b60008181526001830160205260408120548015611fac576000611ee7600183612342565b8554909150600090611efb90600190612342565b9050818114611f60576000866000018281548110611f1b57611f1b6122ba565b9060005260206000200154905080876000018481548110611f3e57611f3e6122ba565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611f7157611f71612587565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610527565b6000915050610527565b828054828255906000526020600020908101928215611ff1579160200282015b82811115611ff1578251825591602001919060010190611fd6565b50611ffd929150612001565b5090565b5b80821115611ffd5760008155600101612002565b60006020828403121561202857600080fd5b81356001600160e01b031981168114610dfa57600080fd5b80356001600160a01b038116811461205757600080fd5b919050565b6000806040838503121561206f57600080fd5b61207883612040565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126120ad57600080fd5b8135602067ffffffffffffffff808311156120ca576120ca612086565b8260051b604051601f19603f830116810181811084821117156120ef576120ef612086565b60405293845285810183019383810192508785111561210d57600080fd5b83870191505b8482101561212c57813583529183019190830190612113565b979650505050505050565b6000806040838503121561214a57600080fd5b61215383612040565b9150602083013567ffffffffffffffff81111561216f57600080fd5b61217b8582860161209c565b9150509250929050565b600081518084526020808501945080840160005b838110156121b557815187529582019590820190600101612199565b509495945050505050565b602081526000610dfa6020830184612185565b6000602082840312156121e557600080fd5b5035919050565b600080604083850312156121ff57600080fd5b8235915061220f60208401612040565b90509250929050565b60006020828403121561222a57600080fd5b813567ffffffffffffffff81111561224157600080fd5b6118eb8482850161209c565b6000806040838503121561226057600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b808201808211156105275761052761226f565b6000602082840312156122aa57600080fd5b81518015158114610dfa57600080fd5b634e487b7160e01b600052603260045260246000fd5b6000600182016122e2576122e261226f565b5060010190565b6001600160a01b038416815260606020820181905260009061230d90830185612185565b828103604084015261231f8185612185565b9695505050505050565b60006020828403121561233b57600080fd5b5051919050565b818103818111156105275761052761226f565b80820281158282048414176105275761052761226f565b60008261238957634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156123a057600080fd5b815160ff81168114610dfa57600080fd5b600181815b808511156123ec5781600019048211156123d2576123d261226f565b808516156123df57918102915b93841c93908002906123b6565b509250929050565b60008261240357506001610527565b8161241057506000610527565b816001811461242657600281146124305761244c565b6001915050610527565b60ff8411156124415761244161226f565b50506001821b610527565b5060208310610133831016604e8410600b841016171561246f575081810a610527565b61247983836123b1565b806000190482111561248d5761248d61226f565b029392505050565b6000610dfa60ff8416836123f4565b60005b838110156124bf5781810151838201526020016124a7565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516125008160178501602088016124a4565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516125318160288401602088016124a4565b01602801949350505050565b602081526000825180602084015261255c8160408501602087016124a4565b601f01601f19169190910160400192915050565b60008161257f5761257f61226f565b506000190190565b634e487b7160e01b600052603160045260246000fdfea264697066735822122043665fae2a12a5643c30e341ec8c420ad415a98aea19f3ac2a165c0b5c5ea2f064736f6c63430008110033

Deployed Bytecode Sourcemap

124658:10238:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;33774:153;;;;;;:::i;:::-;;:::i;:::-;;;470:14:1;;463:22;445:41;;433:2;418:18;33774:153:0;;;;;;;;127464:132;;;;;;:::i;:::-;;:::i;:::-;;;1080:25:1;;;1068:2;1053:18;127464:132:0;934:177:1;126175:398:0;;;;;;:::i;:::-;;:::i;:::-;;127865:329;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;34931:56::-;;34966:21;34931:56;;14152:131;;;;;;:::i;:::-;14226:7;14253:12;;;;;;;;;;:22;;;;14152:131;14593:147;;;;;;:::i;:::-;;:::i;133878:171::-;;;;;;:::i;:::-;;:::i;133120:158::-;;;;;;:::i;:::-;;:::i;126766:616::-;;;;;;:::i;:::-;;:::i;15737:218::-;;;;;;:::i;:::-;;:::i;132750:201::-;;;;;;:::i;:::-;;:::i;128683:300::-;;;;;;:::i;:::-;;:::i;132350:324::-;;;;;;:::i;:::-;;:::i;131382:499::-;;;;;;:::i;:::-;;:::i;34994:68::-;;35035:27;34994:68;;133739:94;;;:::i;131956:325::-;;;;;;:::i;:::-;;:::i;128271:328::-;;;;;;:::i;:::-;;:::i;130115:610::-;;;;;;:::i;:::-;;:::i;129456:580::-;;;;;;:::i;:::-;;:::i;35210:80::-;;35257:33;35210:80;;32473:153;;;;;;:::i;:::-;;:::i;:::-;;;-1:-1:-1;;;;;4869:32:1;;;4851:51;;4839:2;4824:18;32473:153:0;4705:203:1;12612:147:0;;;;;;:::i;:::-;;:::i;11717:49::-;;11762:4;11717:49;;127666:116;;;;;;:::i;:::-;127727:7;127754:20;;;:13;:20;;;;;;;127666:116;133359:331;;;;;;:::i;:::-;;:::i;125859:136::-;;;:::i;132994:87::-;;;:::i;32800:142::-;;;;;;:::i;:::-;;:::i;130799:515::-;;;;;;:::i;:::-;;:::i;129061:310::-;;;;;;:::i;:::-;;:::i;15033:149::-;;;;;;:::i;:::-;;:::i;35135:68::-;;35176:27;35135:68;;33774:153;33859:4;33883:36;33907:11;33883:23;:36::i;:::-;33876:43;33774:153;-1:-1:-1;;33774:153:0:o;127464:132::-;-1:-1:-1;;;;;127564:17:0;;;;127537:7;127564:17;;;:8;:17;;;;;;;;:24;;;;;;;;;127464:132::o;126175:398::-;126243:14;126260:28;126273:7;126282:5;126260:12;:28::i;:::-;126243:45;;126316:1;126307:6;:10;126299:40;;;;-1:-1:-1;;;126299:40:0;;5115:2:1;126299:40:0;;;5097:21:1;5154:2;5134:18;;;5127:30;-1:-1:-1;;;5173:18:1;;;5166:47;5230:18;;126299:40:0;;;;;;;;;-1:-1:-1;;;;;126350:17:0;;;;;;:8;:17;;;;;;;;:24;;;;;;;;:34;;126378:6;;126350:17;:34;;126378:6;;126350:34;:::i;:::-;;;;-1:-1:-1;;126395:20:0;;;;:13;:20;;;;;:30;;126419:6;;126395:20;:30;;126419:6;;126395:30;:::i;:::-;;;;-1:-1:-1;;126436:4:0;;126469;;126436:47;;-1:-1:-1;;;126436:47:0;;-1:-1:-1;;;;;126469:4:0;;;126436:47;;;5695:51:1;5762:18;;;5755:34;;;126436:4:0;;;:22;;5668:18:1;;126436:47:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;126494:4:0;;:26;;-1:-1:-1;;;126494:26:0;;-1:-1:-1;;;;;5713:32:1;;;126494:26:0;;;5695:51:1;5762:18;;;5755:34;;;126494:4:0;;;;:9;;5668:18:1;;126494:26:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;126536:29:0;;;-1:-1:-1;;;;;6302:32:1;;6284:51;;6366:2;6351:18;;6344:34;;;6394:18;;;6387:34;;;126536:29:0;;-1:-1:-1;6272:2:1;6257:18;;-1:-1:-1;126536:29:0;;;;;;;;126232:341;126175:398;;:::o;127865:329::-;127953:16;127982:24;128023:6;:13;128009:28;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;128009:28:0;;127982:55;;128053:9;128048:114;128072:6;:13;128068:1;:17;128048:114;;;128120:30;128131:7;128140:6;128147:1;128140:9;;;;;;;;:::i;:::-;;;;;;;128120:10;:30::i;:::-;128107:7;128115:1;128107:10;;;;;;;;:::i;:::-;;;;;;;;;;:43;128087:3;;;;:::i;:::-;;;;128048:114;;;-1:-1:-1;128179:7:0;127865:329;-1:-1:-1;;;127865:329:0:o;14593:147::-;14226:7;14253:12;;;;;;;;;;:22;;;12208:16;12219:4;12208:10;:16::i;:::-;14707:25:::1;14718:4;14724:7;14707:10;:25::i;:::-;14593:147:::0;;;:::o;133878:171::-;35176:27;12208:16;12219:4;12208:10;:16::i;:::-;133974:5:::1;:12;133990:1;133974:17;133966:50;;;::::0;-1:-1:-1;;;133966:50:0;;6906:2:1;133966:50:0::1;::::0;::::1;6888:21:1::0;6945:2;6925:18;;;6918:30;-1:-1:-1;;;6964:18:1;;;6957:50;7024:18;;133966:50:0::1;6704:344:1::0;133966:50:0::1;134027:14:::0;;::::1;::::0;:6:::1;::::0;:14:::1;::::0;::::1;::::0;::::1;:::i;133120:158::-:0;34966:21;12208:16;12219:4;12208:10;:16::i;:::-;133205:5:::1;:12;133221:1;133205:17;133197:50;;;::::0;-1:-1:-1;;;133197:50:0;;6906:2:1;133197:50:0::1;::::0;::::1;6888:21:1::0;6945:2;6925:18;;;6918:30;-1:-1:-1;;;6964:18:1;;;6957:50;7024:18;;133197:50:0::1;6704:344:1::0;133197:50:0::1;133258:12:::0;;::::1;::::0;:4:::1;::::0;:12:::1;::::0;::::1;::::0;::::1;:::i;126766:616::-:0;126849:24;126876:34;126894:7;126903:6;126876:17;:34::i;:::-;126849:61;;126926:9;126921:225;126945:6;:13;126941:1;:17;126921:225;;;127001:1;126988:7;126996:1;126988:10;;;;;;;;:::i;:::-;;;;;;;:14;126980:44;;;;-1:-1:-1;;;126980:44:0;;5115:2:1;126980:44:0;;;5097:21:1;5154:2;5134:18;;;5127:30;-1:-1:-1;;;5173:18:1;;;5166:47;5230:18;;126980:44:0;4913:341:1;126980:44:0;127071:7;127079:1;127071:10;;;;;;;;:::i;:::-;;;;;;;127039:8;:17;127048:7;-1:-1:-1;;;;;127039:17:0;-1:-1:-1;;;;;127039:17:0;;;;;;;;;;;;:28;127057:6;127064:1;127057:9;;;;;;;;:::i;:::-;;;;;;;127039:28;;;;;;;;;;;;:42;;;;;;;:::i;:::-;;;;;;;;127124:7;127132:1;127124:10;;;;;;;;:::i;:::-;;;;;;;127096:13;:24;127110:6;127117:1;127110:9;;;;;;;;:::i;:::-;;;;;;;127096:24;;;;;;;;;;;;:38;;;;;;;:::i;:::-;;;;-1:-1:-1;126960:3:0;;-1:-1:-1;126960:3:0;;;:::i;:::-;;;;126921:225;;;;127161:9;127156:167;127180:6;:13;127176:1;:17;127156:167;;;127215:4;;127248;;127255:10;;-1:-1:-1;;;;;127215:4:0;;;;:22;;127248:4;;127255:7;;127263:1;;127255:10;;;;;;:::i;:::-;;;;;;;127215:51;;;;;;;;;;;;;;;-1:-1:-1;;;;;5713:32:1;;;;5695:51;;5777:2;5762:18;;5755:34;5683:2;5668:18;;5521:274;127215:51:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;127281:4:0;;127300:10;;-1:-1:-1;;;;;127281:4:0;;;;:9;;127291:7;;127300;;127308:1;;127300:10;;;;;;:::i;:::-;;;;;;;127281:30;;;;;;;;;;;;;;;-1:-1:-1;;;;;5713:32:1;;;;5695:51;;5777:2;5762:18;;5755:34;5683:2;5668:18;;5521:274;127281:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;127195:3;;;;;:::i;:::-;;;;127156:167;;;;127338:36;127349:7;127358:6;127366:7;127338:36;;;;;;;;:::i;15737:218::-;-1:-1:-1;;;;;15833:23:0;;5170:10;15833:23;15825:83;;;;-1:-1:-1;;;15825:83:0;;7822:2:1;15825:83:0;;;7804:21:1;7861:2;7841:18;;;7834:30;7900:34;7880:18;;;7873:62;-1:-1:-1;;;7951:18:1;;;7944:45;8006:19;;15825:83:0;7620:411:1;15825:83:0;15921:26;15933:4;15939:7;15921:11;:26::i;:::-;15737:218;;:::o;132750:201::-;132837:4;;;:19;;-1:-1:-1;;;132837:19:0;;;;;1080:25:1;;;132801:7:0;;;;-1:-1:-1;;;;;132837:4:0;;:12;;1053:18:1;;132837:19:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;132821:35;;132936:4;132941:1;132936:7;;;;;;;;:::i;:::-;;;;;;;;;132926:4;132931:1;132926:7;;;;;;;;:::i;:::-;;;;;;;;;132916:4;132921:1;132916:7;;;;;;;;:::i;:::-;;;;;;;;;132905:4;132910:1;132905:7;;;;;;;;:::i;:::-;;;;;;;;;132894:4;132899:1;132894:7;;;;;;;;:::i;:::-;;;;;;;;;132884:4;132889:1;132884:7;;;;;;;;:::i;:::-;;;;;;;;;132876:5;:15;;;;:::i;:::-;:25;;;;:::i;:::-;132875:37;;;;:::i;:::-;132874:49;;;;:::i;:::-;:59;;;;:::i;:::-;:69;;;;:::i;:::-;132867:76;132750:201;-1:-1:-1;;;132750:201:0:o;128683:300::-;128758:7;128778:15;128796:26;128807:7;128816:5;128796:10;:26::i;:::-;128778:44;;128833:14;128850:24;128859:7;128868:5;128850:8;:24::i;:::-;128833:41;;128898:7;128889:6;:16;128885:72;;;128929:16;128938:7;128929:6;:16;:::i;:::-;128922:23;;;;;;128885:72;-1:-1:-1;128974:1:0;;128683:300;-1:-1:-1;;;;128683:300:0:o;132350:324::-;132424:16;132453:29;132499:6;:13;132485:28;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;132485:28:0;;132453:60;;132529:9;132524:113;132548:6;:13;132544:1;:17;132524:113;;;132601:24;132615:6;132622:1;132615:9;;;;;;;;:::i;:::-;;;;;;;132601:13;:24::i;:::-;132583:12;132596:1;132583:15;;;;;;;;:::i;:::-;;;;;;;;;;:42;132563:3;;;;:::i;:::-;;;;132524:113;;;-1:-1:-1;132654:12:0;132350:324;-1:-1:-1;;132350:324:0:o;131382:499::-;131441:7;131461:11;131475:18;131487:5;131475:11;:18::i;:::-;131461:32;;131504:20;131527:32;131543:15;131552:5;131543:8;:15::i;:::-;131527;:32::i;:::-;131504:55;;131570:11;131584:12;131590:5;131584;:12::i;:::-;131570:26;;131607:16;131626:17;131637:5;131626:10;:17::i;:::-;131607:36;-1:-1:-1;131654:14:0;131701:19;131684:12;131672:9;131678:3;131672;:9;:::i;:::-;:24;;;;:::i;:::-;131671:50;;;;:::i;:::-;131654:67;-1:-1:-1;131732:19:0;131789;131772:12;131755:14;131766:3;131755:8;:14;:::i;:::-;:29;;;;:::i;:::-;131754:55;;;;:::i;:::-;131732:77;;131858:4;;;;;;;;;-1:-1:-1;;;;;131858:4:0;-1:-1:-1;;;;;131858:13:0;;:15;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;131852:21;;:2;:21;:::i;:::-;131828:20;131837:11;131828:6;:20;:::i;:::-;131827:46;;;;:::i;:::-;131820:53;131382:499;-1:-1:-1;;;;;;;;131382:499:0:o;133739:94::-;133783:16;133819:6;133812:13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;133739:94;:::o;131956:325::-;132042:16;132071:24;132112:6;:13;132098:28;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;132098:28:0;;132071:55;;132142:9;132137:112;132161:6;:13;132157:1;:17;132137:112;;;132209:28;132218:7;132227:6;132234:1;132227:9;;;;;;;;:::i;:::-;;;;;;;132209:8;:28::i;:::-;132196:7;132204:1;132196:10;;;;;;;;:::i;:::-;;;;;;;;;;:41;132176:3;;;;:::i;:::-;;;;132137:112;;128271:328;128347:16;128376:29;128422:6;:13;128408:28;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;128408:28:0;;128376:60;;128452:9;128447:115;128471:6;:13;128467:1;:17;128447:115;;;128524:26;128540:6;128547:1;128540:9;;;;;;;;:::i;:::-;;;;;;;127727:7;127754:20;;;:13;:20;;;;;;;127666:116;128524:26;128506:12;128519:1;128506:15;;;;;;;;:::i;:::-;;;;;;;;;;:44;128486:3;;;;:::i;:::-;;;;128447:115;;130115:610;130193:16;130222:29;130254:28;130275:6;130254:20;:28::i;:::-;130222:60;;130293:29;130325:26;130344:6;130325:18;:26::i;:::-;130293:58;;130362:29;130408:6;:13;130394:28;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;130394:28:0;;130362:60;;130438:9;130433:255;130457:6;:13;130453:1;:17;130433:255;;;130514:12;130527:1;130514:15;;;;;;;;:::i;:::-;;;;;;;130496:12;130509:1;130496:15;;;;;;;;:::i;:::-;;;;;;;:33;130492:185;;;130586:12;130599:1;130586:15;;;;;;;;:::i;:::-;;;;;;;130568:12;130581:1;130568:15;;;;;;;;:::i;:::-;;;;;;;:33;;;;:::i;:::-;130550:12;130563:1;130550:15;;;;;;;;:::i;:::-;;;;;;:51;;;;;130492:185;;;130660:1;130642:12;130655:1;130642:15;;;;;;;;:::i;:::-;;;;;;:19;;;;;130492:185;130472:3;;;;:::i;:::-;;;;130433:255;;;-1:-1:-1;130705:12:0;130115:610;-1:-1:-1;;;;130115:610:0:o;129456:580::-;129546:16;129575:24;129602:32;129618:7;129627:6;129602:15;:32::i;:::-;129575:59;;129645:24;129672:30;129686:7;129695:6;129672:13;:30::i;:::-;129645:57;;129713:24;129754:6;:13;129740:28;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;129740:28:0;;129713:55;;129784:9;129779:225;129803:6;:13;129799:1;:17;129779:225;;;129855:7;129863:1;129855:10;;;;;;;;:::i;:::-;;;;;;;129842:7;129850:1;129842:10;;;;;;;;:::i;:::-;;;;;;;:23;129838:155;;;129912:7;129920:1;129912:10;;;;;;;;:::i;:::-;;;;;;;129899:7;129907:1;129899:10;;;;;;;;:::i;:::-;;;;;;;:23;;;;:::i;:::-;129886:7;129894:1;129886:10;;;;;;;;:::i;:::-;;;;;;:36;;;;;129838:155;;;129976:1;129963:7;129971:1;129963:10;;;;;;;;:::i;:::-;;;;;;:14;;;;;129838:155;129818:3;;;;:::i;:::-;;;;129779:225;;;-1:-1:-1;130021:7:0;129456:580;-1:-1:-1;;;;;129456:580:0:o;32473:153::-;32563:7;32590:18;;;:12;:18;;;;;:28;;32612:5;32590:21;:28::i;12612:147::-;12698:4;12722:12;;;;;;;;;;;-1:-1:-1;;;;;12722:29:0;;;;;;;;;;;;;;;12612:147::o;133359:331::-;133453:4;;;:11;;;-1:-1:-1;;;133453:11:0;;;;133415:7;;;;-1:-1:-1;;;;;133453:4:0;;:9;;:11;;;;;;;;;;;:4;:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;133493:4;;;:18;;-1:-1:-1;;;133493:18:0;;;;;1080:25:1;;;133435:29:0;;-1:-1:-1;133475:15:0;;-1:-1:-1;;;;;133493:4:0;;:11;;1053:18:1;;133493::0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;133475:36;;133522:15;133550:7;133540;:17;:41;;133580:1;133540:41;;;133560:17;133570:7;133560;:17;:::i;:::-;133522:59;;133673:6;133680:1;133673:9;;;;;;;;:::i;:::-;;;;;;;;;133661:6;133668:1;133661:9;;;;;;;;:::i;:::-;;;;;;;;;133649:6;133656:1;133649:9;;;;;;;;:::i;:::-;;;;;;;;;133636:6;133643:1;133636:9;;;;;;;;:::i;:::-;;;;;;;;;133623:6;133630:1;133623:9;;;;;;;;:::i;:::-;;;;;;;;;133611:6;133618:1;133611:9;;;;;;;;:::i;:::-;;;;;;;;;133601:7;:19;;;;:::i;:::-;:31;;;;:::i;:::-;133600:45;;;;:::i;:::-;133599:59;;;;:::i;:::-;:71;;;;:::i;:::-;:83;;;;:::i;:::-;133592:90;133359:331;-1:-1:-1;;;;;133359:331:0:o;125859:136::-;125967:4;;:20;;-1:-1:-1;;;125967:20:0;;125944:4;125967:20;;;4851:51:1;;;125899:7:0;;125944:4;;-1:-1:-1;;;;;125967:4:0;;;;:14;;4824:18:1;;125967:20:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;125960:27;;;125859:136;:::o;132994:87::-;133033:16;133069:4;133062:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;132994:87;:::o;32800:142::-;32880:7;32907:18;;;:12;:18;;;;;:27;;:25;:27::i;130799:515::-;130870:7;130890:11;130904:22;130911:7;130920:5;130904:6;:22::i;:::-;130890:36;;130937:20;130960:32;130976:15;130985:5;130976:8;:15::i;130960:32::-;130937:55;;131003:11;131017:12;131023:5;131017;:12::i;:::-;131003:26;;131040:16;131059:17;131070:5;131059:10;:17::i;:::-;131040:36;-1:-1:-1;131087:14:0;131134:19;131117:12;131105:9;131111:3;131105;:9;:::i;:::-;:24;;;;:::i;:::-;131104:50;;;;:::i;:::-;131087:67;-1:-1:-1;131165:19:0;131222;131205:12;131188:14;131199:3;131188:8;:14;:::i;:::-;:29;;;;:::i;:::-;131187:55;;;;:::i;:::-;131165:77;;131291:4;;;;;;;;;-1:-1:-1;;;;;131291:4:0;-1:-1:-1;;;;;131291:13:0;;:15;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;131285:21;;:2;:21;:::i;:::-;131261:20;131270:11;131261:6;:20;:::i;:::-;131260:46;;;;:::i;:::-;131253:53;130799:515;-1:-1:-1;;;;;;;;;130799:515:0:o;129061:310::-;129124:7;127754:20;;;:13;:20;;;;;;129200:19;129222:20;129236:5;129222:13;:20::i;:::-;129200:42;;129271:12;129257:11;:26;129253:92;;;129307:26;129321:12;129307:11;:26;:::i;:::-;129300:33;129061:310;-1:-1:-1;;;;129061:310:0:o;129253:92::-;-1:-1:-1;129362:1:0;;129061:310;-1:-1:-1;;;129061:310:0:o;15033:149::-;14226:7;14253:12;;;;;;;;;;:22;;;12208:16;12219:4;12208:10;:16::i;:::-;15148:26:::1;15160:4;15166:7;15148:11;:26::i;17334:238::-:0;17418:22;17426:4;17432:7;17418;:22::i;:::-;17413:152;;17457:6;:12;;;;;;;;;;;-1:-1:-1;;;;;17457:29:0;;;;;;;;;:36;;-1:-1:-1;;17457:36:0;17489:4;17457:36;;;17540:12;5170:10;;5090:98;17540:12;-1:-1:-1;;;;;17513:40:0;17531:7;-1:-1:-1;;;;;17513:40:0;17525:4;17513:40;;;;;;;;;;17334:238;;:::o;26294:152::-;26364:4;26388:50;26393:3;-1:-1:-1;;;;;26413:23:0;;26388:4;:50::i;31660:214::-;31745:4;-1:-1:-1;;;;;;31769:57:0;;-1:-1:-1;;;31769:57:0;;:97;;;31830:36;31854:11;31830:23;:36::i;13063:105::-;13130:30;13141:4;5170:10;13130;:30::i;:::-;13063:105;:::o;33035:169::-;33123:31;33140:4;33146:7;33123:16;:31::i;:::-;33165:18;;;;:12;:18;;;;;:31;;33188:7;33165:22;:31::i;33298:174::-;33387:32;33405:4;33411:7;33387:17;:32::i;:::-;33430:18;;;;:12;:18;;;;;:34;;33456:7;33430:25;:34::i;134346:148::-;134432:4;;;:22;;-1:-1:-1;;;134432:22:0;;;;;1080:25:1;;;134405:7:0;;-1:-1:-1;;;;;134432:4:0;;;;:15;;1053:18:1;;134432:22:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;134764:129::-;134847:4;;;:19;;-1:-1:-1;;;134847:19:0;;;;;1080:25:1;;;134820:7:0;;-1:-1:-1;;;;;134847:4:0;;;;:12;;1053:18:1;;134847:19:0;934:177:1;134561:152:0;134654:4;;;:29;;-1:-1:-1;;;134654:29:0;;;;;1080:25:1;;;134627:7:0;;-1:-1:-1;;;;;134654:4:0;;;;:19;;1053:18:1;;134654:29:0;934:177:1;27590:158:0;27664:7;27715:22;27719:3;27731:5;27715:3;:22::i;27119:117::-;27182:7;27209:19;27217:3;22603:18;;22520:109;134118:165;134216:4;;;:26;;-1:-1:-1;;;134216:26:0;;-1:-1:-1;;;;;5713:32:1;;;134216:26:0;;;5695:51:1;;;;5762:18;;;5755:34;;;134189:7:0;;134216:4;;;;:10;;5668:18:1;;134216:26:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;20209:414::-;20272:4;22402:19;;;:12;;;:19;;;;;;20289:327;;-1:-1:-1;20332:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;20515:18;;20493:19;;;:12;;;:19;;;;;;:40;;;;20548:11;;20289:327;-1:-1:-1;20599:5:0;20592:12;;12316:204;12401:4;-1:-1:-1;;;;;;12425:47:0;;-1:-1:-1;;;12425:47:0;;:87;;-1:-1:-1;;;;;;;;;;9690:40:0;;;12476:36;9581:157;13458:505;13547:22;13555:4;13561:7;13547;:22::i;:::-;13542:414;;13735:41;13763:7;-1:-1:-1;;;;;13735:41:0;13773:2;13735:19;:41::i;:::-;13849:38;13877:4;13884:2;13849:19;:38::i;:::-;13640:270;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;13640:270:0;;;;;;;;;;-1:-1:-1;;;13586:358:0;;;;;;;:::i;17752:239::-;17836:22;17844:4;17850:7;17836;:22::i;:::-;17832:152;;;17907:5;17875:12;;;;;;;;;;;-1:-1:-1;;;;;17875:29:0;;;;;;;;;;:37;;-1:-1:-1;;17875:37:0;;;17932:40;5170:10;;17875:12;;17932:40;;17907:5;17932:40;17752:239;;:::o;26622:158::-;26695:4;26719:53;26727:3;-1:-1:-1;;;;;26747:23:0;;26719:7;:53::i;22983:120::-;23050:7;23077:3;:11;;23089:5;23077:18;;;;;;;;:::i;:::-;;;;;;;;;23070:25;;22983:120;;;;:::o;7035:451::-;7110:13;7136:19;7168:10;7172:6;7168:1;:10;:::i;:::-;:14;;7181:1;7168:14;:::i;:::-;7158:25;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7158:25:0;;7136:47;;-1:-1:-1;;;7194:6:0;7201:1;7194:9;;;;;;;;:::i;:::-;;;;:15;-1:-1:-1;;;;;7194:15:0;;;;;;;;;-1:-1:-1;;;7220:6:0;7227:1;7220:9;;;;;;;;:::i;:::-;;;;:15;-1:-1:-1;;;;;7220:15:0;;;;;;;;-1:-1:-1;7251:9:0;7263:10;7267:6;7263:1;:10;:::i;:::-;:14;;7276:1;7263:14;:::i;:::-;7251:26;;7246:135;7283:1;7279;:5;7246:135;;;-1:-1:-1;;;7331:5:0;7339:3;7331:11;7318:25;;;;;;;:::i;:::-;;;;7306:6;7313:1;7306:9;;;;;;;;:::i;:::-;;;;:37;-1:-1:-1;;;;;7306:37:0;;;;;;;;-1:-1:-1;7368:1:0;7358:11;;;;;7286:3;;;:::i;:::-;;;7246:135;;;-1:-1:-1;7399:10:0;;7391:55;;;;-1:-1:-1;;;7391:55:0;;12230:2:1;7391:55:0;;;12212:21:1;;;12249:18;;;12242:30;12308:34;12288:18;;;12281:62;12360:18;;7391:55:0;12028:356:1;20799:1420:0;20865:4;21004:19;;;:12;;;:19;;;;;;21040:15;;21036:1176;;21415:21;21439:14;21452:1;21439:10;:14;:::i;:::-;21488:18;;21415:38;;-1:-1:-1;21468:17:0;;21488:22;;21509:1;;21488:22;:::i;:::-;21468:42;;21544:13;21531:9;:26;21527:405;;21578:17;21598:3;:11;;21610:9;21598:22;;;;;;;;:::i;:::-;;;;;;;;;21578:42;;21752:9;21723:3;:11;;21735:13;21723:26;;;;;;;;:::i;:::-;;;;;;;;;;;;:38;;;;21837:23;;;:12;;;:23;;;;;:36;;;21527:405;22013:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;22108:3;:12;;:19;22121:5;22108:19;;;;;;;;;;;22101:26;;;22151:4;22144:11;;;;;;;21036:1176;22195:5;22188:12;;;;;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;14:286:1;72:6;125:2;113:9;104:7;100:23;96:32;93:52;;;141:1;138;131:12;93:52;167:23;;-1:-1:-1;;;;;;219:32:1;;209:43;;199:71;;266:1;263;256:12;497:173;565:20;;-1:-1:-1;;;;;614:31:1;;604:42;;594:70;;660:1;657;650:12;594:70;497:173;;;:::o;675:254::-;743:6;751;804:2;792:9;783:7;779:23;775:32;772:52;;;820:1;817;810:12;772:52;843:29;862:9;843:29;:::i;:::-;833:39;919:2;904:18;;;;891:32;;-1:-1:-1;;;675:254:1:o;1116:127::-;1177:10;1172:3;1168:20;1165:1;1158:31;1208:4;1205:1;1198:15;1232:4;1229:1;1222:15;1248:902;1302:5;1355:3;1348:4;1340:6;1336:17;1332:27;1322:55;;1373:1;1370;1363:12;1322:55;1409:6;1396:20;1435:4;1458:18;1495:2;1491;1488:10;1485:36;;;1501:18;;:::i;:::-;1547:2;1544:1;1540:10;1579:2;1573:9;1642:2;1638:7;1633:2;1629;1625:11;1621:25;1613:6;1609:38;1697:6;1685:10;1682:22;1677:2;1665:10;1662:18;1659:46;1656:72;;;1708:18;;:::i;:::-;1744:2;1737:22;1794:18;;;1870:15;;;1866:24;;;1828:15;;;;-1:-1:-1;1902:15:1;;;1899:35;;;1930:1;1927;1920:12;1899:35;1966:2;1958:6;1954:15;1943:26;;1978:142;1994:6;1989:3;1986:15;1978:142;;;2060:17;;2048:30;;2098:12;;;;2011;;;;1978:142;;;2138:6;1248:902;-1:-1:-1;;;;;;;1248:902:1:o;2155:422::-;2248:6;2256;2309:2;2297:9;2288:7;2284:23;2280:32;2277:52;;;2325:1;2322;2315:12;2277:52;2348:29;2367:9;2348:29;:::i;:::-;2338:39;;2428:2;2417:9;2413:18;2400:32;2455:18;2447:6;2444:30;2441:50;;;2487:1;2484;2477:12;2441:50;2510:61;2563:7;2554:6;2543:9;2539:22;2510:61;:::i;:::-;2500:71;;;2155:422;;;;;:::o;2582:435::-;2635:3;2673:5;2667:12;2700:6;2695:3;2688:19;2726:4;2755:2;2750:3;2746:12;2739:19;;2792:2;2785:5;2781:14;2813:1;2823:169;2837:6;2834:1;2831:13;2823:169;;;2898:13;;2886:26;;2932:12;;;;2967:15;;;;2859:1;2852:9;2823:169;;;-1:-1:-1;3008:3:1;;2582:435;-1:-1:-1;;;;;2582:435:1:o;3022:261::-;3201:2;3190:9;3183:21;3164:4;3221:56;3273:2;3262:9;3258:18;3250:6;3221:56;:::i;3470:180::-;3529:6;3582:2;3570:9;3561:7;3557:23;3553:32;3550:52;;;3598:1;3595;3588:12;3550:52;-1:-1:-1;3621:23:1;;3470:180;-1:-1:-1;3470:180:1:o;3655:254::-;3723:6;3731;3784:2;3772:9;3763:7;3759:23;3755:32;3752:52;;;3800:1;3797;3790:12;3752:52;3836:9;3823:23;3813:33;;3865:38;3899:2;3888:9;3884:18;3865:38;:::i;:::-;3855:48;;3655:254;;;;;:::o;3914:348::-;3998:6;4051:2;4039:9;4030:7;4026:23;4022:32;4019:52;;;4067:1;4064;4057:12;4019:52;4107:9;4094:23;4140:18;4132:6;4129:30;4126:50;;;4172:1;4169;4162:12;4126:50;4195:61;4248:7;4239:6;4228:9;4224:22;4195:61;:::i;4452:248::-;4520:6;4528;4581:2;4569:9;4560:7;4556:23;4552:32;4549:52;;;4597:1;4594;4587:12;4549:52;-1:-1:-1;;4620:23:1;;;4690:2;4675:18;;;4662:32;;-1:-1:-1;4452:248:1:o;5259:127::-;5320:10;5315:3;5311:20;5308:1;5301:31;5351:4;5348:1;5341:15;5375:4;5372:1;5365:15;5391:125;5456:9;;;5477:10;;;5474:36;;;5490:18;;:::i;5800:277::-;5867:6;5920:2;5908:9;5899:7;5895:23;5891:32;5888:52;;;5936:1;5933;5926:12;5888:52;5968:9;5962:16;6021:5;6014:13;6007:21;6000:5;5997:32;5987:60;;6043:1;6040;6033:12;6432:127;6493:10;6488:3;6484:20;6481:1;6474:31;6524:4;6521:1;6514:15;6548:4;6545:1;6538:15;6564:135;6603:3;6624:17;;;6621:43;;6644:18;;:::i;:::-;-1:-1:-1;6691:1:1;6680:13;;6564:135::o;7053:562::-;-1:-1:-1;;;;;7338:32:1;;7320:51;;7407:2;7402;7387:18;;7380:30;;;-1:-1:-1;;7433:56:1;;7470:18;;7462:6;7433:56;:::i;:::-;7537:9;7529:6;7525:22;7520:2;7509:9;7505:18;7498:50;7565:44;7602:6;7594;7565:44;:::i;:::-;7557:52;7053:562;-1:-1:-1;;;;;;7053:562:1:o;8036:184::-;8106:6;8159:2;8147:9;8138:7;8134:23;8130:32;8127:52;;;8175:1;8172;8165:12;8127:52;-1:-1:-1;8198:16:1;;8036:184;-1:-1:-1;8036:184:1:o;8225:128::-;8292:9;;;8313:11;;;8310:37;;;8327:18;;:::i;8358:168::-;8431:9;;;8462;;8479:15;;;8473:22;;8459:37;8449:71;;8500:18;;:::i;8531:217::-;8571:1;8597;8587:132;;8641:10;8636:3;8632:20;8629:1;8622:31;8676:4;8673:1;8666:15;8704:4;8701:1;8694:15;8587:132;-1:-1:-1;8733:9:1;;8531:217::o;8753:273::-;8821:6;8874:2;8862:9;8853:7;8849:23;8845:32;8842:52;;;8890:1;8887;8880:12;8842:52;8922:9;8916:16;8972:4;8965:5;8961:16;8954:5;8951:27;8941:55;;8992:1;8989;8982:12;9031:422;9120:1;9163:5;9120:1;9177:270;9198:7;9188:8;9185:21;9177:270;;;9257:4;9253:1;9249:6;9245:17;9239:4;9236:27;9233:53;;;9266:18;;:::i;:::-;9316:7;9306:8;9302:22;9299:55;;;9336:16;;;;9299:55;9415:22;;;;9375:15;;;;9177:270;;;9181:3;9031:422;;;;;:::o;9458:806::-;9507:5;9537:8;9527:80;;-1:-1:-1;9578:1:1;9592:5;;9527:80;9626:4;9616:76;;-1:-1:-1;9663:1:1;9677:5;;9616:76;9708:4;9726:1;9721:59;;;;9794:1;9789:130;;;;9701:218;;9721:59;9751:1;9742:10;;9765:5;;;9789:130;9826:3;9816:8;9813:17;9810:43;;;9833:18;;:::i;:::-;-1:-1:-1;;9889:1:1;9875:16;;9904:5;;9701:218;;10003:2;9993:8;9990:16;9984:3;9978:4;9975:13;9971:36;9965:2;9955:8;9952:16;9947:2;9941:4;9938:12;9934:35;9931:77;9928:159;;;-1:-1:-1;10040:19:1;;;10072:5;;9928:159;10119:34;10144:8;10138:4;10119:34;:::i;:::-;10189:6;10185:1;10181:6;10177:19;10168:7;10165:32;10162:58;;;10200:18;;:::i;:::-;10238:20;;9458:806;-1:-1:-1;;;9458:806:1:o;10269:140::-;10327:5;10356:47;10397:4;10387:8;10383:19;10377:4;10356:47;:::i;10414:250::-;10499:1;10509:113;10523:6;10520:1;10517:13;10509:113;;;10599:11;;;10593:18;10580:11;;;10573:39;10545:2;10538:10;10509:113;;;-1:-1:-1;;10656:1:1;10638:16;;10631:27;10414:250::o;10669:812::-;11080:25;11075:3;11068:38;11050:3;11135:6;11129:13;11151:75;11219:6;11214:2;11209:3;11205:12;11198:4;11190:6;11186:17;11151:75;:::i;:::-;-1:-1:-1;;;11285:2:1;11245:16;;;11277:11;;;11270:40;11335:13;;11357:76;11335:13;11419:2;11411:11;;11404:4;11392:17;;11357:76;:::i;:::-;11453:17;11472:2;11449:26;;10669:812;-1:-1:-1;;;;10669:812:1:o;11486:396::-;11635:2;11624:9;11617:21;11598:4;11667:6;11661:13;11710:6;11705:2;11694:9;11690:18;11683:34;11726:79;11798:6;11793:2;11782:9;11778:18;11773:2;11765:6;11761:15;11726:79;:::i;:::-;11866:2;11845:15;-1:-1:-1;;11841:29:1;11826:45;;;;11873:2;11822:54;;11486:396;-1:-1:-1;;11486:396:1:o;11887:136::-;11926:3;11954:5;11944:39;;11963:18;;:::i;:::-;-1:-1:-1;;;11999:18:1;;11887:136::o;12389:127::-;12450:10;12445:3;12441:20;12438:1;12431:31;12481:4;12478:1;12471:15;12505:4;12502:1;12495:15

Swarm Source

ipfs://43665fae2a12a5643c30e341ec8c420ad415a98aea19f3ac2a165c0b5c5ea2f0

Block Transaction Gas Used Reward
view all blocks ##produced##

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

Validator Index Block Amount
View All Withdrawals

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

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