ETH Price: $3,116.74 (+0.25%)
Gas: 3 Gwei

Contract

0xbE3026082402c7BB344729ce3a51b259bF1e5915
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Set Approval For...198356032024-05-09 22:55:479 days ago1715295347IN
0xbE302608...9bF1e5915
0 ETH0.000184974.00206957
Set Approval For...196547372024-04-14 15:42:1134 days ago1713109331IN
0xbE302608...9bF1e5915
0 ETH0.0005271311.425847
Unstake195741162024-04-03 8:39:4745 days ago1712133587IN
0xbE302608...9bF1e5915
0 ETH0.0055771123.94270637
Claim195740972024-04-03 8:35:5945 days ago1712133359IN
0xbE302608...9bF1e5915
0 ETH0.001778122.40182523
Set Approval For...195678872024-04-02 11:42:1146 days ago1712058131IN
0xbE302608...9bF1e5915
0 ETH0.0013333328.90066583
Unstake194542382024-03-17 11:21:4762 days ago1710674507IN
0xbE302608...9bF1e5915
0 ETH0.005509524.45019264
Claim194505272024-03-16 22:50:2363 days ago1710629423IN
0xbE302608...9bF1e5915
0 ETH0.0025751732.44402903
Unstake192408032024-02-16 13:38:2392 days ago1708090703IN
0xbE302608...9bF1e5915
0 ETH0.0086650548.45253968
Unstake192407582024-02-16 13:28:5992 days ago1708090139IN
0xbE302608...9bF1e5915
0 ETH0.009550539.72259205
Set Approval For...192232462024-02-14 2:30:4794 days ago1707877847IN
0xbE302608...9bF1e5915
0 ETH0.000746130.80152898
Unstake191608842024-02-05 8:27:47103 days ago1707121667IN
0xbE302608...9bF1e5915
0 ETH0.0042486114.15549375
Unstake191595452024-02-05 3:56:59103 days ago1707105419IN
0xbE302608...9bF1e5915
0 ETH0.0037572612.49368357
Claim190786272024-01-24 19:37:59115 days ago1706125079IN
0xbE302608...9bF1e5915
0 ETH0.0009079511.43906401
Unstake190312442024-01-18 4:03:47121 days ago1705550627IN
0xbE302608...9bF1e5915
0 ETH0.005633425
Unstake189666702024-01-09 3:13:59130 days ago1704770039IN
0xbE302608...9bF1e5915
0 ETH0.0033136214.70526085
Unstake189080342023-12-31 21:07:47139 days ago1704056867IN
0xbE302608...9bF1e5915
0 ETH0.0511269821.88803243
Unstake189079752023-12-31 20:55:47139 days ago1704056147IN
0xbE302608...9bF1e5915
0 ETH0.008733114.83099979
Unstake189079692023-12-31 20:54:35139 days ago1704056075IN
0xbE302608...9bF1e5915
0 ETH0.0026080515.6324219
Unstake189079692023-12-31 20:54:35139 days ago1704056075IN
0xbE302608...9bF1e5915
0 ETH0.0029144415.6324219
Unstake189079682023-12-31 20:54:23139 days ago1704056063IN
0xbE302608...9bF1e5915
0 ETH0.0025944513.91606944
Unstake189079632023-12-31 20:53:11139 days ago1704055991IN
0xbE302608...9bF1e5915
0 ETH0.0024166714.48531607
Unstake189079632023-12-31 20:53:11139 days ago1704055991IN
0xbE302608...9bF1e5915
0 ETH0.0024250114.53531607
Unstake189079632023-12-31 20:53:11139 days ago1704055991IN
0xbE302608...9bF1e5915
0 ETH0.0024166714.48531607
Unstake189079632023-12-31 20:53:11139 days ago1704055991IN
0xbE302608...9bF1e5915
0 ETH0.0024166714.48531607
Unstake189079632023-12-31 20:53:11139 days ago1704055991IN
0xbE302608...9bF1e5915
0 ETH0.0024250114.53531607
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:
StakedN

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion
File 1 of 23 : StakedN.sol
//SPDX-License-Identifier: MIT
/**
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(     (@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@           @@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(   @@@@@@@@@@@@@@@@@@@@(            @@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@         @@@@@@@@@@@@@@@             @@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@           @@@@@@@@@@@(            @@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@      @@@@@@@@@@@@             @@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@(            @@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@     @@@@@@@     @@@@@@@             @@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@(         @@(         @@(            @@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@          @@          @@           @@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@     @@@@@@@     @@@@@@@     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(     @@@@@@@     @@@@@@@     @@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@           @           @           @@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@(            @@@         @@@         @@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@             @@@@@@@     @@@@@@@     @@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@(            @@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@             @@@@@@@@@@@       @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@(            @@@@@@@@@@@@           @@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@             @@@@@@@@@@@@@@@         @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@(            @@@@@@@@@@@@@@@@@@@@@   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@           @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@(     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 */
pragma solidity 0.8.6;

import "./AbstractStaking.sol";
import "./interfaces/IN.sol";
import "./interfaces/INil.sol";
import "./interfaces/INOwnerResolver.sol";
import "./libraries/NilProtocolUtils.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";

/**
 * @title StakedN
 * @author Nil DAO
 */
contract StakedN is AbstractStaking, ERC721Holder, INOwnerResolver, ERC721Enumerable {
    using Strings for uint256;

    uint256 public constant N_UNIT = 1e18;
    uint256 public constant N_SUPPLY = 8888;
    uint256 public constant INVERSE_N_SHARE_OF_NIL = 4;
    uint256 public constant VOTE_DENOMINATOR = 1;
    IN public immutable n;

    constructor(
        INil nil_,
        IN n_,
        address dao,
        uint256 rewardRatePerSecond,
        uint256 votesRatePerSecond
    ) AbstractStaking(nil_, dao, rewardRatePerSecond, votesRatePerSecond) ERC721("Staked n", "STN") {
        require(address(n_) != address(0), "StakedN:ILLEGAL_ADDRESS");
        n = n_;
    }

    function stake(uint256[] calldata nIds) external nonReentrant {
        for (uint256 i = 0; i < nIds.length; i++) {
            n.safeTransferFrom(msg.sender, address(this), nIds[i]);
            _mint(msg.sender, nIds[i]);
        }
        _stake(msg.sender, nIds.length * N_UNIT);
    }

    function unstake(uint256[] calldata nIds) external nonReentrant {
        _unstake(msg.sender, nIds.length * N_UNIT);
        for (uint256 i = 0; i < nIds.length; i++) {
            require(ownerOf(nIds[i]) == msg.sender, "StakedN:WRONG_OWNER");
            _burn(nIds[i]);
            n.safeTransferFrom(address(this), msg.sender, nIds[i]);
        }
    }

    function nOwned(address owner) external view override returns (uint256[] memory nids) {
        uint256 balance = balanceOf(owner);
        nids = new uint256[](balance);
        for (uint256 i = 0; i < balance; i++) {
            nids[i] = tokenOfOwnerByIndex(owner, i);
        }
    }

    function ownerOf(uint256 nid) public view override(INOwnerResolver, ERC721) returns (address) {
        return super.ownerOf(nid);
    }

    function balanceOf(address account) public view override(INOwnerResolver, ERC721) returns (uint256) {
        return super.balanceOf(account);
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 id
    ) internal virtual override {
        //Allow only mint and burn
        require(from == address(0) || to == address(0), "StakedN:TRANSFER_DENIED");
        super._beforeTokenTransfer(from, to, id);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC721Enumerable, AccessControl)
        returns (bool)
    {
        return ERC721Enumerable.supportsInterface(interfaceId) || AccessControl.supportsInterface(interfaceId);
    }

    function getFirst(uint256 tokenId) public view returns (uint256) {
        return n.getFirst(tokenId);
    }

    function getSecond(uint256 tokenId) public view returns (uint256) {
        return n.getSecond(tokenId);
    }

    function getThird(uint256 tokenId) public view returns (uint256) {
        return n.getThird(tokenId);
    }

    function getFourth(uint256 tokenId) public view returns (uint256) {
        return n.getFourth(tokenId);
    }

    function getFifth(uint256 tokenId) public view returns (uint256) {
        return n.getFifth(tokenId);
    }

    function getSixth(uint256 tokenId) public view returns (uint256) {
        return n.getSixth(tokenId);
    }

    function getSeventh(uint256 tokenId) public view returns (uint256) {
        return n.getSeventh(tokenId);
    }

    function getEight(uint256 tokenId) public view returns (uint256) {
        return n.getEight(tokenId);
    }

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        string[17] memory parts;
        parts[
            0
        ] = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>c1{stroke:#231f20;stroke-miterlimit:10;}c2{fill:#fff;}</style><rect class="cls-1" x="0.5" y="0.5" width="350" height="350"></rect><rect class="cls-2" x="182.734" y="129.922" width="37.344" height="37.344" transform="matrix(0.707108, -0.707106, 0.707107, 0.707107, -45.581875, 186.4375)" style="fill: rgb(51, 51, 51);"></rect><rect class="cls-2" x="182.734" y="182.734" width="37.344" height="37.344" transform="matrix(0.707108, -0.707106, 0.707107, 0.707107, -82.925415, 201.906036)" style="fill: rgb(51, 51, 51);"></rect><rect class="cls-2" x="235.545" y="182.734" width="37.344" height="37.344" transform="matrix(0.707108, -0.707106, 0.707107, 0.707107, -67.456871, 239.248123)" style="fill: rgb(51, 51, 51);"></rect><rect class="cls-2" x="182.734" y="235.547" width="37.344" height="37.344" transform="matrix(0.707108, -0.707106, 0.707107, 0.707107, -120.267502, 217.373123)" style="fill: rgb(51, 51, 51);"></rect><rect class="cls-2" x="129.924" y="129.922" width="37.344" height="37.344" transform="matrix(0.707108, -0.707106, 0.707107, 0.707107, -61.050415, 149.093964)" style="fill: rgb(51, 51, 51);"></rect><rect class="cls-2" x="129.924" y="77.112" width="37.344" height="37.344" transform="matrix(0.707108, -0.707106, 0.707107, 0.707107, -23.706875, 133.626877)" style="fill: rgb(51, 51, 51);"></rect><rect class="cls-2" x="77.112" y="129.922" width="37.344" height="37.344" transform="matrix(0.707108, -0.707106, 0.707107, 0.707107, -76.517502, 111.751877)" style="fill: rgb(51, 51, 51);"></rect><rect class="cls-2" x="209.14" y="103.516" width="37.344" height="37.344" transform="matrix(0.707108, -0.707106, 0.707107, 0.707107, -19.175833, 197.375)" style="fill: rgb(51, 51, 51);"></rect><rect class="cls-2" x="235.545" y="77.112" width="37.344" height="37.344" transform="matrix(0.707108, -0.707106, 0.707107, 0.707107, 7.22875, 208.3125)" style="fill: rgb(51, 51, 51);"></rect><rect class="cls-2" x="261.95" y="50.706" width="37.344" height="37.344" transform="matrix(0.707108, -0.707106, 0.707107, 0.707107, 33.634792, 219.25)" style="fill: rgb(51, 51, 51);"></rect><rect class="cls-2" x="50.706" y="261.949" width="37.344" height="37.344" transform="matrix(0.707108, -0.707106, 0.707107, 0.707107, -177.609161, 131.75)" style="fill: rgb(51, 51, 51);"></rect><rect class="cls-2" x="77.112" y="235.547" width="37.344" height="37.344" transform="matrix(0.707108, -0.707106, 0.707107, 0.707107, -151.20459, 142.6875)" style="fill: rgb(51, 51, 51);"></rect><rect class="cls-2" x="103.517" y="209.14" width="37.344" height="37.344" transform="matrix(0.707108, -0.707106, 0.707107, 0.707107, -124.798538, 153.625)" style="fill: rgb(51, 51, 51);"></rect><rect class="cls-2" x="129.924" y="182.734" width="37.344" height="37.344" transform="matrix(0.707108, -0.707106, 0.707107, 0.707107, -98.392502, 164.5625)" style="fill: rgb(51, 51, 51);"></rect><text style="fill: rgb(255, 255, 255); font-family: serif, sans-serif; font-size: 6px; white-space: pre;" x="254.873" y="294.774" transform="matrix(1.166667, 0, 0, 1.166667, -0.083333, -0.083333)">';

        parts[1] = NilProtocolUtils.stringify(n.getFirst(tokenId));

        parts[2] = " ";

        parts[3] = NilProtocolUtils.stringify(n.getSecond(tokenId));

        parts[4] = " ";

        parts[5] = NilProtocolUtils.stringify(n.getThird(tokenId));

        parts[6] = " ";

        parts[7] = NilProtocolUtils.stringify(n.getFourth(tokenId));

        parts[8] = " ";

        parts[9] = NilProtocolUtils.stringify(n.getFifth(tokenId));

        parts[10] = " ";

        parts[11] = NilProtocolUtils.stringify(n.getSixth(tokenId));

        parts[12] = " ";

        parts[13] = NilProtocolUtils.stringify(n.getSeventh(tokenId));

        parts[14] = " ";

        parts[15] = NilProtocolUtils.stringify(n.getEight(tokenId));

        parts[16] = "</text></svg>";

        string memory output = string(
            abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5], parts[6], parts[7], parts[8])
        );
        output = string(
            abi.encodePacked(
                output,
                parts[9],
                parts[10],
                parts[11],
                parts[12],
                parts[13],
                parts[14],
                parts[15],
                parts[16]
            )
        );

        string memory json = NilProtocolUtils.base64encode(
            bytes(
                string(
                    abi.encodePacked(
                        '{"name": "sN #',
                        NilProtocolUtils.stringify(tokenId),
                        '", "description": "Staked N is just staked numbers.", "image": "data:image/svg+xml;base64,',
                        NilProtocolUtils.base64encode(bytes(output)),
                        '"}'
                    )
                )
            )
        );
        output = string(abi.encodePacked("data:application/json;base64,", json));

        return output;
    }
}

