ETH Price: $2,520.80 (+0.22%)

Contract

0xDbD65e821B54EB30e2a516117a2ce1ed6837f504
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Buy180608082023-09-04 4:44:11361 days ago1693802651IN
0xDbD65e82...d6837f504
0.005 ETH0.0020425213.11015324
Account179753542023-08-23 5:34:59373 days ago1692768899IN
0xDbD65e82...d6837f504
0 ETH0.0076193614.01004885
Buy179751212023-08-23 4:48:23373 days ago1692766103IN
0xDbD65e82...d6837f504
0.01 ETH0.0028417918.24037859
Buy179743082023-08-23 2:04:23374 days ago1692756263IN
0xDbD65e82...d6837f504
0.005 ETH0.0027724819.46382167
Buy179742652023-08-23 1:55:23374 days ago1692755723IN
0xDbD65e82...d6837f504
0.005 ETH0.0021173814.86481243
Buy179741132023-08-23 1:24:35374 days ago1692753875IN
0xDbD65e82...d6837f504
0.005 ETH0.0028040119.68514673
Buy179740402023-08-23 1:09:47374 days ago1692752987IN
0xDbD65e82...d6837f504
0.005 ETH0.0021055114.7814602
Buy179739602023-08-23 0:53:47374 days ago1692752027IN
0xDbD65e82...d6837f504
0.005 ETH0.0026689518.73703118
Buy179738772023-08-23 0:37:11374 days ago1692751031IN
0xDbD65e82...d6837f504
0.005 ETH0.0024552817.23699983
Buy179738332023-08-23 0:28:23374 days ago1692750503IN
0xDbD65e82...d6837f504
0.005 ETH0.0020877314.65663971
Buy179738112023-08-23 0:23:59374 days ago1692750239IN
0xDbD65e82...d6837f504
0.005 ETH0.0025167117.66824404
Buy179737402023-08-23 0:09:47374 days ago1692749387IN
0xDbD65e82...d6837f504
0.005 ETH0.0024722817.35633624
Buy179736072023-08-22 23:42:59374 days ago1692747779IN
0xDbD65e82...d6837f504
0.005 ETH0.0025853818.15030269
Buy179735982023-08-22 23:41:11374 days ago1692747671IN
0xDbD65e82...d6837f504
0.005 ETH0.0016986617.75654446
Buy179735792023-08-22 23:37:23374 days ago1692747443IN
0xDbD65e82...d6837f504
0.005 ETH0.0034558624.26136103
Buy179735542023-08-22 23:32:23374 days ago1692747143IN
0xDbD65e82...d6837f504
0.005 ETH0.0032495522.81299396
Buy179732642023-08-22 22:33:59374 days ago1692743639IN
0xDbD65e82...d6837f504
0.005 ETH0.0043111130.26557124
Buy179727602023-08-22 20:52:23374 days ago1692737543IN
0xDbD65e82...d6837f504
0.005 ETH0.0051489736.14760977
Buy179702852023-08-22 12:34:47374 days ago1692707687IN
0xDbD65e82...d6837f504
0.005 ETH0.0041305528.99794097
Buy179702732023-08-22 12:32:23374 days ago1692707543IN
0xDbD65e82...d6837f504
0.005 ETH0.0034578324.26635726
Buy179700342023-08-22 11:43:59374 days ago1692704639IN
0xDbD65e82...d6837f504
0.005 ETH0.0026143318.35351788
Buy179700092023-08-22 11:38:59374 days ago1692704339IN
0xDbD65e82...d6837f504
0.005 ETH0.002777319.49768257
Buy179699822023-08-22 11:33:35374 days ago1692704015IN
0xDbD65e82...d6837f504
0.005 ETH0.003124221.93304851
Buy179699492023-08-22 11:26:59374 days ago1692703619IN
0xDbD65e82...d6837f504
0.005 ETH0.0028715420.15927354
Buy179696152023-08-22 10:19:47374 days ago1692699587IN
0xDbD65e82...d6837f504
0.005 ETH0.0028167619.77470407
View all transactions

Latest 22 internal transactions

Advanced mode:
Parent Transaction Hash Block From To
180608082023-09-04 4:44:11361 days ago1693802651
0xDbD65e82...d6837f504
0.005 ETH
179753542023-08-23 5:34:59373 days ago1692768899
0xDbD65e82...d6837f504
0.27 ETH
179751212023-08-23 4:48:23373 days ago1692766103
0xDbD65e82...d6837f504
0.01 ETH
173485092023-05-27 6:07:59461 days ago1685167679
0xDbD65e82...d6837f504
0.01 ETH
167069252023-02-25 17:58:47552 days ago1677347927
0xDbD65e82...d6837f504
0.01 ETH
166815102023-02-22 4:07:11555 days ago1677038831
0xDbD65e82...d6837f504
0.01 ETH
165757302023-02-07 8:32:11570 days ago1675758731
0xDbD65e82...d6837f504
0.01 ETH
165577942023-02-04 20:26:11573 days ago1675542371
0xDbD65e82...d6837f504
0.01 ETH
165555952023-02-04 13:03:59573 days ago1675515839
0xDbD65e82...d6837f504
0.01 ETH
165465462023-02-03 6:44:23574 days ago1675406663
0xDbD65e82...d6837f504
0.01 ETH
165456582023-02-03 3:44:23574 days ago1675395863
0xDbD65e82...d6837f504
0.01 ETH
165451002023-02-03 1:51:47575 days ago1675389107
0xDbD65e82...d6837f504
0.01 ETH
165420812023-02-02 15:42:59575 days ago1675352579
0xDbD65e82...d6837f504
0.01 ETH
165396782023-02-02 7:38:11575 days ago1675323491
0xDbD65e82...d6837f504
0.01 ETH
165391812023-02-02 5:58:11575 days ago1675317491
0xDbD65e82...d6837f504
0.01 ETH
165346262023-02-01 14:41:11576 days ago1675262471
0xDbD65e82...d6837f504
0.01 ETH
165341922023-02-01 13:13:47576 days ago1675257227
0xDbD65e82...d6837f504
0.01 ETH
165341552023-02-01 13:06:23576 days ago1675256783
0xDbD65e82...d6837f504
0.01 ETH
165341442023-02-01 13:04:11576 days ago1675256651
0xDbD65e82...d6837f504
0.01 ETH
165341432023-02-01 13:03:59576 days ago1675256639
0xDbD65e82...d6837f504
0.01 ETH
165325412023-02-01 7:40:59576 days ago1675237259
0xDbD65e82...d6837f504
0.01 ETH
165321842023-02-01 6:29:23576 days ago1675232963
0xDbD65e82...d6837f504
4.23 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TicketSeller

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 15 : TicketSeller.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.0;

