ETH Price: $3,331.62 (-1.36%)

Contract

0x7da31b1e87A90DE2e7176368d6b4bb6CEADC6e4E
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Release Tokens214644902024-12-23 10:08:111 hr ago1734948491IN
0x7da31b1e...CEADC6e4E
0 ETH0.000733258.13208574
Release Tokens214623632024-12-23 2:59:358 hrs ago1734922775IN
0x7da31b1e...CEADC6e4E
0 ETH0.000593715.52620873
Release Tokens214615932024-12-23 0:24:4711 hrs ago1734913487IN
0x7da31b1e...CEADC6e4E
0 ETH0.00095825.47678653
Release Tokens214604372024-12-22 20:31:1115 hrs ago1734899471IN
0x7da31b1e...CEADC6e4E
0 ETH0.000595616.59343033
Release Tokens214598592024-12-22 18:34:5917 hrs ago1734892499IN
0x7da31b1e...CEADC6e4E
0 ETH0.000827647.70353991
Release Tokens214590112024-12-22 15:44:2319 hrs ago1734882263IN
0x7da31b1e...CEADC6e4E
0 ETH0.000636187.04156357
Release Tokens214588792024-12-22 15:17:5920 hrs ago1734880679IN
0x7da31b1e...CEADC6e4E
0 ETH0.002108169.3466786
Release Tokens214582692024-12-22 13:15:2322 hrs ago1734873323IN
0x7da31b1e...CEADC6e4E
0 ETH0.000666237.38877413
Release Tokens214575312024-12-22 10:46:3524 hrs ago1734864395IN
0x7da31b1e...CEADC6e4E
0 ETH0.000527645.84023229
Release Tokens214557122024-12-22 4:40:4731 hrs ago1734842447IN
0x7da31b1e...CEADC6e4E
0 ETH0.000554735.16335486
Release Tokens214554992024-12-22 3:57:4731 hrs ago1734839867IN
0x7da31b1e...CEADC6e4E
0 ETH0.003127895
Release Tokens214553082024-12-22 3:19:3532 hrs ago1734837575IN
0x7da31b1e...CEADC6e4E
0 ETH0.000642795.99240317
Release Tokens214547072024-12-22 1:18:5934 hrs ago1734830339IN
0x7da31b1e...CEADC6e4E
0 ETH0.000626516.25965955
Release Tokens214533352024-12-21 20:41:4739 hrs ago1734813707IN
0x7da31b1e...CEADC6e4E
0 ETH0.000703587.78753035
Release Tokens214532572024-12-21 20:26:1139 hrs ago1734812771IN
0x7da31b1e...CEADC6e4E
0 ETH0.000681037.53794278
Release Tokens214527722024-12-21 18:48:2340 hrs ago1734806903IN
0x7da31b1e...CEADC6e4E
0 ETH0.0013288410.70010853
Release Tokens214506772024-12-21 11:46:4747 hrs ago1734781607IN
0x7da31b1e...CEADC6e4E
0 ETH0.002065458.11071528
Release Tokens214492222024-12-21 6:54:232 days ago1734764063IN
0x7da31b1e...CEADC6e4E
0 ETH0.001320879.3382149
Release Tokens214490322024-12-21 6:16:112 days ago1734761771IN
0x7da31b1e...CEADC6e4E
0 ETH0.001245718.23031653
Release Tokens214487982024-12-21 5:28:592 days ago1734758939IN
0x7da31b1e...CEADC6e4E
0 ETH0.000974646.89047698
Release Tokens214472192024-12-21 0:08:592 days ago1734739739IN
0x7da31b1e...CEADC6e4E
0 ETH0.001238413.70719456
Release Tokens214469302024-12-20 23:10:592 days ago1734736259IN
0x7da31b1e...CEADC6e4E
0 ETH0.0011469811.4395001
Release Tokens214460202024-12-20 20:08:232 days ago1734725303IN
0x7da31b1e...CEADC6e4E
0 ETH0.0016175316.16128087
Release Tokens214459322024-12-20 19:50:472 days ago1734724247IN
0x7da31b1e...CEADC6e4E
0 ETH0.0017998219.92126746
Release Tokens214456872024-12-20 19:01:352 days ago1734721295IN
0x7da31b1e...CEADC6e4E
0 ETH0.0022823218.3794504
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PortalCreepzVesting

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 12 : PortalCreepzVesting.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Ownable2Step} from "@openzeppelin/contracts/access/Ownable2Step.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";