File 3 of 23 : AbstractStaking.sol
//SPDX-License-Identifier: MIT
/**
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(     (@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@           @@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(   @@@@@@@@@@@@@@@@@@@@(            @@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@         @@@@@@@@@@@@@@@             @@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@           @@@@@@@@@@@(            @@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@      @@@@@@@@@@@@             @@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@(            @@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@     @@@@@@@     @@@@@@@             @@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@(         @@(         @@(            @@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@          @@          @@           @@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@     @@@@@@@     @@@@@@@     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(     @@@@@@@     @@@@@@@     @@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@           @           @           @@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@(            @@@         @@@         @@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@             @@@@@@@     @@@@@@@     @@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@(            @@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@             @@@@@@@@@@@       @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@(            @@@@@@@@@@@@           @@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@             @@@@@@@@@@@@@@@         @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@(            @@@@@@@@@@@@@@@@@@@@@   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@           @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@(     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 */
pragma solidity 0.8.6;

import "./interfaces/INil.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";

/**
 * @title AbstractStaking
 * @author Nil DAO
 */
abstract contract AbstractStaking is AccessControl, ReentrancyGuard {
    bytes32 public constant ADMIN_ROLE = keccak256("ADMIN");
    bytes32 public constant GUARDIAN_ROLE = keccak256("GUARDIAN");

    event Staked(address account, uint256 amount, uint256 balance, uint256 rewards, uint256 votes);
    event Unstaked(address account, uint256 amount, uint256 balance, uint256 rewards, uint256 votes);
    event Rewarded(address account, uint256 rewards);
    event VotesSpent(address account, uint256 votesSpent, uint256 totalVotesStored);
    event VotesSpenderSet(address spender);
    event MinStakingPeriodSet(uint256 minStakingPeriod);

    mapping(address => uint256) public balancePerAccount;
    mapping(address => uint256) public userRewardPerTokenPaid;
    mapping(address => uint256) public userVotesPerTokenPaid;
    mapping(address => uint256) public rewardsByAccount;
    mapping(address => uint256) public votesByAccount;
    mapping(address => uint256) public stakingTimeByAccount;

    address public voteSpender;
    bool public emergencyShutdown;
    uint256 public lastRewardsRateUpdate;
    uint256 public lastVotesUpdate;
    uint256 public rewardRatePerSecond;
    uint256 public votesRatePerSecond;
    uint256 public rewardPerTokenStored;
    uint256 public votesPerTokenStored;
    uint256 public totalVotesStored;
    uint256 public minStakingPeriod;
    uint256 public totalBalance;

    INil public immutable nil;

    constructor(
        INil nil_,
        address dao,
        uint256 rewardRatePerSecond_,
        uint256 votesRatePerSecond_
    ) {
        require(address(nil_) != address(0), "AbstractStaking:ILLEGAL_ADDRESS");
        nil = nil_;
        rewardRatePerSecond = rewardRatePerSecond_;
        votesRatePerSecond = votesRatePerSecond_;
        lastRewardsRateUpdate = block.timestamp;
        lastVotesUpdate = block.timestamp;
        minStakingPeriod = 0;
        _setupRole(GUARDIAN_ROLE, dao);
        _setupRole(ADMIN_ROLE, dao);
        _setupRole(GUARDIAN_ROLE, msg.sender);
        _setupRole(ADMIN_ROLE, msg.sender); // This will be surrendered after deployment
        _setRoleAdmin(GUARDIAN_ROLE, ADMIN_ROLE);
        _setRoleAdmin(ADMIN_ROLE, ADMIN_ROLE);
    }

    modifier onlyGuardian() {
        require(hasRole(GUARDIAN_ROLE, msg.sender), "AbstractStaking:ACCESS_DENIED");
        _;
    }

    modifier onlyAdmin() {
        require(hasRole(ADMIN_ROLE, msg.sender), "AbstractStaking:ACCESS_DENIED");
        _;
    }

    function updateRewards(uint256 newRate) external onlyAdmin {
        require(newRate != rewardRatePerSecond, "AbstractStaking:RATE_NOT_CHANGED");
        rewardPerTokenStored = rewardPerToken();
        lastRewardsRateUpdate = block.timestamp;
        rewardRatePerSecond = newRate;
    }

    function updateVotes(uint256 newRate) external onlyAdmin {
        require(newRate != votesRatePerSecond, "AbstractStaking:RATE_NOT_CHANGED");
        totalVotesStored = totalVotes();
        votesPerTokenStored = votesPerToken();
        lastVotesUpdate = block.timestamp;
        votesRatePerSecond = newRate;
    }

    function rewardPerToken() public view returns (uint256) {
        uint256 delta = block.timestamp - lastRewardsRateUpdate;
        uint256 accruedRewards = delta * rewardRatePerSecond;
        return (rewardPerTokenStored + accruedRewards);
    }

    function votesPerToken() public view returns (uint256) {
        uint256 delta = block.timestamp - lastVotesUpdate;
        uint256 accruedVotes = delta * votesRatePerSecond;
        return (votesPerTokenStored + accruedVotes);
    }

    function calculateCurrentRewards(address account) public view returns (uint256, uint256) {
        uint256 currentRewardPerToken = rewardPerToken();
        uint256 newlyAccruedRewardsPerToken = (currentRewardPerToken - userRewardPerTokenPaid[account]);
        uint256 currentRewards = rewardsByAccount[account] +
            ((balancePerAccount[account] * newlyAccruedRewardsPerToken) / 1e18);
        return (currentRewards, currentRewardPerToken);
    }

    function calculateCurrentVotes(address account) public view returns (uint256, uint256) {
        uint256 currentVotesPerToken = votesPerToken();
        uint256 newlyAccruedVotesPerToken = (currentVotesPerToken - userVotesPerTokenPaid[account]);
        uint256 currentVotes = votesByAccount[account] +
            ((balancePerAccount[account] * newlyAccruedVotesPerToken) / 1e18);
        return (currentVotes, currentVotesPerToken);
    }

    function _accrueRewards(address account) internal returns (uint256) {
        (uint256 currentRewards, uint256 currentRewardPerToken) = calculateCurrentRewards(account);
        rewardsByAccount[account] = currentRewards;
        userRewardPerTokenPaid[account] = currentRewardPerToken;
        return currentRewards;
    }

    function _accrueVotes(address account) internal returns (uint256) {
        (uint256 currentVotes, uint256 currentVotesPerToken) = calculateCurrentVotes(account);
        votesByAccount[account] = currentVotes;
        userVotesPerTokenPaid[account] = currentVotesPerToken;
        // The following differs from rewards as we want to keep track of total votes
        uint256 newlyAccruedVotesPerToken = (currentVotesPerToken - votesPerTokenStored);
        totalVotesStored = totalVotesStored + ((totalBalance * newlyAccruedVotesPerToken) / 1e18);
        lastVotesUpdate = block.timestamp;
        votesPerTokenStored = currentVotesPerToken;
        return currentVotes;
    }

    function _stake(address account, uint256 amount) internal {
        require(!emergencyShutdown, "AbstractStaking:SHUTDOWN");
        uint256 rewards = _accrueRewards(account);
        uint256 votes = _accrueVotes(account);
        uint256 balance = balancePerAccount[account];
        balancePerAccount[account] = balance + amount;
        totalBalance += amount;
        stakingTimeByAccount[account] = block.timestamp;
        emit Staked(account, amount, balance, rewards, votes);
    }

    function _unstake(address account, uint256 amount) internal {
        if (emergencyShutdown) return;
        require(
            block.timestamp - stakingTimeByAccount[account] > minStakingPeriod,
            "AbstractStaking:MIN_STAKING_REQUIRED"
        );
        uint256 rewards = _accrueRewards(account);
        uint256 votes = _accrueVotes(account);
        uint256 balance = balancePerAccount[account];
        balancePerAccount[account] = balance - amount;
        totalBalance -= amount;
        emit Unstaked(account, amount, balance, rewards, votes);
    }

    function claim(address account) external nonReentrant {
        require(!emergencyShutdown, "AbstractStaking:SHUTDOWN");
        (uint256 currentRewards, uint256 currentRewardPerToken) = calculateCurrentRewards(account);
        require(currentRewards > 0, "AbstractStaking:ZERO_REWARDS");
        rewardsByAccount[account] = 0;
        userRewardPerTokenPaid[account] = currentRewardPerToken;
        nil.mint(account, currentRewards);
        emit Rewarded(account, currentRewards);
    }

    function claimableOf(address account) external view returns (uint256) {
        (uint256 currentRewards, ) = calculateCurrentRewards(account);
        return currentRewards;
    }

    function spendVotes(address account, uint256 amount) external nonReentrant {
        require(!emergencyShutdown, "AbstractStaking:SHUTDOWN");
        require(voteSpender == msg.sender, "AbstractStaking:ACCESS_DENIED");
        (uint256 currentVotes, uint256 currentVotesPerToken) = calculateCurrentVotes(account);
        votesByAccount[account] = currentVotes - amount;
        userVotesPerTokenPaid[account] = currentVotesPerToken;
        uint256 newlyAccruedVotesPerToken = (currentVotesPerToken - votesPerTokenStored);
        totalVotesStored = (totalVotesStored + ((totalBalance * newlyAccruedVotesPerToken) / 1e18)) - amount;
        lastVotesUpdate = block.timestamp;
        votesPerTokenStored = currentVotesPerToken;
        emit VotesSpent(account, amount, totalVotesStored);
    }

    function totalVotes() public view returns (uint256) {
        return (totalVotesStored + ((totalBalance * (votesPerToken() - votesPerTokenStored)) / 1e18));
    }

    function setVoteSpender(address voteSpender_) external onlyAdmin {
        voteSpender = voteSpender_;
        emit VotesSpenderSet(voteSpender_);
    }

    function setMinStakingPeriod(uint256 minStakingPeriod_) external onlyAdmin {
        require(minStakingPeriod_ < 14 days, "AbstractStaking:ILLEGAL_MIN_STAKING_PERIOD");
        minStakingPeriod = minStakingPeriod_;
        emit MinStakingPeriodSet(minStakingPeriod_);
    }

    function setEmergencyShutdown(bool emergencyShutdown_) external onlyGuardian {
        emergencyShutdown = emergencyShutdown_;
    }
}

File 4 of 23 : IN.sol
// SPDX-License-Identifier: MIT
/**
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(     (@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@           @@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(   @@@@@@@@@@@@@@@@@@@@(            @@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@         @@@@@@@@@@@@@@@             @@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@           @@@@@@@@@@@(            @@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@      @@@@@@@@@@@@             @@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@(            @@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@     @@@@@@@     @@@@@@@             @@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@(         @@(         @@(            @@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@          @@          @@           @@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@     @@@@@@@     @@@@@@@     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(     @@@@@@@     @@@@@@@     @@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@           @           @           @@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@(            @@@         @@@         @@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@             @@@@@@@     @@@@@@@     @@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@(            @@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@             @@@@@@@@@@@       @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@(            @@@@@@@@@@@@           @@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@             @@@@@@@@@@@@@@@         @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@(            @@@@@@@@@@@@@@@@@@@@@   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@           @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@(     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 */
pragma solidity 0.8.6;
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";

interface IN is IERC721Enumerable, IERC721Metadata {
    function getFirst(uint256 tokenId) external view returns (uint256);

    function getSecond(uint256 tokenId) external view returns (uint256);

    function getThird(uint256 tokenId) external view returns (uint256);

    function getFourth(uint256 tokenId) external view returns (uint256);

    function getFifth(uint256 tokenId) external view returns (uint256);

    function getSixth(uint256 tokenId) external view returns (uint256);

    function getSeventh(uint256 tokenId) external view returns (uint256);

    function getEight(uint256 tokenId) external view returns (uint256);
}

