ETH Price: $3,292.40 (-1.14%)

Contract

0xDe5D4949F445650325c7C8739610c3A979C7a6db
 

Overview

ETH Balance

18.9197 ETH

Eth Value

$62,291.23 (@ $3,292.40/ETH)

Token Holdings

Multichain Info

1 address found via
Transaction Hash
Method
Block
From
To
Claim And Refund197062122024-04-21 20:37:23245 days ago1713731843IN
0xDe5D4949...979C7a6db
0 ETH0.000570946.94541777
Claim And Refund196341222024-04-11 18:19:35255 days ago1712859575IN
0xDe5D4949...979C7a6db
0 ETH0.0016933520.58462258
Claim And Refund196341172024-04-11 18:18:35255 days ago1712859515IN
0xDe5D4949...979C7a6db
0 ETH0.0015729819.12142064
Claim And Refund196341122024-04-11 18:17:35255 days ago1712859455IN
0xDe5D4949...979C7a6db
0 ETH0.0017596821.39094072
Claim And Refund196341072024-04-11 18:16:35255 days ago1712859395IN
0xDe5D4949...979C7a6db
0 ETH0.0017912521.77472654
Claim And Refund196340882024-04-11 18:12:47255 days ago1712859167IN
0xDe5D4949...979C7a6db
0 ETH0.0042351826.12873637
Claim And Refund196340452024-04-11 18:04:11255 days ago1712858651IN
0xDe5D4949...979C7a6db
0 ETH0.003082719.0185811
Claim And Refund196340402024-04-11 18:03:11255 days ago1712858591IN
0xDe5D4949...979C7a6db
0 ETH0.0017555821.34109377
Claim And Refund196340322024-04-11 18:01:35255 days ago1712858495IN
0xDe5D4949...979C7a6db
0 ETH0.0017460421.22515941
Claim And Refund196340252024-04-11 18:00:11255 days ago1712858411IN
0xDe5D4949...979C7a6db
0 ETH0.0016937820.58982307
Claim And Refund196340172024-04-11 17:58:35255 days ago1712858315IN
0xDe5D4949...979C7a6db
0 ETH0.0017396221.14707084
Claim And Refund196340092024-04-11 17:56:59255 days ago1712858219IN
0xDe5D4949...979C7a6db
0 ETH0.0019739723.99592256
Claim And Refund196340062024-04-11 17:56:23255 days ago1712858183IN
0xDe5D4949...979C7a6db
0 ETH0.002024324.60774426
Claim And Refund196340032024-04-11 17:55:47255 days ago1712858147IN
0xDe5D4949...979C7a6db
0 ETH0.0018876922.9470696
Claim And Refund196339992024-04-11 17:54:59255 days ago1712858099IN
0xDe5D4949...979C7a6db
0 ETH0.0017820921.66343582
Claim And Refund196339942024-04-11 17:53:59255 days ago1712858039IN
0xDe5D4949...979C7a6db
0 ETH0.0016903220.54783887
Claim And Refund195552322024-03-31 17:04:11266 days ago1711904651IN
0xDe5D4949...979C7a6db
0 ETH0.002048524.90194193
Claim And Refund195428002024-03-29 23:04:59268 days ago1711753499IN
0xDe5D4949...979C7a6db
0 ETH0.0038688223.86852784
Claim And Refund195427412024-03-29 22:53:11268 days ago1711752791IN
0xDe5D4949...979C7a6db
0 ETH0.0034797324
Claim And Refund195427222024-03-29 22:49:23268 days ago1711752563IN
0xDe5D4949...979C7a6db
0 ETH0.0038321823.64247751
Claim And Refund195415572024-03-29 18:52:23268 days ago1711738343IN
0xDe5D4949...979C7a6db
0 ETH0.0031887919.67310004
Claim And Refund195414632024-03-29 18:33:35268 days ago1711737215IN
0xDe5D4949...979C7a6db
0 ETH0.00364722.5000355
Claim And Refund195414332024-03-29 18:27:35268 days ago1711736855IN
0xDe5D4949...979C7a6db
0 ETH0.0039467124.34907436
Claim And Refund195414062024-03-29 18:22:11268 days ago1711736531IN
0xDe5D4949...979C7a6db
0 ETH0.0043797827.02085851
Claim And Refund195413712024-03-29 18:15:11268 days ago1711736111IN
0xDe5D4949...979C7a6db
0 ETH0.0046254428.53644509
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block
From
To
197062122024-04-21 20:37:23245 days ago1713731843
0xDe5D4949...979C7a6db
0.0701 ETH
196341222024-04-11 18:19:35255 days ago1712859575
0xDe5D4949...979C7a6db
0.29 ETH
196341172024-04-11 18:18:35255 days ago1712859515
0xDe5D4949...979C7a6db
0.29 ETH
196341122024-04-11 18:17:35255 days ago1712859455
0xDe5D4949...979C7a6db
0.29 ETH
196341072024-04-11 18:16:35255 days ago1712859395
0xDe5D4949...979C7a6db
0.29 ETH
196340402024-04-11 18:03:11255 days ago1712858591
0xDe5D4949...979C7a6db
0.29 ETH
196340322024-04-11 18:01:35255 days ago1712858495
0xDe5D4949...979C7a6db
0.29 ETH
196340252024-04-11 18:00:11255 days ago1712858411
0xDe5D4949...979C7a6db
0.29 ETH
196340172024-04-11 17:58:35255 days ago1712858315
0xDe5D4949...979C7a6db
0.29 ETH
196340092024-04-11 17:56:59255 days ago1712858219
0xDe5D4949...979C7a6db
0.29 ETH
196340062024-04-11 17:56:23255 days ago1712858183
0xDe5D4949...979C7a6db
0.29 ETH
196340032024-04-11 17:55:47255 days ago1712858147
0xDe5D4949...979C7a6db
0.29 ETH
196339992024-04-11 17:54:59255 days ago1712858099
0xDe5D4949...979C7a6db
0.29 ETH
196339942024-04-11 17:53:59255 days ago1712858039
0xDe5D4949...979C7a6db
0.29 ETH
195552322024-03-31 17:04:11266 days ago1711904651
0xDe5D4949...979C7a6db
0.29 ETH
195412272024-03-29 17:46:11268 days ago1711734371
0xDe5D4949...979C7a6db
0.29 ETH
194932012024-03-22 22:41:35275 days ago1711147295
0xDe5D4949...979C7a6db
0.29 ETH
194881062024-03-22 5:32:47276 days ago1711085567
0xDe5D4949...979C7a6db
0.29 ETH
194880552024-03-22 5:22:23276 days ago1711084943
0xDe5D4949...979C7a6db
0.29 ETH
194809632024-03-21 5:28:23277 days ago1710998903
0xDe5D4949...979C7a6db
0.29 ETH
194740552024-03-20 6:12:59278 days ago1710915179
0xDe5D4949...979C7a6db
0.29 ETH
194740492024-03-20 6:11:47278 days ago1710915107
0xDe5D4949...979C7a6db
0.29 ETH
194740112024-03-20 6:04:11278 days ago1710914651
0xDe5D4949...979C7a6db
0.29 ETH
194740102024-03-20 6:03:59278 days ago1710914639
0xDe5D4949...979C7a6db
0.29 ETH
194546602024-03-17 12:48:11280 days ago1710679691
0xDe5D4949...979C7a6db
0.29 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RaffleAuctionMinter

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 16 : RaffleAuctionMinter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./RaffleBidHeap.sol";
import "../../basic-tokens/interfaces/IGateway.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

