Contract 0x3C5f6B3Ea031FBD7A762c0b9df2C63fC263FAa29 1

Contract Overview

Balance:
0 Ether

Token:
Txn Hash
Method
Block
From
To
Value
0xd83239b0ca0d66f7c7f0b091c67b22c006fb29ba21ca1578d3c9e7d98a22f493Set Membership U...101508652022-02-11 19:36:2297 days 16 hrs ago0x6d38a527407ade9e5bada4501d8c4508262b97e3 IN  0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa290 Ether0.00004593 1.000000009
0xe90e884d49528c5cbd70509a55b80d24c16e103506b8ab7a37dbc42bda0013a6Set Membership U...101508102022-02-11 19:22:3797 days 16 hrs ago0x6d38a527407ade9e5bada4501d8c4508262b97e3 IN  0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa290 Ether0.000048718 1.000000019
0xba9c3928e182a76b6db72a3a5e608b9f78b1daf9cd420005ec32a6b2aa22ff83Deposit101327092022-02-08 9:37:39101 days 2 hrs ago0xe91ccb9b2d4a3f46fb57feb358f82642bb1955ff IN  0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa290 Ether0.00045423816 1.838916662
0x09f213674622f1480e961bfbd169f2ad3c99dde123a0008e743c885ff09ffabbDeposit101246792022-02-07 0:08:58102 days 11 hrs ago0x80a1874e1046b1cc5defdf4d3153838b72ff94ac IN  0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa290 Ether0.000370521002 1.500000009
0x78deb9e4ea836d37c23bccdff3b18e396647e167695d9a1400c8501f40e381a0Deposit101170192022-02-05 16:13:03103 days 19 hrs ago0x6d38a527407ade9e5bada4501d8c4508262b97e3 IN  0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa290 Ether0.000261314002 1.000000008
0x0073485ea0fae6ce537ae481a577f05bdaa6bf93c21fb89a1375eedda61d5935Set Membership U...101168652022-02-05 15:34:33103 days 20 hrs ago0x6d38a527407ade9e5bada4501d8c4508262b97e3 IN  0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa290 Ether0.000250110001 2.500000014
0x8fba3f19db00084bc2b502c0f4bc14fcc76a2fc94c6c68074c36bdef39c5857f0x60806040101168552022-02-05 15:32:03103 days 20 hrs ago0x6d38a527407ade9e5bada4501d8c4508262b97e3 IN  Create: PillarDAO0 Ether0.002752592512 2.500000011
[ Download CSV Export 
Latest 16 internal transactions
Parent Txn Hash Block From To Value
0xd83239b0ca0d66f7c7f0b091c67b22c006fb29ba21ca1578d3c9e7d98a22f493101508652022-02-11 19:36:2297 days 16 hrs ago 0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa29 0x316ac5cf04bb555da44c8b8f86dec05b56bbd7180 Ether
0xe90e884d49528c5cbd70509a55b80d24c16e103506b8ab7a37dbc42bda0013a6101508102022-02-11 19:22:3797 days 16 hrs ago 0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa29 0x316ac5cf04bb555da44c8b8f86dec05b56bbd7180 Ether
0xba9c3928e182a76b6db72a3a5e608b9f78b1daf9cd420005ec32a6b2aa22ff83101327092022-02-08 9:37:39101 days 2 hrs ago 0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa29 0x316ac5cf04bb555da44c8b8f86dec05b56bbd7180 Ether
0xba9c3928e182a76b6db72a3a5e608b9f78b1daf9cd420005ec32a6b2aa22ff83101327092022-02-08 9:37:39101 days 2 hrs ago 0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa29 0xf4364d84014dfa96748a3329393e6b23aba9baee0 Ether
0xba9c3928e182a76b6db72a3a5e608b9f78b1daf9cd420005ec32a6b2aa22ff83101327092022-02-08 9:37:39101 days 2 hrs ago 0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa29 0xf4364d84014dfa96748a3329393e6b23aba9baee0 Ether
0xb703efa05ed5635f46b3e6e6b65ab8b7a47c72a27a12d01ca269ca7abc53ee6f101247072022-02-07 0:15:59102 days 11 hrs ago 0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa29 0x316ac5cf04bb555da44c8b8f86dec05b56bbd7180 Ether
0xb703efa05ed5635f46b3e6e6b65ab8b7a47c72a27a12d01ca269ca7abc53ee6f101247072022-02-07 0:15:59102 days 11 hrs ago 0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa29 0xf4364d84014dfa96748a3329393e6b23aba9baee0 Ether
0xb703efa05ed5635f46b3e6e6b65ab8b7a47c72a27a12d01ca269ca7abc53ee6f101247072022-02-07 0:15:59102 days 11 hrs ago 0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa29 0xf4364d84014dfa96748a3329393e6b23aba9baee0 Ether
0xb703efa05ed5635f46b3e6e6b65ab8b7a47c72a27a12d01ca269ca7abc53ee6f101247072022-02-07 0:15:59102 days 11 hrs ago 0x2156a9d1362cb909a08ddc0b022c441c94bec3b0 0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa290 Ether
0x09f213674622f1480e961bfbd169f2ad3c99dde123a0008e743c885ff09ffabb101246792022-02-07 0:08:58102 days 11 hrs ago 0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa29 0x316ac5cf04bb555da44c8b8f86dec05b56bbd7180 Ether
0x09f213674622f1480e961bfbd169f2ad3c99dde123a0008e743c885ff09ffabb101246792022-02-07 0:08:58102 days 11 hrs ago 0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa29 0xf4364d84014dfa96748a3329393e6b23aba9baee0 Ether
0x09f213674622f1480e961bfbd169f2ad3c99dde123a0008e743c885ff09ffabb101246792022-02-07 0:08:58102 days 11 hrs ago 0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa29 0xf4364d84014dfa96748a3329393e6b23aba9baee0 Ether
0x78deb9e4ea836d37c23bccdff3b18e396647e167695d9a1400c8501f40e381a0101170192022-02-05 16:13:03103 days 19 hrs ago 0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa29 0x316ac5cf04bb555da44c8b8f86dec05b56bbd7180 Ether
0x78deb9e4ea836d37c23bccdff3b18e396647e167695d9a1400c8501f40e381a0101170192022-02-05 16:13:03103 days 19 hrs ago 0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa29 0xf4364d84014dfa96748a3329393e6b23aba9baee0 Ether
0x78deb9e4ea836d37c23bccdff3b18e396647e167695d9a1400c8501f40e381a0101170192022-02-05 16:13:03103 days 19 hrs ago 0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa29 0xf4364d84014dfa96748a3329393e6b23aba9baee0 Ether
0x0073485ea0fae6ce537ae481a577f05bdaa6bf93c21fb89a1375eedda61d5935101168652022-02-05 15:34:33103 days 20 hrs ago 0x3c5f6b3ea031fbd7a762c0b9df2c63fc263faa29 0x316ac5cf04bb555da44c8b8f86dec05b56bbd7180 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PillarDAO

Compiler Version
v0.8.0+commit.c7dfd78e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2022-02-05
*/

pragma solidity ^0.8.0;
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

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

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

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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

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 Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

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

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() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

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

abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

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`, 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 be 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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * 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 Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

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

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

interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

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

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overriden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @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.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

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

interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

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

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

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

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

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

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}

contract MembershipNFT is ERC721Enumerable, Ownable, ReentrancyGuard {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    string public baseURI;

    address private vaultAddress = address(0);

    modifier onlyVault() {
        require(msg.sender == vaultAddress, "Not the vault");
        _;
    }

    event Minted (
        address indexed owner,
        uint indexed tokenId
    );

    event Burned (
        address indexed owner,
        uint indexed tokenId
    );

    constructor(
        string memory name,
        string memory symbol
    ) ERC721(name, symbol) {
        vaultAddress = msg.sender;
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal onlyVault virtual override {
        //disable transfers
        super._beforeTokenTransfer(from,to,tokenId);
    }

    function mint(address _to) external onlyVault nonReentrant returns (uint256) {
        uint256 mintIndex = totalSupply().add(1);
        _safeMint(_to, mintIndex);
        emit Minted(_to, mintIndex);
        return mintIndex;
    }

    function burn(uint256 _tokenId) onlyVault external {
        address owner = ownerOf(_tokenId);
        _burn(_tokenId);
        emit Burned(owner,_tokenId);
    }

    function _baseURI() internal view virtual override returns (string memory) {
        return baseURI;
    }

    function setBaseURI(string memory _newBaseURI) external onlyVault {
        baseURI = _newBaseURI;
    }

    function withdrawToVault() external onlyVault {
        require(vaultAddress != address(0), "Vault address not set");

        uint256 contractBalance = address(this).balance;
        payable(vaultAddress).transfer(contractBalance);
    }

    function withdrawTokenToVault(address _token) external onlyVault {
        require(_token != address(0), "Invalid token address");

        IERC20 token = IERC20(_token);
        uint256 balance = token.balanceOf(address(this));

        if(balance > 0) {
            token.safeTransfer(vaultAddress,balance);
        }
    }

    function setVaultAddress(address _newVaultAddress) external onlyOwner {
        vaultAddress = _newVaultAddress;
    }

    function getVaultAddress() external view returns (address) {
        return vaultAddress;
    }
}

interface IPillarDAO {
    event DepositEvent (
        address indexed depositAddress,
        uint indexed membershipId
    );

    event WithdrawEvent (
        address indexed withdrawAddress,
        uint indexed membershipId
    );

    function deposit(uint amount) external;

    function withdraw() external;
}

contract PillarDAO is IPillarDAO, Ownable {
    using SafeMath for uint;
    using SafeERC20 for IERC20;

    address private stakingToken;
    uint private constant stakingTerm = 52 weeks;
    uint private stakeAmount;
    MembershipNFT private membershipNFT;

    struct Deposit {
        uint256 depositAmount;
        uint256 depositTime;
    }

    mapping (address => Deposit) private balances;
    mapping (address => uint256) private memberships;

    constructor(
        address _stakingToken,
        uint _stakeAmount,
        address _membershipNft
    ) public {
        require(_stakingToken != address(0), "Invalid staking contract");
        require(_stakeAmount > 0, "Invalid staking amount");
        stakingToken = _stakingToken;
        stakeAmount = _stakeAmount;
        membershipNFT = MembershipNFT(_membershipNft);
    }

    function deposit(uint _amount) override external {
        require(_amount==stakeAmount, "Invalid staked amount");
        require(memberships[msg.sender] == 0,"User is already a member");
        
        IERC20 token = IERC20(stakingToken);
        require(token.allowance(msg.sender, address(this)) >= _amount, "Not enough allowance");
        
        token.safeTransferFrom(msg.sender, address(this), _amount);
        memberships[msg.sender] = membershipNFT.mint(msg.sender);

        emit DepositEvent(msg.sender,memberships[msg.sender]);
        balances[msg.sender] = Deposit({depositAmount: _amount, depositTime: block.timestamp});
    }

    function withdraw() override external {
        require(balances[msg.sender].depositAmount > 0, "Insufficient balance to withdraw");
        require((block.timestamp - balances[msg.sender].depositTime) > 52 weeks, "Too early to withdraw");
        require(memberships[msg.sender] > 0, "Membership does not exists!");

        IERC20 token = IERC20(stakingToken);
        token.safeTransfer(msg.sender,stakeAmount);
        membershipNFT.burn(memberships[msg.sender]);
        emit WithdrawEvent(msg.sender, memberships[msg.sender]);

        memberships[msg.sender] = 0;
        balances[msg.sender] = Deposit({depositAmount: 0, depositTime: 0});
    }

    function balanceOf(address _to) external view returns (uint256) {
        return balances[_to].depositAmount;
    }

    function membershipId(address _to) external view returns (uint256) {
        return memberships[_to];
    }

    function canUnstake(address _to) external view returns (bool) {
        if((block.timestamp - balances[_to].depositTime) >= 52 weeks) {
            return true;
        }
        return false;
    }

    function stakingAmount() external view returns (uint256) {
        return stakeAmount;
    }

    function setMembershipURI(string memory _baseURI) external onlyOwner {
        membershipNFT.setBaseURI(_baseURI);
    }

    function withdrawToOwner() external onlyOwner {
        uint256 contractBalance = address(this).balance;
        payable(msg.sender).transfer(contractBalance);
    }

    function withdrawTokenToOwner(address _token) external onlyOwner {
        require(_token != address(0), "Invalid token address");
        require(_token != stakingToken, "Cannot withdraw staking token");

        IERC20 token = IERC20(_token);
        uint256 balance = token.balanceOf(address(this));

        if(balance > 0) {
            token.safeTransfer(msg.sender,balance);
        }
    }

    function setMembershipNFT(address _newAddr) external onlyOwner {
        membershipNFT = MembershipNFT(_newAddr);
    }    
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_stakingToken","type":"address"},{"internalType":"uint256","name":"_stakeAmount","type":"uint256"},{"internalType":"address","name":"_membershipNft","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"membershipId","type":"uint256"}],"name":"DepositEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"withdrawAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"membershipId","type":"uint256"}],"name":"WithdrawEvent","type":"event"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"canUnstake","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"membershipId","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":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newAddr","type":"address"}],"name":"setMembershipNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"name":"setMembershipURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawToOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"withdrawTokenToOwner","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506040516200132f3803806200132f833981016040819052620000349162000146565b6200004862000042620000d5565b620000d9565b6001600160a01b0383166200007a5760405162461bcd60e51b8152600401620000719062000186565b60405180910390fd5b600082116200009d5760405162461bcd60e51b81526004016200007190620001bd565b600180546001600160a01b039485166001600160a01b03199182161790915560029290925560038054919093169116179055620001f4565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200014157600080fd5b919050565b6000806000606084860312156200015b578283fd5b620001668462000129565b9250602084015191506200017d6040850162000129565b90509250925092565b60208082526018908201527f496e76616c6964207374616b696e6720636f6e74726163740000000000000000604082015260600190565b60208082526016908201527f496e76616c6964207374616b696e6720616d6f756e7400000000000000000000604082015260600190565b61112b80620002046000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806385f4498b1161008c578063b6b55f2511610066578063b6b55f251461017a578063bae3a7f41461018d578063dbfe7341146101a0578063f2fde38b146101b3576100cf565b806385f4498b146101325780638da5cb5b14610152578063aeb75a2414610167576100cf565b80633cb40e16146100d45780633ccfd60b146100de5780634e361c86146100e657806370a08231146100f9578063715018a614610122578063739a3e021461012a575b600080fd5b6100dc6101c6565b005b6100dc610241565b6100dc6100f4366004610c1a565b6103e2565b61010c610107366004610bd3565b610486565b6040516101199190611087565b60405180910390f35b6100dc6104a5565b61010c6104f0565b610145610140366004610bd3565b6104f6565b6040516101199190610d72565b61015a610537565b6040516101199190610d07565b6100dc610175366004610bd3565b610546565b6100dc610188366004610cbb565b6105a7565b61010c61019b366004610bd3565b61079a565b6100dc6101ae366004610bd3565b6107b5565b6100dc6101c1366004610bd3565b6108ea565b6101ce61095b565b6001600160a01b03166101df610537565b6001600160a01b03161461020e5760405162461bcd60e51b815260040161020590610f3d565b60405180910390fd5b6040514790339082156108fc029083906000818181858888f1935050505015801561023d573d6000803e3d6000fd5b5050565b3360009081526004602052604090205461026d5760405162461bcd60e51b815260040161020590610ed1565b336000908152600460205260409020600101546301dfe200906102909042611090565b116102ad5760405162461bcd60e51b815260040161020590610e5c565b336000908152600560205260409020546102d95760405162461bcd60e51b815260040161020590610db0565b6001546002546001600160a01b03909116906102f8908290339061095f565b6003543360009081526005602052604090819020549051630852cd8d60e31b81526001600160a01b03909216916342966c689161033791600401611087565b600060405180830381600087803b15801561035157600080fd5b505af1158015610365573d6000803e3d6000fd5b5050336000818152600560205260408082205490519094509192507f5dba113b49cfa7c90315e8e604e6b506f7abcb909b01dcb19ec39005086e68fc91a350336000818152600560209081526040808320839055805180820182528381528083018481529484526004909252909120905181559051600190910155565b6103ea61095b565b6001600160a01b03166103fb610537565b6001600160a01b0316146104215760405162461bcd60e51b815260040161020590610f3d565b6003546040516355f804b360e01b81526001600160a01b03909116906355f804b390610451908490600401610d7d565b600060405180830381600087803b15801561046b57600080fd5b505af115801561047f573d6000803e3d6000fd5b5050505050565b6001600160a01b0381166000908152600460205260409020545b919050565b6104ad61095b565b6001600160a01b03166104be610537565b6001600160a01b0316146104e45760405162461bcd60e51b815260040161020590610f3d565b6104ee60006109b5565b565b60025490565b6001600160a01b0381166000908152600460205260408120600101546301dfe200906105229042611090565b1061052f575060016104a0565b506000919050565b6000546001600160a01b031690565b61054e61095b565b6001600160a01b031661055f610537565b6001600160a01b0316146105855760405162461bcd60e51b815260040161020590610f3d565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60025481146105c85760405162461bcd60e51b815260040161020590610de7565b33600090815260056020526040902054156105f55760405162461bcd60e51b815260040161020590610f06565b600154604051636eb1769f60e11b81526001600160a01b03909116908290829063dd62ed3e9061062b9033903090600401610d1b565b60206040518083038186803b15801561064357600080fd5b505afa158015610657573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067b9190610cd3565b10156106995760405162461bcd60e51b815260040161020590610f72565b6106ae6001600160a01b038216333085610a05565b6003546040516335313c2160e11b81526001600160a01b0390911690636a627842906106de903390600401610d07565b602060405180830381600087803b1580156106f857600080fd5b505af115801561070c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107309190610cd3565b33600081815260056020526040808220849055517f2d8a08b6430a894aea608bcaa6013d5d3e263bc49110605e4d4ba76930ae5c299190a3506040805180820182529182524260208084019182523360009081526004909152919091209151825551600190910155565b6001600160a01b031660009081526005602052604090205490565b6107bd61095b565b6001600160a01b03166107ce610537565b6001600160a01b0316146107f45760405162461bcd60e51b815260040161020590610f3d565b6001600160a01b03811661081a5760405162461bcd60e51b81526004016102059061100e565b6001546001600160a01b03828116911614156108485760405162461bcd60e51b815260040161020590610fa0565b6040516370a0823160e01b815281906000906001600160a01b038316906370a0823190610879903090600401610d07565b60206040518083038186803b15801561089157600080fd5b505afa1580156108a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c99190610cd3565b905080156108e5576108e56001600160a01b038316338361095f565b505050565b6108f261095b565b6001600160a01b0316610903610537565b6001600160a01b0316146109295760405162461bcd60e51b815260040161020590610f3d565b6001600160a01b03811661094f5760405162461bcd60e51b815260040161020590610e16565b610958816109b5565b50565b3390565b6108e58363a9059cbb60e01b848460405160240161097e929190610d59565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610a2c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610a26846323b872dd60e01b85858560405160240161097e93929190610d35565b50505050565b6000610a81826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610abb9092919063ffffffff16565b8051909150156108e55780806020019051810190610a9f9190610bfa565b6108e55760405162461bcd60e51b81526004016102059061103d565b6060610aca8484600085610ad4565b90505b9392505050565b606082471015610af65760405162461bcd60e51b815260040161020590610e8b565b610aff85610b94565b610b1b5760405162461bcd60e51b815260040161020590610fd7565b600080866001600160a01b03168587604051610b379190610ceb565b60006040518083038185875af1925050503d8060008114610b74576040519150601f19603f3d011682016040523d82523d6000602084013e610b79565b606091505b5091509150610b89828286610b9a565b979650505050505050565b3b151590565b60608315610ba9575081610acd565b825115610bb95782518084602001fd5b8160405162461bcd60e51b81526004016102059190610d7d565b600060208284031215610be4578081fd5b81356001600160a01b0381168114610acd578182fd5b600060208284031215610c0b578081fd5b81518015158114610acd578182fd5b60006020808385031215610c2c578182fd5b823567ffffffffffffffff80821115610c43578384fd5b818501915085601f830112610c56578384fd5b813581811115610c6857610c686110df565b604051601f8201601f1916810185018381118282101715610c8b57610c8b6110df565b6040528181528382018501881015610ca1578586fd5b818585018683013790810190930193909352509392505050565b600060208284031215610ccc578081fd5b5035919050565b600060208284031215610ce4578081fd5b5051919050565b60008251610cfd8184602087016110b3565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6000602082528251806020840152610d9c8160408501602087016110b3565b601f01601f19169190910160400192915050565b6020808252601b908201527f4d656d6265727368697020646f6573206e6f7420657869737473210000000000604082015260600190565b602080825260159082015274125b9d985b1a59081cdd185ad95908185b5bdd5b9d605a1b604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b602080825260159082015274546f6f206561726c7920746f20776974686472617760581b604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b6020808252818101527f496e73756666696369656e742062616c616e636520746f207769746864726177604082015260600190565b60208082526018908201527f5573657220697320616c72656164792061206d656d6265720000000000000000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601490820152734e6f7420656e6f75676820616c6c6f77616e636560601b604082015260600190565b6020808252601d908201527f43616e6e6f74207769746864726177207374616b696e6720746f6b656e000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b602080825260159082015274496e76616c696420746f6b656e206164647265737360581b604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b90815260200190565b6000828210156110ae57634e487b7160e01b81526011600452602481fd5b500390565b60005b838110156110ce5781810151838201526020016110b6565b83811115610a265750506000910152565b634e487b7160e01b600052604160045260246000fdfea2646970667358221220a470f4d7c4a754fe8d6ca15f51e800f90a4f2388f52444a1c2a8b4f90af3ad8364736f6c63430008000033000000000000000000000000f4364d84014dfa96748a3329393e6b23aba9baee00000000000000000000000000000000000000000000021e19e0c9bab2400000000000000000000000000000316ac5cf04bb555da44c8b8f86dec05b56bbd718

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

000000000000000000000000f4364d84014dfa96748a3329393e6b23aba9baee00000000000000000000000000000000000000000000021e19e0c9bab2400000000000000000000000000000316ac5cf04bb555da44c8b8f86dec05b56bbd718

-----Decoded View---------------
Arg [0] : _stakingToken (address): 0xf4364d84014dfa96748a3329393e6b23aba9baee
Arg [1] : _stakeAmount (uint256): 10000000000000000000000
Arg [2] : _membershipNft (address): 0x316ac5cf04bb555da44c8b8f86dec05b56bbd718

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000f4364d84014dfa96748a3329393e6b23aba9baee
Arg [1] : 00000000000000000000000000000000000000000000021e19e0c9bab2400000
Arg [2] : 000000000000000000000000316ac5cf04bb555da44c8b8f86dec05b56bbd718


Deployed ByteCode Sourcemap

56598:3624:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;59503:168;;;:::i;:::-;;58146:664;;;:::i;59373:122::-;;;;;;:::i;:::-;;:::i;58818:117::-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;23765:103;;;:::i;59271:94::-;;;:::i;59060:203::-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;23114:87::-;;;:::i;:::-;;;;;;;:::i;60094:121::-;;;;;;:::i;:::-;;:::i;57479:659::-;;;;;;:::i;:::-;;:::i;58943:109::-;;;;;;:::i;:::-;;:::i;59679:407::-;;;;;;:::i;:::-;;:::i;24023:201::-;;;;;;:::i;:::-;;:::i;59503:168::-;23345:12;:10;:12::i;:::-;-1:-1:-1;;;;;23334:23:0;:7;:5;:7::i;:::-;-1:-1:-1;;;;;23334:23:0;;23326:68;;;;-1:-1:-1;;;23326:68:0;;;;;;;:::i;:::-;;;;;;;;;59618:45:::1;::::0;59586:21:::1;::::0;59626:10:::1;::::0;59618:45;::::1;;;::::0;59586:21;;59560:23:::1;59618:45:::0;59560:23;59618:45;59586:21;59626:10;59618:45;::::1;;;;;;;;;;;;;::::0;::::1;;;;;;23405:1;59503:168::o:0;58146:664::-;58212:10;58240:1;58203:20;;;:8;:20;;;;;:34;58195:83;;;;-1:-1:-1;;;58195:83:0;;;;;;;:::i;:::-;58325:10;58316:20;;;;:8;:20;;;;;:32;;;58352:8;;58298:50;;:15;:50;:::i;:::-;58297:63;58289:97;;;;-1:-1:-1;;;58289:97:0;;;;;;;:::i;:::-;58417:10;58431:1;58405:23;;;:11;:23;;;;;;58397:67;;;;-1:-1:-1;;;58397:67:0;;;;;;;:::i;:::-;58499:12;;58553:11;;-1:-1:-1;;;;;58499:12:0;;;;58523:42;;58499:12;;58542:10;;58523:18;:42::i;:::-;58576:13;;58607:10;58576:13;58595:23;;;:11;:23;;;;;;;;58576:43;;-1:-1:-1;;;58576:43:0;;-1:-1:-1;;;;;58576:13:0;;;;:18;;:43;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;58673:10:0;58661:23;;;;:11;:23;;;;;;;58635:50;;58661:23;;-1:-1:-1;58673:10:0;;-1:-1:-1;58635:50:0;;;-1:-1:-1;58710:10:0;58724:1;58698:23;;;:11;:23;;;;;;;;:27;;;58759:43;;;;;;;;;;;;;;;;58736:20;;;:8;:20;;;;;;:66;;;;;;;;;;;58146:664::o;59373:122::-;23345:12;:10;:12::i;:::-;-1:-1:-1;;;;;23334:23:0;:7;:5;:7::i;:::-;-1:-1:-1;;;;;23334:23:0;;23326:68;;;;-1:-1:-1;;;23326:68:0;;;;;;;:::i;:::-;59453:13:::1;::::0;:34:::1;::::0;-1:-1:-1;;;59453:34:0;;-1:-1:-1;;;;;59453:13:0;;::::1;::::0;:24:::1;::::0;:34:::1;::::0;59478:8;;59453:34:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;59373:122:::0;:::o;58818:117::-;-1:-1:-1;;;;;58900:13:0;;58873:7;58900:13;;;:8;:13;;;;;:27;58818:117;;;;:::o;23765:103::-;23345:12;:10;:12::i;:::-;-1:-1:-1;;;;;23334:23:0;:7;:5;:7::i;:::-;-1:-1:-1;;;;;23334:23:0;;23326:68;;;;-1:-1:-1;;;23326:68:0;;;;;;;:::i;:::-;23830:30:::1;23857:1;23830:18;:30::i;:::-;23765:103::o:0;59271:94::-;59346:11;;59271:94;:::o;59060:203::-;-1:-1:-1;;;;;59155:13:0;;59116:4;59155:13;;;:8;:13;;;;;:25;;;59185:8;;59137:43;;:15;:43;:::i;:::-;59136:57;59133:100;;-1:-1:-1;59217:4:0;59210:11;;59133:100;-1:-1:-1;59250:5:0;59060:203;;;:::o;23114:87::-;23160:7;23187:6;-1:-1:-1;;;;;23187:6:0;23114:87;:::o;60094:121::-;23345:12;:10;:12::i;:::-;-1:-1:-1;;;;;23334:23:0;:7;:5;:7::i;:::-;-1:-1:-1;;;;;23334:23:0;;23326:68;;;;-1:-1:-1;;;23326:68:0;;;;;;;:::i;:::-;60168:13:::1;:39:::0;;-1:-1:-1;;;;;;60168:39:0::1;-1:-1:-1::0;;;;;60168:39:0;;;::::1;::::0;;;::::1;::::0;;60094:121::o;57479:659::-;57556:11;;57547:7;:20;57539:54;;;;-1:-1:-1;;;57539:54:0;;;;;;;:::i;:::-;57624:10;57612:23;;;;:11;:23;;;;;;:28;57604:64;;;;-1:-1:-1;;;57604:64:0;;;;;;;:::i;:::-;57711:12;;57743:42;;-1:-1:-1;;;57743:42:0;;-1:-1:-1;;;;;57711:12:0;;;;57789:7;;57711:12;;57743:15;;:42;;57759:10;;57779:4;;57743:42;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:53;;57735:86;;;;-1:-1:-1;;;57735:86:0;;;;;;;:::i;:::-;57842:58;-1:-1:-1;;;;;57842:22:0;;57865:10;57885:4;57892:7;57842:22;:58::i;:::-;57937:13;;:30;;-1:-1:-1;;;57937:30:0;;-1:-1:-1;;;;;57937:13:0;;;;:18;;:30;;57956:10;;57937:30;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;57923:10;57911:23;;;;:11;:23;;;;;;:56;;;57985:48;;;57911:23;57985:48;-1:-1:-1;58067:63:0;;;;;;;;;;;58113:15;58067:63;;;;;;;58053:10;-1:-1:-1;58044:20:0;;;:8;:20;;;;;;;:86;;;;;;;;;;57479:659::o;58943:109::-;-1:-1:-1;;;;;59028:16:0;59001:7;59028:16;;;:11;:16;;;;;;;58943:109::o;59679:407::-;23345:12;:10;:12::i;:::-;-1:-1:-1;;;;;23334:23:0;:7;:5;:7::i;:::-;-1:-1:-1;;;;;23334:23:0;;23326:68;;;;-1:-1:-1;;;23326:68:0;;;;;;;:::i;:::-;-1:-1:-1;;;;;59763:20:0;::::1;59755:54;;;;-1:-1:-1::0;;;59755:54:0::1;;;;;;;:::i;:::-;59838:12;::::0;-1:-1:-1;;;;;59828:22:0;;::::1;59838:12:::0;::::1;59828:22;;59820:64;;;;-1:-1:-1::0;;;59820:64:0::1;;;;;;;:::i;:::-;59955:30;::::0;-1:-1:-1;;;59955:30:0;;59919:6;;59897:12:::1;::::0;-1:-1:-1;;;;;59955:15:0;::::1;::::0;::::1;::::0;:30:::1;::::0;59979:4:::1;::::0;59955:30:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;59937:48:::0;-1:-1:-1;60001:11:0;;59998:81:::1;;60029:38;-1:-1:-1::0;;;;;60029:18:0;::::1;60048:10;60059:7:::0;60029:18:::1;:38::i;:::-;23405:1;;59679:407:::0;:::o;24023:201::-;23345:12;:10;:12::i;:::-;-1:-1:-1;;;;;23334:23:0;:7;:5;:7::i;:::-;-1:-1:-1;;;;;23334:23:0;;23326:68;;;;-1:-1:-1;;;23326:68:0;;;;;;;:::i;:::-;-1:-1:-1;;;;;24112:22:0;::::1;24104:73;;;;-1:-1:-1::0;;;24104:73:0::1;;;;;;;:::i;:::-;24188:28;24207:8;24188:18;:28::i;:::-;24023:201:::0;:::o;20543:98::-;20623:10;20543:98;:::o;6600:211::-;6717:86;6737:5;6767:23;;;6792:2;6796:5;6744:58;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;6744:58:0;;;;;;;;;;;;;;-1:-1:-1;;;;;6744:58:0;-1:-1:-1;;;;;;6744:58:0;;;;;;;;;;6717:19;:86::i;24384:191::-;24458:16;24477:6;;-1:-1:-1;;;;;24494:17:0;;;-1:-1:-1;;;;;;24494:17:0;;;;;;24527:40;;24477:6;;;;;;;24527:40;;24458:16;24527:40;24384:191;;:::o;6819:248::-;6963:96;6983:5;7013:27;;;7042:4;7048:2;7052:5;6990:68;;;;;;;;;;:::i;6963:96::-;6819:248;;;;:::o;9173:716::-;9597:23;9623:69;9651:4;9623:69;;;;;;;;;;;;;;;;;9631:5;-1:-1:-1;;;;;9623:27:0;;;:69;;;;;:::i;:::-;9707:17;;9597:95;;-1:-1:-1;9707:21:0;9703:179;;9804:10;9793:30;;;;;;;;;;;;:::i;:::-;9785:85;;;;-1:-1:-1;;;9785:85:0;;;;;;;:::i;13312:229::-;13449:12;13481:52;13503:6;13511:4;13517:1;13520:12;13481:21;:52::i;:::-;13474:59;;13312:229;;;;;;:::o;14432:510::-;14602:12;14660:5;14635:21;:30;;14627:81;;;;-1:-1:-1;;;14627:81:0;;;;;;;:::i;:::-;14727:18;14738:6;14727:10;:18::i;:::-;14719:60;;;;-1:-1:-1;;;14719:60:0;;;;;;;:::i;:::-;14793:12;14807:23;14834:6;-1:-1:-1;;;;;14834:11:0;14853:5;14860:4;14834:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;14792:73;;;;14883:51;14900:7;14909:10;14921:12;14883:16;:51::i;:::-;14876:58;14432:510;-1:-1:-1;;;;;;;14432:510:0:o;10506:387::-;10829:20;10877:8;;;10506:387::o;17118:712::-;17268:12;17297:7;17293:530;;;-1:-1:-1;17328:10:0;17321:17;;17293:530;17442:17;;:21;17438:374;;17640:10;17634:17;17701:15;17688:10;17684:2;17680:19;17673:44;17588:148;17783:12;17776:20;;-1:-1:-1;;;17776:20:0;;;;;;;;:::i;14:306:1:-;;126:2;114:9;105:7;101:23;97:32;94:2;;;147:6;139;132:22;94:2;178:23;;-1:-1:-1;;;;;230:31:1;;220:42;;210:2;;281:6;273;266:22;325:297;;445:2;433:9;424:7;420:23;416:32;413:2;;;466:6;458;451:22;413:2;503:9;497:16;556:5;549:13;542:21;535:5;532:32;522:2;;583:6;575;568:22;627:958;;727:2;770;758:9;749:7;745:23;741:32;738:2;;;791:6;783;776:22;738:2;836:9;823:23;865:18;906:2;898:6;895:14;892:2;;;927:6;919;912:22;892:2;970:6;959:9;955:22;945:32;;1015:7;1008:4;1004:2;1000:13;996:27;986:2;;1042:6;1034;1027:22;986:2;1083;1070:16;1105:2;1101;1098:10;1095:2;;;1111:18;;:::i;:::-;1160:2;1154:9;1229:2;1210:13;;-1:-1:-1;;1206:27:1;1194:40;;1190:49;;1254:18;;;1274:22;;;1251:46;1248:2;;;1300:18;;:::i;:::-;1336:2;1329:22;1360:18;;;1397:11;;;1393:20;;1390:33;-1:-1:-1;1387:2:1;;;1441:6;1433;1426:22;1387:2;1502;1497;1493;1489:11;1484:2;1476:6;1472:15;1459:46;1525:15;;;1521:24;;;1514:40;;;;-1:-1:-1;1529:6:1;707:878;-1:-1:-1;;;707:878:1:o;1590:190::-;;1702:2;1690:9;1681:7;1677:23;1673:32;1670:2;;;1723:6;1715;1708:22;1670:2;-1:-1:-1;1751:23:1;;1660:120;-1:-1:-1;1660:120:1:o;1785:194::-;;1908:2;1896:9;1887:7;1883:23;1879:32;1876:2;;;1929:6;1921;1914:22;1876:2;-1:-1:-1;1957:16:1;;1866:113;-1:-1:-1;1866:113:1:o;1984:274::-;;2151:6;2145:13;2167:53;2213:6;2208:3;2201:4;2193:6;2189:17;2167:53;:::i;:::-;2236:16;;;;;2121:137;-1:-1:-1;;2121:137:1:o;2263:203::-;-1:-1:-1;;;;;2427:32:1;;;;2409:51;;2397:2;2382:18;;2364:102::o;2471:304::-;-1:-1:-1;;;;;2701:15:1;;;2683:34;;2753:15;;2748:2;2733:18;;2726:43;2633:2;2618:18;;2600:175::o;2780:375::-;-1:-1:-1;;;;;3038:15:1;;;3020:34;;3090:15;;;;3085:2;3070:18;;3063:43;3137:2;3122:18;;3115:34;;;;2970:2;2955:18;;2937:218::o;3160:274::-;-1:-1:-1;;;;;3352:32:1;;;;3334:51;;3416:2;3401:18;;3394:34;3322:2;3307:18;;3289:145::o;3439:187::-;3604:14;;3597:22;3579:41;;3567:2;3552:18;;3534:92::o;3631:383::-;;3780:2;3769:9;3762:21;3812:6;3806:13;3855:6;3850:2;3839:9;3835:18;3828:34;3871:66;3930:6;3925:2;3914:9;3910:18;3905:2;3897:6;3893:15;3871:66;:::i;:::-;3998:2;3977:15;-1:-1:-1;;3973:29:1;3958:45;;;;4005:2;3954:54;;3752:262;-1:-1:-1;;3752:262:1:o;4019:351::-;4221:2;4203:21;;;4260:2;4240:18;;;4233:30;4299:29;4294:2;4279:18;;4272:57;4361:2;4346:18;;4193:177::o;4375:345::-;4577:2;4559:21;;;4616:2;4596:18;;;4589:30;-1:-1:-1;;;4650:2:1;4635:18;;4628:51;4711:2;4696:18;;4549:171::o;4725:402::-;4927:2;4909:21;;;4966:2;4946:18;;;4939:30;5005:34;5000:2;4985:18;;4978:62;-1:-1:-1;;;5071:2:1;5056:18;;5049:36;5117:3;5102:19;;4899:228::o;5132:345::-;5334:2;5316:21;;;5373:2;5353:18;;;5346:30;-1:-1:-1;;;5407:2:1;5392:18;;5385:51;5468:2;5453:18;;5306:171::o;5482:402::-;5684:2;5666:21;;;5723:2;5703:18;;;5696:30;5762:34;5757:2;5742:18;;5735:62;-1:-1:-1;;;5828:2:1;5813:18;;5806:36;5874:3;5859:19;;5656:228::o;5889:356::-;6091:2;6073:21;;;6110:18;;;6103:30;6169:34;6164:2;6149:18;;6142:62;6236:2;6221:18;;6063:182::o;6250:348::-;6452:2;6434:21;;;6491:2;6471:18;;;6464:30;6530:26;6525:2;6510:18;;6503:54;6589:2;6574:18;;6424:174::o;6603:356::-;6805:2;6787:21;;;6824:18;;;6817:30;6883:34;6878:2;6863:18;;6856:62;6950:2;6935:18;;6777:182::o;6964:344::-;7166:2;7148:21;;;7205:2;7185:18;;;7178:30;-1:-1:-1;;;7239:2:1;7224:18;;7217:50;7299:2;7284:18;;7138:170::o;7313:353::-;7515:2;7497:21;;;7554:2;7534:18;;;7527:30;7593:31;7588:2;7573:18;;7566:59;7657:2;7642:18;;7487:179::o;7671:353::-;7873:2;7855:21;;;7912:2;7892:18;;;7885:30;7951:31;7946:2;7931:18;;7924:59;8015:2;8000:18;;7845:179::o;8029:345::-;8231:2;8213:21;;;8270:2;8250:18;;;8243:30;-1:-1:-1;;;8304:2:1;8289:18;;8282:51;8365:2;8350:18;;8203:171::o;8379:406::-;8581:2;8563:21;;;8620:2;8600:18;;;8593:30;8659:34;8654:2;8639:18;;8632:62;-1:-1:-1;;;8725:2:1;8710:18;;8703:40;8775:3;8760:19;;8553:232::o;8790:177::-;8936:25;;;8924:2;8909:18;;8891:76::o;8972:228::-;;9040:1;9037;9034:8;9031:2;;;-1:-1:-1;;;9065:34:1;;9122:4;9119:1;9112:15;9153:4;9072;9140:18;9031:2;-1:-1:-1;9185:9:1;;9021:179::o;9205:258::-;9277:1;9287:113;9301:6;9298:1;9295:13;9287:113;;;9377:11;;;9371:18;9358:11;;;9351:39;9323:2;9316:10;9287:113;;;9418:6;9415:1;9412:13;9409:2;;;-1:-1:-1;;9453:1:1;9435:16;;9428:27;9258:205::o;9468:127::-;9529:10;9524:3;9520:20;9517:1;9510:31;9560:4;9557:1;9550:15;9584:4;9581:1;9574:15

Swarm Source

ipfs://a470f4d7c4a754fe8d6ca15f51e800f90a4f2388f52444a1c2a8b4f90af3ad83
Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading

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.