File 5 of 23 : INil.sol
// SPDX-License-Identifier: MIT
/**
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(     (@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@           @@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(   @@@@@@@@@@@@@@@@@@@@(            @@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@         @@@@@@@@@@@@@@@             @@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@           @@@@@@@@@@@(            @@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@      @@@@@@@@@@@@             @@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@(            @@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@     @@@@@@@     @@@@@@@             @@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@(         @@(         @@(            @@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@          @@          @@           @@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@     @@@@@@@     @@@@@@@     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(     @@@@@@@     @@@@@@@     @@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@           @           @           @@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@(            @@@         @@@         @@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@             @@@@@@@     @@@@@@@     @@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@(            @@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@             @@@@@@@@@@@       @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@(            @@@@@@@@@@@@           @@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@             @@@@@@@@@@@@@@@         @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@(            @@@@@@@@@@@@@@@@@@@@@   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@           @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@(     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 */
pragma solidity 0.8.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface INil is IERC20 {
    function MAX_SUPPLY() external returns (uint256);

    function mint(address to, uint256 amount) external;
}

File 6 of 23 : INOwnerResolver.sol
// SPDX-License-Identifier: MIT
/**
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(     (@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@           @@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(   @@@@@@@@@@@@@@@@@@@@(            @@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@         @@@@@@@@@@@@@@@             @@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@           @@@@@@@@@@@(            @@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@      @@@@@@@@@@@@             @@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@(            @@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@     @@@@@@@     @@@@@@@             @@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@(         @@(         @@(            @@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@          @@          @@           @@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@     @@@@@@@     @@@@@@@     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(     @@@@@@@     @@@@@@@     @@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@           @           @           @@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@(            @@@         @@@         @@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@             @@@@@@@     @@@@@@@     @@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@(            @@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@             @@@@@@@@@@@       @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@(            @@@@@@@@@@@@           @@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@             @@@@@@@@@@@@@@@         @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@(            @@@@@@@@@@@@@@@@@@@@@   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@           @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@(     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 */
pragma solidity 0.8.6;

interface INOwnerResolver {
    function ownerOf(uint256 nid) external view returns (address);

    function balanceOf(address account) external view returns (uint256);

    function nOwned(address owner) external view returns (uint256[] memory);
}

File 7 of 23 : NilProtocolUtils.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

library NilProtocolUtils {
    bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /// [MIT License]
    /// @title Base64
    /// @notice Provides a function for encoding some bytes in base64
    /// @author Brecht Devos <[email protected]>

    /// @notice Encodes some bytes to the base64 representation
    function base64encode(bytes memory data) external pure returns (string memory) {
        uint256 len = data.length;
        if (len == 0) return "";

        // multiply by 4/3 rounded up
        uint256 encodedLen = 4 * ((len + 2) / 3);

        // Add some extra buffer at the end
        bytes memory result = new bytes(encodedLen + 32);

        bytes memory table = TABLE;

        assembly {
            let tablePtr := add(table, 1)
            let resultPtr := add(result, 32)

            for {
                let i := 0
            } lt(i, len) {

            } {
                i := add(i, 3)
                let input := and(mload(add(data, i)), 0xffffff)

                let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))
                out := shl(8, out)
                out := add(out, and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF))
                out := shl(8, out)
                out := add(out, and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF))
                out := shl(8, out)
                out := add(out, and(mload(add(tablePtr, and(input, 0x3F))), 0xFF))
                out := shl(224, out)

                mstore(resultPtr, out)

                resultPtr := add(resultPtr, 4)
            }

            switch mod(len, 3)
            case 1 {
                mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
            }
            case 2 {
                mstore(sub(resultPtr, 1), shl(248, 0x3d))
            }

            mstore(result, encodedLen)
        }

        return string(result);
    }

    // @notice converts number to string
    function stringify(uint256 value) external pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT license
        // 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);
    }
}

File 8 of 23 : ERC721Holder.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721Receiver.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721Holder is IERC721Receiver {
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
}

File 9 of 23 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "./IERC721Enumerable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
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();
    }
}

File 10 of 23 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
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);
}

File 11 of 23 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.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;

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

File 12 of 23 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

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

File 13 of 23 : AccessControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
        return _roles[role].adminRole;
    }

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

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

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

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    function _grantRole(bytes32 role, address account) private {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 14 of 23 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

File 15 of 23 : IAccessControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 16 of 23 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

File 17 of 23 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
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);
    }
}

File 18 of 23 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 19 of 23 : IERC165.sol
// SPDX-License-Identifier: MIT

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 20 of 23 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
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);
}

File 21 of 23 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
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);
}