contract RaffleAuctionMinter is AccessControl {
    bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");
    uint256 public constant MAX_BID_PER_USER = 50;

    struct ClaimInfo {
        bool hasClaimed;
        uint256 refundAmount;
        uint256 nftCount;
    }

    event Bid(address indexed buyer, uint256 bidPrice);
    event Claim(address indexed buyer, uint256 refundAmount, uint256 nftCount);

    using Counters for Counters.Counter;
    using RaffleBidHeap for RaffleBidHeap.Heap;

    RaffleBidHeap.Heap private _heap;
    Counters.Counter private _idCounter;

    address public gateway;
    address public nftAddress;
    address public paymentRecipient;
    uint256 public auctionEndTime;

    mapping(address => RaffleBidHeap.Bid[]) public userBids;
    mapping(address => bool) public hasClaimed;
    // bidder => limitForBuyerID => bidAmount
    mapping(address => mapping(uint256 => uint256)) buyerBidCount;

    uint256 public highestBidPrice;
    bool public paymentSent;

    constructor(
        address _admin,
        address _gateway,
        address _nftAddress,
        address _paymentRecipient,
        uint256 _nftAmount,
        uint256 _auctionEndTime
    ) {
        _setupRole(DEFAULT_ADMIN_ROLE, _admin);
        _setupRole(MANAGER_ROLE, _admin);
        _setupRole(MANAGER_ROLE, msg.sender);

        gateway = _gateway;
        nftAddress = _nftAddress;
        paymentRecipient = _paymentRecipient;
        auctionEndTime = _auctionEndTime;
        _heap.initialize(_nftAmount);
    }

    receive() external payable {}

    /**************** Management Functions ****************/
    function sendPayment() external {
        require(
            block.timestamp > auctionEndTime,
            "RaffleAuctionMinter: payment can only be made after the auction has ended"
        );
        require(!paymentSent, "RaffleAuctionMinter: payment already sent");
        uint256 value = _heap.size() * _heap.minBid().price;
        (bool success, ) = paymentRecipient.call{value: value}("");
        require(success, "RaffleAuctionMinter: failed to send payment");
        paymentSent = true;
    }

    function setGateway(address _g) external onlyRole(DEFAULT_ADMIN_ROLE) {
        gateway = _g;
    }

    function setRecipient(address _r) external onlyRole(DEFAULT_ADMIN_ROLE) {
        paymentRecipient = _r;
    }

    function setNftAddress(address _addr) external onlyRole(MANAGER_ROLE) {
        nftAddress = _addr;
    }

    function setAuctionEndTime(uint256 _t) external onlyRole(MANAGER_ROLE) {
        require(_t > block.timestamp, "RaffleAuctionMinter: invalid timestamp");
        require(block.timestamp <= auctionEndTime, "RaffleAuctionMinter: already ended");
        auctionEndTime = _t;
    }

    /**************** Core Functions ****************/
    function placeBid(
        uint256 bidPrice,
        uint256 limitForBuyerID,
        uint256 limitForBuyerAmount,
        uint256 expireTime,
        bytes calldata _sig
    ) external payable {
        // Check signature validity
        bytes32 inputHash = _getInputHash(
            bidPrice,
            limitForBuyerID,
            limitForBuyerAmount,
            expireTime
        );
        address signer = IGateway(gateway).nftManager(nftAddress);
        _checkSigValidity(inputHash, _sig, signer);

        require(
            block.timestamp <= expireTime,
            "RaffleAuctionMinter: signature expired"
        );
        require(
            block.timestamp <= auctionEndTime,
            "RaffleAuctionMinter: auction ended"
        );

        require(
            userBids[msg.sender].length < MAX_BID_PER_USER,
            "RaffleAuctionMinter: maximum bid per user reached"
        );
        require(
            buyerBidCount[msg.sender][limitForBuyerID] < limitForBuyerAmount,
            "RaffleAuctionMinter: buyer limit exceeded"
        );

        require(msg.value == bidPrice, "RaffleAuctionMinter: payment mismatch");

        buyerBidCount[msg.sender][limitForBuyerID] += 1;

        _idCounter.increment();
        RaffleBidHeap.Bid memory newBid = RaffleBidHeap.Bid(
            _idCounter.current(),
            msg.sender,
            bidPrice,
            block.timestamp,
            generateRandomNumber(_idCounter.current())
        );

        userBids[msg.sender].push(newBid);
        _heap.tryInsert(newBid);

        emit Bid(msg.sender, bidPrice);
    }

    function claimInfo(address _a) public view returns (ClaimInfo memory info) {
        info.hasClaimed = hasClaimed[_a];
        info.refundAmount = 0;
        info.nftCount = 0;
        RaffleBidHeap.Bid memory _floorBid = _heap.minBid();
        for (uint256 i = 0; i < userBids[_a].length; i++) {
            if (RaffleBidHeap.isHigherOrEqualBid(userBids[_a][i], _floorBid)) {
                info.nftCount += 1;
                info.refundAmount += userBids[_a][i].price - _floorBid.price;
            } else {
                info.refundAmount += userBids[_a][i].price;
            }
        }
    }

    function claimAndRefund() external {
        require(
            block.timestamp > auctionEndTime,
            "RaffleAuctionMinter: No claims or refunds allowed until auction ends"
        );
        ClaimInfo memory info = claimInfo(msg.sender);

        require(!info.hasClaimed, "RaffleAuctionMinter: has claimed");
        require(
            info.nftCount > 0 || info.refundAmount > 0,
            "RaffleAuctionMinter: nothing to claim"
        );

        hasClaimed[msg.sender] = true;

        for (uint256 i = 0; i < info.nftCount; i++) {
            IGateway(gateway).ERC721_mint(nftAddress, msg.sender, 0);
        }
        (bool success, ) = msg.sender.call{value: info.refundAmount}("");
        require(success, "RaffleAuctionMinter: failed to send refund");

        emit Claim(msg.sender, info.refundAmount, info.nftCount);
    }

    /**************** View Functions ****************/
    function tvl() external view returns (uint256) {
        return address(this).balance;
    }

    function floorBid() external view returns (RaffleBidHeap.Bid memory) {
        return _heap.minBid();
    }

    function getUserClaimInfos(
        address[] calldata _addresses
    ) external view returns (ClaimInfo[] memory results) {
        results = new ClaimInfo[](_addresses.length);
        for (uint256 i = 0; i < _addresses.length; i++) {
            results[i] = claimInfo(_addresses[i]);
        }
    }

    function getUserBids(
        address[] calldata _addresses
    ) external view returns (RaffleBidHeap.Bid[][] memory bids) {
        bids = new RaffleBidHeap.Bid[][](_addresses.length);
        for (uint256 i = 0; i < _addresses.length; i++) {
            bids[i] = userBids[_addresses[i]];
        }
    }

    function getTotalBidsCnt() external view returns (uint256) {
        return _idCounter.current();
    }

    function getBidAmtByBuyerId(
        address _buyer,
        uint256 _limitForBuyerID
    ) external view returns (uint256) {
        return buyerBidCount[_buyer][_limitForBuyerID];
    }

    function _getInputHash(
        uint256 bidPrice,
        uint256 limitForBuyerID,
        uint256 limitForBuyerAmount,
        uint256 expireTime
    ) internal view returns (bytes32) {
        return
            keccak256(
                abi.encodePacked(
                    msg.sender,
                    bidPrice,
                    limitForBuyerID,
                    limitForBuyerAmount,
                    expireTime,
                    block.chainid,
                    address(this)
                )
            );
    }

    function _checkSigValidity(
        bytes32 hash,
        bytes memory sig,
        address signer
    ) internal pure {
        require(
            signer == ECDSA.recover(_getEthSignedMessageHash(hash), sig),
            "RaffleAuctionMinter: invalid signature"
        );
    }

    function _getEthSignedMessageHash(
        bytes32 criteriaMessageHash
    ) internal pure returns (bytes32) {
        return ECDSA.toEthSignedMessageHash(criteriaMessageHash);
    }

    function generateRandomNumber(uint256 userInput) public view returns (uint256) {
        uint256 randomNumber = uint256(
            keccak256(
                abi.encodePacked(
                    blockhash(block.number - 1), // Use the hash value of the previous block as a seed
                    block.timestamp, // Use the current block's timestamp as a seed
                    userInput // Use the user input as a seed
                )
            )
        );
        return randomNumber;
    }

}

File 2 of 16 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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:
 *
 * ```solidity
 * 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}:
 *
 * ```solidity
 * 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. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
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 16 : 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 16 : 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 5 of 16 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 6 of 16 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32")
            mstore(0x1c, hash)
            message := keccak256(0x00, 0x3c)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, "\x19\x01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            data := keccak256(ptr, 0x42)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Data with intended validator, created from a
     * `validator` and `data` according to the version 0 of EIP-191.
     *
     * See {recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x00", validator, data));
    }
}