import "../tokens/IFungibleSBT.sol";
import "./EnumerableSalesSet.sol";
import "../wallet/IWallet.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/structs/BitMaps.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract TicketSeller is ReentrancyGuard, AccessControl, Ownable {
    using Address for address payable;
    using BitMaps for BitMaps.BitMap;
    using EnumerableSalesSet for EnumerableSalesSet.Set;

    event Bought(
        address indexed collection,
        uint256 indexed id,
        address indexed buyer,
        uint256 amount
    );

    event Repayment(
        address indexed collection,
        uint256 indexed id,
        address indexed buyer,
        uint256 amount
    );

    bytes32 public constant ADMIN = "ADMIN";
    bytes32 public constant ACCOUNTANT = "ACCOUNTANT";

    // ==================================================
    // Variables
    // ==================================================
    mapping(address => mapping(uint256 => uint256)) public cost;
    mapping(address => mapping(uint256 => uint256)) public salesAmount;
    mapping(address => mapping(uint256 => EnumerableSalesSet.Set))
        private _salesSet;
    mapping(address => BitMaps.BitMap) private _paused;
    mapping(address => BitMaps.BitMap) private _isCompleteAccount;
    IWallet public wallet;

    // ==================================================
    // constractor
    // ==================================================
    constructor() {
        _grantRole(ADMIN, msg.sender);
    }

    // ==================================================
    // Functions for sale
    // ==================================================
    modifier whenNotPaused(address collection, uint256 id) {
        require(_paused[collection].get(id) == false, "paused.");
        _;
    }

    modifier enoughEth(address collection, uint256 id) {
        require(msg.value >= cost[collection][id], "not enough eth.");
        _;
    }

    function buy(address collection, uint256 id)
        external
        payable
        whenNotPaused(collection, id)
        enoughEth(collection, id)
    {
        IFungibleSBT(collection).mint(msg.sender, id);

        if (_isCompleteAccount[collection].get(id)) {
            _account(payable(IFungibleSBT(collection).owner()), msg.value);
        } else {
            _escrow(collection, id);
        }

        emit Bought(address(collection), id, msg.sender, msg.value);
    }

    function _escrow(address collection, uint256 id) private {
        salesAmount[collection][id] += msg.value;
        _salesSet[collection][id].add(
            EnumerableSalesSet.Sales(msg.sender, msg.value)
        );
    }

    function _account(address payable organizer, uint256 amount)
        private
        nonReentrant
    {
        wallet.account{value: amount}(organizer);
    }

    modifier notCompleteAccount(address collection, uint256 id) {
        require(
            _isCompleteAccount[collection].get(id) == false,
            "the account is already complete."
        );
        _;
    }

    // ==================================================================
    // for accountant operation
    // ==================================================================
    function account(address collection, uint256 id)
        external
        onlyRole(ACCOUNTANT)
        notCompleteAccount(collection, id)
    {
        _isCompleteAccount[collection].set(id);

        _account(
            payable(IFungibleSBT(collection).owner()),
            salesAmount[collection][id]
        );

        delete salesAmount[collection][id];
        delete _salesSet[collection][id];
    }

    modifier onlyOrganizorOrAccountant(address collection) {
        require(
            msg.sender == IFungibleSBT(collection).owner() ||
                hasRole(ACCOUNTANT, msg.sender),
            "you are not organizer or accountant."
        );
        _;
    }

    function repayment(
        address collection,
        uint256 id,
        uint256 maxIndex
    )
        external
        onlyOrganizorOrAccountant(collection)
        notCompleteAccount(collection, id)
        nonReentrant
    {
        _paused[collection].setTo(id, true);

        EnumerableSalesSet.Sales[] memory sales = _salesSet[collection][id]
            .values();
        for (uint256 i = 0; i < maxIndex && i < sales.length; i++) {
            _salesSet[collection][id].remove(sales[i]);
            salesAmount[collection][id] -= sales[i].amount;
            payable(sales[i].buyer).sendValue(sales[i].amount);

            emit Repayment(collection, id, sales[i].buyer, sales[i].amount);
        }
    }

    function getSales(address collection, uint256 id)
        external
        view
        returns (address[] memory, uint256[] memory)
    {
        EnumerableSalesSet.Sales[] memory sales = _salesSet[collection][id]
            .values();

        address[] memory buyers = new address[](sales.length);
        uint256[] memory amounts = new uint256[](sales.length);

        for (uint256 i = 0; i < sales.length; i++) {
            buyers[i] = sales[i].buyer;
            amounts[i] = sales[i].amount;
        }

        return (buyers, amounts);
    }

    // ==================================================================
    // for organizer operation
    // ==================================================================
    modifier onlyCollectionOwner(address collection) {
        require(IFungibleSBT(collection).owner() == msg.sender, "not owner.");
        _;
    }

    function setCost(
        address collection,
        uint256 id,
        uint256 value
    ) external onlyCollectionOwner(collection) {
        uint256 nextId = IFungibleSBT(collection).nextId();
        require(id <= nextId, "invalid id.");

        cost[collection][id] = value;

        if (id == nextId) {
            IFungibleSBT(collection).add();
            IFungibleSBT(collection).mint(msg.sender, id);
        }
    }

    function pause(
        address collection,
        uint256 id,
        bool isPaused
    ) external onlyCollectionOwner(collection) {
        _paused[collection].setTo(id, isPaused);
    }

    function paused(address collection, uint256 id)
        external
        view
        returns (bool)
    {
        return _paused[collection].get(id);
    }

    // ==================================================================
    // for admin operations
    // ==================================================================
    function setWallet(address value) external onlyRole(ADMIN) {
        wallet = IWallet(value);
    }

    // ==================================================================
    // operations
    // ==================================================================
    function grantRole(bytes32 role, address target) public override onlyOwner {
        _grantRole(role, target);
    }

    function revokeRole(bytes32 role, address target)
        public
        override
        onlyOwner
    {
        _revokeRole(role, target);
    }
}