interface ICreepzNFT is IERC721 {
    function stakedAtTimestamp(uint256 tokenId) external view returns (uint256);
}

/// @dev Struct and associated functionality for carrying a split of token rewards between treasury and NFT owner.
library Rewards {
    struct Split {
        uint256 treasury;
        uint256 creepzOwner;
    }

    function add(Split memory a, Split memory b) internal pure {
        a.treasury += b.treasury;
        a.creepzOwner += b.creepzOwner;
    }
}

/// @dev Events abstracted for use in tests.
interface IPortalCreepzVestingEvents {
    event RewardForTokenReleased(uint256 indexed tokenId, uint256 treasuryReward, uint256 creepzReward);
}

/**
 * @title PortalCreepzVesting
 * @dev Contract for vesting rewards for Creepz nfts. Users get linear access to their tokens within a given vesting period.
 * If user claims for creepz that is not staked, all rewards go to treasury.
 */
contract PortalCreepzVesting is ReentrancyGuard, Ownable2Step, IPortalCreepzVestingEvents {
    using Rewards for Rewards.Split;
    using SafeERC20 for IERC20;

    // External contracts to interact with
    ICreepzNFT public immutable creepzNFT;
    IERC20 public immutable token;
    address public immutable treasury;

    // Vesting parameters
    uint256 public constant ALLOCATION = 2697.6 ether;
    uint256 public constant DURATION = 365 days / 12 * 9;
    uint256 public startTimestamp;
    uint256 public endTimestamp;

    // Timestamps at which a claim was last made for each Creepz NFT ID.
    mapping(uint256 => uint256) public lastClaimedAt;

    // Errors
    error InvalidTokenIds();
    error MsgSenderNotCreepzOwner(uint256 tokenId, address owner);
    error TokenTransferFailed();
    error TimestampAlreadySet();

    /**
     * @notice Constructor to initialize the contract with CreepzNFT and Token contracts, treasury address and start timestamp for vesting
     * @param _creepzNFT Address of the CreepzNFT contract
     * @param _token Address of the token contract
     * @param _startTimestamp Start timestamp for vesting
     * @param _treasury Address of the treasury
     */
    constructor(ICreepzNFT _creepzNFT, IERC20 _token, uint256 _startTimestamp, address _treasury, address _owner) {
        creepzNFT = _creepzNFT;
        token = _token;
        treasury = _treasury;

        _setStartTimestamp(_startTimestamp);
        _transferOwnership(_owner);
    }

    /**
     * @notice Function for users to claim their vested tokens. Only token owners can claim their vested tokens.
     * @param creepzIds Creepz NFT IDs to claim the vested tokens for.
     */
    function releaseTokens(uint256[] calldata creepzIds) external nonReentrant {
        if (creepzIds.length > 50 || creepzIds.length == 0) {
            revert InvalidTokenIds();
        }

        Rewards.Split memory total;
        for (uint256 i = 0; i < creepzIds.length; ++i) {
            total.add(_releaseTokensForCreepzId(creepzIds[i]));
        }

        if (total.treasury > 0) {
            token.safeTransfer(treasury, total.treasury);
        }
        if (total.creepzOwner > 0) {
            token.safeTransfer(msg.sender, total.creepzOwner);
        }
    }

    /**
     * @notice Function to calculate the claimable amount for multiple token IDs
     * @param tokenIds Token IDs to calculate the claimable amount for; IDs MUST be distinct.
     * @return total Total claimable amount for the token IDs
     */
    function claimableAmountForTokens(uint256[] calldata tokenIds) external view returns (uint256 total) {
        for (uint256 i = 0; i < tokenIds.length; i++) {
            total += _getReleasableTokensForCreepzId(tokenIds[i]).creepzOwner;
        }
    }

    /**
     * @notice Function to calculate the claimable amount for a single token ID
     * @param tokenId Token ID to calculate the claimable amount for
     * @return claimable Claimable amount for the token ID
     */
    function claimableAmount(uint256 tokenId) external view returns (uint256) {
        return _getReleasableTokensForCreepzId(tokenId).creepzOwner;
    }

    /**
     * @notice Function to set the start timestamp for vesting. Can be changed before the start timestamp is reached.
     * @param _startTimestamp New start timestamp for vesting
     */
    function setStartTimestamp(uint256 _startTimestamp) public onlyOwner {
        _setStartTimestamp(_startTimestamp);
    }

    /**
     * @notice Function to withdraw tokens from the contract in case of emergency
     */
    function emergencyWithdraw(uint256 amount) external onlyOwner {
        token.safeTransfer(treasury, amount);
    }

    /**
     * @notice Internal function to set the start timestamp for vesting
     */
    function _setStartTimestamp(uint256 _startTimestamp) internal {
        if (startTimestamp != 0 && block.timestamp > startTimestamp) {
            revert TimestampAlreadySet();
        }
        startTimestamp = _startTimestamp;
        endTimestamp = _startTimestamp + DURATION;
    }

    /**
     * @notice Internal function to release the tokens for a single token ID.
     * @dev Updates the `lastClaimedAt` value for the ID, but does NOT transfer tokens.
     * @param creepzId Token ID to release the tokens for
     * @return Claimable amount split by treasury and user
     */
    function _releaseTokensForCreepzId(uint256 creepzId) internal returns (Rewards.Split memory) {
        address owner = creepzNFT.ownerOf(creepzId);
        if (owner != msg.sender) {
            revert MsgSenderNotCreepzOwner(creepzId, owner);
        }

        Rewards.Split memory split = _getReleasableTokensForCreepzId(creepzId);
        lastClaimedAt[creepzId] = Math.min(endTimestamp, block.timestamp);

        emit RewardForTokenReleased(creepzId, split.treasury, split.creepzOwner);
        return split;
    }

    /**
     * @notice Internal view function to calculate the claimable amount for a single token ID
     * @param creepzId Token ID to calculate the claimable amount for
     * @return Claimable amount split by treasury and user
     */
    function _getReleasableTokensForCreepzId(uint256 creepzId) internal view returns (Rewards.Split memory) {
        if (block.timestamp <= startTimestamp || startTimestamp == 0) {
            return Rewards.Split(0, 0);
        }

        uint256 last = Math.max(startTimestamp, lastClaimedAt[creepzId]);
        uint256 end = Math.min(endTimestamp, block.timestamp);
        uint256 stakedAt = Math.min(end, creepzNFT.stakedAtTimestamp(creepzId));

        uint256 alloc = _getAllocationForCreepz(creepzId);
        if (stakedAt == 0) {
            // Unstaked Creepz' rewards go to the treasury.
            return Rewards.Split({treasury: _calculateReward(alloc, last, end), creepzOwner: 0});
        }
        if (stakedAt <= last) {
            // Staked for the entire period.
            return Rewards.Split({treasury: 0, creepzOwner: _calculateReward(alloc, last, end)});
        }
        return Rewards.Split({
            // Split the above at the point of staking.
            treasury: _calculateReward(alloc, last, stakedAt),
            creepzOwner: _calculateReward(alloc, stakedAt, end)
        });
    }

    /**
     * @notice Internal view function to calculate the reward for a given time period
     * @param rewardPerCreepz Reward per Creepz in wei
     * @param rewardStart Start timestamp for the reward
     * @param rewardEnd End timestamp for the reward
     * @return reward Total reward for the given time period
     */
    function _calculateReward(uint256 rewardPerCreepz, uint256 rewardStart, uint256 rewardEnd)
        internal
        pure
        returns (uint256)
    {
        assert(rewardEnd >= rewardStart);
        uint256 elapsedTime = rewardEnd - rewardStart;
        return (elapsedTime * rewardPerCreepz) / DURATION;
    }

    /**
     * @notice Internal function to check if a token ID is a 1-1 creepz. Hardcoded for gas optimization
     * @param tokenId Token ID to check if it is a special creepz
     */
    function _isSpecialCreepz(uint256 tokenId) internal pure returns (bool) {
        return (
            tokenId == 132 || tokenId == 700 || tokenId == 1887 || tokenId == 2899 || tokenId == 3925 || tokenId == 5751
                || tokenId == 7680 || tokenId == 8283 || tokenId == 10349 || tokenId == 10725
        );
    }

    /**
     * @notice Internal view function to calculate vested amount for a user
     * @param tokenId Creepz ID to get the allocation for
     */
    function _getAllocationForCreepz(uint256 tokenId) internal pure returns (uint256) {
        if (_isSpecialCreepz(tokenId)) {
            return ALLOCATION * 2;
        }
        return ALLOCATION;
    }
}