File 7 of 16 : 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 8 of 16 : 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 9 of 16 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 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 256, 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 << 3) < value ? 1 : 0);
        }
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

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

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.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 `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

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

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 12 of 16 : IERC1155Gateway.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IERC1155Gateway {
    /********************************************************************
     *                        ERC1155 interfaces                        *
     ********************************************************************/

    /**
     * @dev Mint ERC1155 tokens.
     * @param account receiver of the minted tokens
     * @param id id of tokens to be minted
     * @param amount amount of tokens to be minted
     */
    function ERC1155_mint(
        address nftContract,
        address account,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) external;

    /**
     * @dev Mint a batch of ERC1155 tokens.
     *
     * See {ERC1155_mint}
     */
    function ERC1155_mintBatch(
        address nftContract,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) external;

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

File 13 of 16 : IERC20Gateway.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IERC20Gateway {
    /********************************************************************
     *                         ERC20 interfaces                         *
     ********************************************************************/

    /**
     * @dev Mint some ERC20 tokens to the recipient address.
     * @notice Only gateway contract is authorized to mint.
     * @param recipient The recipient of the minted ERC20 tokens.
     * @param amount The amount to be minted.
     */
    function ERC20_mint(
        address erc20Contract,
        address recipient,
        uint256 amount
    ) external;
}

File 14 of 16 : IERC721Gateway.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IERC721Gateway {
    /********************************************************************
     *                        ERC721 interfaces                         *
     ********************************************************************/

    /**
     * @dev Mint an ERC721 token to the given address.
     * @notice Only gateway contract is authorized to mint.
     * @param recipient The recipient of the minted NFT.
     * @param tokenId The tokenId to be minted.
     */
    function ERC721_mint(
        address nftContract,
        address recipient,
        uint256 tokenId
    ) external;

    function ERC721_mintBatch(
        address nftContract,
        address recipient,
        uint256[] calldata tokenId
    ) external;

    /**
     * @dev Set `baseURI` of the ERC721 token. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`.
     */
    function ERC721_setURI(address nftContract, string memory newURI) external;
}

File 15 of 16 : IGateway.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IERC721Gateway.sol";
import "./IERC1155Gateway.sol";
import "./IERC20Gateway.sol";

interface IGateway is IERC721Gateway, IERC1155Gateway, IERC20Gateway {
    function operatorWhitelist(address _operator) external view returns (bool);

    function setManagerOf(address _nftContract, address _manager) external;

    function nftManager(address _nftContract) external view returns (address);

    function isInManagement(
        address _x,
        address _tokenContract
    ) external view returns (bool);

    function pause(address _contract) external;

    function unpause(address _contract) external;
}