File 2 of 15 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

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

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

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

    /**
     * @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(account),
                        " 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 3 of 15 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 4 of 15 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract 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 5 of 15 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 6 of 15 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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 7 of 15 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

File 10 of 15 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

File 11 of 15 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _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) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @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] = _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 12 of 15 : BitMaps.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/BitMaps.sol)
pragma solidity ^0.8.0;

/**
 * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential.
 * Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].
 */
library BitMaps {
    struct BitMap {
        mapping(uint256 => uint256) _data;
    }

    /**
     * @dev Returns whether the bit at `index` is set.
     */
    function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {
        uint256 bucket = index >> 8;
        uint256 mask = 1 << (index & 0xff);
        return bitmap._data[bucket] & mask != 0;
    }

    /**
     * @dev Sets the bit at `index` to the boolean `value`.
     */
    function setTo(
        BitMap storage bitmap,
        uint256 index,
        bool value
    ) internal {
        if (value) {
            set(bitmap, index);
        } else {
            unset(bitmap, index);
        }
    }

    /**
     * @dev Sets the bit at `index`.
     */
    function set(BitMap storage bitmap, uint256 index) internal {
        uint256 bucket = index >> 8;
        uint256 mask = 1 << (index & 0xff);
        bitmap._data[bucket] |= mask;
    }

    /**
     * @dev Unsets the bit at `index`.
     */
    function unset(BitMap storage bitmap, uint256 index) internal {
        uint256 bucket = index >> 8;
        uint256 mask = 1 << (index & 0xff);
        bitmap._data[bucket] &= ~mask;
    }
}

File 13 of 15 : EnumerableSalesSet.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