File 2 of 12 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

File 3 of 12 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

File 4 of 12 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

File 5 of 12 : Ownable2Step.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.0;

import "./Ownable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

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

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

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
        _transferOwnership(sender);
    }
}

File 6 of 12 : 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 7 of 12 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

File 8 of 12 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 9 of 12 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 10 of 12 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 11 of 12 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 12 of 12 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

Settings
{
  "remappings": [
    "@layerzero-contracts/=lib/solidity-examples/contracts/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@Chainlink/=lib/chainlink-brownie-contracts/contracts/",
    "@prb/math/=lib/prb-math/",
    "@sstore2/=lib/sstore2/",
    "@prb/test/=lib/prb-math/node_modules/@prb/test/",
    "chainlink-brownie-contracts/=lib/chainlink-brownie-contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "prb-math/=lib/prb-math/src/",
    "solidity-examples/=lib/solidity-examples/contracts/",
    "solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/",
    "sstore2/=lib/sstore2/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract ICreepzNFT","name":"_creepzNFT","type":"address"},{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"uint256","name":"_startTimestamp","type":"uint256"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidTokenIds","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"MsgSenderNotCreepzOwner","type":"error"},{"inputs":[],"name":"TimestampAlreadySet","type":"error"},{"inputs":[],"name":"TokenTransferFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"treasuryReward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"creepzReward","type":"uint256"}],"name":"RewardForTokenReleased","type":"event"},{"inputs":[],"name":"ALLOCATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"claimableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"claimableAmountForTokens","outputs":[{"internalType":"uint256","name":"total","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"creepzNFT","outputs":[{"internalType":"contract ICreepzNFT","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lastClaimedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"creepzIds","type":"uint256[]"}],"name":"releaseTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startTimestamp","type":"uint256"}],"name":"setStartTimestamp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60e06040523480156200001157600080fd5b50604051620012fe380380620012fe833981016040819052620000349162000151565b600160005562000044336200007e565b6001600160a01b0380861660805284811660a052821660c05262000068836200009c565b62000073816200007e565b5050505050620001ed565b600280546001600160a01b03191690556200009981620000e9565b50565b60035415801590620000af575060035442115b15620000ce57604051631f09b56f60e01b815260040160405180910390fd5b6003819055620000e3630168e6a082620001c5565b60045550565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03811681146200009957600080fd5b600080600080600060a086880312156200016a57600080fd5b855162000177816200013b565b60208701519095506200018a816200013b565b604087015160608801519195509350620001a4816200013b565b6080870151909250620001b7816200013b565b809150509295509295909350565b80820180821115620001e757634e487b7160e01b600052601160045260246000fd5b92915050565b60805160a05160c0516110b06200024e600039600081816101860152818161033b015261055201526000818161028c015281816103190152818161052f01526105940152600081816101e801528181610645015261090701526110b06000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c8063889646ea116100a2578063e30c397811610071578063e30c397814610247578063e6fd48bc14610258578063f2fde38b14610261578063f7e1e3d314610274578063fc0c546a1461028757600080fd5b8063889646ea1461020a5780638da5cb5b1461021a578063a85adeab1461022b578063c44bef751461023457600080fd5b806361d027b3116100e957806361d027b3146101815780636cfe0ad1146101c0578063715018a6146101d357806379ba5097146101db578063822ab3b2146101e357600080fd5b80631be052891461011b5780632426a84f1461013957806352e123d31461014c5780635312ea8e1461016c575b600080fd5b610126630168e6a081565b6040519081526020015b60405180910390f35b610126610147366004610e2e565b6102ae565b61012661015a366004610ea3565b60056020526000908152604090205481565b61017f61017a366004610ea3565b610304565b005b6101a87f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610130565b6101266101ce366004610ea3565b610363565b61017f610378565b61017f61038c565b6101a87f000000000000000000000000000000000000000000000000000000000000000081565b61012668923cb86b80adc0000081565b6001546001600160a01b03166101a8565b61012660045481565b61017f610242366004610ea3565b610408565b6002546001600160a01b03166101a8565b61012660035481565b61017f61026f366004610ed1565b610419565b61017f610282366004610e2e565b61048a565b6101a87f000000000000000000000000000000000000000000000000000000000000000081565b6000805b828110156102fd576102db8484838181106102cf576102cf610ef5565b905060200201356105cb565b602001516102e99083610f21565b9150806102f581610f34565b9150506102b2565b5092915050565b61030c61076e565b6103606001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000836107c8565b50565b600061036e826105cb565b6020015192915050565b61038061076e565b61038a600061081f565b565b60025433906001600160a01b031681146103ff5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b6103608161081f565b61041061076e565b61036081610838565b61042161076e565b600280546001600160a01b0383166001600160a01b031990911681179091556104526001546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b610492610881565b603281118061049f575080155b156104bd5760405163340bc4c960e01b815260040160405180910390fd5b604080518082019091526000808252602082015260005b82811015610517576105076105008585848181106104f4576104f4610ef5565b905060200201356108da565b8390610a33565b61051081610f34565b90506104d4565b50805115610577578051610577906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016907f0000000000000000000000000000000000000000000000000000000000000000906107c8565b6020810151156105bc5760208101516105bc906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169033906107c8565b506105c76001600055565b5050565b6040805180820190915260008082526020820152600354421115806105f05750600354155b1561060e575050604080518082019091526000808252602082015290565b600354600083815260056020526040812054909161062b91610a64565b9050600061063b60045442610a7e565b905060006106d7827f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166399ff4f53886040518263ffffffff1660e01b815260040161069191815260200190565b602060405180830381865afa1580156106ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d29190610f4d565b610a7e565b905060006106e486610a8d565b905081600003610718576040518060400160405280610704838787610ac1565b815260006020909101529695505050505050565b8382116107485760405180604001604052806000815260200161073c838787610ac1565b90529695505050505050565b604051806040016040528061075e838786610ac1565b815260200161073c838587610ac1565b6001546001600160a01b0316331461038a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103f6565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261081a908490610b03565b505050565b600280546001600160a01b031916905561036081610bd8565b6003541580159061084a575060035442115b1561086857604051631f09b56f60e01b815260040160405180910390fd5b600381905561087b630168e6a082610f21565b60045550565b6002600054036108d35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103f6565b6002600055565b60408051808201909152600080825260208201526040516331a9108f60e11b8152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015610956573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097a9190610f66565b90506001600160a01b03811633146109b7576040516364ffe31d60e11b8152600481018490526001600160a01b03821660248201526044016103f6565b60006109c2846105cb565b90506109d060045442610a7e565b60008581526005602090815260409182902092909255825191830151905186927f50e744e30514626ee3a8dd835ab25461924c5b9d25142480ee0785346b866e8692610a2492918252602082015260400190565b60405180910390a29392505050565b805182518390610a44908390610f21565b9052506020808201519083018051610a5d908390610f21565b9052505050565b6000818311610a735781610a75565b825b90505b92915050565b6000818310610a735781610a75565b6000610a9882610c2a565b15610ab157610a7868923cb86b80adc000006002610f83565b5068923cb86b80adc00000919050565b600082821015610ad357610ad3610f9a565b6000610adf8484610fb0565b9050630168e6a0610af08683610f83565b610afa9190610fc3565b95945050505050565b6000610b58826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c9e9092919063ffffffff16565b9050805160001480610b79575080806020019051810190610b799190610fe5565b61081a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103f6565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008160841480610c3c5750816102bc145b80610c4857508161075f145b80610c54575081610b53145b80610c60575081610f55145b80610c6c575081611677145b80610c78575081611e00145b80610c8457508161205b145b80610c9057508161286d145b80610a785750506129e51490565b6060610cad8484600085610cb5565b949350505050565b606082471015610d165760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103f6565b600080866001600160a01b03168587604051610d32919061102b565b60006040518083038185875af1925050503d8060008114610d6f576040519150601f19603f3d011682016040523d82523d6000602084013e610d74565b606091505b5091509150610d8587838387610d90565b979650505050505050565b60608315610dff578251600003610df8576001600160a01b0385163b610df85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103f6565b5081610cad565b610cad8383815115610e145781518083602001fd5b8060405162461bcd60e51b81526004016103f69190611047565b60008060208385031215610e4157600080fd5b823567ffffffffffffffff80821115610e5957600080fd5b818501915085601f830112610e6d57600080fd5b813581811115610e7c57600080fd5b8660208260051b8501011115610e9157600080fd5b60209290920196919550909350505050565b600060208284031215610eb557600080fd5b5035919050565b6001600160a01b038116811461036057600080fd5b600060208284031215610ee357600080fd5b8135610eee81610ebc565b9392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7857610a78610f0b565b600060018201610f4657610f46610f0b565b5060010190565b600060208284031215610f5f57600080fd5b5051919050565b600060208284031215610f7857600080fd5b8151610eee81610ebc565b8082028115828204841417610a7857610a78610f0b565b634e487b7160e01b600052600160045260246000fd5b81810381811115610a7857610a78610f0b565b600082610fe057634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215610ff757600080fd5b81518015158114610eee57600080fd5b60005b8381101561102257818101518382015260200161100a565b50506000910152565b6000825161103d818460208701611007565b9190910192915050565b6020815260008251806020840152611066816040850160208701611007565b601f01601f1916919091016040019291505056fea26469706673582212202a0bf33ceb7a445180b85dc3e65e263f9d789a53e89461d8feac3d0f782b85a864736f6c634300081400330000000000000000000000005946aeaab44e65eb370ffaa6a7ef2218cff9b47d0000000000000000000000001bbe973bef3a977fc51cbed703e8ffdefe001fed000000000000000000000000000000000000000000000000000000006607db9800000000000000000000000067e13c87e3b7f2004b42fda01d617b2db8e7d90a000000000000000000000000370a976ecf1b02dd8f56279d55d85c946f4a3fc6

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101165760003560e01c8063889646ea116100a2578063e30c397811610071578063e30c397814610247578063e6fd48bc14610258578063f2fde38b14610261578063f7e1e3d314610274578063fc0c546a1461028757600080fd5b8063889646ea1461020a5780638da5cb5b1461021a578063a85adeab1461022b578063c44bef751461023457600080fd5b806361d027b3116100e957806361d027b3146101815780636cfe0ad1146101c0578063715018a6146101d357806379ba5097146101db578063822ab3b2146101e357600080fd5b80631be052891461011b5780632426a84f1461013957806352e123d31461014c5780635312ea8e1461016c575b600080fd5b610126630168e6a081565b6040519081526020015b60405180910390f35b610126610147366004610e2e565b6102ae565b61012661015a366004610ea3565b60056020526000908152604090205481565b61017f61017a366004610ea3565b610304565b005b6101a87f00000000000000000000000067e13c87e3b7f2004b42fda01d617b2db8e7d90a81565b6040516001600160a01b039091168152602001610130565b6101266101ce366004610ea3565b610363565b61017f610378565b61017f61038c565b6101a87f0000000000000000000000005946aeaab44e65eb370ffaa6a7ef2218cff9b47d81565b61012668923cb86b80adc0000081565b6001546001600160a01b03166101a8565b61012660045481565b61017f610242366004610ea3565b610408565b6002546001600160a01b03166101a8565b61012660035481565b61017f61026f366004610ed1565b610419565b61017f610282366004610e2e565b61048a565b6101a87f0000000000000000000000001bbe973bef3a977fc51cbed703e8ffdefe001fed81565b6000805b828110156102fd576102db8484838181106102cf576102cf610ef5565b905060200201356105cb565b602001516102e99083610f21565b9150806102f581610f34565b9150506102b2565b5092915050565b61030c61076e565b6103606001600160a01b037f0000000000000000000000001bbe973bef3a977fc51cbed703e8ffdefe001fed167f00000000000000000000000067e13c87e3b7f2004b42fda01d617b2db8e7d90a836107c8565b50565b600061036e826105cb565b6020015192915050565b61038061076e565b61038a600061081f565b565b60025433906001600160a01b031681146103ff5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b6103608161081f565b61041061076e565b61036081610838565b61042161076e565b600280546001600160a01b0383166001600160a01b031990911681179091556104526001546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b610492610881565b603281118061049f575080155b156104bd5760405163340bc4c960e01b815260040160405180910390fd5b604080518082019091526000808252602082015260005b82811015610517576105076105008585848181106104f4576104f4610ef5565b905060200201356108da565b8390610a33565b61051081610f34565b90506104d4565b50805115610577578051610577906001600160a01b037f0000000000000000000000001bbe973bef3a977fc51cbed703e8ffdefe001fed16907f00000000000000000000000067e13c87e3b7f2004b42fda01d617b2db8e7d90a906107c8565b6020810151156105bc5760208101516105bc906001600160a01b037f0000000000000000000000001bbe973bef3a977fc51cbed703e8ffdefe001fed169033906107c8565b506105c76001600055565b5050565b6040805180820190915260008082526020820152600354421115806105f05750600354155b1561060e575050604080518082019091526000808252602082015290565b600354600083815260056020526040812054909161062b91610a64565b9050600061063b60045442610a7e565b905060006106d7827f0000000000000000000000005946aeaab44e65eb370ffaa6a7ef2218cff9b47d6001600160a01b03166399ff4f53886040518263ffffffff1660e01b815260040161069191815260200190565b602060405180830381865afa1580156106ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d29190610f4d565b610a7e565b905060006106e486610a8d565b905081600003610718576040518060400160405280610704838787610ac1565b815260006020909101529695505050505050565b8382116107485760405180604001604052806000815260200161073c838787610ac1565b90529695505050505050565b604051806040016040528061075e838786610ac1565b815260200161073c838587610ac1565b6001546001600160a01b0316331461038a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103f6565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261081a908490610b03565b505050565b600280546001600160a01b031916905561036081610bd8565b6003541580159061084a575060035442115b1561086857604051631f09b56f60e01b815260040160405180910390fd5b600381905561087b630168e6a082610f21565b60045550565b6002600054036108d35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103f6565b6002600055565b60408051808201909152600080825260208201526040516331a9108f60e11b8152600481018390526000907f0000000000000000000000005946aeaab44e65eb370ffaa6a7ef2218cff9b47d6001600160a01b031690636352211e90602401602060405180830381865afa158015610956573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097a9190610f66565b90506001600160a01b03811633146109b7576040516364ffe31d60e11b8152600481018490526001600160a01b03821660248201526044016103f6565b60006109c2846105cb565b90506109d060045442610a7e565b60008581526005602090815260409182902092909255825191830151905186927f50e744e30514626ee3a8dd835ab25461924c5b9d25142480ee0785346b866e8692610a2492918252602082015260400190565b60405180910390a29392505050565b805182518390610a44908390610f21565b9052506020808201519083018051610a5d908390610f21565b9052505050565b6000818311610a735781610a75565b825b90505b92915050565b6000818310610a735781610a75565b6000610a9882610c2a565b15610ab157610a7868923cb86b80adc000006002610f83565b5068923cb86b80adc00000919050565b600082821015610ad357610ad3610f9a565b6000610adf8484610fb0565b9050630168e6a0610af08683610f83565b610afa9190610fc3565b95945050505050565b6000610b58826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c9e9092919063ffffffff16565b9050805160001480610b79575080806020019051810190610b799190610fe5565b61081a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103f6565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008160841480610c3c5750816102bc145b80610c4857508161075f145b80610c54575081610b53145b80610c60575081610f55145b80610c6c575081611677145b80610c78575081611e00145b80610c8457508161205b145b80610c9057508161286d145b80610a785750506129e51490565b6060610cad8484600085610cb5565b949350505050565b606082471015610d165760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103f6565b600080866001600160a01b03168587604051610d32919061102b565b60006040518083038185875af1925050503d8060008114610d6f576040519150601f19603f3d011682016040523d82523d6000602084013e610d74565b606091505b5091509150610d8587838387610d90565b979650505050505050565b60608315610dff578251600003610df8576001600160a01b0385163b610df85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103f6565b5081610cad565b610cad8383815115610e145781518083602001fd5b8060405162461bcd60e51b81526004016103f69190611047565b60008060208385031215610e4157600080fd5b823567ffffffffffffffff80821115610e5957600080fd5b818501915085601f830112610e6d57600080fd5b813581811115610e7c57600080fd5b8660208260051b8501011115610e9157600080fd5b60209290920196919550909350505050565b600060208284031215610eb557600080fd5b5035919050565b6001600160a01b038116811461036057600080fd5b600060208284031215610ee357600080fd5b8135610eee81610ebc565b9392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610a7857610a78610f0b565b600060018201610f4657610f46610f0b565b5060010190565b600060208284031215610f5f57600080fd5b5051919050565b600060208284031215610f7857600080fd5b8151610eee81610ebc565b8082028115828204841417610a7857610a78610f0b565b634e487b7160e01b600052600160045260246000fd5b81810381811115610a7857610a78610f0b565b600082610fe057634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215610ff757600080fd5b81518015158114610eee57600080fd5b60005b8381101561102257818101518382015260200161100a565b50506000910152565b6000825161103d818460208701611007565b9190910192915050565b6020815260008251806020840152611066816040850160208701611007565b601f01601f1916919091016040019291505056fea26469706673582212202a0bf33ceb7a445180b85dc3e65e263f9d789a53e89461d8feac3d0f782b85a864736f6c63430008140033

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