File 16 of 16 : RaffleBidHeap.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library RaffleBidHeap {
    struct Bid {
        uint256 id;
        address bidder;
        uint256 price;
        uint256 timestamp;
        uint256 nonce;
    }

    struct Heap {
        // These variables should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637

        uint256 _maxCapacity;
        Bid[] _tree;
    }

    function initialize(Heap storage heap, uint256 cap) internal {
        require(heap._maxCapacity == 0, "BidHeap: duplicated initialize");
        heap._maxCapacity = cap;
    }

    function isFull(Heap storage heap) internal view returns (bool) {
        return heap._tree.length >= heap._maxCapacity;
    }

    function size(Heap storage heap) internal view returns (uint256) {
        return heap._tree.length;
    }

    function minBid(Heap storage heap) internal view returns (Bid memory) {
        require(heap._tree.length > 0, "BidHeap: heap is empty");
        return heap._tree[0];
    }

    function tryInsert(
        Heap storage heap,
        Bid memory newBid
    ) internal returns (bool) {
        if (isFull(heap)) {
            if (!isHigherOrEqualBid(newBid, heap._tree[0])) {
                return false;
            }
            heap._tree[0] = newBid;
            heapifyDown(heap, 0);
        } else {
            heap._tree.push(newBid);
            heapifyUp(heap, heap._tree.length - 1);
        }
        return true;
    }

    function heapifyUp(Heap storage heap, uint256 index) private {
        while (index > 0) {
            uint256 parentIndex = (index - 1) / 2;
            if (
                isHigherOrEqualBid(heap._tree[index], heap._tree[parentIndex])
            ) {
                break;
            }

            swap(heap, index, parentIndex);
            index = parentIndex;
        }
    }

    function heapifyDown(Heap storage heap, uint256 index) private {
        uint256 smallest = index;

        while (true) {
            uint256 leftChild = 2 * index + 1;
            uint256 rightChild = 2 * index + 2;
            if (
                leftChild < heap._tree.length &&
                isHigherOrEqualBid(heap._tree[smallest], heap._tree[leftChild])
            ) {
                smallest = leftChild;
            }
            if (
                rightChild < heap._tree.length &&
                isHigherOrEqualBid(heap._tree[smallest], heap._tree[rightChild])
            ) {
                smallest = rightChild;
            }
            if (smallest == index) {
                break;
            }
            swap(heap, smallest, index);
            index = smallest;
        }
    }

    function isHigherOrEqualBid(
        Bid memory _b1,
        Bid memory _b2
    ) internal pure returns (bool) {
        return _b1.price > _b2.price ||
            (_b1.price == _b2.price && _b1.nonce < _b2.nonce) ||
            (_b1.price == _b2.price && _b1.nonce == _b2.nonce && _b1.id <= _b2.id);
    }

    function swap(Heap storage heap, uint256 index1, uint256 index2) private {
        Bid memory temp = heap._tree[index1];
        heap._tree[index1] = heap._tree[index2];
        heap._tree[index2] = temp;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address","name":"_gateway","type":"address"},{"internalType":"address","name":"_nftAddress","type":"address"},{"internalType":"address","name":"_paymentRecipient","type":"address"},{"internalType":"uint256","name":"_nftAmount","type":"uint256"},{"internalType":"uint256","name":"_auctionEndTime","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"bidPrice","type":"uint256"}],"name":"Bid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"refundAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nftCount","type":"uint256"}],"name":"Claim","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":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_BID_PER_USER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionEndTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimAndRefund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_a","type":"address"}],"name":"claimInfo","outputs":[{"components":[{"internalType":"bool","name":"hasClaimed","type":"bool"},{"internalType":"uint256","name":"refundAmount","type":"uint256"},{"internalType":"uint256","name":"nftCount","type":"uint256"}],"internalType":"struct RaffleAuctionMinter.ClaimInfo","name":"info","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"floorBid","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct RaffleBidHeap.Bid","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gateway","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"userInput","type":"uint256"}],"name":"generateRandomNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_buyer","type":"address"},{"internalType":"uint256","name":"_limitForBuyerID","type":"uint256"}],"name":"getBidAmtByBuyerId","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":[],"name":"getTotalBidsCnt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"getUserBids","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct RaffleBidHeap.Bid[][]","name":"bids","type":"tuple[][]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"getUserClaimInfos","outputs":[{"components":[{"internalType":"bool","name":"hasClaimed","type":"bool"},{"internalType":"uint256","name":"refundAmount","type":"uint256"},{"internalType":"uint256","name":"nftCount","type":"uint256"}],"internalType":"struct RaffleAuctionMinter.ClaimInfo[]","name":"results","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"hasClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"highestBidPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentSent","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"bidPrice","type":"uint256"},{"internalType":"uint256","name":"limitForBuyerID","type":"uint256"},{"internalType":"uint256","name":"limitForBuyerAmount","type":"uint256"},{"internalType":"uint256","name":"expireTime","type":"uint256"},{"internalType":"bytes","name":"_sig","type":"bytes"}],"name":"placeBid","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sendPayment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_t","type":"uint256"}],"name":"setAuctionEndTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_g","type":"address"}],"name":"setGateway","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"setNftAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_r","type":"address"}],"name":"setRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tvl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userBids","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b5060405162002c6238038062002c628339810160408190526200003491620001f7565b62000041600087620000d2565b6200005c60008051602062002c4283398151915287620000d2565b6200007760008051602062002c4283398151915233620000d2565b600480546001600160a01b038088166001600160a01b0319928316179092556005805487841690831617905560068054928616929091169190911790556007819055620000c6600183620000e2565b50505050505062000266565b620000de82826200013a565b5050565b815415620001365760405162461bcd60e51b815260206004820152601e60248201527f426964486561703a206475706c69636174656420696e697469616c697a650000604482015260640160405180910390fd5b9055565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000de576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001963390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b80516001600160a01b0381168114620001f257600080fd5b919050565b60008060008060008060c087890312156200021157600080fd5b6200021c87620001da565b95506200022c60208801620001da565b94506200023c60408801620001da565b93506200024c60608801620001da565b92506080870151915060a087015190509295509295509295565b6129cc80620002766000396000f3fe6080604052600436106101e75760003560e01c80636a54e8301161010257806396ec50c311610095578063d97830b111610064578063d97830b1146105ec578063e5328e0614610619578063ec87621c1461062c578063feee55d11461066057600080fd5b806396ec50c31461054d578063a217fddf1461059d578063b99f218e146105b2578063d547741f146105cc57600080fd5b80638fafa963116100d15780638fafa963146104b357806390646b4a146104e057806391d148541461050057806396de34201461052057600080fd5b80636a54e8301461043957806373b2e80e1461044e578063886f9ece1461047e5780638bbbe1af1461049157600080fd5b80633bbed4a01161017a5780635bf8633a116101495780635bf8633a146103cf578063607e2737146103ef5780636720ceb11461040457806368e845551461041957600080fd5b80633bbed4a0146103635780634303707e1461038357806345cb3f4d146103a35780634b449cba146103b957600080fd5b8063248a9ca3116101b6578063248a9ca3146102d35780632b1eaf29146103035780632f2ff15d1461032357806336568abe1461034357600080fd5b806301ffc9a7146101f35780630b102d1a14610228578063116191b61461024a57806321e6b0d31461028257600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b5061021361020e36600461245e565b610675565b60405190151581526020015b60405180910390f35b34801561023457600080fd5b5061024861024336600461249d565b6106ac565b005b34801561025657600080fd5b5060045461026a906001600160a01b031681565b6040516001600160a01b03909116815260200161021f565b34801561028e57600080fd5b506102c561029d3660046124ba565b6001600160a01b03919091166000908152600a60209081526040808320938352929052205490565b60405190815260200161021f565b3480156102df57600080fd5b506102c56102ee3660046124e6565b60009081526020819052604090206001015490565b34801561030f57600080fd5b5060065461026a906001600160a01b031681565b34801561032f57600080fd5b5061024861033e3660046124ff565b6106f9565b34801561034f57600080fd5b5061024861035e3660046124ff565b610723565b34801561036f57600080fd5b5061024861037e36600461249d565b6107a6565b34801561038f57600080fd5b506102c561039e3660046124e6565b6107d4565b3480156103af57600080fd5b506102c5600b5481565b3480156103c557600080fd5b506102c560075481565b3480156103db57600080fd5b5060055461026a906001600160a01b031681565b3480156103fb57600080fd5b5061024861081b565b34801561041057600080fd5b50610248610b16565b34801561042557600080fd5b506102486104343660046124e6565b610cee565b34801561044557600080fd5b506102c5610dd9565b34801561045a57600080fd5b5061021361046936600461249d565b60096020526000908152604090205460ff1681565b61024861048c36600461252f565b610de9565b34801561049d57600080fd5b506104a6611250565b60405161021f91906125c7565b3480156104bf57600080fd5b506104d36104ce366004612605565b611262565b60405161021f919061267a565b3480156104ec57600080fd5b506102486104fb36600461249d565b611343565b34801561050c57600080fd5b5061021361051b3660046124ff565b611371565b34801561052c57600080fd5b5061054061053b366004612605565b61139a565b60405161021f91906126de565b34801561055957600080fd5b5061056d6105683660046124ba565b6114fc565b604080519586526001600160a01b039094166020860152928401919091526060830152608082015260a00161021f565b3480156105a957600080fd5b506102c5600081565b3480156105be57600080fd5b50600c546102139060ff1681565b3480156105d857600080fd5b506102486105e73660046124ff565b611554565b3480156105f857600080fd5b5061060c61060736600461249d565b611579565b60405161021f91906127a3565b34801561062557600080fd5b50476102c5565b34801561063857600080fd5b506102c57f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b34801561066c57600080fd5b506102c5603281565b60006001600160e01b03198216637965db0b60e01b14806106a657506301ffc9a760e01b6001600160e01b03198316145b92915050565b7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b086106d68161176f565b50600580546001600160a01b0319166001600160a01b0392909216919091179055565b6000828152602081905260409020600101546107148161176f565b61071e838361177c565b505050565b6001600160a01b03811633146107985760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6107a28282611800565b5050565b60006107b18161176f565b50600680546001600160a01b0319166001600160a01b0392909216919091179055565b6000806107e26001436127dc565b604080519140602083015242908201526060810184905260800160408051601f1981840301815291905280516020909101209392505050565b60075442116108a05760405162461bcd60e51b8152602060048201526044602482018190527f526166666c6541756374696f6e4d696e7465723a204e6f20636c61696d73206f908201527f7220726566756e647320616c6c6f77656420756e74696c2061756374696f6e20606482015263656e647360e01b608482015260a40161078f565b60006108ab33611579565b8051909150156108fd5760405162461bcd60e51b815260206004820181905260248201527f526166666c6541756374696f6e4d696e7465723a2068617320636c61696d6564604482015260640161078f565b600081604001511180610914575060008160200151115b61096e5760405162461bcd60e51b815260206004820152602560248201527f526166666c6541756374696f6e4d696e7465723a206e6f7468696e6720746f20604482015264636c61696d60d81b606482015260840161078f565b336000908152600960205260408120805460ff191660011790555b8160400151811015610a18576004805460055460405163ec1b14ab60e01b81526001600160a01b039182169381019390935233602484015260006044840152169063ec1b14ab90606401600060405180830381600087803b1580156109ed57600080fd5b505af1158015610a01573d6000803e3d6000fd5b505050508080610a10906127ef565b915050610989565b50602081015160405160009133918381818185875af1925050503d8060008114610a5e576040519150601f19603f3d011682016040523d82523d6000602084013e610a63565b606091505b5050905080610ac75760405162461bcd60e51b815260206004820152602a60248201527f526166666c6541756374696f6e4d696e7465723a206661696c656420746f2073604482015269195b99081c99599d5b9960b21b606482015260840161078f565b6020820151604080840151905133927f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf792610b0a92918252602082015260400190565b60405180910390a25050565b6007544211610b9f5760405162461bcd60e51b815260206004820152604960248201527f526166666c6541756374696f6e4d696e7465723a207061796d656e742063616e60448201527f206f6e6c79206265206d616465206166746572207468652061756374696f6e206064820152681a185cc8195b99195960ba1b608482015260a40161078f565b600c5460ff1615610c045760405162461bcd60e51b815260206004820152602960248201527f526166666c6541756374696f6e4d696e7465723a207061796d656e7420616c726044820152681958591e481cd95b9d60ba1b606482015260840161078f565b6000610c106001611865565b60400151600254610c219190612808565b6006546040519192506000916001600160a01b039091169083908381818185875af1925050503d8060008114610c73576040519150601f19603f3d011682016040523d82523d6000602084013e610c78565b606091505b5050905080610cdd5760405162461bcd60e51b815260206004820152602b60248201527f526166666c6541756374696f6e4d696e7465723a206661696c656420746f207360448201526a195b99081c185e5b595b9d60aa1b606482015260840161078f565b5050600c805460ff19166001179055565b7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08610d188161176f565b428211610d765760405162461bcd60e51b815260206004820152602660248201527f526166666c6541756374696f6e4d696e7465723a20696e76616c69642074696d6044820152650657374616d760d41b606482015260840161078f565b600754421115610dd35760405162461bcd60e51b815260206004820152602260248201527f526166666c6541756374696f6e4d696e7465723a20616c726561647920656e64604482015261195960f21b606482015260840161078f565b50600755565b6000610de460035490565b905090565b6040805133606090811b6bffffffffffffffffffffffff19908116602080850191909152603484018b9052605484018a905260748401899052609484018890524660b48501523090921b1660d4830152825160c881840301815260e8909201909252805191012060009060048054600554604051639cb9f9d360e01b81526001600160a01b03918216938101939093529293506000921690639cb9f9d390602401602060405180830381865afa158015610ea7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecb919061281f565b9050610f0f8285858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250611927915050565b84421115610f6e5760405162461bcd60e51b815260206004820152602660248201527f526166666c6541756374696f6e4d696e7465723a207369676e617475726520656044820152651e1c1a5c995960d21b606482015260840161078f565b600754421115610fcb5760405162461bcd60e51b815260206004820152602260248201527f526166666c6541756374696f6e4d696e7465723a2061756374696f6e20656e64604482015261195960f21b606482015260840161078f565b336000908152600860205260409020546032116110445760405162461bcd60e51b815260206004820152603160248201527f526166666c6541756374696f6e4d696e7465723a206d6178696d756d20626964604482015270081c195c881d5cd95c881c995858da1959607a1b606482015260840161078f565b336000908152600a602090815260408083208a845290915290205486116110bf5760405162461bcd60e51b815260206004820152602960248201527f526166666c6541756374696f6e4d696e7465723a206275796572206c696d697460448201526808195e18d95959195960ba1b606482015260840161078f565b87341461111c5760405162461bcd60e51b815260206004820152602560248201527f526166666c6541756374696f6e4d696e7465723a207061796d656e74206d69736044820152640dac2e8c6d60db1b606482015260840161078f565b336000908152600a602090815260408083208a8452909152812080546001929061114790849061283c565b909155505060038054600101905560006040518060a0016040528061116b60035490565b8152336020820152604081018b905242606082015260800161118f61039e60035490565b90523360009081526008602090815260408083208054600180820183559185529383902085516005909502019384559184015183830180546001600160a01b0319166001600160a01b03909216919091179055830151600283015560608301516003830155608083015160049092019190915590915061120f90826119a8565b5060405189815233907fe684a55f31b79eca403df938249029212a5925ec6be8012e099b45bc1019e5d29060200160405180910390a2505050505050505050565b611258612426565b610de46001611865565b60608167ffffffffffffffff81111561127d5761127d61284f565b6040519080825280602002602001820160405280156112d457816020015b6112c1604051806060016040528060001515815260200160008152602001600081525090565b81526020019060019003908161129b5790505b50905060005b8281101561133c5761130c8484838181106112f7576112f7612865565b9050602002016020810190610607919061249d565b82828151811061131e5761131e612865565b60200260200101819052508080611334906127ef565b9150506112da565b5092915050565b600061134e8161176f565b50600480546001600160a01b0319166001600160a01b0392909216919091179055565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60608167ffffffffffffffff8111156113b5576113b561284f565b6040519080825280602002602001820160405280156113e857816020015b60608152602001906001900390816113d35790505b50905060005b8281101561133c576008600085858481811061140c5761140c612865565b9050602002016020810190611421919061249d565b6001600160a01b03166001600160a01b03168152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156114c85760008481526020908190206040805160a08101825260058602909201805483526001808201546001600160a01b031684860152600282015492840192909252600381015460608401526004015460808301529083529092019101611461565b505050508282815181106114de576114de612865565b602002602001018190525080806114f4906127ef565b9150506113ee565b6008602052816000526040600020818154811061151857600080fd5b6000918252602090912060059091020180546001820154600283015460038401546004909401549295506001600160a01b039091169350919085565b60008281526020819052604090206001015461156f8161176f565b61071e8383611800565b61159f604051806060016040528060001515815260200160008152602001600081525090565b6001600160a01b03821660009081526009602090815260408083205460ff161515845290830182905282018190526115d76001611865565b905060005b6001600160a01b038416600090815260086020526040902054811015611768576001600160a01b0384166000908152600860205260409020805461168591908390811061162b5761162b612865565b60009182526020918290206040805160a08101825260059093029091018054835260018101546001600160a01b03169383019390935260028301549082015260038201546060820152600490910154608082015283611b3d565b156117055760018360400181815161169d919061283c565b9052506040808301516001600160a01b03861660009081526008602052919091208054839081106116d0576116d0612865565b9060005260206000209060050201600201546116ec91906127dc565b836020018181516116fd919061283c565b905250611756565b6001600160a01b038416600090815260086020526040902080548290811061172f5761172f612865565b90600052602060002090600502016002015483602001818151611752919061283c565b9052505b80611760816127ef565b9150506115dc565b5050919050565b6117798133611ba7565b50565b6117868282611371565b6107a2576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556117bc3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61180a8282611371565b156107a2576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b61186d612426565b60018201546118b75760405162461bcd60e51b8152602060048201526016602482015275426964486561703a206865617020697320656d70747960501b604482015260640161078f565b816001016000815481106118cd576118cd612865565b60009182526020918290206040805160a08101825260059093029091018054835260018101546001600160a01b03169383019390935260028301549082015260038201546060820152600490910154608082015292915050565b61193961193384611c00565b83611c34565b6001600160a01b0316816001600160a01b03161461071e5760405162461bcd60e51b815260206004820152602660248201527f526166666c6541756374696f6e4d696e7465723a20696e76616c6964207369676044820152656e617475726560d01b606482015260840161078f565b8154600183015460009111611aba57611a2a82846001016000815481106119d1576119d1612865565b60009182526020918290206040805160a08101825260059093029091018054835260018101546001600160a01b031693830193909352600283015490820152600382015460608201526004909101546080820152611b3d565b611a36575060006106a6565b8183600101600081548110611a4d57611a4d612865565b600091825260208083208451600593909302019182558301516001820180546001600160a01b0319166001600160a01b039092169190911790556040830151600282015560608301516003820155608090920151600490920191909155611ab5908490611c58565b611b34565b6001838101805480830182556000828152602090819020865160059093020191825585015181840180546001600160a01b0319166001600160a01b039092169190911790556040850151600282015560608501516003820155608085015160049091015554611b34918591611b2f91906127dc565b611de6565b50600192915050565b6000816040015183604001511180611b6e575081604001518360400151148015611b6e575081608001518360800151105b80611ba0575081604001518360400151148015611b92575081608001518360800151145b8015611ba057508151835111155b9392505050565b611bb18282611371565b6107a257611bbe81611ea6565b611bc9836020611eb8565b604051602001611bda92919061289f565b60408051601f198184030181529082905262461bcd60e51b825261078f91600401612914565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c829052603c81206106a6565b6000806000611c438585612054565b91509150611c5081612099565b509392505050565b805b6000611c67836002612808565b611c7290600161283c565b90506000611c81846002612808565b611c8c90600261283c565b600186015490915082108015611d205750611d20856001018481548110611cb557611cb5612865565b60009182526020918290206040805160a0810182526005909302909101805483526001808201546001600160a01b031694840194909452600281015491830191909152600381015460608301526004015460808201529087018054859081106119d1576119d1612865565b15611d29578192505b600185015481108015611dba5750611dba856001018481548110611d4f57611d4f612865565b60009182526020918290206040805160a0810182526005909302909101805483526001808201546001600160a01b031694840194909452600281015491830191909152600381015460608301526004015460808201529087018054849081106119d1576119d1612865565b15611dc3578092505b838303611dd1575050505050565b611ddc8584866121e3565b8293505050611c5a565b80156107a25760006002611dfb6001846127dc565b611e059190612947565b9050611e8a836001018381548110611e1f57611e1f612865565b60009182526020918290206040805160a0810182526005909302909101805483526001808201546001600160a01b031694840194909452600281015491830191909152600381015460608301526004015460808201529085018054849081106119d1576119d1612865565b15611e9457505050565b611e9f8383836121e3565b9050611de6565b60606106a66001600160a01b03831660145b60606000611ec7836002612808565b611ed290600261283c565b67ffffffffffffffff811115611eea57611eea61284f565b6040519080825280601f01601f191660200182016040528015611f14576020820181803683370190505b509050600360fc1b81600081518110611f2f57611f2f612865565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611f5e57611f5e612865565b60200101906001600160f81b031916908160001a9053506000611f82846002612808565b611f8d90600161283c565b90505b6001811115612005576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611fc157611fc1612865565b1a60f81b828281518110611fd757611fd7612865565b60200101906001600160f81b031916908160001a90535060049490941c93611ffe81612969565b9050611f90565b508315611ba05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161078f565b600080825160410361208a5760208301516040840151606085015160001a61207e87828585612362565b94509450505050612092565b506000905060025b9250929050565b60008160048111156120ad576120ad612980565b036120b55750565b60018160048111156120c9576120c9612980565b036121165760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161078f565b600281600481111561212a5761212a612980565b036121775760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161078f565b600381600481111561218b5761218b612980565b036117795760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161078f565b60008360010183815481106121fa576121fa612865565b60009182526020918290206040805160a0810182526005909302909101805483526001808201546001600160a01b031694840194909452600281015491830191909152600381015460608301526004015460808201529085018054919250908390811061226957612269612865565b906000526020600020906005020184600101848154811061228c5761228c612865565b60009182526020909120825460059092020190815560018083015481830180546001600160a01b0319166001600160a01b0390921691909117905560028084015490830155600380840154908301556004928301549290910191909155840180548291908490811061230057612300612865565b6000918252602091829020835160059290920201908155908201516001820180546001600160a01b0319166001600160a01b03909216919091179055604082015160028201556060820151600382015560809091015160049091015550505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612399575060009050600361241d565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156123ed573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166124165760006001925092505061241d565b9150600090505b94509492505050565b6040518060a001604052806000815260200160006001600160a01b031681526020016000815260200160008152602001600081525090565b60006020828403121561247057600080fd5b81356001600160e01b031981168114611ba057600080fd5b6001600160a01b038116811461177957600080fd5b6000602082840312156124af57600080fd5b8135611ba081612488565b600080604083850312156124cd57600080fd5b82356124d881612488565b946020939093013593505050565b6000602082840312156124f857600080fd5b5035919050565b6000806040838503121561251257600080fd5b82359150602083013561252481612488565b809150509250929050565b60008060008060008060a0878903121561254857600080fd5b86359550602087013594506040870135935060608701359250608087013567ffffffffffffffff8082111561257c57600080fd5b818901915089601f83011261259057600080fd5b81358181111561259f57600080fd5b8a60208285010111156125b157600080fd5b6020830194508093505050509295509295509295565b815181526020808301516001600160a01b03169082015260408083015190820152606080830151908201526080808301519082015260a081016106a6565b6000806020838503121561261857600080fd5b823567ffffffffffffffff8082111561263057600080fd5b818501915085601f83011261264457600080fd5b81358181111561265357600080fd5b8660208260051b850101111561266857600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b818110156126d2576126bf83855180511515825260208082015190830152604090810151910152565b9284019260609290920191600101612696565b50909695505050505050565b6000602080830181845280855180835260408601915060408160051b87010192508387016000805b8381101561279557888603603f19018552825180518088529088019088880190845b8181101561277f5761276c838551805182526020808201516001600160a01b0316908301526040808201519083015260608082015190830152608090810151910152565b928a019260a09290920191600101612728565b5090975050509386019391860191600101612706565b509398975050505050505050565b8151151581526020808301519082015260408083015190820152606081016106a6565b634e487b7160e01b600052601160045260246000fd5b818103818111156106a6576106a66127c6565b600060018201612801576128016127c6565b5060010190565b80820281158282048414176106a6576106a66127c6565b60006020828403121561283157600080fd5b8151611ba081612488565b808201808211156106a6576106a66127c6565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60005b8381101561289657818101518382015260200161287e565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516128d781601785016020880161287b565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161290881602884016020880161287b565b01602801949350505050565b602081526000825180602084015261293381604085016020870161287b565b601f01601f19169190910160400192915050565b60008261296457634e487b7160e01b600052601260045260246000fd5b500490565b600081612978576129786127c6565b506000190190565b634e487b7160e01b600052602160045260246000fdfea26469706673582212209d70b82e13b204e5de8031fe52e2af5748974f199afc49c3797722257e016a4264736f6c63430008130033241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b080000000000000000000000002100c6ba5361f4afa29c5d187ae5e0cd5a0f9cf60000000000000000000000007127f0feaef8143241a5fac62ac5b7be02ef26a9000000000000000000000000babafdd8045740449a42b788a26e9b3a32f88ac1000000000000000000000000f67ad8ff23aafc109cb004cf6eec6fb51076659100000000000000000000000000000000000000000000000000000000000016bf0000000000000000000000000000000000000000000000000000000065d7e03c