library EnumerableSalesSet {
    
    struct Sales {
        address buyer;
        uint256 amount;
    }
    
    struct Set {
        Sales[] _values;
        mapping(address => uint256) _indexes;
    }

    function add(Set storage set, Sales memory value) internal returns (bool) {
        if (!contains(set, value)) {
            set._values.push(value);
            set._indexes[value.buyer] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    function remove(Set storage set, Sales memory value) internal returns (bool) {
        uint256 valueIndex = set._indexes[value.buyer];

        if (valueIndex != 0) {
            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                Sales memory lastValue = set._values[lastIndex];
                set._values[toDeleteIndex] = lastValue;
                set._indexes[lastValue.buyer] = valueIndex;
            }

            set._values.pop();
            delete set._indexes[value.buyer];

            return true;
        } else {
            return false;
        }
    }

    function contains(Set storage set, Sales memory value) internal view returns (bool) {
        return set._indexes[value.buyer] != 0;
    }

    function length(Set storage set) internal view returns (uint256) {
        return set._values.length;
    }

    function at(Set storage set, uint256 index) internal view returns (Sales memory) {
        return set._values[index];
    }

    function values(Set storage set) internal view returns (Sales[] memory) {
        return set._values;
    }
}

File 14 of 15 : IFungibleSBT.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.0;

interface IFungibleSBT {
    function mint(address to, uint256 id) external;

    function owner() external view returns (address);

    function add() external;

    function exists(uint256 id) external view returns (bool);

    function nextId() external view returns (uint256);
}

File 15 of 15 : IWallet.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.0;

interface IWallet {
    function account(address payable organizer) external payable;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Bought","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Repayment","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":"ACCOUNTANT","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ADMIN","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":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"account","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"buy","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"cost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getSales","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"target","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":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bool","name":"isPaused","type":"bool"}],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"maxIndex","type":"uint256"}],"name":"repayment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"target","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"salesAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"value","type":"address"}],"name":"setWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wallet","outputs":[{"internalType":"contract IWallet","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608080604052346100d8576001600090815560028054336001600160a01b0319821681179092556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a36420a226a4a760d91b9081815260016020526040812033825260205260ff60408220541615610089575b611d8f83816100de8239f35b81815260016020526040812033825260205260408120600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d339280a4388061007d565b600080fdfe608060408181526004918236101561001657600080fd5b600092833560e01c91826301ffc9a71461168d57508163192df65514611318578163248a9ca3146112ee5781632a0acc6a146112cb5781632f2ff15d1461122c57816336568abe1461119a578163521eb273146111715781635afbf71b1461108557816363580ec714611046578163715018a614610fe85781638b9d294014610fc05781638da5cb5b14610f9757816391d1485414610f51578163a217fddf14610f36578163a774571314610d84578163b160bc4a14610ba0578163cce7ec13146108d9578163d547741f146108a9578163deaa59df14610679578163f15c97a114610292578163f2fde38b146101c157508063f3896131146101655763f94d6dc71461012257600080fd5b3461016157806003193601126101615760209181906001600160a01b036101476116e0565b168152600384528181206024358252845220549051908152f35b5080fd5b50346101615780600319360112610161576020916101b8906001600160a01b0361018d6116e0565b1681526006845282602435912060019160ff918160081c600052602052161b60406000205416151590565b90519015158152f35b90503461028e57602036600319011261028e576101dc6116e0565b906101e56117b1565b6001600160a01b0391821692831561023c575050600254826bffffffffffffffffffffffff60a01b821617600255167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152fd5b8280fd5b90508234610676576102a336611711565b8551638da5cb5b60e01b8152909491926001600160a01b039081169260209283818381885afa90811561066c57908391889161063f575b501633148015610614575b156105c5578386526007835261031f610319868a892060019160ff918160081c600052602052161b60406000205416151590565b15611a01565b6103276119ab565b83865260068352610352858988208160081c600052602052600160ff604060002092161b8154179055565b838652600595868452888120868252845288812096875461037281611d08565b9861037f8c519a8b61186b565b818a528352858320839087808c015b8484106105a6575050505050815b8981108061059c575b15610594578683528186528a832088845286526103cf8b84206103c8838c611bb4565b5190611bef565b50856103db828b611bb4565b5101518784528487528b842089855287528b8420805491820391821161057f575584610407828b611bb4565b51511686610415838c611bb4565b5101519081471061053c578480809381935af13d15610537573d67ffffffffffffffff8111610522578c5190610454601f8201601f19168a018361186b565b815284883d92013e5b156104b957808989897fcbe0b6fe2aea46efef85bdf9cdfee471a62da5b2dceb2e29415c70ab220a9ede8f8b90816104a6888e61049d6104b49c8b611bb4565b51511698611bb4565b5101519051908152a4611b8f565b61039c565b8a5162461bcd60e51b8152808501879052603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608490fd5b604186634e487b7160e01b6000525260246000fd5b61045d565b8c5162461bcd60e51b8152808701899052601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606490fd5b601186634e487b7160e01b6000525260246000fd5b826001815580f35b50885181106103a5565b6001916002916105b585611bc8565b815201920192019190889061038e565b875162461bcd60e51b81529081018390526024808201527f796f7520617265206e6f74206f7267616e697a6572206f72206163636f756e7460448201526330b73a1760e11b6064820152608490fd5b50691050d0d3d5539510539560b21b86526001835287862033600052835260ff8860002054166102e5565b61065f9150853d8711610665575b610657818361186b565b81019061188d565b8a6102da565b503d61064d565b89513d89823e3d90fd5b80fd5b90503461028e57602090816003193601126108a5576106966116e0565b926420a226a4a760d91b8060005260018085528260002033600052855260ff836000205416156106df57600880546001600160a01b0319166001600160a01b0388161790558680f35b6106e833611a80565b918351906106f58261184f565b604282528682019260603685378251156108905760308453825181101561089057607860218401536041905b8082116108235750506107e257836107b2604888956107d4956107a39560449a995196879361077a8b86019b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8d528251928391603789019101611a4c565b8401917001034b99036b4b9b9b4b733903937b6329607d1b603784015251809386840190611a4c565b0103602881018552018361186b565b5195869462461bcd60e51b865285015251809281602486015285850190611a4c565b601f01601f19168101030190fd5b606485878087519262461bcd60e51b845283015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f8116601081101561087b576f181899199a1a9b1b9c1cb0b131b232b360811b901a6108528486611a6f565b53871c918015610866576000190190610721565b601188634e487b7160e01b6000525260246000fd5b603289634e487b7160e01b6000525260246000fd5b603287634e487b7160e01b6000525260246000fd5b8380fd5b9190503461028e57366003190112610161576108d6906108c76116fb565b906108d06117b1565b3561173b565b80f35b9180915060031936011261028e576108ef6116e0565b916024359160018060a01b03809416918286526020946006865261092e8584892060019160ff918160081c600052602052161b60406000205416151590565b610b7457838752600386528287208588528652828720543410610b4057908691843b1561028e5783516340c10f1960e01b815233838201908152602081018890528490829081906040010381838a5af18015610a9357908491610b2c575b50859052600787526109b98685852060019160ff918160081c600052602052161b60406000205416151590565b15610a9d578351638da5cb5b60e01b81529087828481895afa918215610a93578492610a74575b506109e96119ab565b8060085416803b15610a66578492602491875195869485936373b9aa9160e01b8552169083015234905af18015610a6a57610a52575b509060017fbe39bcb4b5645ce3e99dc49d095db856201db6af874a4d39b96cd1ed4a06a11d92555b51933485523394a480f35b610a5b90611809565b610a66578438610a1f565b8480fd5b83513d84823e3d90fd5b610a8c919250883d8a1161066557610657818361186b565b90386109e0565b85513d86823e3d90fd5b50908390528085528186208487528552818620805491348301809311610b175750907fbe39bcb4b5645ce3e99dc49d095db856201db6af874a4d39b96cd1ed4a06a11d929155828652600585528086208487528552610b11818720825190610b0482611833565b3382523488830152611924565b50610a47565b601190634e487b7160e01b6000525260246000fd5b610b3590611809565b61028e57823861098c565b5084606492519162461bcd60e51b8352820152600f60248201526e3737ba1032b737bab3b41032ba341760891b6044820152fd5b5084606492519162461bcd60e51b835282015260076024820152663830bab9b2b21760c91b6044820152fd5b83833461016157610bb036611711565b8351638da5cb5b60e01b81526020966001600160a01b0394851695949093929190888286818a5afa918215610d7a5790610bf592918992610d5b575b50163314611d20565b835163186e33a360e21b81529087828581895afa918215610d51578792610d1e575b50818311610ced578697868852600381528588209084895252848720558114610c3e578480f35b833b15610a66578251634f2be91f60e01b81528581848183895af18015610ce357908691610ccf575b5050833b15610a665782516340c10f1960e01b815233928101928352602083019190915292849184919082908490829060400103925af1908115610cc65750610cb2575b8080808480f35b610cbb90611809565b610676578082610cab565b513d84823e3d90fd5b610cd890611809565b610a66578487610c67565b84513d88823e3d90fd5b845162461bcd60e51b8152808501899052600b60248201526a34b73b30b634b21034b21760a91b6044820152606490fd5b9091508781813d8311610d4a575b610d36818361186b565b81010312610d4657519088610c17565b8680fd5b503d610d2c565b85513d89823e3d90fd5b610d739192508a3d8c1161066557610657818361186b565b908a610bec565b86513d8a823e3d90fd5b5050346101615780600319360112610161576001600160a01b039182610da86116e0565b168152602060058152828220602435835281528282208054610dc981611d08565b91610dd68651938461186b565b81835284528284208490848085015b848410610f17575050505050805194610e15610e0087611d08565b96610e0d8751988961186b565b808852611d08565b838701601f19809201368237835195610e45610e3088611d08565b97610e3d8a51998a61186b565b808952611d08565b8787019301368437805b8551811015610e98578085610e67610e939389611bb4565b515116610e74828d611bb4565b5287610e808289611bb4565b510151610e8d828b611bb4565b52611b8f565b610e4f565b5088929186888a9687519788978189019189525180915260608801949186905b828210610efa5750505050858303868301525180835291810193925b828110610ee357505050500390f35b835185528695509381019392810192600101610ed4565b8351811687528a9950958501959285019260019190910190610eb8565b600191600291610f2685611bc8565b8152019201920191908590610de5565b50503461016157816003193601126101615751908152602090f35b90503461028e578160031936011261028e5781602093610f6f6116fb565b9235815260018552209060018060a01b0316600052825260ff81600020541690519015158152f35b50503461016157816003193601126101615760025490516001600160a01b039091168152602090f35b50503461016157816003193601126101615751691050d0d3d5539510539560b21b8152602090f35b83346106765780600319360112610676576110016117b1565b600280546001600160a01b031981169091556000906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b90503461028e578160031936011261028e5760209282916001600160a01b0361106d6116e0565b16825284528181206024358252845220549051908152f35b90503461028e57606036600319011261028e576110a06116e0565b916024359260443592831515840361116d578251638da5cb5b60e01b81526001600160a01b03928316929091602090839081865afa91821561116357906110f1929188926111435750163314611d20565b8452600660205280842091156111245750906108d6918160081c600052602052600160ff604060002092161b8154179055565b60ff906001928460081c60005260205260002092161b19815416905580f35b61115c91925060203d811161066557610657818361186b565b9038610bec565b84513d89823e3d90fd5b8580fd5b50503461016157816003193601126101615760085490516001600160a01b039091168152602090f35b839150346101615782600319360112610161576111b56116fb565b90336001600160a01b038316036111d157906108d6913561173b565b608490602085519162461bcd60e51b8352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152fd5b90503461028e578160031936011261028e5735906112486116fb565b906112516117b1565b82845260016020528084209160018060a01b0316918260005260205260ff8160002054161561127e578380f35b828452600160205280842082600052602052600020600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8480a43880808380f35b505034610161578160031936011261016157516420a226a4a760d91b8152602090f35b90503461028e57602036600319011261028e57816020936001923581528285522001549051908152f35b9190503461028e578060031936011261028e576113336116e0565b906024803591691050d0d3d5539510539560b21b92838752600194602094868652838920338a52865260ff848a2054161561150c575060018060a01b0380911690818952600786526113a361031984868c2060019160ff918160081c600052602052161b60406000205416151590565b818952600786526113ce83858b208160081c600052602052600160ff604060002092161b8154179055565b8351638da5cb5b60e01b815290899087838b81875afa9283156115025782936114e3575b508382528988528582208583528852858220549261140e6119ab565b816008541690813b156108a55787516373b9aa9160e01b81529216828c015290928391889183915af180156114d9576114c6575b5085885580885286855282882082895285528783812055875260058452818720908752835285209081549486835585611479578680f35b6001600160ff1b03861686036114b55750508452832091811b8201915b8281106114a4578080808680f35b600080825582820155600201611496565b634e487b7160e01b87526011905285fd5b6114d290989198611809565b9638611442565b84513d8b823e3d90fd5b6114fb919350883d8a1161066557610657818361186b565b91386113f2565b86513d84823e3d90fd5b8785858b8a8a9561151c33611a80565b908451926115298461184f565b6042845288840194606036873784511561167b5760308653845182101561167b5790607860218601536041915b818311611612575050506115d257836115b16048896107d49660449a99966107a361077a9776020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b9b5198858a9687019d8e528251928391603789019101611a4c565b5196879562461bcd60e51b8752860152519283809286015285850190611a4c565b60648688878188519362461bcd60e51b85528401528201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015611669576f181899199a1a9b1b9c1cb0b131b232b360811b901a6116428588611a6f565b53891c92801561165757600019019190611556565b634e487b7160e01b825260118a528882fd5b634e487b7160e01b835260328b528983fd5b634e487b7160e01b8152603289528790fd5b84913461028e57602036600319011261028e573563ffffffff60e01b811680910361028e5760209250637965db0b60e01b81149081156116cf575b5015158152f35b6301ffc9a760e01b149050836116c8565b600435906001600160a01b03821682036116f657565b600080fd5b602435906001600160a01b03821682036116f657565b60609060031901126116f6576004356001600160a01b03811681036116f657906024359060443590565b906000918083526001602052604083209160018060a01b03169182845260205260ff60408420541661176c57505050565b8083526001602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b6002546001600160a01b031633036117c557565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b67ffffffffffffffff811161181d57604052565b634e487b7160e01b600052604160045260246000fd5b6040810190811067ffffffffffffffff82111761181d57604052565b6080810190811067ffffffffffffffff82111761181d57604052565b90601f8019910116810190811067ffffffffffffffff82111761181d57604052565b908160209103126116f657516001600160a01b03811681036116f65790565b80548210156118c85760005260206000209060011b0190600090565b634e487b7160e01b600052603260045260246000fd5b919061190e57805182546001600160a01b0319166001600160a01b03919091161782556020015160019190910155565b634e487b7160e01b600052600060045260246000fd5b91906001830160018060a01b039081835116916000928352816020526040832054156000146119a3578554956801000000000000000087101561198f5761197f856119798960016040999a9b018555846118ac565b906118de565b5494511682526020522055600190565b634e487b7160e01b84526041600452602484fd5b509093505050565b6002600054146119bc576002600055565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b15611a0857565b606460405162461bcd60e51b815260206004820152602060248201527f746865206163636f756e7420697320616c726561647920636f6d706c6574652e6044820152fd5b60005b838110611a5f5750506000910152565b8181015183820152602001611a4f565b9081518110156118c8570160200190565b604051906060820182811067ffffffffffffffff82111761181d57604052602a82526020820160403682378251156118c8576030905381516001908110156118c857607860218401536029905b808211611b21575050611add5790565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015611b7a576f181899199a1a9b1b9c1cb0b131b232b360811b901a611b508486611a6f565b5360041c918015611b65576000190190611acd565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b6000198114611b9e5760010190565b634e487b7160e01b600052601160045260246000fd5b80518210156118c85760209160051b010190565b90604051611bd581611833565b82546001600160a01b031681526001909201546020830152565b81516001600160a01b03908116600090815260018301602081905260408220549194909390918015611d005760001990808201818111611cec578354838101908111611cd857908181889303611c9f575b5050505081548015611c8b570190611c5882826118ac565b611c775760018188809355015555511682526020526040812055600190565b634e487b7160e01b87526004879052602487fd5b634e487b7160e01b87526031600452602487fd5b61197991611cb9611cb3611cc293896118ac565b50611bc8565b928391886118ac565b5116875285602052604087205538848180611c40565b634e487b7160e01b89526011600452602489fd5b634e487b7160e01b88526011600452602488fd5b505050505090565b67ffffffffffffffff811161181d5760051b60200190565b15611d2757565b60405162461bcd60e51b815260206004820152600a6024820152693737ba1037bbb732b91760b11b6044820152606490fdfea2646970667358221220892db0c85d911d4f711c904aa49db72d9c16a2a32f7cec9c7e10ded93fc8a0d864736f6c63430008110033

Deployed Bytecode

0x608060408181526004918236101561001657600080fd5b600092833560e01c91826301ffc9a71461168d57508163192df65514611318578163248a9ca3146112ee5781632a0acc6a146112cb5781632f2ff15d1461122c57816336568abe1461119a578163521eb273146111715781635afbf71b1461108557816363580ec714611046578163715018a614610fe85781638b9d294014610fc05781638da5cb5b14610f9757816391d1485414610f51578163a217fddf14610f36578163a774571314610d84578163b160bc4a14610ba0578163cce7ec13146108d9578163d547741f146108a9578163deaa59df14610679578163f15c97a114610292578163f2fde38b146101c157508063f3896131146101655763f94d6dc71461012257600080fd5b3461016157806003193601126101615760209181906001600160a01b036101476116e0565b168152600384528181206024358252845220549051908152f35b5080fd5b50346101615780600319360112610161576020916101b8906001600160a01b0361018d6116e0565b1681526006845282602435912060019160ff918160081c600052602052161b60406000205416151590565b90519015158152f35b90503461028e57602036600319011261028e576101dc6116e0565b906101e56117b1565b6001600160a01b0391821692831561023c575050600254826bffffffffffffffffffffffff60a01b821617600255167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152fd5b8280fd5b90508234610676576102a336611711565b8551638da5cb5b60e01b8152909491926001600160a01b039081169260209283818381885afa90811561066c57908391889161063f575b501633148015610614575b156105c5578386526007835261031f610319868a892060019160ff918160081c600052602052161b60406000205416151590565b15611a01565b6103276119ab565b83865260068352610352858988208160081c600052602052600160ff604060002092161b8154179055565b838652600595868452888120868252845288812096875461037281611d08565b9861037f8c519a8b61186b565b818a528352858320839087808c015b8484106105a6575050505050815b8981108061059c575b15610594578683528186528a832088845286526103cf8b84206103c8838c611bb4565b5190611bef565b50856103db828b611bb4565b5101518784528487528b842089855287528b8420805491820391821161057f575584610407828b611bb4565b51511686610415838c611bb4565b5101519081471061053c578480809381935af13d15610537573d67ffffffffffffffff8111610522578c5190610454601f8201601f19168a018361186b565b815284883d92013e5b156104b957808989897fcbe0b6fe2aea46efef85bdf9cdfee471a62da5b2dceb2e29415c70ab220a9ede8f8b90816104a6888e61049d6104b49c8b611bb4565b51511698611bb4565b5101519051908152a4611b8f565b61039c565b8a5162461bcd60e51b8152808501879052603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608490fd5b604186634e487b7160e01b6000525260246000fd5b61045d565b8c5162461bcd60e51b8152808701899052601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606490fd5b601186634e487b7160e01b6000525260246000fd5b826001815580f35b50885181106103a5565b6001916002916105b585611bc8565b815201920192019190889061038e565b875162461bcd60e51b81529081018390526024808201527f796f7520617265206e6f74206f7267616e697a6572206f72206163636f756e7460448201526330b73a1760e11b6064820152608490fd5b50691050d0d3d5539510539560b21b86526001835287862033600052835260ff8860002054166102e5565b61065f9150853d8711610665575b610657818361186b565b81019061188d565b8a6102da565b503d61064d565b89513d89823e3d90fd5b80fd5b90503461028e57602090816003193601126108a5576106966116e0565b926420a226a4a760d91b8060005260018085528260002033600052855260ff836000205416156106df57600880546001600160a01b0319166001600160a01b0388161790558680f35b6106e833611a80565b918351906106f58261184f565b604282528682019260603685378251156108905760308453825181101561089057607860218401536041905b8082116108235750506107e257836107b2604888956107d4956107a39560449a995196879361077a8b86019b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8d528251928391603789019101611a4c565b8401917001034b99036b4b9b9b4b733903937b6329607d1b603784015251809386840190611a4c565b0103602881018552018361186b565b5195869462461bcd60e51b865285015251809281602486015285850190611a4c565b601f01601f19168101030190fd5b606485878087519262461bcd60e51b845283015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f8116601081101561087b576f181899199a1a9b1b9c1cb0b131b232b360811b901a6108528486611a6f565b53871c918015610866576000190190610721565b601188634e487b7160e01b6000525260246000fd5b603289634e487b7160e01b6000525260246000fd5b603287634e487b7160e01b6000525260246000fd5b8380fd5b9190503461028e57366003190112610161576108d6906108c76116fb565b906108d06117b1565b3561173b565b80f35b9180915060031936011261028e576108ef6116e0565b916024359160018060a01b03809416918286526020946006865261092e8584892060019160ff918160081c600052602052161b60406000205416151590565b610b7457838752600386528287208588528652828720543410610b4057908691843b1561028e5783516340c10f1960e01b815233838201908152602081018890528490829081906040010381838a5af18015610a9357908491610b2c575b50859052600787526109b98685852060019160ff918160081c600052602052161b60406000205416151590565b15610a9d578351638da5cb5b60e01b81529087828481895afa918215610a93578492610a74575b506109e96119ab565b8060085416803b15610a66578492602491875195869485936373b9aa9160e01b8552169083015234905af18015610a6a57610a52575b509060017fbe39bcb4b5645ce3e99dc49d095db856201db6af874a4d39b96cd1ed4a06a11d92555b51933485523394a480f35b610a5b90611809565b610a66578438610a1f565b8480fd5b83513d84823e3d90fd5b610a8c919250883d8a1161066557610657818361186b565b90386109e0565b85513d86823e3d90fd5b50908390528085528186208487528552818620805491348301809311610b175750907fbe39bcb4b5645ce3e99dc49d095db856201db6af874a4d39b96cd1ed4a06a11d929155828652600585528086208487528552610b11818720825190610b0482611833565b3382523488830152611924565b50610a47565b601190634e487b7160e01b6000525260246000fd5b610b3590611809565b61028e57823861098c565b5084606492519162461bcd60e51b8352820152600f60248201526e3737ba1032b737bab3b41032ba341760891b6044820152fd5b5084606492519162461bcd60e51b835282015260076024820152663830bab9b2b21760c91b6044820152fd5b83833461016157610bb036611711565b8351638da5cb5b60e01b81526020966001600160a01b0394851695949093929190888286818a5afa918215610d7a5790610bf592918992610d5b575b50163314611d20565b835163186e33a360e21b81529087828581895afa918215610d51578792610d1e575b50818311610ced578697868852600381528588209084895252848720558114610c3e578480f35b833b15610a66578251634f2be91f60e01b81528581848183895af18015610ce357908691610ccf575b5050833b15610a665782516340c10f1960e01b815233928101928352602083019190915292849184919082908490829060400103925af1908115610cc65750610cb2575b8080808480f35b610cbb90611809565b610676578082610cab565b513d84823e3d90fd5b610cd890611809565b610a66578487610c67565b84513d88823e3d90fd5b845162461bcd60e51b8152808501899052600b60248201526a34b73b30b634b21034b21760a91b6044820152606490fd5b9091508781813d8311610d4a575b610d36818361186b565b81010312610d4657519088610c17565b8680fd5b503d610d2c565b85513d89823e3d90fd5b610d739192508a3d8c1161066557610657818361186b565b908a610bec565b86513d8a823e3d90fd5b5050346101615780600319360112610161576001600160a01b039182610da86116e0565b168152602060058152828220602435835281528282208054610dc981611d08565b91610dd68651938461186b565b81835284528284208490848085015b848410610f17575050505050805194610e15610e0087611d08565b96610e0d8751988961186b565b808852611d08565b838701601f19809201368237835195610e45610e3088611d08565b97610e3d8a51998a61186b565b808952611d08565b8787019301368437805b8551811015610e98578085610e67610e939389611bb4565b515116610e74828d611bb4565b5287610e808289611bb4565b510151610e8d828b611bb4565b52611b8f565b610e4f565b5088929186888a9687519788978189019189525180915260608801949186905b828210610efa5750505050858303868301525180835291810193925b828110610ee357505050500390f35b835185528695509381019392810192600101610ed4565b8351811687528a9950958501959285019260019190910190610eb8565b600191600291610f2685611bc8565b8152019201920191908590610de5565b50503461016157816003193601126101615751908152602090f35b90503461028e578160031936011261028e5781602093610f6f6116fb565b9235815260018552209060018060a01b0316600052825260ff81600020541690519015158152f35b50503461016157816003193601126101615760025490516001600160a01b039091168152602090f35b50503461016157816003193601126101615751691050d0d3d5539510539560b21b8152602090f35b83346106765780600319360112610676576110016117b1565b600280546001600160a01b031981169091556000906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b90503461028e578160031936011261028e5760209282916001600160a01b0361106d6116e0565b16825284528181206024358252845220549051908152f35b90503461028e57606036600319011261028e576110a06116e0565b916024359260443592831515840361116d578251638da5cb5b60e01b81526001600160a01b03928316929091602090839081865afa91821561116357906110f1929188926111435750163314611d20565b8452600660205280842091156111245750906108d6918160081c600052602052600160ff604060002092161b8154179055565b60ff906001928460081c60005260205260002092161b19815416905580f35b61115c91925060203d811161066557610657818361186b565b9038610bec565b84513d89823e3d90fd5b8580fd5b50503461016157816003193601126101615760085490516001600160a01b039091168152602090f35b839150346101615782600319360112610161576111b56116fb565b90336001600160a01b038316036111d157906108d6913561173b565b608490602085519162461bcd60e51b8352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152fd5b90503461028e578160031936011261028e5735906112486116fb565b906112516117b1565b82845260016020528084209160018060a01b0316918260005260205260ff8160002054161561127e578380f35b828452600160205280842082600052602052600020600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8480a43880808380f35b505034610161578160031936011261016157516420a226a4a760d91b8152602090f35b90503461028e57602036600319011261028e57816020936001923581528285522001549051908152f35b9190503461028e578060031936011261028e576113336116e0565b906024803591691050d0d3d5539510539560b21b92838752600194602094868652838920338a52865260ff848a2054161561150c575060018060a01b0380911690818952600786526113a361031984868c2060019160ff918160081c600052602052161b60406000205416151590565b818952600786526113ce83858b208160081c600052602052600160ff604060002092161b8154179055565b8351638da5cb5b60e01b815290899087838b81875afa9283156115025782936114e3575b508382528988528582208583528852858220549261140e6119ab565b816008541690813b156108a55787516373b9aa9160e01b81529216828c015290928391889183915af180156114d9576114c6575b5085885580885286855282882082895285528783812055875260058452818720908752835285209081549486835585611479578680f35b6001600160ff1b03861686036114b55750508452832091811b8201915b8281106114a4578080808680f35b600080825582820155600201611496565b634e487b7160e01b87526011905285fd5b6114d290989198611809565b9638611442565b84513d8b823e3d90fd5b6114fb919350883d8a1161066557610657818361186b565b91386113f2565b86513d84823e3d90fd5b8785858b8a8a9561151c33611a80565b908451926115298461184f565b6042845288840194606036873784511561167b5760308653845182101561167b5790607860218601536041915b818311611612575050506115d257836115b16048896107d49660449a99966107a361077a9776020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b9b5198858a9687019d8e528251928391603789019101611a4c565b5196879562461bcd60e51b8752860152519283809286015285850190611a4c565b60648688878188519362461bcd60e51b85528401528201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015611669576f181899199a1a9b1b9c1cb0b131b232b360811b901a6116428588611a6f565b53891c92801561165757600019019190611556565b634e487b7160e01b825260118a528882fd5b634e487b7160e01b835260328b528983fd5b634e487b7160e01b8152603289528790fd5b84913461028e57602036600319011261028e573563ffffffff60e01b811680910361028e5760209250637965db0b60e01b81149081156116cf575b5015158152f35b6301ffc9a760e01b149050836116c8565b600435906001600160a01b03821682036116f657565b600080fd5b602435906001600160a01b03821682036116f657565b60609060031901126116f6576004356001600160a01b03811681036116f657906024359060443590565b906000918083526001602052604083209160018060a01b03169182845260205260ff60408420541661176c57505050565b8083526001602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b6002546001600160a01b031633036117c557565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b67ffffffffffffffff811161181d57604052565b634e487b7160e01b600052604160045260246000fd5b6040810190811067ffffffffffffffff82111761181d57604052565b6080810190811067ffffffffffffffff82111761181d57604052565b90601f8019910116810190811067ffffffffffffffff82111761181d57604052565b908160209103126116f657516001600160a01b03811681036116f65790565b80548210156118c85760005260206000209060011b0190600090565b634e487b7160e01b600052603260045260246000fd5b919061190e57805182546001600160a01b0319166001600160a01b03919091161782556020015160019190910155565b634e487b7160e01b600052600060045260246000fd5b91906001830160018060a01b039081835116916000928352816020526040832054156000146119a3578554956801000000000000000087101561198f5761197f856119798960016040999a9b018555846118ac565b906118de565b5494511682526020522055600190565b634e487b7160e01b84526041600452602484fd5b509093505050565b6002600054146119bc576002600055565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b15611a0857565b606460405162461bcd60e51b815260206004820152602060248201527f746865206163636f756e7420697320616c726561647920636f6d706c6574652e6044820152fd5b60005b838110611a5f5750506000910152565b8181015183820152602001611a4f565b9081518110156118c8570160200190565b604051906060820182811067ffffffffffffffff82111761181d57604052602a82526020820160403682378251156118c8576030905381516001908110156118c857607860218401536029905b808211611b21575050611add5790565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015611b7a576f181899199a1a9b1b9c1cb0b131b232b360811b901a611b508486611a6f565b5360041c918015611b65576000190190611acd565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b6000198114611b9e5760010190565b634e487b7160e01b600052601160045260246000fd5b80518210156118c85760209160051b010190565b90604051611bd581611833565b82546001600160a01b031681526001909201546020830152565b81516001600160a01b03908116600090815260018301602081905260408220549194909390918015611d005760001990808201818111611cec578354838101908111611cd857908181889303611c9f575b5050505081548015611c8b570190611c5882826118ac565b611c775760018188809355015555511682526020526040812055600190565b634e487b7160e01b87526004879052602487fd5b634e487b7160e01b87526031600452602487fd5b61197991611cb9611cb3611cc293896118ac565b50611bc8565b928391886118ac565b5116875285602052604087205538848180611c40565b634e487b7160e01b89526011600452602489fd5b634e487b7160e01b88526011600452602488fd5b505050505090565b67ffffffffffffffff811161181d5760051b60200190565b15611d2757565b60405162461bcd60e51b815260206004820152600a6024820152693737ba1037bbb732b91760b11b6044820152606490fdfea2646970667358221220892db0c85d911d4f711c904aa49db72d9c16a2a32f7cec9c7e10ded93fc8a0d864736f6c63430008110033

Block Transaction Difficulty 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
Loading...
Loading
[ Download: CSV Export  ]
[ 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.