0000000000000000000000005946aeaab44e65eb370ffaa6a7ef2218cff9b47d0000000000000000000000001bbe973bef3a977fc51cbed703e8ffdefe001fed000000000000000000000000000000000000000000000000000000006607db9800000000000000000000000067e13c87e3b7f2004b42fda01d617b2db8e7d90a000000000000000000000000370a976ecf1b02dd8f56279d55d85c946f4a3fc6

-----Decoded View---------------
Arg [0] : _creepzNFT (address): 0x5946aeAAB44e65Eb370FFaa6a7EF2218Cff9b47D
Arg [1] : _token (address): 0x1Bbe973BeF3a977Fc51CbED703E8ffDEfE001Fed
Arg [2] : _startTimestamp (uint256): 1711791000
Arg [3] : _treasury (address): 0x67E13c87e3b7f2004b42FDA01d617b2dB8e7d90A
Arg [4] : _owner (address): 0x370a976ecF1B02dD8F56279D55d85C946f4a3FC6

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000005946aeaab44e65eb370ffaa6a7ef2218cff9b47d
Arg [1] : 0000000000000000000000001bbe973bef3a977fc51cbed703e8ffdefe001fed
Arg [2] : 000000000000000000000000000000000000000000000000000000006607db98
Arg [3] : 00000000000000000000000067e13c87e3b7f2004b42fda01d617b2db8e7d90a
Arg [4] : 000000000000000000000000370a976ecf1b02dd8f56279d55d85c946f4a3fc6


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  ]

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.