Deployed Bytecode

0x6080604052600436106101e75760003560e01c80636a54e8301161010257806396ec50c311610095578063d97830b111610064578063d97830b1146105ec578063e5328e0614610619578063ec87621c1461062c578063feee55d11461066057600080fd5b806396ec50c31461054d578063a217fddf1461059d578063b99f218e146105b2578063d547741f146105cc57600080fd5b80638fafa963116100d15780638fafa963146104b357806390646b4a146104e057806391d148541461050057806396de34201461052057600080fd5b80636a54e8301461043957806373b2e80e1461044e578063886f9ece1461047e5780638bbbe1af1461049157600080fd5b80633bbed4a01161017a5780635bf8633a116101495780635bf8633a146103cf578063607e2737146103ef5780636720ceb11461040457806368e845551461041957600080fd5b80633bbed4a0146103635780634303707e1461038357806345cb3f4d146103a35780634b449cba146103b957600080fd5b8063248a9ca3116101b6578063248a9ca3146102d35780632b1eaf29146103035780632f2ff15d1461032357806336568abe1461034357600080fd5b806301ffc9a7146101f35780630b102d1a14610228578063116191b61461024a57806321e6b0d31461028257600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b5061021361020e36600461245e565b610675565b60405190151581526020015b60405180910390f35b34801561023457600080fd5b5061024861024336600461249d565b6106ac565b005b34801561025657600080fd5b5060045461026a906001600160a01b031681565b6040516001600160a01b03909116815260200161021f565b34801561028e57600080fd5b506102c561029d3660046124ba565b6001600160a01b03919091166000908152600a60209081526040808320938352929052205490565b60405190815260200161021f565b3480156102df57600080fd5b506102c56102ee3660046124e6565b60009081526020819052604090206001015490565b34801561030f57600080fd5b5060065461026a906001600160a01b031681565b34801561032f57600080fd5b5061024861033e3660046124ff565b6106f9565b34801561034f57600080fd5b5061024861035e3660046124ff565b610723565b34801561036f57600080fd5b5061024861037e36600461249d565b6107a6565b34801561038f57600080fd5b506102c561039e3660046124e6565b6107d4565b3480156103af57600080fd5b506102c5600b5481565b3480156103c557600080fd5b506102c560075481565b3480156103db57600080fd5b5060055461026a906001600160a01b031681565b3480156103fb57600080fd5b5061024861081b565b34801561041057600080fd5b50610248610b16565b34801561042557600080fd5b506102486104343660046124e6565b610cee565b34801561044557600080fd5b506102c5610dd9565b34801561045a57600080fd5b5061021361046936600461249d565b60096020526000908152604090205460ff1681565b61024861048c36600461252f565b610de9565b34801561049d57600080fd5b506104a6611250565b60405161021f91906125c7565b3480156104bf57600080fd5b506104d36104ce366004612605565b611262565b60405161021f919061267a565b3480156104ec57600080fd5b506102486104fb36600461249d565b611343565b34801561050c57600080fd5b5061021361051b3660046124ff565b611371565b34801561052c57600080fd5b5061054061053b366004612605565b61139a565b60405161021f91906126de565b34801561055957600080fd5b5061056d6105683660046124ba565b6114fc565b604080519586526001600160a01b039094166020860152928401919091526060830152608082015260a00161021f565b3480156105a957600080fd5b506102c5600081565b3480156105be57600080fd5b50600c546102139060ff1681565b3480156105d857600080fd5b506102486105e73660046124ff565b611554565b3480156105f857600080fd5b5061060c61060736600461249d565b611579565b60405161021f91906127a3565b34801561062557600080fd5b50476102c5565b34801561063857600080fd5b506102c57f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b34801561066c57600080fd5b506102c5603281565b60006001600160e01b03198216637965db0b60e01b14806106a657506301ffc9a760e01b6001600160e01b03198316145b92915050565b7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b086106d68161176f565b50600580546001600160a01b0319166001600160a01b0392909216919091179055565b6000828152602081905260409020600101546107148161176f565b61071e838361177c565b505050565b6001600160a01b03811633146107985760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6107a28282611800565b5050565b60006107b18161176f565b50600680546001600160a01b0319166001600160a01b0392909216919091179055565b6000806107e26001436127dc565b604080519140602083015242908201526060810184905260800160408051601f1981840301815291905280516020909101209392505050565b60075442116108a05760405162461bcd60e51b8152602060048201526044602482018190527f526166666c6541756374696f6e4d696e7465723a204e6f20636c61696d73206f908201527f7220726566756e647320616c6c6f77656420756e74696c2061756374696f6e20606482015263656e647360e01b608482015260a40161078f565b60006108ab33611579565b8051909150156108fd5760405162461bcd60e51b815260206004820181905260248201527f526166666c6541756374696f6e4d696e7465723a2068617320636c61696d6564604482015260640161078f565b600081604001511180610914575060008160200151115b61096e5760405162461bcd60e51b815260206004820152602560248201527f526166666c6541756374696f6e4d696e7465723a206e6f7468696e6720746f20604482015264636c61696d60d81b606482015260840161078f565b336000908152600960205260408120805460ff191660011790555b8160400151811015610a18576004805460055460405163ec1b14ab60e01b81526001600160a01b039182169381019390935233602484015260006044840152169063ec1b14ab90606401600060405180830381600087803b1580156109ed57600080fd5b505af1158015610a01573d6000803e3d6000fd5b505050508080610a10906127ef565b915050610989565b50602081015160405160009133918381818185875af1925050503d8060008114610a5e576040519150601f19603f3d011682016040523d82523d6000602084013e610a63565b606091505b5050905080610ac75760405162461bcd60e51b815260206004820152602a60248201527f526166666c6541756374696f6e4d696e7465723a206661696c656420746f2073604482015269195b99081c99599d5b9960b21b606482015260840161078f565b6020820151604080840151905133927f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf792610b0a92918252602082015260400190565b60405180910390a25050565b6007544211610b9f5760405162461bcd60e51b815260206004820152604960248201527f526166666c6541756374696f6e4d696e7465723a207061796d656e742063616e60448201527f206f6e6c79206265206d616465206166746572207468652061756374696f6e206064820152681a185cc8195b99195960ba1b608482015260a40161078f565b600c5460ff1615610c045760405162461bcd60e51b815260206004820152602960248201527f526166666c6541756374696f6e4d696e7465723a207061796d656e7420616c726044820152681958591e481cd95b9d60ba1b606482015260840161078f565b6000610c106001611865565b60400151600254610c219190612808565b6006546040519192506000916001600160a01b039091169083908381818185875af1925050503d8060008114610c73576040519150601f19603f3d011682016040523d82523d6000602084013e610c78565b606091505b5050905080610cdd5760405162461bcd60e51b815260206004820152602b60248201527f526166666c6541756374696f6e4d696e7465723a206661696c656420746f207360448201526a195b99081c185e5b595b9d60aa1b606482015260840161078f565b5050600c805460ff19166001179055565b7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08610d188161176f565b428211610d765760405162461bcd60e51b815260206004820152602660248201527f526166666c6541756374696f6e4d696e7465723a20696e76616c69642074696d6044820152650657374616d760d41b606482015260840161078f565b600754421115610dd35760405162461bcd60e51b815260206004820152602260248201527f526166666c6541756374696f6e4d696e7465723a20616c726561647920656e64604482015261195960f21b606482015260840161078f565b50600755565b6000610de460035490565b905090565b6040805133606090811b6bffffffffffffffffffffffff19908116602080850191909152603484018b9052605484018a905260748401899052609484018890524660b48501523090921b1660d4830152825160c881840301815260e8909201909252805191012060009060048054600554604051639cb9f9d360e01b81526001600160a01b03918216938101939093529293506000921690639cb9f9d390602401602060405180830381865afa158015610ea7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecb919061281f565b9050610f0f8285858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250611927915050565b84421115610f6e5760405162461bcd60e51b815260206004820152602660248201527f526166666c6541756374696f6e4d696e7465723a207369676e617475726520656044820152651e1c1a5c995960d21b606482015260840161078f565b600754421115610fcb5760405162461bcd60e51b815260206004820152602260248201527f526166666c6541756374696f6e4d696e7465723a2061756374696f6e20656e64604482015261195960f21b606482015260840161078f565b336000908152600860205260409020546032116110445760405162461bcd60e51b815260206004820152603160248201527f526166666c6541756374696f6e4d696e7465723a206d6178696d756d20626964604482015270081c195c881d5cd95c881c995858da1959607a1b606482015260840161078f565b336000908152600a602090815260408083208a845290915290205486116110bf5760405162461bcd60e51b815260206004820152602960248201527f526166666c6541756374696f6e4d696e7465723a206275796572206c696d697460448201526808195e18d95959195960ba1b606482015260840161078f565b87341461111c5760405162461bcd60e51b815260206004820152602560248201527f526166666c6541756374696f6e4d696e7465723a207061796d656e74206d69736044820152640dac2e8c6d60db1b606482015260840161078f565b336000908152600a602090815260408083208a8452909152812080546001929061114790849061283c565b909155505060038054600101905560006040518060a0016040528061116b60035490565b8152336020820152604081018b905242606082015260800161118f61039e60035490565b90523360009081526008602090815260408083208054600180820183559185529383902085516005909502019384559184015183830180546001600160a01b0319166001600160a01b03909216919091179055830151600283015560608301516003830155608083015160049092019190915590915061120f90826119a8565b5060405189815233907fe684a55f31b79eca403df938249029212a5925ec6be8012e099b45bc1019e5d29060200160405180910390a2505050505050505050565b611258612426565b610de46001611865565b60608167ffffffffffffffff81111561127d5761127d61284f565b6040519080825280602002602001820160405280156112d457816020015b6112c1604051806060016040528060001515815260200160008152602001600081525090565b81526020019060019003908161129b5790505b50905060005b8281101561133c5761130c8484838181106112f7576112f7612865565b9050602002016020810190610607919061249d565b82828151811061131e5761131e612865565b60200260200101819052508080611334906127ef565b9150506112da565b5092915050565b600061134e8161176f565b50600480546001600160a01b0319166001600160a01b0392909216919091179055565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60608167ffffffffffffffff8111156113b5576113b561284f565b6040519080825280602002602001820160405280156113e857816020015b60608152602001906001900390816113d35790505b50905060005b8281101561133c576008600085858481811061140c5761140c612865565b9050602002016020810190611421919061249d565b6001600160a01b03166001600160a01b03168152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156114c85760008481526020908190206040805160a08101825260058602909201805483526001808201546001600160a01b031684860152600282015492840192909252600381015460608401526004015460808301529083529092019101611461565b505050508282815181106114de576114de612865565b602002602001018190525080806114f4906127ef565b9150506113ee565b6008602052816000526040600020818154811061151857600080fd5b6000918252602090912060059091020180546001820154600283015460038401546004909401549295506001600160a01b039091169350919085565b60008281526020819052604090206001015461156f8161176f565b61071e8383611800565b61159f604051806060016040528060001515815260200160008152602001600081525090565b6001600160a01b03821660009081526009602090815260408083205460ff161515845290830182905282018190526115d76001611865565b905060005b6001600160a01b038416600090815260086020526040902054811015611768576001600160a01b0384166000908152600860205260409020805461168591908390811061162b5761162b612865565b60009182526020918290206040805160a08101825260059093029091018054835260018101546001600160a01b03169383019390935260028301549082015260038201546060820152600490910154608082015283611b3d565b156117055760018360400181815161169d919061283c565b9052506040808301516001600160a01b03861660009081526008602052919091208054839081106116d0576116d0612865565b9060005260206000209060050201600201546116ec91906127dc565b836020018181516116fd919061283c565b905250611756565b6001600160a01b038416600090815260086020526040902080548290811061172f5761172f612865565b90600052602060002090600502016002015483602001818151611752919061283c565b9052505b80611760816127ef565b9150506115dc565b5050919050565b6117798133611ba7565b50565b6117868282611371565b6107a2576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556117bc3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61180a8282611371565b156107a2576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b61186d612426565b60018201546118b75760405162461bcd60e51b8152602060048201526016602482015275426964486561703a206865617020697320656d70747960501b604482015260640161078f565b816001016000815481106118cd576118cd612865565b60009182526020918290206040805160a08101825260059093029091018054835260018101546001600160a01b03169383019390935260028301549082015260038201546060820152600490910154608082015292915050565b61193961193384611c00565b83611c34565b6001600160a01b0316816001600160a01b03161461071e5760405162461bcd60e51b815260206004820152602660248201527f526166666c6541756374696f6e4d696e7465723a20696e76616c6964207369676044820152656e617475726560d01b606482015260840161078f565b8154600183015460009111611aba57611a2a82846001016000815481106119d1576119d1612865565b60009182526020918290206040805160a08101825260059093029091018054835260018101546001600160a01b031693830193909352600283015490820152600382015460608201526004909101546080820152611b3d565b611a36575060006106a6565b8183600101600081548110611a4d57611a4d612865565b600091825260208083208451600593909302019182558301516001820180546001600160a01b0319166001600160a01b039092169190911790556040830151600282015560608301516003820155608090920151600490920191909155611ab5908490611c58565b611b34565b6001838101805480830182556000828152602090819020865160059093020191825585015181840180546001600160a01b0319166001600160a01b039092169190911790556040850151600282015560608501516003820155608085015160049091015554611b34918591611b2f91906127dc565b611de6565b50600192915050565b6000816040015183604001511180611b6e575081604001518360400151148015611b6e575081608001518360800151105b80611ba0575081604001518360400151148015611b92575081608001518360800151145b8015611ba057508151835111155b9392505050565b611bb18282611371565b6107a257611bbe81611ea6565b611bc9836020611eb8565b604051602001611bda92919061289f565b60408051601f198184030181529082905262461bcd60e51b825261078f91600401612914565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c829052603c81206106a6565b6000806000611c438585612054565b91509150611c5081612099565b509392505050565b805b6000611c67836002612808565b611c7290600161283c565b90506000611c81846002612808565b611c8c90600261283c565b600186015490915082108015611d205750611d20856001018481548110611cb557611cb5612865565b60009182526020918290206040805160a0810182526005909302909101805483526001808201546001600160a01b031694840194909452600281015491830191909152600381015460608301526004015460808201529087018054859081106119d1576119d1612865565b15611d29578192505b600185015481108015611dba5750611dba856001018481548110611d4f57611d4f612865565b60009182526020918290206040805160a0810182526005909302909101805483526001808201546001600160a01b031694840194909452600281015491830191909152600381015460608301526004015460808201529087018054849081106119d1576119d1612865565b15611dc3578092505b838303611dd1575050505050565b611ddc8584866121e3565b8293505050611c5a565b80156107a25760006002611dfb6001846127dc565b611e059190612947565b9050611e8a836001018381548110611e1f57611e1f612865565b60009182526020918290206040805160a0810182526005909302909101805483526001808201546001600160a01b031694840194909452600281015491830191909152600381015460608301526004015460808201529085018054849081106119d1576119d1612865565b15611e9457505050565b611e9f8383836121e3565b9050611de6565b60606106a66001600160a01b03831660145b60606000611ec7836002612808565b611ed290600261283c565b67ffffffffffffffff811115611eea57611eea61284f565b6040519080825280601f01601f191660200182016040528015611f14576020820181803683370190505b509050600360fc1b81600081518110611f2f57611f2f612865565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611f5e57611f5e612865565b60200101906001600160f81b031916908160001a9053506000611f82846002612808565b611f8d90600161283c565b90505b6001811115612005576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611fc157611fc1612865565b1a60f81b828281518110611fd757611fd7612865565b60200101906001600160f81b031916908160001a90535060049490941c93611ffe81612969565b9050611f90565b508315611ba05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161078f565b600080825160410361208a5760208301516040840151606085015160001a61207e87828585612362565b94509450505050612092565b506000905060025b9250929050565b60008160048111156120ad576120ad612980565b036120b55750565b60018160048111156120c9576120c9612980565b036121165760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161078f565b600281600481111561212a5761212a612980565b036121775760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161078f565b600381600481111561218b5761218b612980565b036117795760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161078f565b60008360010183815481106121fa576121fa612865565b60009182526020918290206040805160a0810182526005909302909101805483526001808201546001600160a01b031694840194909452600281015491830191909152600381015460608301526004015460808201529085018054919250908390811061226957612269612865565b906000526020600020906005020184600101848154811061228c5761228c612865565b60009182526020909120825460059092020190815560018083015481830180546001600160a01b0319166001600160a01b0390921691909117905560028084015490830155600380840154908301556004928301549290910191909155840180548291908490811061230057612300612865565b6000918252602091829020835160059290920201908155908201516001820180546001600160a01b0319166001600160a01b03909216919091179055604082015160028201556060820151600382015560809091015160049091015550505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612399575060009050600361241d565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156123ed573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166124165760006001925092505061241d565b9150600090505b94509492505050565b6040518060a001604052806000815260200160006001600160a01b031681526020016000815260200160008152602001600081525090565b60006020828403121561247057600080fd5b81356001600160e01b031981168114611ba057600080fd5b6001600160a01b038116811461177957600080fd5b6000602082840312156124af57600080fd5b8135611ba081612488565b600080604083850312156124cd57600080fd5b82356124d881612488565b946020939093013593505050565b6000602082840312156124f857600080fd5b5035919050565b6000806040838503121561251257600080fd5b82359150602083013561252481612488565b809150509250929050565b60008060008060008060a0878903121561254857600080fd5b86359550602087013594506040870135935060608701359250608087013567ffffffffffffffff8082111561257c57600080fd5b818901915089601f83011261259057600080fd5b81358181111561259f57600080fd5b8a60208285010111156125b157600080fd5b6020830194508093505050509295509295509295565b815181526020808301516001600160a01b03169082015260408083015190820152606080830151908201526080808301519082015260a081016106a6565b6000806020838503121561261857600080fd5b823567ffffffffffffffff8082111561263057600080fd5b818501915085601f83011261264457600080fd5b81358181111561265357600080fd5b8660208260051b850101111561266857600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b818110156126d2576126bf83855180511515825260208082015190830152604090810151910152565b9284019260609290920191600101612696565b50909695505050505050565b6000602080830181845280855180835260408601915060408160051b87010192508387016000805b8381101561279557888603603f19018552825180518088529088019088880190845b8181101561277f5761276c838551805182526020808201516001600160a01b0316908301526040808201519083015260608082015190830152608090810151910152565b928a019260a09290920191600101612728565b5090975050509386019391860191600101612706565b509398975050505050505050565b8151151581526020808301519082015260408083015190820152606081016106a6565b634e487b7160e01b600052601160045260246000fd5b818103818111156106a6576106a66127c6565b600060018201612801576128016127c6565b5060010190565b80820281158282048414176106a6576106a66127c6565b60006020828403121561283157600080fd5b8151611ba081612488565b808201808211156106a6576106a66127c6565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60005b8381101561289657818101518382015260200161287e565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516128d781601785016020880161287b565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161290881602884016020880161287b565b01602801949350505050565b602081526000825180602084015261293381604085016020870161287b565b601f01601f19169190910160400192915050565b60008261296457634e487b7160e01b600052601260045260246000fd5b500490565b600081612978576129786127c6565b506000190190565b634e487b7160e01b600052602160045260246000fdfea26469706673582212209d70b82e13b204e5de8031fe52e2af5748974f199afc49c3797722257e016a4264736f6c63430008130033

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