File 22 of 23 : IERC721.sol
// SPDX-License-Identifier: MIT

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`, 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;
}

File 23 of 23 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
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);
}

File 24 of 23 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
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 {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_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 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 {}
}

Settings
{
  "metadata": {
    "bytecodeHash": "none",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 800
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {
    "contracts/libraries/NilProtocolUtils.sol": {
      "NilProtocolUtils": "0x61fae53d161095e9b75306837ff06c7b778f6504"
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract INil","name":"nil_","type":"address"},{"internalType":"contract IN","name":"n_","type":"address"},{"internalType":"address","name":"dao","type":"address"},{"internalType":"uint256","name":"rewardRatePerSecond","type":"uint256"},{"internalType":"uint256","name":"votesRatePerSecond","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minStakingPeriod","type":"uint256"}],"name":"MinStakingPeriodSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewards","type":"uint256"}],"name":"Rewarded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"balance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewards","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"votes","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"balance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewards","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"votes","type":"uint256"}],"name":"Unstaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"spender","type":"address"}],"name":"VotesSpenderSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"votesSpent","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalVotesStored","type":"uint256"}],"name":"VotesSpent","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GUARDIAN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INVERSE_N_SHARE_OF_NIL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"N_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"N_UNIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VOTE_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balancePerAccount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"calculateCurrentRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"calculateCurrentVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"claimableOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyShutdown","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getEight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getFifth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getFirst","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getFourth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getSeventh","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getSixth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getThird","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRewardsRateUpdate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastVotesUpdate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minStakingPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"n","outputs":[{"internalType":"contract IN","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nOwned","outputs":[{"internalType":"uint256[]","name":"nids","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nil","outputs":[{"internalType":"contract INil","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"nid","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRatePerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardsByAccount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"emergencyShutdown_","type":"bool"}],"name":"setEmergencyShutdown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"minStakingPeriod_","type":"uint256"}],"name":"setMinStakingPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"voteSpender_","type":"address"}],"name":"setVoteSpender","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"spendVotes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"nIds","type":"uint256[]"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakingTimeByAccount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalVotesStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"nIds","type":"uint256[]"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newRate","type":"uint256"}],"name":"updateRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newRate","type":"uint256"}],"name":"updateVotes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userRewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userVotesPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voteSpender","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"votesByAccount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"votesPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"votesPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"votesRatePerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60c06040523480156200001157600080fd5b5060405162005c6f38038062005c6f8339810160408190526200003491620003f2565b604080518082018252600881526729ba30b5b2b2103760c11b6020808301919091528251808401909352600383526229aa2760e91b908301526001805590868585856001600160a01b038416620000d25760405162461bcd60e51b815260206004820152601f60248201527f41627374726163745374616b696e673a494c4c4547414c5f414444524553530060448201526064015b60405180910390fd5b6001600160601b0319606085901b16608052600b829055600c819055426009819055600a5560006010556200011760008051602062005c2f8339815191528462000251565b6200013260008051602062005c4f8339815191528462000251565b6200014d60008051602062005c2f8339815191523362000251565b6200016860008051602062005c4f8339815191523362000251565b6200019260008051602062005c2f83398151915260008051602062005c4f83398151915262000261565b620001ad60008051602062005c4f8339815191528062000261565b50508351620001c692506012915060208501906200034c565b508051620001dc9060139060208401906200034c565b5050506001600160a01b038416620002375760405162461bcd60e51b815260206004820152601760248201527f5374616b65644e3a494c4c4547414c5f414444524553530000000000000000006044820152606401620000c9565b50505060601b6001600160601b03191660a05250620004ad565b6200025d8282620002ac565b5050565b600082815260208190526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200025d576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620003083390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b8280546200035a9062000457565b90600052602060002090601f0160209004810192826200037e5760008555620003c9565b82601f106200039957805160ff1916838001178555620003c9565b82800160010185558215620003c9579182015b82811115620003c9578251825591602001919060010190620003ac565b50620003d7929150620003db565b5090565b5b80821115620003d75760008155600101620003dc565b600080600080600060a086880312156200040b57600080fd5b8551620004188162000494565b60208701519095506200042b8162000494565b60408701519094506200043e8162000494565b6060870151608090970151959894975095949392505050565b600181811c908216806200046c57607f821691505b602082108114156200048e57634e487b7160e01b600052602260045260246000fd5b50919050565b6001600160a01b0381168114620004aa57600080fd5b50565b60805160601c60a05160601c6156d16200055e600039600081816106c201528181610d3601528181610f06015281816115dd01528181611716015281816118b70152818161190701528181611957015281816119b601528181611d5201528181611e9b01528181611fe6015281816121310152818161227c015281816123c8015281816125140152818161266001528181612e270152612fab01526000818161069b015261122f01526156d16000f3fe608060405234801561001057600080fd5b50600436106104a85760003560e01c80636352211e1161026b578063b1e95e9411610150578063cd3daf9d116100c8578063dfccedd311610097578063e53fa29e1161007c578063e53fa29e14610a4c578063e985e9c514610a6c578063fa7f71b114610aa857600080fd5b8063dfccedd314610a30578063e449f34114610a3957600080fd5b8063cd3daf9d146109f9578063d439476e14610a01578063d547741f14610a14578063df136d6514610a2757600080fd5b8063c36f771f1161011f578063c6760b9c11610104578063c6760b9c146109c0578063c87b56dd146109d3578063c9662ebb146109e657600080fd5b8063c36f771f14610997578063c590cd68146109a057600080fd5b8063b1e95e941461093e578063b88d4fde14610951578063bae3110714610964578063c279187c1461097757600080fd5b80638c921d06116101e35780639ec29b82116101b2578063a22cb46511610197578063a22cb46514610902578063abfe3ca914610915578063ad7a672f1461093557600080fd5b80639ec29b82146108e7578063a217fddf146108fa57600080fd5b80638c921d061461088257806391d14854146108955780639347e43f146108cc57806395d89b41146108df57600080fd5b806375b238fc1161023a5780638903ab9d1161021f5780638903ab9d1461083c5780638aa001fc1461084f5780638b8763471461086257600080fd5b806375b238fc1461080257806388ee6a431461082957600080fd5b80636352211e146107c0578063667386f7146107d35780636dfc941e146107e657806370a08231146107ef57600080fd5b806324ea54f41161039157806336568abe1161030957806342d9d876116102d85780635b1697ce116102bd5780635b1697ce146107a65780635d773b2c146107af5780635d7cb91c146107b857600080fd5b806342d9d876146107805780634f6ccce71461079357600080fd5b806336568abe146107275780633baed92f1461073a5780634088093f1461075a57806342842e0e1461076d57600080fd5b80632e52d606116103605780632f745c59116103455780632f745c59146106f757806332c43a1f1461070a5780633403c2fc1461071357600080fd5b80632e52d606146106bd5780632f2ff15d146106e457600080fd5b806324ea54f414610646578063265a499b1461066d5780632a265d9a1461068d5780632c22f4551461069657600080fd5b80630e67354d1161042457806318160ddd116103f35780631e83409a116103d85780631e83409a146105fd57806323b872dd14610610578063248a9ca31461062357600080fd5b806318160ddd146105ed57806319f614b9146105f557600080fd5b80630e67354d146105735780630fbf0a931461059b57806314c64402146105ae578063150b7a02146105c157600080fd5b8063081812fc1161047b578063095ea7b311610460578063095ea7b3146105435780630b2503a6146105585780630d15fd771461056b57600080fd5b8063081812fc1461051057806308a6e4f91461053b57600080fd5b806301357bab146104ad57806301ffc9a7146104cf578063069c34f6146104f257806306fdde03146104fb575b600080fd5b6104bc670de0b6b3a764000081565b6040519081526020015b60405180910390f35b6104e26104dd3660046144b0565b610abb565b60405190151581526020016104c6565b6104bc60105481565b610503610adb565b6040516104c69190614888565b61052361051e366004614474565b610b6d565b6040516001600160a01b0390911681526020016104c6565b6104bc600481565b6105566105513660046143ba565b610c07565b005b6104bc610566366004614474565b610d1d565b6104bc610db9565b61058661058136600461425b565b610e02565b604080519283526020830191909152016104c6565b6105566105a93660046143e4565b610ea1565b6105566105bc366004614459565b61100e565b6105d46105cf3660046142e5565b6110c5565b6040516001600160e01b031990911681526020016104c6565b601a546104bc565b6104bc600181565b61055661060b36600461425b565b6110d6565b61055661061e3660046142a9565b6112d9565b6104bc610631366004614474565b60009081526020819052604090206001015490565b6104bc7f8b5b16d04624687fcf0d0228f19993c9157c1ed07b41d8d430fd9100eb099fe881565b6104bc61067b36600461425b565b60046020526000908152604090205481565b6104bc60095481565b6105237f000000000000000000000000000000000000000000000000000000000000000081565b6105237f000000000000000000000000000000000000000000000000000000000000000081565b6105566106f236600461448d565b611360565b6104bc6107053660046143ba565b611386565b6104bc600a5481565b6008546104e290600160a01b900460ff1681565b61055661073536600461448d565b61142e565b6104bc61074836600461425b565b60026020526000908152604090205481565b610556610768366004614474565b6114ba565b61055661077b3660046142a9565b6115a9565b6104bc61078e366004614474565b6115c4565b6104bc6107a1366004614474565b611614565b6104bc6122b881565b6104bc600b5481565b6104bc6116b8565b6105236107ce366004614474565b6116f2565b6104bc6107e1366004614474565b6116fd565b6104bc600c5481565b6104bc6107fd36600461425b565b61174d565b6104bc7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4281565b610556610837366004614474565b611758565b6104bc61084a36600461425b565b61188a565b6104bc61085d366004614474565b61189e565b6104bc61087036600461425b565b60036020526000908152604090205481565b6104bc610890366004614474565b6118ee565b6104e26108a336600461448d565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6104bc6108da366004614474565b61193e565b61050361198e565b6104bc6108f5366004614474565b61199d565b6104bc600081565b610556610910366004614390565b6119ed565b6104bc61092336600461425b565b60056020526000908152604090205481565b6104bc60115481565b61055661094c366004614474565b611ab2565b61055661095f3660046142e5565b611b96565b61055661097236600461425b565b611c24565b6104bc61098536600461425b565b60066020526000908152604090205481565b6104bc600f5481565b6104bc6109ae36600461425b565b60076020526000908152604090205481565b600854610523906001600160a01b031681565b6105036109e1366004614474565b611cf0565b6105866109f436600461425b565b612a28565b6104bc612abb565b610556610a0f3660046143ba565b612aee565b610556610a2236600461448d565b612ce8565b6104bc600d5481565b6104bc600e5481565b610556610a473660046143e4565b612d0e565b610a5f610a5a36600461425b565b612ef3565b6040516104c69190614844565b6104e2610a7a366004614276565b6001600160a01b03918216600090815260176020908152604080832093909416825291909152205460ff1690565b6104bc610ab6366004614474565b612f92565b6000610ac682612fe2565b80610ad55750610ad582613007565b92915050565b606060128054610aea906149a7565b80601f0160208091040260200160405190810160405280929190818152602001828054610b16906149a7565b8015610b635780601f10610b3857610100808354040283529160200191610b63565b820191906000526020600020905b815481529060010190602001808311610b4657829003601f168201915b5050505050905090565b6000818152601460205260408120546001600160a01b0316610beb5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152601660205260409020546001600160a01b031690565b6000610c128261303c565b9050806001600160a01b0316836001600160a01b03161415610c805760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610be2565b336001600160a01b0382161480610c9c5750610c9c8133610a7a565b610d0e5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610be2565b610d1883836130c7565b505050565b60405163059281d360e11b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690630b2503a6906024015b60206040518083038186803b158015610d8157600080fd5b505afa158015610d95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad59190614561565b6000670de0b6b3a7640000600e54610dcf6116b8565b610dd9919061494d565b601154610de6919061492e565b610df0919061490c565b600f54610dfd91906148f4565b905090565b6000806000610e0f612abb565b6001600160a01b03851660009081526003602052604081205491925090610e36908361494d565b6001600160a01b03861660009081526002602052604081205491925090670de0b6b3a764000090610e6890849061492e565b610e72919061490c565b6001600160a01b038716600090815260056020526040902054610e9591906148f4565b96929550919350505050565b60026001541415610ef45760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610be2565b600260015560005b81811015610fea577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166342842e0e3330868686818110610f4757610f47614a29565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b158015610f9e57600080fd5b505af1158015610fb2573d6000803e3d6000fd5b50505050610fd833848484818110610fcc57610fcc614a29565b90506020020135613135565b80610fe2816149e2565b915050610efc565b5061100633611001670de0b6b3a76400008461492e565b613283565b505060018055565b3360009081527fc05ec64e211cc9b3f20351aa917dc92f371c52a9ae3566b93bf47db2074b0329602052604090205460ff1661108c5760405162461bcd60e51b815260206004820152601d60248201527f41627374726163745374616b696e673a4143434553535f44454e4945440000006044820152606401610be2565b60088054911515600160a01b027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909216919091179055565b630a85bd0160e11b5b949350505050565b600260015414156111295760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610be2565b6002600155600854600160a01b900460ff16156111885760405162461bcd60e51b815260206004820152601860248201527f41627374726163745374616b696e673a53485554444f574e00000000000000006044820152606401610be2565b60008061119483610e02565b91509150600082116111e85760405162461bcd60e51b815260206004820152601c60248201527f41627374726163745374616b696e673a5a45524f5f52455741524453000000006044820152606401610be2565b6001600160a01b038381166000818152600560209081526040808320839055600390915290819020849055516340c10f1960e01b81526004810191909152602481018490527f0000000000000000000000000000000000000000000000000000000000000000909116906340c10f1990604401600060405180830381600087803b15801561127557600080fd5b505af1158015611289573d6000803e3d6000fd5b5050604080516001600160a01b0387168152602081018690527fb3b7a071186534c03b40695710096f289fd4ed6c1a374aff0bb648955e4fe563935001905060405180910390a150506001805550565b6112e333826133bf565b6113555760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610be2565b610d188383836134b2565b60008281526020819052604090206001015461137c8133613671565b610d1883836136ef565b60006113918361378d565b82106114055760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e64730000000000000000000000000000000000000000006064820152608401610be2565b506001600160a01b03919091166000908152601860209081526040808320938352929052205490565b6001600160a01b03811633146114ac5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610be2565b6114b68282613827565b5050565b3360009081527f5cbfc8ee58ca47855df7bcf648dd304ddb6b932f9b87878bdf6318d7ec7ee5b7602052604090205460ff166115385760405162461bcd60e51b815260206004820152601d60248201527f41627374726163745374616b696e673a4143434553535f44454e4945440000006044820152606401610be2565b600c5481141561158a5760405162461bcd60e51b815260206004820181905260248201527f41627374726163745374616b696e673a524154455f4e4f545f4348414e4745446044820152606401610be2565b611592610db9565b600f5561159d6116b8565b600e5542600a55600c55565b610d1883838360405180602001604052806000815250611b96565b60405163216cec3b60e11b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906342d9d87690602401610d69565b600061161f601a5490565b82106116935760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e647300000000000000000000000000000000000000006064820152608401610be2565b601a82815481106116a6576116a6614a29565b90600052602060002001549050919050565b600080600a54426116c9919061494d565b90506000600c54826116db919061492e565b905080600e546116eb91906148f4565b9250505090565b6000610ad58261303c565b60405163667386f760e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063667386f790602401610d69565b6000610ad58261378d565b3360009081527f5cbfc8ee58ca47855df7bcf648dd304ddb6b932f9b87878bdf6318d7ec7ee5b7602052604090205460ff166117d65760405162461bcd60e51b815260206004820152601d60248201527f41627374726163745374616b696e673a4143434553535f44454e4945440000006044820152606401610be2565b62127500811061184e5760405162461bcd60e51b815260206004820152602a60248201527f41627374726163745374616b696e673a494c4c4547414c5f4d494e5f5354414b60448201527f494e475f504552494f44000000000000000000000000000000000000000000006064820152608401610be2565b60108190556040518181527fbc6ba7ae52fb7c0043799abd7b08a2cb181b730096564a856c61c623c42c23ea906020015b60405180910390a150565b60008061189683610e02565b509392505050565b6040516322a8007f60e21b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690638aa001fc90602401610d69565b6040516346490e8360e11b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690638c921d0690602401610d69565b604051639347e43f60e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639347e43f90602401610d69565b606060138054610aea906149a7565b604051634f614dc160e11b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639ec29b8290602401610d69565b6001600160a01b038216331415611a465760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610be2565b3360008181526017602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3360009081527f5cbfc8ee58ca47855df7bcf648dd304ddb6b932f9b87878bdf6318d7ec7ee5b7602052604090205460ff16611b305760405162461bcd60e51b815260206004820152601d60248201527f41627374726163745374616b696e673a4143434553535f44454e4945440000006044820152606401610be2565b600b54811415611b825760405162461bcd60e51b815260206004820181905260248201527f41627374726163745374616b696e673a524154455f4e4f545f4348414e4745446044820152606401610be2565b611b8a612abb565b600d5542600955600b55565b611ba033836133bf565b611c125760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610be2565b611c1e848484846138a6565b50505050565b3360009081527f5cbfc8ee58ca47855df7bcf648dd304ddb6b932f9b87878bdf6318d7ec7ee5b7602052604090205460ff16611ca25760405162461bcd60e51b815260206004820152601d60248201527f41627374726163745374616b696e673a4143434553535f44454e4945440000006044820152606401610be2565b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f87c83011685ca936f8b1392fb73a8a5ce61effeb882a6786e14e32eacf58d0ca9060200161187f565b6060611cfa614207565b60405180610c800160405280610c568152602001614a6f610c569139815260405163667386f760e01b8152600481018490527361fae53d161095e9b75306837ff06c7b778f6504906368f7aee5906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063667386f79060240160206040518083038186803b158015611d9457600080fd5b505afa158015611da8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dcc9190614561565b6040518263ffffffff1660e01b8152600401611dea91815260200190565b60006040518083038186803b158015611e0257600080fd5b505af4158015611e16573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611e3e91908101906144ea565b6020808301919091526040805180820190915260018152600160fd1b9181019190915281600260200201526040516322a8007f60e21b8152600481018490527361fae53d161095e9b75306837ff06c7b778f6504906368f7aee5907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690638aa001fc9060240160206040518083038186803b158015611ee557600080fd5b505afa158015611ef9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1d9190614561565b6040518263ffffffff1660e01b8152600401611f3b91815260200190565b60006040518083038186803b158015611f5357600080fd5b505af4158015611f67573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611f8f91908101906144ea565b60608201526040805180820190915260018152600160fd1b6020820152816004602002015260405163fa7f71b160e01b8152600481018490527361fae53d161095e9b75306837ff06c7b778f6504906368f7aee5907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fa7f71b19060240160206040518083038186803b15801561203057600080fd5b505afa158015612044573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120689190614561565b6040518263ffffffff1660e01b815260040161208691815260200190565b60006040518083038186803b15801561209e57600080fd5b505af41580156120b2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120da91908101906144ea565b60a08201526040805180820190915260018152600160fd1b60208201528160066020020152604051634f614dc160e11b8152600481018490527361fae53d161095e9b75306837ff06c7b778f6504906368f7aee5907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639ec29b829060240160206040518083038186803b15801561217b57600080fd5b505afa15801561218f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121b39190614561565b6040518263ffffffff1660e01b81526004016121d191815260200190565b60006040518083038186803b1580156121e957600080fd5b505af41580156121fd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261222591908101906144ea565b60e08201526040805180820190915260018152600160fd1b6020820152816008602002015260405163059281d360e11b8152600481018490527361fae53d161095e9b75306837ff06c7b778f6504906368f7aee5907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690630b2503a69060240160206040518083038186803b1580156122c657600080fd5b505afa1580156122da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122fe9190614561565b6040518263ffffffff1660e01b815260040161231c91815260200190565b60006040518083038186803b15801561233457600080fd5b505af4158015612348573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261237091908101906144ea565b6101208201526040805180820190915260018152600160fd1b602082015281600a602002015260405163216cec3b60e11b8152600481018490527361fae53d161095e9b75306837ff06c7b778f6504906368f7aee5907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906342d9d8769060240160206040518083038186803b15801561241257600080fd5b505afa158015612426573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244a9190614561565b6040518263ffffffff1660e01b815260040161246891815260200190565b60006040518083038186803b15801561248057600080fd5b505af4158015612494573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526124bc91908101906144ea565b6101608201526040805180820190915260018152600160fd1b602082015281600c60200201526040516346490e8360e11b8152600481018490527361fae53d161095e9b75306837ff06c7b778f6504906368f7aee5907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690638c921d069060240160206040518083038186803b15801561255e57600080fd5b505afa158015612572573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125969190614561565b6040518263ffffffff1660e01b81526004016125b491815260200190565b60006040518083038186803b1580156125cc57600080fd5b505af41580156125e0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261260891908101906144ea565b6101a08201526040805180820190915260018152600160fd1b602082015281600e6020020152604051639347e43f60e01b8152600481018490527361fae53d161095e9b75306837ff06c7b778f6504906368f7aee5907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639347e43f9060240160206040518083038186803b1580156126aa57600080fd5b505afa1580156126be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126e29190614561565b6040518263ffffffff1660e01b815260040161270091815260200190565b60006040518083038186803b15801561271857600080fd5b505af415801561272c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261275491908101906144ea565b6101e0820152604080518082018252600d81527f3c2f746578743e3c2f7376673e00000000000000000000000000000000000000602080830191909152610200840191909152825181840151838501516060860151608087015160a088015160c089015160e08a01516101008b0151995160009a6127d49a9091016145a6565b60408051808303601f19018152908290526101208401516101408501516101608601516101808701516101a08801516101c08901516101e08a01516102008b0151979950612827988a98906020016145a6565b604051602081830303815290604052905060007361fae53d161095e9b75306837ff06c7b778f65046373ea32347361fae53d161095e9b75306837ff06c7b778f65046368f7aee5886040518263ffffffff1660e01b815260040161288d91815260200190565b60006040518083038186803b1580156128a557600080fd5b505af41580156128b9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526128e191908101906144ea565b604051631cfa8c8d60e21b81527361fae53d161095e9b75306837ff06c7b778f6504906373ea323490612918908890600401614888565b60006040518083038186803b15801561293057600080fd5b505af4158015612944573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261296c91908101906144ea565b60405160200161297d929190614666565b6040516020818303038152906040526040518263ffffffff1660e01b81526004016129a89190614888565b60006040518083038186803b1580156129c057600080fd5b505af41580156129d4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526129fc91908101906144ea565b905080604051602001612a0f9190614742565b60408051601f1981840301815291905295945050505050565b6000806000612a356116b8565b6001600160a01b03851660009081526004602052604081205491925090612a5c908361494d565b6001600160a01b03861660009081526002602052604081205491925090670de0b6b3a764000090612a8e90849061492e565b612a98919061490c565b6001600160a01b038716600090815260066020526040902054610e9591906148f4565b60008060095442612acc919061494d565b90506000600b5482612ade919061492e565b905080600d546116eb91906148f4565b60026001541415612b415760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610be2565b6002600155600854600160a01b900460ff1615612ba05760405162461bcd60e51b815260206004820152601860248201527f41627374726163745374616b696e673a53485554444f574e00000000000000006044820152606401610be2565b6008546001600160a01b03163314612bfa5760405162461bcd60e51b815260206004820152601d60248201527f41627374726163745374616b696e673a4143434553535f44454e4945440000006044820152606401610be2565b600080612c0684612a28565b9092509050612c15838361494d565b6001600160a01b03851660009081526006602090815260408083209390935560049052908120829055600e54612c4b908361494d565b905083670de0b6b3a764000082601154612c65919061492e565b612c6f919061490c565b600f54612c7c91906148f4565b612c86919061494d565b600f81905542600a55600e839055604080516001600160a01b03881681526020810187905280820192909252517fcbc6eefd7b233bc1b7a15ae4538d04117992884b15e7e1a6fe9dfca4ac9c45a79181900360600190a1505060018055505050565b600082815260208190526040902060010154612d048133613671565b610d188383613827565b60026001541415612d615760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610be2565b6002600155612d8133612d7c670de0b6b3a76400008461492e565b61392f565b60005b81811015612eea5733612dae848484818110612da257612da2614a29565b905060200201356116f2565b6001600160a01b031614612e045760405162461bcd60e51b815260206004820152601360248201527f5374616b65644e3a57524f4e475f4f574e4552000000000000000000000000006044820152606401610be2565b612e25838383818110612e1957612e19614a29565b90506020020135613a8a565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166342842e0e3033868686818110612e6857612e68614a29565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b158015612ebf57600080fd5b505af1158015612ed3573d6000803e3d6000fd5b505050508080612ee2906149e2565b915050612d84565b50506001805550565b60606000612f008361174d565b90508067ffffffffffffffff811115612f1b57612f1b614a3f565b604051908082528060200260200182016040528015612f44578160200160208202803683370190505b50915060005b81811015612f8b57612f5c8482611386565b838281518110612f6e57612f6e614a29565b602090810291909101015280612f83816149e2565b915050612f4a565b5050919050565b60405163fa7f71b160e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fa7f71b190602401610d69565b60006001600160e01b0319821663780e9d6360e01b1480610ad55750610ad582613b31565b60006001600160e01b03198216637965db0b60e01b1480610ad557506301ffc9a760e01b6001600160e01b0319831614610ad5565b6000818152601460205260408120546001600160a01b031680610ad55760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610be2565b600081815260166020526040902080546001600160a01b0319166001600160a01b03841690811790915581906130fc8261303c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6001600160a01b03821661318b5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610be2565b6000818152601460205260409020546001600160a01b0316156131f05760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610be2565b6131fc60008383613b70565b6001600160a01b03821660009081526015602052604081208054600192906132259084906148f4565b909155505060008181526014602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600854600160a01b900460ff16156132dd5760405162461bcd60e51b815260206004820152601860248201527f41627374726163745374616b696e673a53485554444f574e00000000000000006044820152606401610be2565b60006132e883613be4565b905060006132f584613c24565b6001600160a01b03851660009081526002602052604090205490915061331b84826148f4565b6001600160a01b038616600090815260026020526040812091909155601180548692906133499084906148f4565b90915550506001600160a01b03851660008181526007602090815260409182902042905581519283528201869052810182905260608101849052608081018390527f9cfd25589d1eb8ad71e342a86a8524e83522e3936c0803048c08f6d9ad974f409060a0015b60405180910390a15050505050565b6000818152601460205260408120546001600160a01b03166134385760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610be2565b60006134438361303c565b9050806001600160a01b0316846001600160a01b0316148061347e5750836001600160a01b031661347384610b6d565b6001600160a01b0316145b806110ce57506001600160a01b0380821660009081526017602090815260408083209388168352929052205460ff166110ce565b826001600160a01b03166134c58261303c565b6001600160a01b0316146135415760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e00000000000000000000000000000000000000000000006064820152608401610be2565b6001600160a01b0382166135a35760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610be2565b6135ae838383613b70565b6135b96000826130c7565b6001600160a01b03831660009081526015602052604081208054600192906135e290849061494d565b90915550506001600160a01b03821660009081526015602052604081208054600192906136109084906148f4565b909155505060008181526014602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166114b6576136ad816001600160a01b03166014613caf565b6136b8836020613caf565b6040516020016136c9929190614787565b60408051601f198184030181529082905262461bcd60e51b8252610be291600401614888565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166114b6576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556137493390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006001600160a01b03821661380b5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610be2565b506001600160a01b031660009081526015602052604090205490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156114b6576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6138b18484846134b2565b6138bd84848484613e5f565b611c1e5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610be2565b600854600160a01b900460ff1615613945575050565b6010546001600160a01b03831660009081526007602052604090205461396b904261494d565b116139c45760405162461bcd60e51b8152602060048201526024808201527f41627374726163745374616b696e673a4d494e5f5354414b494e475f524551556044820152631254915160e21b6064820152608401610be2565b60006139cf83613be4565b905060006139dc84613c24565b6001600160a01b038516600090815260026020526040902054909150613a02848261494d565b6001600160a01b03861660009081526002602052604081209190915560118054869290613a3090849061494d565b9091555050604080516001600160a01b03871681526020810186905290810182905260608101849052608081018390527fdcfd2b4017d03f7e541021db793b2f9b31e4acdee005f789e52853c390e3e9629060a0016133b0565b6000613a958261303c565b9050613aa381600084613b70565b613aae6000836130c7565b6001600160a01b0381166000908152601560205260408120805460019290613ad790849061494d565b909155505060008281526014602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60006001600160e01b031982166380ac58cd60e01b1480610ac657506001600160e01b03198216635b5e139f60e01b1480610ad55750610ad582613007565b6001600160a01b0383161580613b8d57506001600160a01b038216155b613bd95760405162461bcd60e51b815260206004820152601760248201527f5374616b65644e3a5452414e534645525f44454e4945440000000000000000006044820152606401610be2565b610d18838383613fbf565b6000806000613bf284610e02565b6001600160a01b0390951660009081526005602090815260408083208490556003909152902094909455509192915050565b6000806000613c3284612a28565b6001600160a01b038616600090815260066020908152604080832085905560049091528120829055600e5492945090925090613c6e908361494d565b9050670de0b6b3a764000081601154613c87919061492e565b613c91919061490c565b600f54613c9e91906148f4565b600f555042600a55600e5592915050565b60606000613cbe83600261492e565b613cc99060026148f4565b67ffffffffffffffff811115613ce157613ce1614a3f565b6040519080825280601f01601f191660200182016040528015613d0b576020820181803683370190505b509050600360fc1b81600081518110613d2657613d26614a29565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613d5557613d55614a29565b60200101906001600160f81b031916908160001a9053506000613d7984600261492e565b613d849060016148f4565b90505b6001811115613e09577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613dc557613dc5614a29565b1a60f81b828281518110613ddb57613ddb614a29565b60200101906001600160f81b031916908160001a90535060049490941c93613e0281614990565b9050613d87565b508315613e585760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610be2565b9392505050565b60006001600160a01b0384163b15613fb757604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290613ea3903390899088908890600401614808565b602060405180830381600087803b158015613ebd57600080fd5b505af1925050508015613eed575060408051601f3d908101601f19168201909252613eea918101906144cd565b60015b613f9d573d808015613f1b576040519150601f19603f3d011682016040523d82523d6000602084013e613f20565b606091505b508051613f955760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610be2565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506110ce565b5060016110ce565b6001600160a01b03831661401a5761401581601a80546000838152601b60205260408120829055600182018355919091527f057c384a7d1c54f3a1b2e5e67b2617b8224fdfd1ea7234eea573a6ff665ff63e0155565b61403d565b816001600160a01b0316836001600160a01b03161461403d5761403d8382614077565b6001600160a01b03821661405457610d1881614114565b826001600160a01b0316826001600160a01b031614610d1857610d1882826141c3565b600060016140848461378d565b61408e919061494d565b6000838152601960205260409020549091508082146140e1576001600160a01b03841660009081526018602090815260408083208584528252808320548484528184208190558352601990915290208190555b5060009182526019602090815260408084208490556001600160a01b039094168352601881528383209183525290812055565b601a546000906141269060019061494d565b6000838152601b6020526040812054601a805493945090928490811061414e5761414e614a29565b9060005260206000200154905080601a838154811061416f5761416f614a29565b6000918252602080832090910192909255828152601b9091526040808220849055858252812055601a8054806141a7576141a7614a13565b6001900381819060005260206000200160009055905550505050565b60006141ce8361378d565b6001600160a01b039093166000908152601860209081526040808320868452825280832085905593825260199052919091209190915550565b6040518061022001604052806011905b60608152602001906001900390816142175790505090565b80356001600160a01b038116811461424657600080fd5b919050565b8035801515811461424657600080fd5b60006020828403121561426d57600080fd5b613e588261422f565b6000806040838503121561428957600080fd5b6142928361422f565b91506142a06020840161422f565b90509250929050565b6000806000606084860312156142be57600080fd5b6142c78461422f565b92506142d56020850161422f565b9150604084013590509250925092565b600080600080608085870312156142fb57600080fd5b6143048561422f565b93506143126020860161422f565b925060408501359150606085013567ffffffffffffffff81111561433557600080fd5b8501601f8101871361434657600080fd5b8035614359614354826148cc565b61489b565b81815288602083850101111561436e57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b600080604083850312156143a357600080fd5b6143ac8361422f565b91506142a06020840161424b565b600080604083850312156143cd57600080fd5b6143d68361422f565b946020939093013593505050565b600080602083850312156143f757600080fd5b823567ffffffffffffffff8082111561440f57600080fd5b818501915085601f83011261442357600080fd5b81358181111561443257600080fd5b8660208260051b850101111561444757600080fd5b60209290920196919550909350505050565b60006020828403121561446b57600080fd5b613e588261424b565b60006020828403121561448657600080fd5b5035919050565b600080604083850312156144a057600080fd5b823591506142a06020840161422f565b6000602082840312156144c257600080fd5b8135613e5881614a55565b6000602082840312156144df57600080fd5b8151613e5881614a55565b6000602082840312156144fc57600080fd5b815167ffffffffffffffff81111561451357600080fd5b8201601f8101841361452457600080fd5b8051614532614354826148cc565b81815285602083850101111561454757600080fd5b614558826020830160208601614964565b95945050505050565b60006020828403121561457357600080fd5b5051919050565b60008151808452614592816020860160208601614964565b601f01601f19169290920160200192915050565b60008a516145b8818460208f01614964565b8a516145ca8183860160208f01614964565b8a5191840101906145df818360208e01614964565b89516145f18183850160208e01614964565b8951929091010190614607818360208c01614964565b875191019061461a818360208b01614964565b865161462c8183850160208b01614964565b8651929091010190614642818360208901614964565b84516146548183850160208901614964565b9101019b9a5050505050505050505050565b7f7b226e616d65223a2022734e202300000000000000000000000000000000000081526000835161469e81600e850160208801614964565b7f222c20226465736372697074696f6e223a20225374616b6564204e206973206a600e918401918201527f757374207374616b6564206e756d626572732e222c2022696d616765223a2022602e8201527f646174613a696d6167652f7376672b786d6c3b6261736536342c000000000000604e8201528351614727816068840160208801614964565b61227d60f01b60689290910191820152606a01949350505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161477a81601d850160208701614964565b91909101601d0192915050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516147bf816017850160208801614964565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516147fc816028840160208801614964565b01602801949350505050565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261483a608083018461457a565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561487c57835183529284019291840191600101614860565b50909695505050505050565b602081526000613e58602083018461457a565b604051601f8201601f1916810167ffffffffffffffff811182821017156148c4576148c4614a3f565b604052919050565b600067ffffffffffffffff8211156148e6576148e6614a3f565b50601f01601f191660200190565b60008219821115614907576149076149fd565b500190565b60008261492957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615614948576149486149fd565b500290565b60008282101561495f5761495f6149fd565b500390565b60005b8381101561497f578181015183820152602001614967565b83811115611c1e5750506000910152565b60008161499f5761499f6149fd565b506000190190565b600181811c908216806149bb57607f821691505b602082108114156149dc57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156149f6576149f66149fd565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114614a6b57600080fd5b5056fe3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f73766722207072657365727665417370656374526174696f3d22784d696e594d696e206d656574222076696577426f783d223020302033353020333530223e3c7374796c653e63317b7374726f6b653a233233316632303b7374726f6b652d6d697465726c696d69743a31303b7d63327b66696c6c3a236666663b7d3c2f7374796c653e3c7265637420636c6173733d22636c732d312220783d22302e352220793d22302e35222077696474683d2233353022206865696768743d22333530223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223138322e3733342220793d223132392e393232222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d34352e3538313837352c203138362e343337352922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223138322e3733342220793d223138322e373334222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d38322e3932353431352c203230312e3930363033362922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223233352e3534352220793d223138322e373334222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d36372e3435363837312c203233392e3234383132332922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223138322e3733342220793d223233352e353437222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d3132302e3236373530322c203231372e3337333132332922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223132392e3932342220793d223132392e393232222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d36312e3035303431352c203134392e3039333936342922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223132392e3932342220793d2237372e313132222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d32332e3730363837352c203133332e3632363837372922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d2237372e3131322220793d223132392e393232222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d37362e3531373530322c203131312e3735313837372922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223230392e31342220793d223130332e353136222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d31392e3137353833332c203139372e3337352922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223233352e3534352220793d2237372e313132222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c20372e32323837352c203230382e333132352922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223236312e39352220793d2235302e373036222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c2033332e3633343739322c203231392e32352922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d2235302e3730362220793d223236312e393439222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d3137372e3630393136312c203133312e37352922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d2237372e3131322220793d223233352e353437222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d3135312e32303435392c203134322e363837352922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223130332e3531372220793d223230392e3134222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d3132342e3739383533382c203135332e3632352922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223132392e3932342220793d223138322e373334222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d39382e3339323530322c203136342e353632352922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c74657874207374796c653d2266696c6c3a20726762283235352c203235352c20323535293b20666f6e742d66616d696c793a2073657269662c2073616e732d73657269663b20666f6e742d73697a653a203670783b2077686974652d73706163653a207072653b2220783d223235342e3837332220793d223239342e37373422207472616e73666f726d3d226d617472697828312e3136363636372c20302c20302c20312e3136363636372c202d302e3038333333332c202d302e30383333333329223ea164736f6c6343000806000a8b5b16d04624687fcf0d0228f19993c9157c1ed07b41d8d430fd9100eb099fe8df8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4200000000000000000000000047252a63c723889814aebcac0683e615624cec6400000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d60000000000000000000000009073ba45b25774a32cae9bf4a67e49c82a8a37fa000000000000000000000000000000000000000000000000000002daeb09aeb900000000000000000000000000000000000000000000000000000a86cc92e3da

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106104a85760003560e01c80636352211e1161026b578063b1e95e9411610150578063cd3daf9d116100c8578063dfccedd311610097578063e53fa29e1161007c578063e53fa29e14610a4c578063e985e9c514610a6c578063fa7f71b114610aa857600080fd5b8063dfccedd314610a30578063e449f34114610a3957600080fd5b8063cd3daf9d146109f9578063d439476e14610a01578063d547741f14610a14578063df136d6514610a2757600080fd5b8063c36f771f1161011f578063c6760b9c11610104578063c6760b9c146109c0578063c87b56dd146109d3578063c9662ebb146109e657600080fd5b8063c36f771f14610997578063c590cd68146109a057600080fd5b8063b1e95e941461093e578063b88d4fde14610951578063bae3110714610964578063c279187c1461097757600080fd5b80638c921d06116101e35780639ec29b82116101b2578063a22cb46511610197578063a22cb46514610902578063abfe3ca914610915578063ad7a672f1461093557600080fd5b80639ec29b82146108e7578063a217fddf146108fa57600080fd5b80638c921d061461088257806391d14854146108955780639347e43f146108cc57806395d89b41146108df57600080fd5b806375b238fc1161023a5780638903ab9d1161021f5780638903ab9d1461083c5780638aa001fc1461084f5780638b8763471461086257600080fd5b806375b238fc1461080257806388ee6a431461082957600080fd5b80636352211e146107c0578063667386f7146107d35780636dfc941e146107e657806370a08231146107ef57600080fd5b806324ea54f41161039157806336568abe1161030957806342d9d876116102d85780635b1697ce116102bd5780635b1697ce146107a65780635d773b2c146107af5780635d7cb91c146107b857600080fd5b806342d9d876146107805780634f6ccce71461079357600080fd5b806336568abe146107275780633baed92f1461073a5780634088093f1461075a57806342842e0e1461076d57600080fd5b80632e52d606116103605780632f745c59116103455780632f745c59146106f757806332c43a1f1461070a5780633403c2fc1461071357600080fd5b80632e52d606146106bd5780632f2ff15d146106e457600080fd5b806324ea54f414610646578063265a499b1461066d5780632a265d9a1461068d5780632c22f4551461069657600080fd5b80630e67354d1161042457806318160ddd116103f35780631e83409a116103d85780631e83409a146105fd57806323b872dd14610610578063248a9ca31461062357600080fd5b806318160ddd146105ed57806319f614b9146105f557600080fd5b80630e67354d146105735780630fbf0a931461059b57806314c64402146105ae578063150b7a02146105c157600080fd5b8063081812fc1161047b578063095ea7b311610460578063095ea7b3146105435780630b2503a6146105585780630d15fd771461056b57600080fd5b8063081812fc1461051057806308a6e4f91461053b57600080fd5b806301357bab146104ad57806301ffc9a7146104cf578063069c34f6146104f257806306fdde03146104fb575b600080fd5b6104bc670de0b6b3a764000081565b6040519081526020015b60405180910390f35b6104e26104dd3660046144b0565b610abb565b60405190151581526020016104c6565b6104bc60105481565b610503610adb565b6040516104c69190614888565b61052361051e366004614474565b610b6d565b6040516001600160a01b0390911681526020016104c6565b6104bc600481565b6105566105513660046143ba565b610c07565b005b6104bc610566366004614474565b610d1d565b6104bc610db9565b61058661058136600461425b565b610e02565b604080519283526020830191909152016104c6565b6105566105a93660046143e4565b610ea1565b6105566105bc366004614459565b61100e565b6105d46105cf3660046142e5565b6110c5565b6040516001600160e01b031990911681526020016104c6565b601a546104bc565b6104bc600181565b61055661060b36600461425b565b6110d6565b61055661061e3660046142a9565b6112d9565b6104bc610631366004614474565b60009081526020819052604090206001015490565b6104bc7f8b5b16d04624687fcf0d0228f19993c9157c1ed07b41d8d430fd9100eb099fe881565b6104bc61067b36600461425b565b60046020526000908152604090205481565b6104bc60095481565b6105237f00000000000000000000000047252a63c723889814aebcac0683e615624cec6481565b6105237f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d681565b6105566106f236600461448d565b611360565b6104bc6107053660046143ba565b611386565b6104bc600a5481565b6008546104e290600160a01b900460ff1681565b61055661073536600461448d565b61142e565b6104bc61074836600461425b565b60026020526000908152604090205481565b610556610768366004614474565b6114ba565b61055661077b3660046142a9565b6115a9565b6104bc61078e366004614474565b6115c4565b6104bc6107a1366004614474565b611614565b6104bc6122b881565b6104bc600b5481565b6104bc6116b8565b6105236107ce366004614474565b6116f2565b6104bc6107e1366004614474565b6116fd565b6104bc600c5481565b6104bc6107fd36600461425b565b61174d565b6104bc7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4281565b610556610837366004614474565b611758565b6104bc61084a36600461425b565b61188a565b6104bc61085d366004614474565b61189e565b6104bc61087036600461425b565b60036020526000908152604090205481565b6104bc610890366004614474565b6118ee565b6104e26108a336600461448d565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6104bc6108da366004614474565b61193e565b61050361198e565b6104bc6108f5366004614474565b61199d565b6104bc600081565b610556610910366004614390565b6119ed565b6104bc61092336600461425b565b60056020526000908152604090205481565b6104bc60115481565b61055661094c366004614474565b611ab2565b61055661095f3660046142e5565b611b96565b61055661097236600461425b565b611c24565b6104bc61098536600461425b565b60066020526000908152604090205481565b6104bc600f5481565b6104bc6109ae36600461425b565b60076020526000908152604090205481565b600854610523906001600160a01b031681565b6105036109e1366004614474565b611cf0565b6105866109f436600461425b565b612a28565b6104bc612abb565b610556610a0f3660046143ba565b612aee565b610556610a2236600461448d565b612ce8565b6104bc600d5481565b6104bc600e5481565b610556610a473660046143e4565b612d0e565b610a5f610a5a36600461425b565b612ef3565b6040516104c69190614844565b6104e2610a7a366004614276565b6001600160a01b03918216600090815260176020908152604080832093909416825291909152205460ff1690565b6104bc610ab6366004614474565b612f92565b6000610ac682612fe2565b80610ad55750610ad582613007565b92915050565b606060128054610aea906149a7565b80601f0160208091040260200160405190810160405280929190818152602001828054610b16906149a7565b8015610b635780601f10610b3857610100808354040283529160200191610b63565b820191906000526020600020905b815481529060010190602001808311610b4657829003601f168201915b5050505050905090565b6000818152601460205260408120546001600160a01b0316610beb5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152601660205260409020546001600160a01b031690565b6000610c128261303c565b9050806001600160a01b0316836001600160a01b03161415610c805760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610be2565b336001600160a01b0382161480610c9c5750610c9c8133610a7a565b610d0e5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610be2565b610d1883836130c7565b505050565b60405163059281d360e11b8152600481018290526000907f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b031690630b2503a6906024015b60206040518083038186803b158015610d8157600080fd5b505afa158015610d95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad59190614561565b6000670de0b6b3a7640000600e54610dcf6116b8565b610dd9919061494d565b601154610de6919061492e565b610df0919061490c565b600f54610dfd91906148f4565b905090565b6000806000610e0f612abb565b6001600160a01b03851660009081526003602052604081205491925090610e36908361494d565b6001600160a01b03861660009081526002602052604081205491925090670de0b6b3a764000090610e6890849061492e565b610e72919061490c565b6001600160a01b038716600090815260056020526040902054610e9591906148f4565b96929550919350505050565b60026001541415610ef45760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610be2565b600260015560005b81811015610fea577f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b03166342842e0e3330868686818110610f4757610f47614a29565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b158015610f9e57600080fd5b505af1158015610fb2573d6000803e3d6000fd5b50505050610fd833848484818110610fcc57610fcc614a29565b90506020020135613135565b80610fe2816149e2565b915050610efc565b5061100633611001670de0b6b3a76400008461492e565b613283565b505060018055565b3360009081527fc05ec64e211cc9b3f20351aa917dc92f371c52a9ae3566b93bf47db2074b0329602052604090205460ff1661108c5760405162461bcd60e51b815260206004820152601d60248201527f41627374726163745374616b696e673a4143434553535f44454e4945440000006044820152606401610be2565b60088054911515600160a01b027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909216919091179055565b630a85bd0160e11b5b949350505050565b600260015414156111295760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610be2565b6002600155600854600160a01b900460ff16156111885760405162461bcd60e51b815260206004820152601860248201527f41627374726163745374616b696e673a53485554444f574e00000000000000006044820152606401610be2565b60008061119483610e02565b91509150600082116111e85760405162461bcd60e51b815260206004820152601c60248201527f41627374726163745374616b696e673a5a45524f5f52455741524453000000006044820152606401610be2565b6001600160a01b038381166000818152600560209081526040808320839055600390915290819020849055516340c10f1960e01b81526004810191909152602481018490527f00000000000000000000000047252a63c723889814aebcac0683e615624cec64909116906340c10f1990604401600060405180830381600087803b15801561127557600080fd5b505af1158015611289573d6000803e3d6000fd5b5050604080516001600160a01b0387168152602081018690527fb3b7a071186534c03b40695710096f289fd4ed6c1a374aff0bb648955e4fe563935001905060405180910390a150506001805550565b6112e333826133bf565b6113555760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610be2565b610d188383836134b2565b60008281526020819052604090206001015461137c8133613671565b610d1883836136ef565b60006113918361378d565b82106114055760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e64730000000000000000000000000000000000000000006064820152608401610be2565b506001600160a01b03919091166000908152601860209081526040808320938352929052205490565b6001600160a01b03811633146114ac5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610be2565b6114b68282613827565b5050565b3360009081527f5cbfc8ee58ca47855df7bcf648dd304ddb6b932f9b87878bdf6318d7ec7ee5b7602052604090205460ff166115385760405162461bcd60e51b815260206004820152601d60248201527f41627374726163745374616b696e673a4143434553535f44454e4945440000006044820152606401610be2565b600c5481141561158a5760405162461bcd60e51b815260206004820181905260248201527f41627374726163745374616b696e673a524154455f4e4f545f4348414e4745446044820152606401610be2565b611592610db9565b600f5561159d6116b8565b600e5542600a55600c55565b610d1883838360405180602001604052806000815250611b96565b60405163216cec3b60e11b8152600481018290526000907f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b0316906342d9d87690602401610d69565b600061161f601a5490565b82106116935760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e647300000000000000000000000000000000000000006064820152608401610be2565b601a82815481106116a6576116a6614a29565b90600052602060002001549050919050565b600080600a54426116c9919061494d565b90506000600c54826116db919061492e565b905080600e546116eb91906148f4565b9250505090565b6000610ad58261303c565b60405163667386f760e01b8152600481018290526000907f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b03169063667386f790602401610d69565b6000610ad58261378d565b3360009081527f5cbfc8ee58ca47855df7bcf648dd304ddb6b932f9b87878bdf6318d7ec7ee5b7602052604090205460ff166117d65760405162461bcd60e51b815260206004820152601d60248201527f41627374726163745374616b696e673a4143434553535f44454e4945440000006044820152606401610be2565b62127500811061184e5760405162461bcd60e51b815260206004820152602a60248201527f41627374726163745374616b696e673a494c4c4547414c5f4d494e5f5354414b60448201527f494e475f504552494f44000000000000000000000000000000000000000000006064820152608401610be2565b60108190556040518181527fbc6ba7ae52fb7c0043799abd7b08a2cb181b730096564a856c61c623c42c23ea906020015b60405180910390a150565b60008061189683610e02565b509392505050565b6040516322a8007f60e21b8152600481018290526000907f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b031690638aa001fc90602401610d69565b6040516346490e8360e11b8152600481018290526000907f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b031690638c921d0690602401610d69565b604051639347e43f60e01b8152600481018290526000907f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b031690639347e43f90602401610d69565b606060138054610aea906149a7565b604051634f614dc160e11b8152600481018290526000907f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b031690639ec29b8290602401610d69565b6001600160a01b038216331415611a465760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610be2565b3360008181526017602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3360009081527f5cbfc8ee58ca47855df7bcf648dd304ddb6b932f9b87878bdf6318d7ec7ee5b7602052604090205460ff16611b305760405162461bcd60e51b815260206004820152601d60248201527f41627374726163745374616b696e673a4143434553535f44454e4945440000006044820152606401610be2565b600b54811415611b825760405162461bcd60e51b815260206004820181905260248201527f41627374726163745374616b696e673a524154455f4e4f545f4348414e4745446044820152606401610be2565b611b8a612abb565b600d5542600955600b55565b611ba033836133bf565b611c125760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610be2565b611c1e848484846138a6565b50505050565b3360009081527f5cbfc8ee58ca47855df7bcf648dd304ddb6b932f9b87878bdf6318d7ec7ee5b7602052604090205460ff16611ca25760405162461bcd60e51b815260206004820152601d60248201527f41627374726163745374616b696e673a4143434553535f44454e4945440000006044820152606401610be2565b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f87c83011685ca936f8b1392fb73a8a5ce61effeb882a6786e14e32eacf58d0ca9060200161187f565b6060611cfa614207565b60405180610c800160405280610c568152602001614a6f610c569139815260405163667386f760e01b8152600481018490527361fae53d161095e9b75306837ff06c7b778f6504906368f7aee5906001600160a01b037f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d6169063667386f79060240160206040518083038186803b158015611d9457600080fd5b505afa158015611da8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dcc9190614561565b6040518263ffffffff1660e01b8152600401611dea91815260200190565b60006040518083038186803b158015611e0257600080fd5b505af4158015611e16573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611e3e91908101906144ea565b6020808301919091526040805180820190915260018152600160fd1b9181019190915281600260200201526040516322a8007f60e21b8152600481018490527361fae53d161095e9b75306837ff06c7b778f6504906368f7aee5907f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b031690638aa001fc9060240160206040518083038186803b158015611ee557600080fd5b505afa158015611ef9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1d9190614561565b6040518263ffffffff1660e01b8152600401611f3b91815260200190565b60006040518083038186803b158015611f5357600080fd5b505af4158015611f67573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611f8f91908101906144ea565b60608201526040805180820190915260018152600160fd1b6020820152816004602002015260405163fa7f71b160e01b8152600481018490527361fae53d161095e9b75306837ff06c7b778f6504906368f7aee5907f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b03169063fa7f71b19060240160206040518083038186803b15801561203057600080fd5b505afa158015612044573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120689190614561565b6040518263ffffffff1660e01b815260040161208691815260200190565b60006040518083038186803b15801561209e57600080fd5b505af41580156120b2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120da91908101906144ea565b60a08201526040805180820190915260018152600160fd1b60208201528160066020020152604051634f614dc160e11b8152600481018490527361fae53d161095e9b75306837ff06c7b778f6504906368f7aee5907f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b031690639ec29b829060240160206040518083038186803b15801561217b57600080fd5b505afa15801561218f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121b39190614561565b6040518263ffffffff1660e01b81526004016121d191815260200190565b60006040518083038186803b1580156121e957600080fd5b505af41580156121fd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261222591908101906144ea565b60e08201526040805180820190915260018152600160fd1b6020820152816008602002015260405163059281d360e11b8152600481018490527361fae53d161095e9b75306837ff06c7b778f6504906368f7aee5907f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b031690630b2503a69060240160206040518083038186803b1580156122c657600080fd5b505afa1580156122da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122fe9190614561565b6040518263ffffffff1660e01b815260040161231c91815260200190565b60006040518083038186803b15801561233457600080fd5b505af4158015612348573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261237091908101906144ea565b6101208201526040805180820190915260018152600160fd1b602082015281600a602002015260405163216cec3b60e11b8152600481018490527361fae53d161095e9b75306837ff06c7b778f6504906368f7aee5907f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b0316906342d9d8769060240160206040518083038186803b15801561241257600080fd5b505afa158015612426573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244a9190614561565b6040518263ffffffff1660e01b815260040161246891815260200190565b60006040518083038186803b15801561248057600080fd5b505af4158015612494573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526124bc91908101906144ea565b6101608201526040805180820190915260018152600160fd1b602082015281600c60200201526040516346490e8360e11b8152600481018490527361fae53d161095e9b75306837ff06c7b778f6504906368f7aee5907f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b031690638c921d069060240160206040518083038186803b15801561255e57600080fd5b505afa158015612572573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125969190614561565b6040518263ffffffff1660e01b81526004016125b491815260200190565b60006040518083038186803b1580156125cc57600080fd5b505af41580156125e0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261260891908101906144ea565b6101a08201526040805180820190915260018152600160fd1b602082015281600e6020020152604051639347e43f60e01b8152600481018490527361fae53d161095e9b75306837ff06c7b778f6504906368f7aee5907f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b031690639347e43f9060240160206040518083038186803b1580156126aa57600080fd5b505afa1580156126be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126e29190614561565b6040518263ffffffff1660e01b815260040161270091815260200190565b60006040518083038186803b15801561271857600080fd5b505af415801561272c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261275491908101906144ea565b6101e0820152604080518082018252600d81527f3c2f746578743e3c2f7376673e00000000000000000000000000000000000000602080830191909152610200840191909152825181840151838501516060860151608087015160a088015160c089015160e08a01516101008b0151995160009a6127d49a9091016145a6565b60408051808303601f19018152908290526101208401516101408501516101608601516101808701516101a08801516101c08901516101e08a01516102008b0151979950612827988a98906020016145a6565b604051602081830303815290604052905060007361fae53d161095e9b75306837ff06c7b778f65046373ea32347361fae53d161095e9b75306837ff06c7b778f65046368f7aee5886040518263ffffffff1660e01b815260040161288d91815260200190565b60006040518083038186803b1580156128a557600080fd5b505af41580156128b9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526128e191908101906144ea565b604051631cfa8c8d60e21b81527361fae53d161095e9b75306837ff06c7b778f6504906373ea323490612918908890600401614888565b60006040518083038186803b15801561293057600080fd5b505af4158015612944573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261296c91908101906144ea565b60405160200161297d929190614666565b6040516020818303038152906040526040518263ffffffff1660e01b81526004016129a89190614888565b60006040518083038186803b1580156129c057600080fd5b505af41580156129d4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526129fc91908101906144ea565b905080604051602001612a0f9190614742565b60408051601f1981840301815291905295945050505050565b6000806000612a356116b8565b6001600160a01b03851660009081526004602052604081205491925090612a5c908361494d565b6001600160a01b03861660009081526002602052604081205491925090670de0b6b3a764000090612a8e90849061492e565b612a98919061490c565b6001600160a01b038716600090815260066020526040902054610e9591906148f4565b60008060095442612acc919061494d565b90506000600b5482612ade919061492e565b905080600d546116eb91906148f4565b60026001541415612b415760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610be2565b6002600155600854600160a01b900460ff1615612ba05760405162461bcd60e51b815260206004820152601860248201527f41627374726163745374616b696e673a53485554444f574e00000000000000006044820152606401610be2565b6008546001600160a01b03163314612bfa5760405162461bcd60e51b815260206004820152601d60248201527f41627374726163745374616b696e673a4143434553535f44454e4945440000006044820152606401610be2565b600080612c0684612a28565b9092509050612c15838361494d565b6001600160a01b03851660009081526006602090815260408083209390935560049052908120829055600e54612c4b908361494d565b905083670de0b6b3a764000082601154612c65919061492e565b612c6f919061490c565b600f54612c7c91906148f4565b612c86919061494d565b600f81905542600a55600e839055604080516001600160a01b03881681526020810187905280820192909252517fcbc6eefd7b233bc1b7a15ae4538d04117992884b15e7e1a6fe9dfca4ac9c45a79181900360600190a1505060018055505050565b600082815260208190526040902060010154612d048133613671565b610d188383613827565b60026001541415612d615760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610be2565b6002600155612d8133612d7c670de0b6b3a76400008461492e565b61392f565b60005b81811015612eea5733612dae848484818110612da257612da2614a29565b905060200201356116f2565b6001600160a01b031614612e045760405162461bcd60e51b815260206004820152601360248201527f5374616b65644e3a57524f4e475f4f574e4552000000000000000000000000006044820152606401610be2565b612e25838383818110612e1957612e19614a29565b90506020020135613a8a565b7f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b03166342842e0e3033868686818110612e6857612e68614a29565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b158015612ebf57600080fd5b505af1158015612ed3573d6000803e3d6000fd5b505050508080612ee2906149e2565b915050612d84565b50506001805550565b60606000612f008361174d565b90508067ffffffffffffffff811115612f1b57612f1b614a3f565b604051908082528060200260200182016040528015612f44578160200160208202803683370190505b50915060005b81811015612f8b57612f5c8482611386565b838281518110612f6e57612f6e614a29565b602090810291909101015280612f83816149e2565b915050612f4a565b5050919050565b60405163fa7f71b160e01b8152600481018290526000907f00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d66001600160a01b03169063fa7f71b190602401610d69565b60006001600160e01b0319821663780e9d6360e01b1480610ad55750610ad582613b31565b60006001600160e01b03198216637965db0b60e01b1480610ad557506301ffc9a760e01b6001600160e01b0319831614610ad5565b6000818152601460205260408120546001600160a01b031680610ad55760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610be2565b600081815260166020526040902080546001600160a01b0319166001600160a01b03841690811790915581906130fc8261303c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6001600160a01b03821661318b5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610be2565b6000818152601460205260409020546001600160a01b0316156131f05760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610be2565b6131fc60008383613b70565b6001600160a01b03821660009081526015602052604081208054600192906132259084906148f4565b909155505060008181526014602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600854600160a01b900460ff16156132dd5760405162461bcd60e51b815260206004820152601860248201527f41627374726163745374616b696e673a53485554444f574e00000000000000006044820152606401610be2565b60006132e883613be4565b905060006132f584613c24565b6001600160a01b03851660009081526002602052604090205490915061331b84826148f4565b6001600160a01b038616600090815260026020526040812091909155601180548692906133499084906148f4565b90915550506001600160a01b03851660008181526007602090815260409182902042905581519283528201869052810182905260608101849052608081018390527f9cfd25589d1eb8ad71e342a86a8524e83522e3936c0803048c08f6d9ad974f409060a0015b60405180910390a15050505050565b6000818152601460205260408120546001600160a01b03166134385760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610be2565b60006134438361303c565b9050806001600160a01b0316846001600160a01b0316148061347e5750836001600160a01b031661347384610b6d565b6001600160a01b0316145b806110ce57506001600160a01b0380821660009081526017602090815260408083209388168352929052205460ff166110ce565b826001600160a01b03166134c58261303c565b6001600160a01b0316146135415760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e00000000000000000000000000000000000000000000006064820152608401610be2565b6001600160a01b0382166135a35760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610be2565b6135ae838383613b70565b6135b96000826130c7565b6001600160a01b03831660009081526015602052604081208054600192906135e290849061494d565b90915550506001600160a01b03821660009081526015602052604081208054600192906136109084906148f4565b909155505060008181526014602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166114b6576136ad816001600160a01b03166014613caf565b6136b8836020613caf565b6040516020016136c9929190614787565b60408051601f198184030181529082905262461bcd60e51b8252610be291600401614888565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166114b6576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556137493390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006001600160a01b03821661380b5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610be2565b506001600160a01b031660009081526015602052604090205490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156114b6576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6138b18484846134b2565b6138bd84848484613e5f565b611c1e5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610be2565b600854600160a01b900460ff1615613945575050565b6010546001600160a01b03831660009081526007602052604090205461396b904261494d565b116139c45760405162461bcd60e51b8152602060048201526024808201527f41627374726163745374616b696e673a4d494e5f5354414b494e475f524551556044820152631254915160e21b6064820152608401610be2565b60006139cf83613be4565b905060006139dc84613c24565b6001600160a01b038516600090815260026020526040902054909150613a02848261494d565b6001600160a01b03861660009081526002602052604081209190915560118054869290613a3090849061494d565b9091555050604080516001600160a01b03871681526020810186905290810182905260608101849052608081018390527fdcfd2b4017d03f7e541021db793b2f9b31e4acdee005f789e52853c390e3e9629060a0016133b0565b6000613a958261303c565b9050613aa381600084613b70565b613aae6000836130c7565b6001600160a01b0381166000908152601560205260408120805460019290613ad790849061494d565b909155505060008281526014602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60006001600160e01b031982166380ac58cd60e01b1480610ac657506001600160e01b03198216635b5e139f60e01b1480610ad55750610ad582613007565b6001600160a01b0383161580613b8d57506001600160a01b038216155b613bd95760405162461bcd60e51b815260206004820152601760248201527f5374616b65644e3a5452414e534645525f44454e4945440000000000000000006044820152606401610be2565b610d18838383613fbf565b6000806000613bf284610e02565b6001600160a01b0390951660009081526005602090815260408083208490556003909152902094909455509192915050565b6000806000613c3284612a28565b6001600160a01b038616600090815260066020908152604080832085905560049091528120829055600e5492945090925090613c6e908361494d565b9050670de0b6b3a764000081601154613c87919061492e565b613c91919061490c565b600f54613c9e91906148f4565b600f555042600a55600e5592915050565b60606000613cbe83600261492e565b613cc99060026148f4565b67ffffffffffffffff811115613ce157613ce1614a3f565b6040519080825280601f01601f191660200182016040528015613d0b576020820181803683370190505b509050600360fc1b81600081518110613d2657613d26614a29565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613d5557613d55614a29565b60200101906001600160f81b031916908160001a9053506000613d7984600261492e565b613d849060016148f4565b90505b6001811115613e09577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613dc557613dc5614a29565b1a60f81b828281518110613ddb57613ddb614a29565b60200101906001600160f81b031916908160001a90535060049490941c93613e0281614990565b9050613d87565b508315613e585760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610be2565b9392505050565b60006001600160a01b0384163b15613fb757604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290613ea3903390899088908890600401614808565b602060405180830381600087803b158015613ebd57600080fd5b505af1925050508015613eed575060408051601f3d908101601f19168201909252613eea918101906144cd565b60015b613f9d573d808015613f1b576040519150601f19603f3d011682016040523d82523d6000602084013e613f20565b606091505b508051613f955760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610be2565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506110ce565b5060016110ce565b6001600160a01b03831661401a5761401581601a80546000838152601b60205260408120829055600182018355919091527f057c384a7d1c54f3a1b2e5e67b2617b8224fdfd1ea7234eea573a6ff665ff63e0155565b61403d565b816001600160a01b0316836001600160a01b03161461403d5761403d8382614077565b6001600160a01b03821661405457610d1881614114565b826001600160a01b0316826001600160a01b031614610d1857610d1882826141c3565b600060016140848461378d565b61408e919061494d565b6000838152601960205260409020549091508082146140e1576001600160a01b03841660009081526018602090815260408083208584528252808320548484528184208190558352601990915290208190555b5060009182526019602090815260408084208490556001600160a01b039094168352601881528383209183525290812055565b601a546000906141269060019061494d565b6000838152601b6020526040812054601a805493945090928490811061414e5761414e614a29565b9060005260206000200154905080601a838154811061416f5761416f614a29565b6000918252602080832090910192909255828152601b9091526040808220849055858252812055601a8054806141a7576141a7614a13565b6001900381819060005260206000200160009055905550505050565b60006141ce8361378d565b6001600160a01b039093166000908152601860209081526040808320868452825280832085905593825260199052919091209190915550565b6040518061022001604052806011905b60608152602001906001900390816142175790505090565b80356001600160a01b038116811461424657600080fd5b919050565b8035801515811461424657600080fd5b60006020828403121561426d57600080fd5b613e588261422f565b6000806040838503121561428957600080fd5b6142928361422f565b91506142a06020840161422f565b90509250929050565b6000806000606084860312156142be57600080fd5b6142c78461422f565b92506142d56020850161422f565b9150604084013590509250925092565b600080600080608085870312156142fb57600080fd5b6143048561422f565b93506143126020860161422f565b925060408501359150606085013567ffffffffffffffff81111561433557600080fd5b8501601f8101871361434657600080fd5b8035614359614354826148cc565b61489b565b81815288602083850101111561436e57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b600080604083850312156143a357600080fd5b6143ac8361422f565b91506142a06020840161424b565b600080604083850312156143cd57600080fd5b6143d68361422f565b946020939093013593505050565b600080602083850312156143f757600080fd5b823567ffffffffffffffff8082111561440f57600080fd5b818501915085601f83011261442357600080fd5b81358181111561443257600080fd5b8660208260051b850101111561444757600080fd5b60209290920196919550909350505050565b60006020828403121561446b57600080fd5b613e588261424b565b60006020828403121561448657600080fd5b5035919050565b600080604083850312156144a057600080fd5b823591506142a06020840161422f565b6000602082840312156144c257600080fd5b8135613e5881614a55565b6000602082840312156144df57600080fd5b8151613e5881614a55565b6000602082840312156144fc57600080fd5b815167ffffffffffffffff81111561451357600080fd5b8201601f8101841361452457600080fd5b8051614532614354826148cc565b81815285602083850101111561454757600080fd5b614558826020830160208601614964565b95945050505050565b60006020828403121561457357600080fd5b5051919050565b60008151808452614592816020860160208601614964565b601f01601f19169290920160200192915050565b60008a516145b8818460208f01614964565b8a516145ca8183860160208f01614964565b8a5191840101906145df818360208e01614964565b89516145f18183850160208e01614964565b8951929091010190614607818360208c01614964565b875191019061461a818360208b01614964565b865161462c8183850160208b01614964565b8651929091010190614642818360208901614964565b84516146548183850160208901614964565b9101019b9a5050505050505050505050565b7f7b226e616d65223a2022734e202300000000000000000000000000000000000081526000835161469e81600e850160208801614964565b7f222c20226465736372697074696f6e223a20225374616b6564204e206973206a600e918401918201527f757374207374616b6564206e756d626572732e222c2022696d616765223a2022602e8201527f646174613a696d6167652f7376672b786d6c3b6261736536342c000000000000604e8201528351614727816068840160208801614964565b61227d60f01b60689290910191820152606a01949350505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161477a81601d850160208701614964565b91909101601d0192915050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516147bf816017850160208801614964565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516147fc816028840160208801614964565b01602801949350505050565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261483a608083018461457a565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561487c57835183529284019291840191600101614860565b50909695505050505050565b602081526000613e58602083018461457a565b604051601f8201601f1916810167ffffffffffffffff811182821017156148c4576148c4614a3f565b604052919050565b600067ffffffffffffffff8211156148e6576148e6614a3f565b50601f01601f191660200190565b60008219821115614907576149076149fd565b500190565b60008261492957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615614948576149486149fd565b500290565b60008282101561495f5761495f6149fd565b500390565b60005b8381101561497f578181015183820152602001614967565b83811115611c1e5750506000910152565b60008161499f5761499f6149fd565b506000190190565b600181811c908216806149bb57607f821691505b602082108114156149dc57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156149f6576149f66149fd565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114614a6b57600080fd5b5056fe3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f73766722207072657365727665417370656374526174696f3d22784d696e594d696e206d656574222076696577426f783d223020302033353020333530223e3c7374796c653e63317b7374726f6b653a233233316632303b7374726f6b652d6d697465726c696d69743a31303b7d63327b66696c6c3a236666663b7d3c2f7374796c653e3c7265637420636c6173733d22636c732d312220783d22302e352220793d22302e35222077696474683d2233353022206865696768743d22333530223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223138322e3733342220793d223132392e393232222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d34352e3538313837352c203138362e343337352922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223138322e3733342220793d223138322e373334222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d38322e3932353431352c203230312e3930363033362922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223233352e3534352220793d223138322e373334222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d36372e3435363837312c203233392e3234383132332922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223138322e3733342220793d223233352e353437222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d3132302e3236373530322c203231372e3337333132332922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223132392e3932342220793d223132392e393232222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d36312e3035303431352c203134392e3039333936342922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223132392e3932342220793d2237372e313132222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d32332e3730363837352c203133332e3632363837372922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d2237372e3131322220793d223132392e393232222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d37362e3531373530322c203131312e3735313837372922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223230392e31342220793d223130332e353136222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d31392e3137353833332c203139372e3337352922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223233352e3534352220793d2237372e313132222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c20372e32323837352c203230382e333132352922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223236312e39352220793d2235302e373036222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c2033332e3633343739322c203231392e32352922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d2235302e3730362220793d223236312e393439222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d3137372e3630393136312c203133312e37352922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d2237372e3131322220793d223233352e353437222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d3135312e32303435392c203134322e363837352922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223130332e3531372220793d223230392e3134222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d3132342e3739383533382c203135332e3632352922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c7265637420636c6173733d22636c732d322220783d223132392e3932342220793d223138322e373334222077696474683d2233372e33343422206865696768743d2233372e33343422207472616e73666f726d3d226d617472697828302e3730373130382c202d302e3730373130362c20302e3730373130372c20302e3730373130372c202d39382e3339323530322c203136342e353632352922207374796c653d2266696c6c3a207267622835312c2035312c203531293b223e3c2f726563743e3c74657874207374796c653d2266696c6c3a20726762283235352c203235352c20323535293b20666f6e742d66616d696c793a2073657269662c2073616e732d73657269663b20666f6e742d73697a653a203670783b2077686974652d73706163653a207072653b2220783d223235342e3837332220793d223239342e37373422207472616e73666f726d3d226d617472697828312e3136363636372c20302c20302c20312e3136363636372c202d302e3038333333332c202d302e30383333333329223ea164736f6c6343000806000a

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

00000000000000000000000047252a63c723889814aebcac0683e615624cec6400000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d60000000000000000000000009073ba45b25774a32cae9bf4a67e49c82a8a37fa000000000000000000000000000000000000000000000000000002daeb09aeb900000000000000000000000000000000000000000000000000000a86cc92e3da

-----Decoded View---------------
Arg [0] : nil_ (address): 0x47252A63C723889814AeBcAC0683E615624ceC64
Arg [1] : n_ (address): 0x05a46f1E545526FB803FF974C790aCeA34D1f2D6
Arg [2] : dao (address): 0x9073Ba45B25774A32CAe9BF4A67E49C82A8a37Fa
Arg [3] : rewardRatePerSecond (uint256): 3139269406393
Arg [4] : votesRatePerSecond (uint256): 11574074074074

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 00000000000000000000000047252a63c723889814aebcac0683e615624cec64
Arg [1] : 00000000000000000000000005a46f1e545526fb803ff974c790acea34d1f2d6
Arg [2] : 0000000000000000000000009073ba45b25774a32cae9bf4a67e49c82a8a37fa
Arg [3] : 000000000000000000000000000000000000000000000000000002daeb09aeb9
Arg [4] : 00000000000000000000000000000000000000000000000000000a86cc92e3da


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.