0000000000000000000000002100c6ba5361f4afa29c5d187ae5e0cd5a0f9cf60000000000000000000000007127f0feaef8143241a5fac62ac5b7be02ef26a9000000000000000000000000babafdd8045740449a42b788a26e9b3a32f88ac1000000000000000000000000f67ad8ff23aafc109cb004cf6eec6fb51076659100000000000000000000000000000000000000000000000000000000000016bf0000000000000000000000000000000000000000000000000000000065d7e03c

-----Decoded View---------------
Arg [0] : _admin (address): 0x2100c6Ba5361f4Afa29c5d187aE5E0Cd5a0F9CF6
Arg [1] : _gateway (address): 0x7127f0FEaEF8143241A5FaC62aC5b7be02Ef26A9
Arg [2] : _nftAddress (address): 0xbAbaFdd8045740449a42B788a26E9b3A32F88aC1
Arg [3] : _paymentRecipient (address): 0xf67Ad8Ff23aaFc109Cb004cF6EeC6fb510766591
Arg [4] : _nftAmount (uint256): 5823
Arg [5] : _auctionEndTime (uint256): 1708646460

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000002100c6ba5361f4afa29c5d187ae5e0cd5a0f9cf6
Arg [1] : 0000000000000000000000007127f0feaef8143241a5fac62ac5b7be02ef26a9
Arg [2] : 000000000000000000000000babafdd8045740449a42b788a26e9b3a32f88ac1
Arg [3] : 000000000000000000000000f67ad8ff23aafc109cb004cf6eec6fb510766591
Arg [4] : 00000000000000000000000000000000000000000000000000000000000016bf
Arg [5] : 0000000000000000000000000000000000000000000000000000000065d7e03c


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.