ETH Price: $3,085.79 (+1.21%)
Gas: 3 Gwei

veBlue (veBLUE)
 

Overview

TokenID

251

Total Transfers

-

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x8883002a...Ff80D0352
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
VotingEscrow

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 100 runs

Other Settings:
default evmVersion
File 1 of 9 : IVotes.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)
pragma solidity ^0.8.0;

/**
 * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.
 *
 * _Available since v4.5._
 */
interface IVotes {
    /**
     * @dev Emitted when an account changes their delegate.
     */
    event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);

    /**
     * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.
     */
    event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);

    /**
     * @dev Returns the current amount of votes that `account` has.
     */
    function getVotes(address account) external view returns (uint256);

    /**
     * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).
     */
    function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);

    /**
     * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).
     *
     * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.
     * Votes that have not been delegated are still part of total supply, even though they would not participate in a
     * vote.
     */
    function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);

    /**
     * @dev Returns the delegate that `account` has chosen.
     */
    function delegates(address account) external view returns (address);

    /**
     * @dev Delegates votes from the sender to `delegatee`.
     */
    function delegate(address delegatee) external;

    /**
     * @dev Delegates votes from signer to `delegatee`.
     */
    function delegateBySig(
        address delegatee,
        uint256 nonce,
        uint256 expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
}

File 2 of 9 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

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 3 of 9 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 4 of 9 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

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 `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

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

pragma solidity ^0.8.0;

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

File 6 of 9 : IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IERC20 {
    function totalSupply() external view returns (uint256);
    function transfer(address recipient, uint amount) external returns (bool);
    function decimals() external view returns (uint8);
    function symbol() external view returns (string memory);
    function balanceOf(address) external view returns (uint);
    function transferFrom(address sender, address recipient, uint amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint);
    function approve(address spender, uint value) external returns (bool);

    event Transfer(address indexed from, address indexed to, uint value);
    event Approval(address indexed owner, address indexed spender, uint value);
}

File 7 of 9 : IVeArtProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IVeArtProxy {
    function _tokenURI(uint _tokenId, uint _balanceOf, uint _locked_end, uint _value) external view returns (string memory output);
}

File 8 of 9 : IVotingEscrow.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IVotingEscrow {

    struct Point {
        int128 bias;
        int128 slope; // # -dweight / dt
        uint256 ts;
        uint256 blk; // block
    }

    struct LockedBalance {
        int128 amount;
        uint end;
    }

    function create_lock(uint _value, uint _lock_duration) external returns (uint);
    function create_lock_for(uint _value, uint _lock_duration, address _to) external returns (uint);
    function merge(uint _from, uint _to) external;
    function increase_amount(uint _tokenId, uint _value) external;
    function increase_unlock_time(uint _tokenId, uint _lock_duration) external;
    function split(uint[] memory amounts, uint _tokenId) external;
    function withdraw(uint _tokenId) external;
    function setApprovalForAll(address _operator, bool _approved) external;

    function locked(uint id) external view returns(LockedBalance memory);
    function tokenOfOwnerByIndex(address _owner, uint _tokenIndex) external view returns (uint);

    function token() external view returns (address);
    function team() external returns (address);
    function epoch() external view returns (uint);
    function point_history(uint loc) external view returns (Point memory);
    function user_point_history(uint tokenId, uint loc) external view returns (Point memory);
    function user_point_epoch(uint tokenId) external view returns (uint);
    function optionToken() external view returns (address);
    function ownerOf(uint) external view returns (address);
    function isApprovedOrOwner(address, uint) external view returns (bool);
    function transferFrom(address, address, uint) external;
    function safeTransferFrom(
        address _from,
        address _to,
        uint _tokenId
    ) external;

    function voted(uint) external view returns (bool);
    function attachments(uint) external view returns (uint);
    function voting(uint tokenId) external;
    function abstain(uint tokenId) external;
    function attach(uint tokenId) external;
    function detach(uint tokenId) external;

    function checkpoint() external;
    function deposit_for(uint tokenId, uint value) external;

    function balanceOfNFT(uint _id) external view returns (uint);
    function balanceOf(address _owner) external view returns (uint);
    function totalSupply() external view returns (uint);
    function supply() external view returns (uint);
    function balanceOfNFTAt(uint _tokenId, uint _t) external view returns (uint);
    function balanceOfAtNFT(uint _tokenId, uint _t) external view returns (uint);



    function decimals() external view returns(uint8);
}

File 9 of 9 : VotingEscrow.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

import {IERC721, IERC721Metadata} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import {IVotes} from "@openzeppelin/contracts/governance/utils/IVotes.sol";
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import {IERC20} from "./interfaces/IERC20.sol";
import {IVeArtProxy} from "./interfaces/IVeArtProxy.sol";
import {IVotingEscrow} from "./interfaces/IVotingEscrow.sol";

interface IVoter {
    function minter() external view returns(address);
}

interface IMinter {
    function _rewards_distributor() external view returns(address);
}

/// @title Voting Escrow
/// @notice veNFT implementation that escrows ERC-20 tokens in the form of an ERC-721 NFT
/// @notice Votes have a weight depending on time, so that users are committed to the future of (whatever they are voting for)
/// @author Modified from Solidly (https://github.com/solidlyexchange/solidly/blob/master/contracts/ve.sol)
/// @author Modified from Curve (https://github.com/curvefi/curve-dao-contracts/blob/master/contracts/VotingEscrow.vy)
/// @author Modified from Nouns DAO (https://github.com/withtally/my-nft-dao-project/blob/main/contracts/ERC721Checkpointable.sol)
/// @dev Vote weight decays linearly over time. Lock time cannot be more than `MAXTIME` (2 years).
contract VotingEscrow is IERC721, IERC721Metadata, IVotes {
    enum DepositType {
        DEPOSIT_FOR_TYPE,
        CREATE_LOCK_TYPE,
        INCREASE_LOCK_AMOUNT,
        INCREASE_UNLOCK_TIME,
        MERGE_TYPE,
        SPLIT_TYPE
    }

    struct LockedBalance {
        int128 amount;
        uint end;
    }

    struct Point {
        int128 bias;
        int128 slope; // # -dweight / dt
        uint ts;
        uint blk; // block
    }
    /* We cannot really do block numbers per se b/c slope is per time, not per block
     * and per block could be fairly bad b/c Ethereum changes blocktimes.
     * What we can do is to extrapolate ***At functions */

    /// @notice A checkpoint for marking delegated tokenIds from a given timestamp
    struct Checkpoint {
        uint timestamp;
        uint[] tokenIds;
    }

    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event Deposit(
        address indexed provider,
        uint tokenId,
        uint value,
        uint indexed locktime,
        DepositType deposit_type,
        uint ts
    );
    event Withdraw(address indexed provider, uint tokenId, uint value, uint ts);
    event Supply(uint prevSupply, uint supply);

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    address public immutable token;
    address public voter;
    address public team;
    address public artProxy;
    address public optionToken;

    bool public toggleMaxLock = true;

    mapping(uint => Point) public point_history; // epoch -> unsigned point

    /// @dev Mapping of interface id to bool about whether or not it's supported
    mapping(bytes4 => bool) internal supportedInterfaces;

    /// @dev ERC165 interface ID of ERC165
    bytes4 internal constant ERC165_INTERFACE_ID = 0x01ffc9a7;

    /// @dev ERC165 interface ID of ERC721
    bytes4 internal constant ERC721_INTERFACE_ID = 0x80ac58cd;

    /// @dev ERC165 interface ID of ERC721Metadata
    bytes4 internal constant ERC721_METADATA_INTERFACE_ID = 0x5b5e139f;

    /// @dev Current count of token
    uint internal tokenId;

    /// @notice Contract constructor
    /// @param token_addr `BLUE` token address
    constructor(address token_addr, address art_proxy) {
        token = token_addr;
        voter = msg.sender;
        team = msg.sender;
        artProxy = art_proxy;

        point_history[0].blk = block.number;
        point_history[0].ts = block.timestamp;

        supportedInterfaces[ERC165_INTERFACE_ID] = true;
        supportedInterfaces[ERC721_INTERFACE_ID] = true;
        supportedInterfaces[ERC721_METADATA_INTERFACE_ID] = true;

        // mint-ish
        emit Transfer(address(0), address(this), tokenId);
        // burn-ish
        emit Transfer(address(this), address(0), tokenId);
    }

    /*//////////////////////////////////////////////////////////////
                                MODIFIERS
    //////////////////////////////////////////////////////////////*/

    /// @dev reentrancy guard
    uint8 internal constant _not_entered = 1;
    uint8 internal constant _entered = 2;
    uint8 internal _entered_state = 1;
    modifier nonreentrant() {
        require(_entered_state == _not_entered);
        _entered_state = _entered;
        _;
        _entered_state = _not_entered;
    }

    /*///////////////////////////////////////////////////////////////
                             METADATA STORAGE
    //////////////////////////////////////////////////////////////*/

    string constant public name = "veBlue";
    string constant public symbol = "veBLUE";
    string constant public version = "1.0.0";
    uint8 constant public decimals = 18;

    function setTeam(address _team) external {
        require(msg.sender == team);
        team = _team;
    }

    function setOptionToken(address _optionToken) external {
        require(msg.sender == team);
        optionToken = _optionToken;
    }

    function setArtProxy(address _proxy) external {
        require(msg.sender == team);
        artProxy = _proxy;
    }

    /// @dev Returns current token URI metadata
    /// @param _tokenId Token ID to fetch URI for.
    function tokenURI(uint _tokenId) external view returns (string memory) {
        require(idToOwner[_tokenId] != address(0), "Query for nonexistent token");
        LockedBalance memory _locked = locked[_tokenId];
        return IVeArtProxy(artProxy)._tokenURI(_tokenId,_balanceOfNFT(_tokenId, block.timestamp),_locked.end,uint(int256(_locked.amount)));
    }

    /*//////////////////////////////////////////////////////////////
                      ERC721 BALANCE/OWNER STORAGE
    //////////////////////////////////////////////////////////////*/

    /// @dev Mapping from NFT ID to the address that owns it.
    mapping(uint => address) internal idToOwner;

    /// @dev Mapping from owner address to count of his tokens.
    mapping(address => uint) internal ownerToNFTokenCount;

    /// @dev Returns the address of the owner of the NFT.
    /// @param _tokenId The identifier for an NFT.
    function ownerOf(uint _tokenId) public view returns (address) {
        return idToOwner[_tokenId];
    }

    /// @dev Returns the number of NFTs owned by `_owner`.
    ///      Throws if `_owner` is the zero address. NFTs assigned to the zero address are considered invalid.
    /// @param _owner Address for whom to query the balance.
    function _balance(address _owner) internal view returns (uint) {
        return ownerToNFTokenCount[_owner];
    }

    /// @dev Returns the number of NFTs owned by `_owner`.
    ///      Throws if `_owner` is the zero address. NFTs assigned to the zero address are considered invalid.
    /// @param _owner Address for whom to query the balance.
    function balanceOf(address _owner) external view returns (uint) {
        return _balance(_owner);
    }

    /*//////////////////////////////////////////////////////////////
                         ERC721 APPROVAL STORAGE
    //////////////////////////////////////////////////////////////*/

    /// @dev Mapping from NFT ID to approved address.
    mapping(uint => address) internal idToApprovals;

    /// @dev Mapping from owner address to mapping of operator addresses.
    mapping(address => mapping(address => bool)) internal ownerToOperators;

    mapping(uint => uint) public ownership_change;

    /// @dev Get the approved address for a single NFT.
    /// @param _tokenId ID of the NFT to query the approval of.
    function getApproved(uint _tokenId) external view returns (address) {
        return idToApprovals[_tokenId];
    }

    /// @dev Checks if `_operator` is an approved operator for `_owner`.
    /// @param _owner The address that owns the NFTs.
    /// @param _operator The address that acts on behalf of the owner.
    function isApprovedForAll(address _owner, address _operator) external view returns (bool) {
        return (ownerToOperators[_owner])[_operator];
    }

    /*//////////////////////////////////////////////////////////////
                              ERC721 LOGIC
    //////////////////////////////////////////////////////////////*/

    /// @dev Set or reaffirm the approved address for an NFT. The zero address indicates there is no approved address.
    ///      Throws unless `msg.sender` is the current NFT owner, or an authorized operator of the current owner.
    ///      Throws if `_tokenId` is not a valid NFT. (NOTE: This is not written the EIP)
    ///      Throws if `_approved` is the current owner. (NOTE: This is not written the EIP)
    /// @param _approved Address to be approved for the given NFT ID.
    /// @param _tokenId ID of the token to be approved.
    function approve(address _approved, uint _tokenId) public {
        address owner = idToOwner[_tokenId];
        // Throws if `_tokenId` is not a valid NFT
        require(owner != address(0));
        // Throws if `_approved` is the current owner
        require(_approved != owner);
        // Check requirements
        bool senderIsOwner = (idToOwner[_tokenId] == msg.sender);
        bool senderIsApprovedForAll = (ownerToOperators[owner])[msg.sender];
        require(senderIsOwner || senderIsApprovedForAll);
        // Set the approval
        idToApprovals[_tokenId] = _approved;
        emit Approval(owner, _approved, _tokenId);
    }

    /// @dev Enables or disables approval for a third party ("operator") to manage all of
    ///      `msg.sender`'s assets. It also emits the ApprovalForAll event.
    ///      Throws if `_operator` is the `msg.sender`. (NOTE: This is not written the EIP)
    /// @notice This works even if sender doesn't own any tokens at the time.
    /// @param _operator Address to add to the set of authorized operators.
    /// @param _approved True if the operators is approved, false to revoke approval.
    function setApprovalForAll(address _operator, bool _approved) external {
        // Throws if `_operator` is the `msg.sender`
        assert(_operator != msg.sender);
        ownerToOperators[msg.sender][_operator] = _approved;
        emit ApprovalForAll(msg.sender, _operator, _approved);
    }

    /* TRANSFER FUNCTIONS */
    /// @dev Clear an approval of a given address
    ///      Throws if `_owner` is not the current owner.
    function _clearApproval(address _owner, uint _tokenId) internal {
        // Throws if `_owner` is not the current owner
        assert(idToOwner[_tokenId] == _owner);
        if (idToApprovals[_tokenId] != address(0)) {
            // Reset approvals
            idToApprovals[_tokenId] = address(0);
        }
    }

    /// @dev Returns whether the given spender can transfer a given token ID
    /// @param _spender address of the spender to query
    /// @param _tokenId uint ID of the token to be transferred
    /// @return bool whether the msg.sender is approved for the given token ID, is an operator of the owner, or is the owner of the token
    function _isApprovedOrOwner(address _spender, uint _tokenId) internal view returns (bool) {
        address owner = idToOwner[_tokenId];
        bool spenderIsOwner = owner == _spender;
        bool spenderIsApproved = _spender == idToApprovals[_tokenId];
        bool spenderIsApprovedForAll = (ownerToOperators[owner])[_spender];
        return spenderIsOwner || spenderIsApproved || spenderIsApprovedForAll;
    }

    function isApprovedOrOwner(address _spender, uint _tokenId) external view returns (bool) {
        return _isApprovedOrOwner(_spender, _tokenId);
    }

    /// @dev Exeute transfer of a NFT.
    ///      Throws unless `msg.sender` is the current owner, an authorized operator, or the approved
    ///      address for this NFT. (NOTE: `msg.sender` not allowed in internal function so pass `_sender`.)
    ///      Throws if `_to` is the zero address.
    ///      Throws if `_from` is not the current owner.
    ///      Throws if `_tokenId` is not a valid NFT.
    function _transferFrom(
        address _from,
        address _to,
        uint _tokenId,
        address _sender
    ) internal {
        require(attachments[_tokenId] == 0 && !voted[_tokenId], "attached");
        // Check requirements
        require(_isApprovedOrOwner(_sender, _tokenId));
        // Clear approval. Throws if `_from` is not the current owner
        _clearApproval(_from, _tokenId);
        // Remove NFT. Throws if `_tokenId` is not a valid NFT
        _removeTokenFrom(_from, _tokenId);
        // auto re-delegate
        _moveTokenDelegates(delegates(_from), delegates(_to), _tokenId);
        // Add NFT
        _addTokenTo(_to, _tokenId);
        // Set the block of ownership transfer (for Flash NFT protection)
        ownership_change[_tokenId] = block.number;
        // Log the transfer
        emit Transfer(_from, _to, _tokenId);
    }

    /// @dev Throws unless `msg.sender` is the current owner, an authorized operator, or the approved address for this NFT.
    ///      Throws if `_from` is not the current owner.
    ///      Throws if `_to` is the zero address.
    ///      Throws if `_tokenId` is not a valid NFT.
    /// @notice The caller is responsible to confirm that `_to` is capable of receiving NFTs or else
    ///        they maybe be permanently lost.
    /// @param _from The current owner of the NFT.
    /// @param _to The new owner.
    /// @param _tokenId The NFT to transfer.
    function transferFrom(
        address _from,
        address _to,
        uint _tokenId
    ) external {
        _transferFrom(_from, _to, _tokenId, msg.sender);
    }

    /// @dev Transfers the ownership of an NFT from one address to another address.
    ///      Throws unless `msg.sender` is the current owner, an authorized operator, or the
    ///      approved address for this NFT.
    ///      Throws if `_from` is not the current owner.
    ///      Throws if `_to` is the zero address.
    ///      Throws if `_tokenId` is not a valid NFT.
    ///      If `_to` is a smart contract, it calls `onERC721Received` on `_to` and throws if
    ///      the return value is not `bytes4(keccak256("onERC721Received(address,address,uint,bytes)"))`.
    /// @param _from The current owner of the NFT.
    /// @param _to The new owner.
    /// @param _tokenId The NFT to transfer.
    function safeTransferFrom(
        address _from,
        address _to,
        uint _tokenId
    ) external {
        safeTransferFrom(_from, _to, _tokenId, "");
    }

    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.
        uint size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /// @dev Transfers the ownership of an NFT from one address to another address.
    ///      Throws unless `msg.sender` is the current owner, an authorized operator, or the
    ///      approved address for this NFT.
    ///      Throws if `_from` is not the current owner.
    ///      Throws if `_to` is the zero address.
    ///      Throws if `_tokenId` is not a valid NFT.
    ///      If `_to` is a smart contract, it calls `onERC721Received` on `_to` and throws if
    ///      the return value is not `bytes4(keccak256("onERC721Received(address,address,uint,bytes)"))`.
    /// @param _from The current owner of the NFT.
    /// @param _to The new owner.
    /// @param _tokenId The NFT to transfer.
    /// @param _data Additional data with no specified format, sent in call to `_to`.
    function safeTransferFrom(
        address _from,
        address _to,
        uint _tokenId,
        bytes memory _data
    ) public {
        _transferFrom(_from, _to, _tokenId, msg.sender);

        if (_isContract(_to)) {
            // Throws if transfer destination is a contract which does not implement 'onERC721Received'
            try IERC721Receiver(_to).onERC721Received(msg.sender, _from, _tokenId, _data) returns (bytes4 response) {
                if (response != IERC721Receiver(_to).onERC721Received.selector) {
                    revert("ERC721: ERC721Receiver rejected tokens");
                }
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert('ERC721: transfer to non ERC721Receiver implementer');
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        }
    }

    /*//////////////////////////////////////////////////////////////
                              ERC165 LOGIC
    //////////////////////////////////////////////////////////////*/

    /// @dev Interface identification is specified in ERC-165.
    /// @param _interfaceID Id of the interface
    function supportsInterface(bytes4 _interfaceID) external view returns (bool) {
        return supportedInterfaces[_interfaceID];
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    /// @dev Mapping from owner address to mapping of index to tokenIds
    mapping(address => mapping(uint => uint)) internal ownerToNFTokenIdList;

    /// @dev Mapping from NFT ID to index of owner
    mapping(uint => uint) internal tokenToOwnerIndex;

    /// @dev  Get token by index
    function tokenOfOwnerByIndex(address _owner, uint _tokenIndex) external view returns (uint) {
        return ownerToNFTokenIdList[_owner][_tokenIndex];
    }

    /// @dev Add a NFT to an index mapping to a given address
    /// @param _to address of the receiver
    /// @param _tokenId uint ID Of the token to be added
    function _addTokenToOwnerList(address _to, uint _tokenId) internal {
        uint current_count = _balance(_to);

        ownerToNFTokenIdList[_to][current_count] = _tokenId;
        tokenToOwnerIndex[_tokenId] = current_count;
    }

    /// @dev Add a NFT to a given address
    ///      Throws if `_tokenId` is owned by someone.
    function _addTokenTo(address _to, uint _tokenId) internal {
        // Throws if `_tokenId` is owned by someone
        assert(idToOwner[_tokenId] == address(0));
        // Change the owner
        idToOwner[_tokenId] = _to;
        // Update owner token index tracking
        _addTokenToOwnerList(_to, _tokenId);
        // Change count tracking
        ownerToNFTokenCount[_to] += 1;
    }

    /// @dev Function to mint tokens
    ///      Throws if `_to` is zero address.
    ///      Throws if `_tokenId` is owned by someone.
    /// @param _to The address that will receive the minted tokens.
    /// @param _tokenId The token id to mint.
    /// @return A boolean that indicates if the operation was successful.
    function _mint(address _to, uint _tokenId) internal returns (bool) {
        // Throws if `_to` is zero address
        assert(_to != address(0));
        // checkpoint for gov
        _moveTokenDelegates(address(0), delegates(_to), _tokenId);
        // Add NFT. Throws if `_tokenId` is owned by someone
        _addTokenTo(_to, _tokenId);
        emit Transfer(address(0), _to, _tokenId);
        return true;
    }

    /// @dev Remove a NFT from an index mapping to a given address
    /// @param _from address of the sender
    /// @param _tokenId uint ID Of the token to be removed
    function _removeTokenFromOwnerList(address _from, uint _tokenId) internal {
        // Delete
        uint current_count = _balance(_from) - 1;
        uint current_index = tokenToOwnerIndex[_tokenId];

        if (current_count == current_index) {
            // update ownerToNFTokenIdList
            ownerToNFTokenIdList[_from][current_count] = 0;
            // update tokenToOwnerIndex
            tokenToOwnerIndex[_tokenId] = 0;
        } else {
            uint lastTokenId = ownerToNFTokenIdList[_from][current_count];

            // Add
            // update ownerToNFTokenIdList
            ownerToNFTokenIdList[_from][current_index] = lastTokenId;
            // update tokenToOwnerIndex
            tokenToOwnerIndex[lastTokenId] = current_index;

            // Delete
            // update ownerToNFTokenIdList
            ownerToNFTokenIdList[_from][current_count] = 0;
            // update tokenToOwnerIndex
            tokenToOwnerIndex[_tokenId] = 0;
        }
    }

    /// @dev Remove a NFT from a given address
    ///      Throws if `_from` is not the current owner.
    function _removeTokenFrom(address _from, uint _tokenId) internal {
        // Throws if `_from` is not the current owner
        assert(idToOwner[_tokenId] == _from);
        // Change the owner
        idToOwner[_tokenId] = address(0);
        // Update owner token index tracking
        _removeTokenFromOwnerList(_from, _tokenId);
        // Change count tracking
        ownerToNFTokenCount[_from] -= 1;
    }

    function _burn(uint _tokenId) internal {
        require(_isApprovedOrOwner(msg.sender, _tokenId), "caller is not owner nor approved");

        address owner = ownerOf(_tokenId);

        // Clear approval
        approve(address(0), _tokenId);
        // checkpoint for gov
        _moveTokenDelegates(delegates(owner), address(0), _tokenId);
        // Remove token
        //_removeTokenFrom(msg.sender, _tokenId);
        _removeTokenFrom(owner, _tokenId);
        
        emit Transfer(owner, address(0), _tokenId);
    }

    /*//////////////////////////////////////////////////////////////
                             ESCROW STORAGE
    //////////////////////////////////////////////////////////////*/

    mapping(uint => uint) public user_point_epoch;
    mapping(uint => Point[1000000000]) public user_point_history; // user -> Point[user_epoch]
    mapping(uint => LockedBalance) public locked;
    uint public epoch;
    mapping(uint => int128) public slope_changes; // time -> signed slope change
    uint public supply;

    uint internal constant WEEK = 1 weeks;
    uint internal constant MAXTIME = 2 * 365 * 86400;
    int128 internal constant iMAXTIME = 2 * 365 * 86400;
    uint internal constant MULTIPLIER = 1 ether;

    /*//////////////////////////////////////////////////////////////
                              ESCROW LOGIC
    //////////////////////////////////////////////////////////////*/

    /// @notice Get the most recently recorded rate of voting power decrease for `_tokenId`
    /// @param _tokenId token of the NFT
    /// @return Value of the slope
    function get_last_user_slope(uint _tokenId) external view returns (int128) {
        uint uepoch = user_point_epoch[_tokenId];
        return user_point_history[_tokenId][uepoch].slope;
    }

    /// @notice Get the timestamp for checkpoint `_idx` for `_tokenId`
    /// @param _tokenId token of the NFT
    /// @param _idx User epoch number
    /// @return Epoch time of the checkpoint
    function user_point_history__ts(uint _tokenId, uint _idx) external view returns (uint) {
        return user_point_history[_tokenId][_idx].ts;
    }

    /// @notice Get timestamp when `_tokenId`'s lock finishes
    /// @param _tokenId User NFT
    /// @return Epoch time of the lock end
    function locked__end(uint _tokenId) external view returns (uint) {
        return locked[_tokenId].end;
    }

    /// @notice Record global and per-user data to checkpoint
    /// @param _tokenId NFT token ID. No user checkpoint if 0
    /// @param old_locked Pevious locked amount / end lock time for the user
    /// @param new_locked New locked amount / end lock time for the user
    function _checkpoint(
        uint _tokenId,
        LockedBalance memory old_locked,
        LockedBalance memory new_locked
    ) internal {
        Point memory u_old;
        Point memory u_new;
        int128 old_dslope = 0;
        int128 new_dslope = 0;
        uint _epoch = epoch;

        if (_tokenId != 0) {
            // Calculate slopes and biases
            // Kept at zero when they have to
            if (old_locked.end > block.timestamp && old_locked.amount > 0) {
                u_old.slope = old_locked.amount / iMAXTIME;
                u_old.bias = u_old.slope * int128(int256(old_locked.end - block.timestamp));
            }
            if (new_locked.end > block.timestamp && new_locked.amount > 0) {
                u_new.slope = new_locked.amount / iMAXTIME;
                u_new.bias = u_new.slope * int128(int256(new_locked.end - block.timestamp));
            }

            // Read values of scheduled changes in the slope
            // old_locked.end can be in the past and in the future
            // new_locked.end can ONLY by in the FUTURE unless everything expired: than zeros
            old_dslope = slope_changes[old_locked.end];
            if (new_locked.end != 0) {
                if (new_locked.end == old_locked.end) {
                    new_dslope = old_dslope;
                } else {
                    new_dslope = slope_changes[new_locked.end];
                }
            }
        }

        Point memory last_point = Point({bias: 0, slope: 0, ts: block.timestamp, blk: block.number});
        if (_epoch > 0) {
            last_point = point_history[_epoch];
        }
        uint last_checkpoint = last_point.ts;
        // initial_last_point is used for extrapolation to calculate block number
        // (approximately, for *At methods) and save them
        // as we cannot figure that out exactly from inside the contract
        Point memory initial_last_point = last_point;
        uint block_slope = 0; // dblock/dt
        if (block.timestamp > last_point.ts) {
            block_slope = (MULTIPLIER * (block.number - last_point.blk)) / (block.timestamp - last_point.ts);
        }
        // If last point is already recorded in this block, slope=0
        // But that's ok b/c we know the block in such case

        // Go over weeks to fill history and calculate what the current point is
        {
            uint t_i = (last_checkpoint / WEEK) * WEEK;
            for (uint i = 0; i < 255; ++i) {
                // Hopefully it won't happen that this won't get used in 5 years!
                // If it does, users will be able to withdraw but vote weight will be broken
                t_i += WEEK;
                int128 d_slope = 0;
                if (t_i > block.timestamp) {
                    t_i = block.timestamp;
                } else {
                    d_slope = slope_changes[t_i];
                }
                last_point.bias -= last_point.slope * int128(int256(t_i - last_checkpoint));
                last_point.slope += d_slope;
                if (last_point.bias < 0) {
                    // This can happen
                    last_point.bias = 0;
                }
                if (last_point.slope < 0) {
                    // This cannot happen - just in case
                    last_point.slope = 0;
                }
                last_checkpoint = t_i;
                last_point.ts = t_i;
                last_point.blk = initial_last_point.blk + (block_slope * (t_i - initial_last_point.ts)) / MULTIPLIER;
                _epoch += 1;
                if (t_i == block.timestamp) {
                    last_point.blk = block.number;
                    break;
                } else {
                    point_history[_epoch] = last_point;
                }
            }
        }

        epoch = _epoch;
        // Now point_history is filled until t=now

        if (_tokenId != 0) {
            // If last point was in this block, the slope change has been applied already
            // But in such case we have 0 slope(s)
            last_point.slope += (u_new.slope - u_old.slope);
            last_point.bias += (u_new.bias - u_old.bias);
            if (last_point.slope < 0) {
                last_point.slope = 0;
            }
            if (last_point.bias < 0) {
                last_point.bias = 0;
            }
        }

        // Record the changed point into history
        point_history[_epoch] = last_point;

        if (_tokenId != 0) {
            // Schedule the slope changes (slope is going down)
            // We subtract new_user_slope from [new_locked.end]
            // and add old_user_slope to [old_locked.end]
            if (old_locked.end > block.timestamp) {
                // old_dslope was <something> - u_old.slope, so we cancel that
                old_dslope += u_old.slope;
                if (new_locked.end == old_locked.end) {
                    old_dslope -= u_new.slope; // It was a new deposit, not extension
                }
                slope_changes[old_locked.end] = old_dslope;
            }

            if (new_locked.end > block.timestamp) {
                if (new_locked.end > old_locked.end) {
                    new_dslope -= u_new.slope; // old slope disappeared at this point
                    slope_changes[new_locked.end] = new_dslope;
                }
                // else: we recorded it already in old_dslope
            }
            // Now handle user history
            uint user_epoch = user_point_epoch[_tokenId] + 1;

            user_point_epoch[_tokenId] = user_epoch;
            u_new.ts = block.timestamp;
            u_new.blk = block.number;
            user_point_history[_tokenId][user_epoch] = u_new;
        }
    }

    /// @notice Deposit and lock tokens for a user
    /// @param _tokenId NFT that holds lock
    /// @param _value Amount to deposit
    /// @param unlock_time New time when to unlock the tokens, or 0 if unchanged
    /// @param locked_balance Previous locked amount / timestamp
    /// @param deposit_type The type of deposit
    function _deposit_for(
        uint _tokenId,
        uint _value,
        uint unlock_time,
        LockedBalance memory locked_balance,
        DepositType deposit_type
    ) internal {
        LockedBalance memory _locked = locked_balance;
        uint supply_before = supply;

        supply = supply_before + _value;
        LockedBalance memory old_locked;
        (old_locked.amount, old_locked.end) = (_locked.amount, _locked.end);
        // Adding to existing lock, or if a lock is expired - creating a new one
        _locked.amount += int128(int256(_value));
        if (unlock_time != 0) {
            _locked.end = unlock_time;
        }
        locked[_tokenId] = _locked;

        // Possibilities:
        // Both old_locked.end could be current or expired (>/< block.timestamp)
        // value == 0 (extend lock) or value > 0 (add to lock or extend lock)
        // _locked.end > block.timestamp (always)
        _checkpoint(_tokenId, old_locked, _locked);

        address from = msg.sender;
        if (_value != 0 && deposit_type != DepositType.MERGE_TYPE && deposit_type != DepositType.SPLIT_TYPE ) {
            assert(IERC20(token).transferFrom(from, address(this), _value));
        }

        emit Deposit(from, _tokenId, _value, _locked.end, deposit_type, block.timestamp);
        emit Supply(supply_before, supply_before + _value);
    }

    function block_number() external view returns (uint) {
        return block.number;
    }

    /// @notice Record global data to checkpoint
    function checkpoint() external {
        _checkpoint(0, LockedBalance(0, 0), LockedBalance(0, 0));
    }

    /// @notice Deposit `_value` tokens for `_tokenId` and add to the lock
    /// @dev Anyone (even a smart contract) can deposit for someone else, but
    ///      cannot extend their locktime and deposit for a brand new user
    /// @param _tokenId lock NFT
    /// @param _value Amount to add to user's lock
    function deposit_for(uint _tokenId, uint _value) external nonreentrant {
        LockedBalance memory _locked = locked[_tokenId];

        require(_value > 0); // dev: need non-zero value
        require(_locked.amount > 0, 'No existing lock found');
        require(_locked.end > block.timestamp, 'Cannot add to expired lock. Withdraw');
        if(toggleMaxLock && msg.sender == getRewardsDistributor()){
            //maxlock
            _deposit_for(_tokenId, _value, (block.timestamp + MAXTIME) / WEEK * WEEK, _locked, DepositType.DEPOSIT_FOR_TYPE);
        }else{
            _deposit_for(_tokenId, _value, 0, _locked, DepositType.DEPOSIT_FOR_TYPE);
        }

    }

    /// @notice Deposit `_value` tokens for `_to` and lock for `_lock_duration`
    /// @param _value Amount to deposit
    /// @param _lock_duration Number of seconds to lock tokens for (rounded down to nearest week)
    /// @param _to Address to deposit
    function _create_lock(uint _value, uint _lock_duration, address _to) internal returns (uint) {
        uint unlock_time = (block.timestamp + _lock_duration) / WEEK * WEEK; // Locktime is rounded down to weeks

        require(_value > 0); // dev: need non-zero value
        require(unlock_time > block.timestamp, 'Can only lock until time in the future');
        require(unlock_time <= block.timestamp + MAXTIME, 'Voting lock can be 2 years max');

        ++tokenId;
        uint _tokenId = tokenId;
        _mint(_to, _tokenId);

        _deposit_for(_tokenId, _value, unlock_time, locked[_tokenId], DepositType.CREATE_LOCK_TYPE);
        return _tokenId;
    }

    /// @notice Deposit `_value` tokens for `msg.sender` and lock for `_lock_duration`
    /// @param _value Amount to deposit
    /// @param _lock_duration Number of seconds to lock tokens for (rounded down to nearest week)
    function create_lock(uint _value, uint _lock_duration) external nonreentrant returns (uint) {
        return _create_lock(_value, _lock_duration, msg.sender);
    }

    /// @notice Deposit `_value` tokens for `_to` and lock for `_lock_duration`
    /// @param _value Amount to deposit
    /// @param _lock_duration Number of seconds to lock tokens for (rounded down to nearest week)
    /// @param _to Address to deposit
    function create_lock_for(uint _value, uint _lock_duration, address _to) external nonreentrant returns (uint) {
        return _create_lock(_value, _lock_duration, _to);
    }

    /// @notice Deposit `_value` additional tokens for `_tokenId` without modifying the unlock time
    /// @param _value Amount of tokens to deposit and add to the lock
    function increase_amount(uint _tokenId, uint _value) external nonreentrant {
        assert(_isApprovedOrOwner(msg.sender, _tokenId));

        LockedBalance memory _locked = locked[_tokenId];

        assert(_value > 0); // dev: need non-zero value
        require(_locked.amount > 0, 'No existing lock found');
        require(_locked.end > block.timestamp, 'Cannot add to expired lock. Withdraw');

        _deposit_for(_tokenId, _value, 0, _locked, DepositType.INCREASE_LOCK_AMOUNT);
    }

    /// @notice Extend the unlock time for `_tokenId`
    /// @param _lock_duration New number of seconds until tokens unlock
    function increase_unlock_time(uint _tokenId, uint _lock_duration) external nonreentrant {
        assert(_isApprovedOrOwner(msg.sender, _tokenId));

        LockedBalance memory _locked = locked[_tokenId];
        uint unlock_time = (block.timestamp + _lock_duration) / WEEK * WEEK; // Locktime is rounded down to weeks

        require(_locked.end > block.timestamp, 'Lock expired');
        require(_locked.amount > 0, 'Nothing is locked');
        require(unlock_time > _locked.end, 'Can only increase lock duration');
        require(unlock_time <= block.timestamp + MAXTIME, 'Voting lock can be 2 years max');

        _deposit_for(_tokenId, 0, unlock_time, _locked, DepositType.INCREASE_UNLOCK_TIME);
    }

    /// @notice Withdraw all tokens for `_tokenId`
    /// @dev Only possible if the lock has expired
    function withdraw(uint _tokenId) external nonreentrant {
        assert(_isApprovedOrOwner(msg.sender, _tokenId));
        require(attachments[_tokenId] == 0 && !voted[_tokenId], "attached");

        LockedBalance memory _locked = locked[_tokenId];
        require(msg.sender == optionToken || block.timestamp >= _locked.end, "The lock didn't expire");
        uint value = uint(int256(_locked.amount));

        locked[_tokenId] = LockedBalance(0,0);
        uint supply_before = supply;
        supply = supply_before - value;

        // old_locked can have either expired <= timestamp or zero end
        // _locked has only 0 end
        // Both can have >= 0 amount
        _checkpoint(_tokenId, _locked, LockedBalance(0,0));

        assert(IERC20(token).transfer(msg.sender, value));

        // Burn the NFT
        _burn(_tokenId);

        emit Withdraw(msg.sender, _tokenId, value, block.timestamp);
        emit Supply(supply_before, supply_before - value);
    }

    /*///////////////////////////////////////////////////////////////
                           GAUGE VOTING STORAGE
    //////////////////////////////////////////////////////////////*/

    // The following ERC20/minime-compatible methods are not real balanceOf and supply!
    // They measure the weights for the purpose of voting, so they don't represent
    // real coins.

    /// @notice Binary search to estimate timestamp for block number
    /// @param _block Block to find
    /// @param max_epoch Don't go beyond this epoch
    /// @return Approximate timestamp for block
    function _find_block_epoch(uint _block, uint max_epoch) internal view returns (uint) {
        // Binary search
        uint _min = 0;
        uint _max = max_epoch;
        for (uint i = 0; i < 128; ++i) {
            // Will be always enough for 128-bit numbers
            if (_min >= _max) {
                break;
            }
            uint _mid = (_min + _max + 1) / 2;
            if (point_history[_mid].blk <= _block) {
                _min = _mid;
            } else {
                _max = _mid - 1;
            }
        }
        return _min;
    }

    /// @notice Get the current voting power for `_tokenId`
    /// @dev Adheres to the ERC20 `balanceOf` interface for Aragon compatibility
    /// @param _tokenId NFT for lock
    /// @param _t Epoch time to return voting power at
    /// @return User voting power
    function _balanceOfNFT(uint _tokenId, uint _t) internal view returns (uint) {
        uint _epoch = user_point_epoch[_tokenId];
        if (_epoch == 0) {
            return 0;
        } else {
            Point memory last_point = user_point_history[_tokenId][_epoch];
            last_point.bias -= last_point.slope * int128(int256(_t) - int256(last_point.ts));
            if (last_point.bias < 0) {
                last_point.bias = 0;
            }
            return uint(int256(last_point.bias));
        }
    }

    function balanceOfNFT(uint _tokenId) external view returns (uint) {
        if (ownership_change[_tokenId] == block.number) return 0;
        return _balanceOfNFT(_tokenId, block.timestamp);
    }

    function balanceOfNFTAt(uint _tokenId, uint _t) external view returns (uint) {
        return _balanceOfNFT(_tokenId, _t);
    }

    /// @notice Measure voting power of `_tokenId` at block height `_block`
    /// @dev Adheres to MiniMe `balanceOfAt` interface: https://github.com/Giveth/minime
    /// @param _tokenId User's wallet NFT
    /// @param _block Block to calculate the voting power at
    /// @return Voting power
    function _balanceOfAtNFT(uint _tokenId, uint _block) internal view returns (uint) {
        // Copying and pasting totalSupply code because Vyper cannot pass by
        // reference yet
        assert(_block <= block.number);

        // Binary search
        uint _min = 0;
        uint _max = user_point_epoch[_tokenId];
        for (uint i = 0; i < 128; ++i) {
            // Will be always enough for 128-bit numbers
            if (_min >= _max) {
                break;
            }
            uint _mid = (_min + _max + 1) / 2;
            if (user_point_history[_tokenId][_mid].blk <= _block) {
                _min = _mid;
            } else {
                _max = _mid - 1;
            }
        }

        Point memory upoint = user_point_history[_tokenId][_min];

        uint max_epoch = epoch;
        uint _epoch = _find_block_epoch(_block, max_epoch);
        Point memory point_0 = point_history[_epoch];
        uint d_block = 0;
        uint d_t = 0;
        if (_epoch < max_epoch) {
            Point memory point_1 = point_history[_epoch + 1];
            d_block = point_1.blk - point_0.blk;
            d_t = point_1.ts - point_0.ts;
        } else {
            d_block = block.number - point_0.blk;
            d_t = block.timestamp - point_0.ts;
        }
        uint block_time = point_0.ts;
        if (d_block != 0) {
            block_time += (d_t * (_block - point_0.blk)) / d_block;
        }

        upoint.bias -= upoint.slope * int128(int256(block_time - upoint.ts));
        if (upoint.bias >= 0) {
            return uint(uint128(upoint.bias));
        } else {
            return 0;
        }
    }

    function balanceOfAtNFT(uint _tokenId, uint _block) external view returns (uint) {
        return _balanceOfAtNFT(_tokenId, _block);
    }

    /// @notice Calculate total voting power at some point in the past
    /// @param _block Block to calculate the total voting power at
    /// @return Total voting power at `_block`
    function totalSupplyAt(uint _block) external view returns (uint) {
        assert(_block <= block.number);
        uint _epoch = epoch;
        uint target_epoch = _find_block_epoch(_block, _epoch);

        Point memory point = point_history[target_epoch];
        uint dt = 0;
        if (target_epoch < _epoch) {
            Point memory point_next = point_history[target_epoch + 1];
            if (point.blk != point_next.blk) {
                dt = ((_block - point.blk) * (point_next.ts - point.ts)) / (point_next.blk - point.blk);
            }
        } else {
            if (point.blk != block.number) {
                dt = ((_block - point.blk) * (block.timestamp - point.ts)) / (block.number - point.blk);
            }
        }
        // Now dt contains info on how far are we beyond point
        return _supply_at(point, point.ts + dt);
    }
    /// @notice Calculate total voting power at some point in the past
    /// @param point The point (bias/slope) to start search from
    /// @param t Time to calculate the total voting power at
    /// @return Total voting power at that time
    function _supply_at(Point memory point, uint t) internal view returns (uint) {
        Point memory last_point = point;
        uint t_i = (last_point.ts / WEEK) * WEEK;
        for (uint i = 0; i < 255; ++i) {
            t_i += WEEK;
            int128 d_slope = 0;
            if (t_i > t) {
                t_i = t;
            } else {
                d_slope = slope_changes[t_i];
            }
            last_point.bias -= last_point.slope * int128(int256(t_i - last_point.ts));
            if (t_i == t) {
                break;
            }
            last_point.slope += d_slope;
            last_point.ts = t_i;
        }

        if (last_point.bias < 0) {
            last_point.bias = 0;
        }
        return uint(uint128(last_point.bias));
    }

    function totalSupply() external view returns (uint) {
        return totalSupplyAtT(block.timestamp);
    }

    function getRewardsDistributor() internal view returns (address) {
        return IMinter(IVoter(voter).minter())._rewards_distributor();
    }

    /// @notice Calculate total voting power
    /// @dev Adheres to the ERC20 `totalSupply` interface for Aragon compatibility
    /// @return Total voting power
    function totalSupplyAtT(uint t) public view returns (uint) {
        uint _epoch = epoch;
        Point memory last_point = point_history[_epoch];
        return _supply_at(last_point, t);
    }

    /*///////////////////////////////////////////////////////////////
                            GAUGE VOTING LOGIC
    //////////////////////////////////////////////////////////////*/

    mapping(uint => uint) public attachments;
    mapping(uint => bool) public voted;

    function setVoter(address _voter) external {
        require(msg.sender == team);
        voter = _voter;
    }

    function setToggleMaxLock(bool _newValue) external {
        require(msg.sender == team);
        toggleMaxLock = _newValue;
    }

    function voting(uint _tokenId) external {
        require(msg.sender == voter);
        voted[_tokenId] = true;
    }

    function abstain(uint _tokenId) external {
        require(msg.sender == voter);
        voted[_tokenId] = false;
    }

    function attach(uint _tokenId) external {
        require(msg.sender == voter);
        attachments[_tokenId] = attachments[_tokenId] + 1;
    }

    function detach(uint _tokenId) external {
        require(msg.sender == voter);
        attachments[_tokenId] = attachments[_tokenId] - 1;
    }

    function merge(uint _from, uint _to) external {
        require(attachments[_from] == 0 && !voted[_from], "attached");
        require(_from != _to);
        require(_isApprovedOrOwner(msg.sender, _from));
        require(_isApprovedOrOwner(msg.sender, _to));

        LockedBalance memory _locked0 = locked[_from];
        LockedBalance memory _locked1 = locked[_to];
        uint value0 = uint(int256(_locked0.amount));
        uint end = _locked0.end >= _locked1.end ? _locked0.end : _locked1.end;

        locked[_from] = LockedBalance(0, 0);
        _checkpoint(_from, _locked0, LockedBalance(0, 0));
        _burn(_from);
        _deposit_for(_to, value0, end, _locked1, DepositType.MERGE_TYPE);
    }


    /**
     * @notice split NFT into multiple
     * @param amounts   % of split
     * @param _tokenId  NFTs ID
     */
    function split(uint[] memory amounts, uint _tokenId) external {
        
        // check permission and vote
        require(attachments[_tokenId] == 0 && !voted[_tokenId], "attached");
        require(_isApprovedOrOwner(msg.sender, _tokenId));

        // save old data and totalWeight
        address _to = idToOwner[_tokenId];
        LockedBalance memory _locked = locked[_tokenId];
        uint end = _locked.end;
        uint value = uint(int256(_locked.amount));
        require(value > 0); // dev: need non-zero value
        
        // reset supply, _deposit_for increase it
        supply = supply - value;

        uint i;
        uint totalWeight = 0;
        for(i = 0; i < amounts.length; i++){
            totalWeight += amounts[i];
        }

        // remove old data
        locked[_tokenId] = LockedBalance(0, 0);
        _checkpoint(_tokenId, _locked, LockedBalance(0, 0));
        _burn(_tokenId);

        // save end
        uint unlock_time = end;
        require(unlock_time > block.timestamp, 'Can only lock until time in the future');
        require(unlock_time <= block.timestamp + MAXTIME, 'Voting lock can be 2 years max');
        
        // mint 
        uint _value = 0;
        for(i = 0; i < amounts.length; i++){   
            ++tokenId;
            _tokenId = tokenId;
            _mint(_to, _tokenId);
            _value = value * amounts[i] / totalWeight;
            _deposit_for(_tokenId, _value, unlock_time, locked[_tokenId], DepositType.SPLIT_TYPE);
        }     

    }

    /*///////////////////////////////////////////////////////////////
                            DAO VOTING STORAGE
    //////////////////////////////////////////////////////////////*/

    /// @notice The EIP-712 typehash for the contract's domain
    bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");

    /// @notice The EIP-712 typehash for the delegation struct used by the contract
    bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");

    /// @notice A record of each accounts delegate
    mapping(address => address) private _delegates;
    uint public constant MAX_DELEGATES = 1024; // avoid too much gas

    /// @notice A record of delegated token checkpoints for each account, by index
    mapping(address => mapping(uint32 => Checkpoint)) public checkpoints;

    /// @notice The number of checkpoints for each account
    mapping(address => uint32) public numCheckpoints;

    /// @notice A record of states for signing / validating signatures
    mapping(address => uint) public nonces;

    /**
     * @notice Overrides the standard `Comp.sol` delegates mapping to return
     * the delegator's own address if they haven't delegated.
     * This avoids having to delegate to oneself.
     */
    function delegates(address delegator) public view returns (address) {
        address current = _delegates[delegator];
        return current == address(0) ? delegator : current;
    }

    /**
     * @notice Gets the current votes balance for `account`
     * @param account The address to get votes balance
     * @return The number of current votes for `account`
     */
    function getVotes(address account) external view returns (uint) {
        uint32 nCheckpoints = numCheckpoints[account];
        if (nCheckpoints == 0) {
            return 0;
        }
        uint[] storage _tokenIds = checkpoints[account][nCheckpoints - 1].tokenIds;
        uint votes = 0;
        for (uint i = 0; i < _tokenIds.length; i++) {
            uint tId = _tokenIds[i];
            votes = votes + _balanceOfNFT(tId, block.timestamp);
        }
        return votes;
    }

    function getPastVotesIndex(address account, uint timestamp) public view returns (uint32) {
        uint32 nCheckpoints = numCheckpoints[account];
        if (nCheckpoints == 0) {
            return 0;
        }
        // First check most recent balance
        if (checkpoints[account][nCheckpoints - 1].timestamp <= timestamp) {
            return (nCheckpoints - 1);
        }

        // Next check implicit zero balance
        if (checkpoints[account][0].timestamp > timestamp) {
            return 0;
        }

        uint32 lower = 0;
        uint32 upper = nCheckpoints - 1;
        while (upper > lower) {
            uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
            Checkpoint storage cp = checkpoints[account][center];
            if (cp.timestamp == timestamp) {
                return center;
            } else if (cp.timestamp < timestamp) {
                lower = center;
            } else {
                upper = center - 1;
            }
        }
        return lower;
    }

    function getPastVotes(address account, uint timestamp)
        public
        view
        returns (uint)
    {
        uint32 _checkIndex = getPastVotesIndex(account, timestamp);
        // Sum votes
        uint[] storage _tokenIds = checkpoints[account][_checkIndex].tokenIds;
        uint votes = 0;
        for (uint i = 0; i < _tokenIds.length; i++) {
            uint tId = _tokenIds[i];
            // Use the provided input timestamp here to get the right decay
            votes = votes + _balanceOfNFT(tId, timestamp);
        }
        return votes;
    }

    function getPastTotalSupply(uint256 timestamp) external view returns (uint) {
        return totalSupplyAtT(timestamp);
    }

    /*///////////////////////////////////////////////////////////////
                             DAO VOTING LOGIC
    //////////////////////////////////////////////////////////////*/

    function _moveTokenDelegates(
        address srcRep,
        address dstRep,
        uint _tokenId
    ) internal {
        if (srcRep != dstRep && _tokenId > 0) {
            if (srcRep != address(0)) {
                uint32 srcRepNum = numCheckpoints[srcRep];
                uint[] storage srcRepOld = srcRepNum > 0
                    ? checkpoints[srcRep][srcRepNum - 1].tokenIds
                    : checkpoints[srcRep][0].tokenIds;
                uint32 nextSrcRepNum = _findWhatCheckpointToWrite(srcRep);
                uint[] storage srcRepNew = checkpoints[srcRep][
                    nextSrcRepNum
                ].tokenIds;
                // All the same except _tokenId
                for (uint i = 0; i < srcRepOld.length; i++) {
                    uint tId = srcRepOld[i];
                    if (tId != _tokenId) {
                        srcRepNew.push(tId);
                    }
                }

                numCheckpoints[srcRep] = srcRepNum + 1;
            }

            if (dstRep != address(0)) {
                uint32 dstRepNum = numCheckpoints[dstRep];
                uint[] storage dstRepOld = dstRepNum > 0
                    ? checkpoints[dstRep][dstRepNum - 1].tokenIds
                    : checkpoints[dstRep][0].tokenIds;
                uint32 nextDstRepNum = _findWhatCheckpointToWrite(dstRep);
                uint[] storage dstRepNew = checkpoints[dstRep][
                    nextDstRepNum
                ].tokenIds;
                // All the same plus _tokenId
                require(
                    dstRepOld.length + 1 <= MAX_DELEGATES,
                    "dstRep would have too many tokenIds"
                );
                for (uint i = 0; i < dstRepOld.length; i++) {
                    uint tId = dstRepOld[i];
                    dstRepNew.push(tId);
                }
                dstRepNew.push(_tokenId);

                numCheckpoints[dstRep] = dstRepNum + 1;
            }
        }
    }

    function _findWhatCheckpointToWrite(address account)
        internal
        view
        returns (uint32)
    {
        uint _timestamp = block.timestamp;
        uint32 _nCheckPoints = numCheckpoints[account];

        if (
            _nCheckPoints > 0 &&
            checkpoints[account][_nCheckPoints - 1].timestamp == _timestamp
        ) {
            return _nCheckPoints - 1;
        } else {
            return _nCheckPoints;
        }
    }

    function _moveAllDelegates(
        address owner,
        address srcRep,
        address dstRep
    ) internal {
        // You can only redelegate what you own
        if (srcRep != dstRep) {
            if (srcRep != address(0)) {
                uint32 srcRepNum = numCheckpoints[srcRep];
                uint[] storage srcRepOld = srcRepNum > 0
                    ? checkpoints[srcRep][srcRepNum - 1].tokenIds
                    : checkpoints[srcRep][0].tokenIds;
                uint32 nextSrcRepNum = _findWhatCheckpointToWrite(srcRep);
                uint[] storage srcRepNew = checkpoints[srcRep][
                    nextSrcRepNum
                ].tokenIds;
                // All the same except what owner owns
                for (uint i = 0; i < srcRepOld.length; i++) {
                    uint tId = srcRepOld[i];
                    if (idToOwner[tId] != owner) {
                        srcRepNew.push(tId);
                    }
                }

                numCheckpoints[srcRep] = srcRepNum + 1;
            }

            if (dstRep != address(0)) {
                uint32 dstRepNum = numCheckpoints[dstRep];
                uint[] storage dstRepOld = dstRepNum > 0
                    ? checkpoints[dstRep][dstRepNum - 1].tokenIds
                    : checkpoints[dstRep][0].tokenIds;
                uint32 nextDstRepNum = _findWhatCheckpointToWrite(dstRep);
                uint[] storage dstRepNew = checkpoints[dstRep][
                    nextDstRepNum
                ].tokenIds;
                uint ownerTokenCount = ownerToNFTokenCount[owner];
                require(
                    dstRepOld.length + ownerTokenCount <= MAX_DELEGATES,
                    "dstRep would have too many tokenIds"
                );
                // All the same
                for (uint i = 0; i < dstRepOld.length; i++) {
                    uint tId = dstRepOld[i];
                    dstRepNew.push(tId);
                }
                // Plus all that's owned
                for (uint i = 0; i < ownerTokenCount; i++) {
                    uint tId = ownerToNFTokenIdList[owner][i];
                    dstRepNew.push(tId);
                }

                numCheckpoints[dstRep] = dstRepNum + 1;
            }
        }
    }

    function _delegate(address delegator, address delegatee) internal {
        /// @notice differs from `_delegate()` in `Comp.sol` to use `delegates` override method to simulate auto-delegation
        address currentDelegate = delegates(delegator);

        _delegates[delegator] = delegatee;

        emit DelegateChanged(delegator, currentDelegate, delegatee);
        _moveAllDelegates(delegator, currentDelegate, delegatee);
    }

    /**
     * @notice Delegate votes from `msg.sender` to `delegatee`
     * @param delegatee The address to delegate votes to
     */
    function delegate(address delegatee) public {
        if (delegatee == address(0)) delegatee = msg.sender;
        return _delegate(msg.sender, delegatee);
    }

    function delegateBySig(
        address delegatee,
        uint nonce,
        uint expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public {
        require(delegatee != msg.sender);
        require(delegatee != address(0));
        
        bytes32 domainSeparator = keccak256(
            abi.encode(
                DOMAIN_TYPEHASH,
                keccak256(bytes(name)),
                keccak256(bytes(version)),
                block.chainid,
                address(this)
            )
        );
        bytes32 structHash = keccak256(
            abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry)
        );
        bytes32 digest = keccak256(
            abi.encodePacked("\x19\x01", domainSeparator, structHash)
        );
        address signatory = ecrecover(digest, v, r, s);
        require(
            signatory != address(0),
            "VotingEscrow::delegateBySig: invalid signature"
        );
        require(
            nonce == nonces[signatory]++,
            "VotingEscrow::delegateBySig: invalid nonce"
        );
        require(
            block.timestamp <= expiry,
            "VotingEscrow::delegateBySig: signature expired"
        );
        return _delegate(signatory, delegatee);
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"token_addr","type":"address"},{"internalType":"address","name":"art_proxy","type":"address"}],"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":true,"internalType":"address","name":"delegator","type":"address"},{"indexed":true,"internalType":"address","name":"fromDelegate","type":"address"},{"indexed":true,"internalType":"address","name":"toDelegate","type":"address"}],"name":"DelegateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"DelegateVotesChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"locktime","type":"uint256"},{"indexed":false,"internalType":"enum VotingEscrow.DepositType","name":"deposit_type","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"prevSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"supply","type":"uint256"}],"name":"Supply","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":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DELEGATION_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DELEGATES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"abstain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_approved","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"artProxy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"attach","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"attachments","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_block","type":"uint256"}],"name":"balanceOfAtNFT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"balanceOfNFT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_t","type":"uint256"}],"name":"balanceOfNFTAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"block_number","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"checkpoint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint32","name":"","type":"uint32"}],"name":"checkpoints","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_lock_duration","type":"uint256"}],"name":"create_lock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_lock_duration","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"create_lock_for","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"}],"name":"delegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"delegateBySig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegator","type":"address"}],"name":"delegates","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"deposit_for","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"detach","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"epoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"timestamp","type":"uint256"}],"name":"getPastTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"getPastVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"getPastVotesIndex","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"get_last_user_slope","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"increase_amount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_lock_duration","type":"uint256"}],"name":"increase_unlock_time","outputs":[],"stateMutability":"nonpayable","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":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isApprovedOrOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"locked","outputs":[{"internalType":"int128","name":"amount","type":"int128"},{"internalType":"uint256","name":"end","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"locked__end","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"merge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"numCheckpoints","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"optionToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ownership_change","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"point_history","outputs":[{"internalType":"int128","name":"bias","type":"int128"},{"internalType":"int128","name":"slope","type":"int128"},{"internalType":"uint256","name":"ts","type":"uint256"},{"internalType":"uint256","name":"blk","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":"address","name":"_proxy","type":"address"}],"name":"setArtProxy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_optionToken","type":"address"}],"name":"setOptionToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_team","type":"address"}],"name":"setTeam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_newValue","type":"bool"}],"name":"setToggleMaxLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_voter","type":"address"}],"name":"setVoter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"slope_changes","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"split","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"supply","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":[],"name":"team","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleMaxLock","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_tokenIndex","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":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_block","type":"uint256"}],"name":"totalSupplyAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"t","type":"uint256"}],"name":"totalSupplyAtT","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":"","type":"uint256"}],"name":"user_point_epoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"user_point_history","outputs":[{"internalType":"int128","name":"bias","type":"int128"},{"internalType":"int128","name":"slope","type":"int128"},{"internalType":"uint256","name":"ts","type":"uint256"},{"internalType":"uint256","name":"blk","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"user_point_history__ts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"voted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"voting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a06040526003805460ff60a01b1916600160a01b1790556007805460ff191660011790553480156200003157600080fd5b5060405162004fc738038062004fc78339810160408190526200005491620001cc565b6001600160a01b0382811660805260008054336001600160a01b031991821681178355600180548316909117815560028054909216938516939093179055437f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ee55427f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ed5560056020527fc01909ce2b517f8cd3a46ae0cfde9179f9b675cf633d3d84c8226585cc73c156805460ff1990811684179091557f072ad3113145b5af48d301e3b9fc3bd1c97c3f26a14f5d44904b71469875631e8054821684179055635b5e139f60e01b82527f3b767bd59d7164fff7ec5b80ca1165d9d6e12ee8656896fac4159b0760bfd9f780549091169092179091556006546040519091309160008051602062004fa7833981519152908290a4600654604051600090309060008051602062004fa7833981519152908390a4505062000204565b80516001600160a01b0381168114620001c757600080fd5b919050565b60008060408385031215620001e057600080fd5b620001eb83620001af565b9150620001fb60208401620001af565b90509250929050565b608051614d796200022e60003960008181610b7f0152818161108d01526131020152614d796000f3fe608060405234801561001057600080fd5b50600436106103de5760003560e01c806370a0823111610206578063c1f0fb9f1161012b578063e7a324dc116100c3578063f1127ed811610087578063f1127ed814610b19578063f8a0576314610b44578063fbd3a29d14610b67578063fc0c546a14610b7a578063fd4a77f114610ba157600080fd5b8063e7a324dc14610a7c578063e7e242d414610aa3578063e985e9c514610ab6578063ea043fe514610af2578063ee99fe2814610b0657600080fd5b8063c1f0fb9f146109a4578063c2c4c5c1146109b7578063c3cda520146109bf578063c87b56dd146109d2578063d1c2babb146109e5578063d1febfb9146109f8578063d4e54c3b14610a36578063e0514aba14610a49578063e441135c14610a5c57600080fd5b806395d89b411161019e57806395d89b41146108b2578063981b24d0146108d7578063986b7d8a146108ea5780639ab24eb0146108fd578063a183af5214610910578063a22cb46514610923578063a4d855df14610936578063b45a3c0e14610949578063b88d4fde1461099157600080fd5b806370a08231146107e45780637116c60c146107f7578063711974841461080a5780637ecebe001461082d57806385f2aef21461084d5780638c2c9baf146108605780638e539e8c146108735780638fbb38ff14610886578063900cf0cf146108a957600080fd5b8063313ce567116103075780635594a0451161029f5780635f5b0c32116102635780635f5b0c32146107595780636352211e1461076257806365fc38731461078b5780636f5488371461079e5780636fcfff45146107be57600080fd5b80635594a045146106fa57806356afe7441461070d57806356f184e814610720578063587cde1e146107335780635c19a95c1461074657600080fd5b8063313ce567146106245780633a46b1a81461063e57806342842e0e14610651578063430c208114610664578063461f711c1461067757806346c96aac1461069d5780634bc2a657146106b05780634f06e0f7146106c357806354fd4d50146106d657600080fd5b806318160ddd1161037a57806318160ddd1461055a5780631c984bc31461056257806320606b701461057557806323b872dd1461059c57806325a58b56146105af5780632bab754b146105b55780632e1a7d4d146105c85780632e720f7d146105db5780632f745c59146105ee57600080fd5b806301ffc9a7146103e3578063047fc9aa1461042557806306fdde031461043c5780630758c7d81461046e578063081812fc14610496578063095cf5c6146104d7578063095ea7b3146104ec5780630d6a2033146104ff5780631376f3da1461051f575b600080fd5b6104106103f13660046142fc565b6001600160e01b03191660009081526005602052604090205460ff1690565b60405190151581526020015b60405180910390f35b61042e60145481565b60405190815260200161041c565b610461604051806040016040528060068152602001657665426c756560d01b81525081565b60405161041c9190614371565b61048161047c366004614399565b610bb4565b60405163ffffffff909116815260200161041c565b6104bf6104a43660046143c5565b6000908152600a60205260409020546001600160a01b031690565b6040516001600160a01b03909116815260200161041c565b6104ea6104e53660046143de565b610d27565b005b6104ea6104fa366004614399565b610d60565b61042e61050d3660046143c5565b60156020526000908152604090205481565b61053261052d3660046143fb565b610e48565b60408051600f95860b81529390940b602084015292820152606081019190915260800161041c565b61042e610e8f565b61042e6105703660046143fb565b610e9f565b61042e7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6104ea6105aa36600461441d565b610ed1565b4361042e565b6003546104bf906001600160a01b031681565b6104ea6105d63660046143c5565b610ee2565b6104ea6105e93660046143de565b6111b0565b61042e6105fc366004614399565b6001600160a01b03919091166000908152600d60209081526040808320938352929052205490565b61062c601281565b60405160ff909116815260200161041c565b61042e61064c366004614399565b6111e9565b6104ea61065f36600461441d565b611288565b610410610672366004614399565b6112a3565b61068a6106853660046143c5565b6112b6565b604051600f9190910b815260200161041c565b6000546104bf906001600160a01b031681565b6104ea6106be3660046143de565b6112f9565b6104ea6106d13660046143de565b611332565b610461604051806040016040528060058152602001640312e302e360dc1b81525081565b6002546104bf906001600160a01b031681565b6104ea61071b3660046144a5565b61136b565b6104ea61072e36600461455f565b6115e0565b6104bf6107413660046143de565b611615565b6104ea6107543660046143de565b611645565b61042e61040081565b6104bf6107703660046143c5565b6000908152600860205260409020546001600160a01b031690565b61042e6107993660046143fb565b611663565b61042e6107ac3660046143c5565b600c6020526000908152604090205481565b6104816107cc3660046143de565b60196020526000908152604090205463ffffffff1681565b61042e6107f23660046143de565b6116a5565b61042e6108053660046143c5565b6116b0565b61068a6108183660046143c5565b601360205260009081526040902054600f0b81565b61042e61083b3660046143de565b601a6020526000908152604090205481565b6001546104bf906001600160a01b031681565b61042e61086e3660046143fb565b611710565b61042e6108813660046143c5565b61171c565b6104106108943660046143c5565b60166020526000908152604090205460ff1681565b61042e60125481565b610461604051806040016040528060068152602001657665424c554560d01b81525081565b61042e6108e53660046143c5565b611727565b6104ea6108f83660046143c5565b6118c9565b61042e61090b3660046143de565b61190d565b6104ea61091e3660046143fb565b6119e0565b6104ea61093136600461457c565b611ab6565b6104ea6109443660046143fb565b611b3a565b6109776109573660046143c5565b60116020526000908152604090208054600190910154600f9190910b9082565b60408051600f9390930b835260208301919091520161041c565b6104ea61099f3660046145dd565b611cef565b6104ea6109b23660046143c5565b611e8e565b6104ea611ebd565b6104ea6109cd36600461468c565b611efd565b6104616109e03660046143c5565b612261565b6104ea6109f33660046143fb565b61238d565b610532610a063660046143c5565b600460205260009081526040902080546001820154600290920154600f82810b93600160801b909304900b919084565b61042e610a443660046146ee565b6124f2565b61042e610a573660046143fb565b612535565b61042e610a6a3660046143c5565b600f6020526000908152604090205481565b61042e7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b61042e610ab13660046143c5565b612541565b610410610ac4366004614727565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b60035461041090600160a01b900460ff1681565b6104ea610b143660046143fb565b612569565b61042e610b27366004614755565b601860209081526000928352604080842090915290825290205481565b61042e610b523660046143c5565b60009081526011602052604090206001015490565b6104ea610b753660046143c5565b612683565b6104bf7f000000000000000000000000000000000000000000000000000000000000000081565b6104ea610baf3660046143c5565b6126b4565b6001600160a01b03821660009081526019602052604081205463ffffffff16808203610be4576000915050610d21565b6001600160a01b03841660009081526018602052604081208491610c096001856147a2565b63ffffffff16815260208101919091526040016000205411610c3857610c306001826147a2565b915050610d21565b6001600160a01b0384166000908152601860209081526040808320838052909152902054831015610c6d576000915050610d21565b600080610c7b6001846147a2565b90505b8163ffffffff168163ffffffff161115610d1c5760006002610ca084846147a2565b610caa91906147dd565b610cb490836147a2565b6001600160a01b038816600090815260186020908152604080832063ffffffff851684529091529020805491925090879003610cf657509350610d2192505050565b8054871115610d0757819350610d15565b610d126001836147a2565b92505b5050610c7e565b509150505b92915050565b6001546001600160a01b03163314610d3e57600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600860205260409020546001600160a01b031680610d8257600080fd5b806001600160a01b0316836001600160a01b031603610da057600080fd5b6000828152600860209081526040808320546001600160a01b038581168552600b845282852033808752945291909320549216149060ff168180610de15750805b610dea57600080fd5b6000848152600a602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918716917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a45050505050565b601060205281600052604060002081633b9aca008110610e6757600080fd5b6003020180546001820154600290920154600f82810b9550600160801b90920490910b925084565b6000610e9a426116b0565b905090565b600082815260106020526040812082633b9aca008110610ec157610ec1614800565b6003020160010154905092915050565b610edd838383336126e6565b505050565b60075460ff16600114610ef457600080fd5b6007805460ff19166002179055610f0b33826127b5565b610f1757610f17614816565b600081815260156020526040902054158015610f42575060008181526016602052604090205460ff16155b610f675760405162461bcd60e51b8152600401610f5e9061482c565b60405180910390fd5b60008181526011602090815260409182902082518084019093528054600f0b835260010154908201526003546001600160a01b0316331480610fad575080602001514210155b610ff25760405162461bcd60e51b8152602060048201526016602482015275546865206c6f636b206469646e27742065787069726560501b6044820152606401610f5e565b8051604080518082018252600080825260208083018281528783526011909152929020905181546001600160801b0319166001600160801b039091161781559051600190910155601454600f9190910b9061104d828261484e565b6014556040805180820190915260008082526020820152611071908590859061281b565b60405163a9059cbb60e01b8152336004820152602481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a9059cbb906044016020604051808303816000875af11580156110de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111029190614865565b61110e5761110e614816565b61111784612dff565b60408051858152602081018490524281830152905133917f02f25270a4d87bea75db541cdfe559334a275b4a233520ed6c0a2429667cca94919081900360600190a27f5e2aa66efd74cce82b21852e317e5490d9ecc9e6bb953ae24d90851258cc2f5c81611185848261484e565b6040805192835260208301919091520160405180910390a150506007805460ff191660011790555050565b6001546001600160a01b031633146111c757600080fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000806111f68484610bb4565b6001600160a01b038516600090815260186020908152604080832063ffffffff851684529091528120919250600190910190805b825481101561127e57600083828154811061124757611247614800565b9060005260206000200154905061125e8188612ec0565b6112689084614882565b92505080806112769061489a565b91505061122a565b5095945050505050565b610edd83838360405180602001604052806000815250611cef565b60006112af83836127b5565b9392505050565b6000818152600f60209081526040808320546010909252822081633b9aca0081106112e3576112e3614800565b6003020154600160801b9004600f0b9392505050565b6001546001600160a01b0316331461131057600080fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b0316331461134957600080fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b600081815260156020526040902054158015611396575060008181526016602052604090205460ff16155b6113b25760405162461bcd60e51b8152600401610f5e9061482c565b6113bc33826127b5565b6113c557600080fd5b600081815260086020908152604080832054601183529281902081518083019092528054600f0b8083526001909101549282018390526001600160a01b03909316929091908061141457600080fd5b80601454611422919061484e565b6014556000805b875182101561146b5787828151811061144457611444614800565b6020026020010151816114579190614882565b9050816114638161489a565b925050611429565b604080518082018252600080825260208083018281528b835260118252848320935184546001600160801b0319166001600160801b03909116178455516001909301929092558251808401909352808352908201526114cd908890879061281b565b6114d687612dff565b834281116114f65760405162461bcd60e51b8152600401610f5e906148b3565b6115046303c2670042614882565b8111156115235760405162461bcd60e51b8152600401610f5e906148f9565b60008093505b89518410156115d4576006600081546115419061489a565b909155506006549850611554888a612f94565b50828a858151811061156857611568614800565b60200260200101518661157b9190614930565b611585919061494f565b60008a81526011602090815260409182902082518084019093528054600f0b835260010154908201529091506115c2908a90839085906005612ff3565b836115cc8161489a565b945050611529565b50505050505050505050565b6001546001600160a01b031633146115f757600080fd5b60038054911515600160a01b0260ff60a01b19909216919091179055565b6001600160a01b03808216600090815260176020526040812054909116801561163e57806112af565b5090919050565b6001600160a01b0381166116565750335b6116603382613216565b50565b60075460009060ff1660011461167857600080fd5b6007805460ff19166002179055611690838333613289565b90506007805460ff1916600117905592915050565b6000610d2182613371565b601254600081815260046020908152604080832081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060820152909190611708818561338c565b949350505050565b60006112af838361348d565b6000610d21826116b0565b60004382111561173957611739614816565b60125460006117488483613766565b600081815260046020908152604080832081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060820152919250838310156118575760006004816117ab866001614882565b8152602080820192909252604090810160002081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060808301829052850151919250146118515782606001518160600151611817919061484e565b8360400151826040015161182b919061484e565b606085015161183a908a61484e565b6118449190614930565b61184e919061494f565b91505b506118a6565b438260600151146118a6576060820151611871904361484e565b6040830151611880904261484e565b606084015161188f908961484e565b6118999190614930565b6118a3919061494f565b90505b6118bf828284604001516118ba9190614882565b61338c565b9695505050505050565b6000546001600160a01b031633146118e057600080fd5b6000818152601560205260409020546118fb9060019061484e565b60009182526015602052604090912055565b6001600160a01b03811660009081526019602052604081205463ffffffff1680820361193c5750600092915050565b6001600160a01b0383166000908152601860205260408120816119606001856147a2565b63ffffffff1663ffffffff16815260200190815260200160002060010190506000805b82548110156119d75760008382815481106119a0576119a0614800565b906000526020600020015490506119b78142612ec0565b6119c19084614882565b92505080806119cf9061489a565b915050611983565b50949350505050565b60075460ff166001146119f257600080fd5b6007805460ff19166002179055611a0933836127b5565b611a1557611a15614816565b60008281526011602090815260409182902082518084019093528054600f0b8352600101549082015281611a4b57611a4b614816565b60008160000151600f0b13611a725760405162461bcd60e51b8152600401610f5e90614963565b42816020015111611a955760405162461bcd60e51b8152600401610f5e90614993565b611aa483836000846002612ff3565b50506007805460ff1916600117905550565b336001600160a01b03831603611ace57611ace614816565b336000818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60075460ff16600114611b4c57600080fd5b6007805460ff19166002179055611b6333836127b5565b611b6f57611b6f614816565b600082815260116020908152604080832081518083019092528054600f0b825260010154918101919091529062093a8080611baa8542614882565b611bb4919061494f565b611bbe9190614930565b905042826020015111611c025760405162461bcd60e51b815260206004820152600c60248201526b131bd8dac8195e1c1a5c995960a21b6044820152606401610f5e565b60008260000151600f0b13611c4d5760405162461bcd60e51b8152602060048201526011602482015270139bdd1a1a5b99c81a5cc81b1bd8dad959607a1b6044820152606401610f5e565b81602001518111611ca05760405162461bcd60e51b815260206004820152601f60248201527f43616e206f6e6c7920696e637265617365206c6f636b206475726174696f6e006044820152606401610f5e565b611cae6303c2670042614882565b811115611ccd5760405162461bcd60e51b8152600401610f5e906148f9565b611cdc84600083856003612ff3565b50506007805460ff191660011790555050565b611cfb848484336126e6565b823b15611e8857604051630a85bd0160e11b81526001600160a01b0384169063150b7a0290611d349033908890879087906004016149d7565b6020604051808303816000875af1925050508015611d6f575060408051601f3d908101601f19168201909252611d6c91810190614a0a565b60015b611e17573d808015611d9d576040519150601f19603f3d011682016040523d82523d6000602084013e611da2565b606091505b508051600003611e0f5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6064820152608401610f5e565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b14611e865760405162461bcd60e51b815260206004820152602660248201527f4552433732313a2045524337323152656365697665722072656a656374656420604482015265746f6b656e7360d01b6064820152608401610f5e565b505b50505050565b6000546001600160a01b03163314611ea557600080fd5b6000908152601660205260409020805460ff19169055565b611efb600060405180604001604052806000600f0b8152602001600081525060405180604001604052806000600f0b8152602001600081525061281b565b565b336001600160a01b03871603611f1257600080fd5b6001600160a01b038616611f2557600080fd5b60408051808201825260068152657665426c756560d01b6020918201528151808301835260058152640312e302e360dc1b9082015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527f47a336bc0aa525742f7a63780d512ead9d13972f64a4169451be60f42795cc8b818401527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c60608201524660808201523060a0808301919091528351808303909101815260c0820184528051908301207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60e08301526001600160a01b038a1661010083015261012082018990526101408083018990528451808403909101815261016083019094528351939092019290922061190160f01b61018084015261018283018290526101a2830181905290916000906101c20160408051601f198184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa1580156120e5573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661215f5760405162461bcd60e51b815260206004820152602e60248201527f566f74696e67457363726f773a3a64656c656761746542795369673a20696e7660448201526d616c6964207369676e617475726560901b6064820152608401610f5e565b6001600160a01b0381166000908152601a602052604081208054916121838361489a565b9190505589146121e85760405162461bcd60e51b815260206004820152602a60248201527f566f74696e67457363726f773a3a64656c656761746542795369673a20696e76604482015269616c6964206e6f6e636560b01b6064820152608401610f5e565b8742111561224f5760405162461bcd60e51b815260206004820152602e60248201527f566f74696e67457363726f773a3a64656c656761746542795369673a2073696760448201526d1b985d1d5c9948195e1c1a5c995960921b6064820152608401610f5e565b6115d4818b613216565b505050505050565b6000818152600860205260409020546060906001600160a01b03166122c85760405162461bcd60e51b815260206004820152601b60248201527f517565727920666f72206e6f6e6578697374656e7420746f6b656e00000000006044820152606401610f5e565b60008281526011602090815260409182902082518084019093528054600f0b835260010154908201526002546001600160a01b031663dd9ec1498461230d8142612ec0565b6020850151855160405160e086901b6001600160e01b0319168152600481019490945260248401929092526044830152600f0b6064820152608401600060405180830381865afa158015612365573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112af9190810190614a27565b6000828152601560205260409020541580156123b8575060008281526016602052604090205460ff16155b6123d45760405162461bcd60e51b8152600401610f5e9061482c565b8082036123e057600080fd5b6123ea33836127b5565b6123f357600080fd5b6123fd33826127b5565b61240657600080fd5b6000828152601160208181526040808420815180830183528154600f90810b825260019283015482860190815288885295855283872084518086019095528054820b855290920154938301849052805194519095929490910b921115612470578260200151612476565b83602001515b604080518082018252600080825260208083018281528b835260118252848320935184546001600160801b0319166001600160801b03909116178455516001909301929092558251808401909352808352908201529091506124db908790869061281b565b6124e486612dff565b612259858383866004612ff3565b60075460009060ff1660011461250757600080fd5b6007805460ff1916600217905561251f848484613289565b90506007805460ff191660011790559392505050565b60006112af8383612ec0565b6000818152600c602052604081205443900361255f57506000919050565b610d218242612ec0565b60075460ff1660011461257b57600080fd5b6007805460ff1916600217905560008281526011602090815260409182902082518084019093528054600f0b83526001015490820152816125bb57600080fd5b60008160000151600f0b136125e25760405162461bcd60e51b8152600401610f5e90614963565b428160200151116126055760405162461bcd60e51b8152600401610f5e90614993565b600354600160a01b900460ff16801561263657506126216137ec565b6001600160a01b0316336001600160a01b0316145b156126745761266f838362093a80806126536303c2670042614882565b61265d919061494f565b6126679190614930565b846000612ff3565b611aa4565b611aa483836000846000612ff3565b6000546001600160a01b0316331461269a57600080fd5b6000818152601560205260409020546118fb906001614882565b6000546001600160a01b031633146126cb57600080fd5b6000908152601660205260409020805460ff19166001179055565b600082815260156020526040902054158015612711575060008281526016602052604090205460ff16155b61272d5760405162461bcd60e51b8152600401610f5e9061482c565b61273781836127b5565b61274057600080fd5b61274a84836138c5565b612754848361392c565b61276f61276085611615565b61276985611615565b846139ad565b6127798383613d0f565b6000828152600c60205260408082204390555183916001600160a01b038087169290881691600080516020614d2483398151915291a450505050565b600081815260086020908152604080832054600a8352818420546001600160a01b03918216808652600b855283862088841680885295529285205492938085149392909116149060ff1682806128085750815b806128105750805b979650505050505050565b6128236142b8565b61282b6142b8565b6012546000908190871561294e57428760200151118015612853575060008760000151600f0b135b15612898578651612869906303c2670090614a95565b600f0b60208087019190915287015161288390429061484e565b85602001516128929190614ad3565b600f0b85525b4286602001511180156128b2575060008660000151600f0b135b156128f75785516128c8906303c2670090614a95565b600f0b6020808601919091528601516128e290429061484e565b84602001516128f19190614ad3565b600f0b84525b602080880151600090815260138252604090205490870151600f9190910b93501561294e5786602001518660200151036129335782915061294e565b602080870151600090815260139091526040902054600f0b91505b6040805160808101825260008082526020820152429181019190915243606082015281156129c3575060008181526004602090815260409182902082516080810184528154600f81810b8352600160801b909104900b9281019290925260018101549282019290925260029091015460608201525b604081015181600042831015612a105760408401516129e2904261484e565b60608501516129f1904361484e565b612a0390670de0b6b3a7640000614930565b612a0d919061494f565b90505b600062093a80612a20818661494f565b612a2a9190614930565b905060005b60ff811015612ba457612a4562093a8083614882565b9150600042831115612a5957429250612a6d565b50600082815260136020526040902054600f0b5b612a77868461484e565b8760200151612a869190614ad3565b87518890612a95908390614b67565b600f0b905250602087018051829190612aaf908390614bb7565b600f90810b90915288516000910b12159050612aca57600087525b60008760200151600f0b1215612ae257600060208801525b60408088018490528501519295508592670de0b6b3a764000090612b06908561484e565b612b109086614930565b612b1a919061494f565b8560600151612b299190614882565b6060880152612b39600189614882565b9750428303612b4e5750436060870152612ba4565b6000888152600460209081526040918290208951918a01516001600160801b03908116600160801b029216919091178155908801516001820155606088015160029091015550612b9d8161489a565b9050612a2f565b505060128590558b15612c2f5788602001518860200151612bc59190614b67565b84602001818151612bd69190614bb7565b600f0b90525088518851612bea9190614b67565b84518590612bf9908390614bb7565b600f90810b90915260208601516000910b12159050612c1a57600060208501525b60008460000151600f0b1215612c2f57600084525b6000858152600460209081526040918290208651918701516001600160801b03908116600160801b02921691909117815590850151600182015560608501516002909101558b15612df157428b602001511115612ce6576020890151612c959088614bb7565b96508a602001518a6020015103612cb8576020880151612cb59088614b67565b96505b60208b810151600090815260139091526040902080546001600160801b0319166001600160801b0389161790555b428a602001511115612d41578a602001518a602001511115612d41576020880151612d119087614b67565b60208b810151600090815260139091526040902080546001600160801b0319166001600160801b03831617905595505b60008c8152600f6020526040812054612d5b906001614882565b905080600f60008f815260200190815260200160002081905550428960400181815250504389606001818152505088601060008f815260200190815260200160002082633b9aca008110612db157612db1614800565b825160208401516001600160801b03908116600160801b029116176003919091029190910190815560408201516001820155606090910151600290910155505b505050505050505050505050565b612e0933826127b5565b612e555760405162461bcd60e51b815260206004820181905260248201527f63616c6c6572206973206e6f74206f776e6572206e6f7220617070726f7665646044820152606401610f5e565b6000818152600860205260408120546001600160a01b031690612e789083610d60565b612e8c612e8482611615565b6000846139ad565b612e96818361392c565b60405182906000906001600160a01b03841690600080516020614d24833981519152908390a45050565b6000828152600f6020526040812054808203612ee0576000915050610d21565b600084815260106020526040812082633b9aca008110612f0257612f02614800565b60408051608081018252600392909202929092018054600f81810b8452600160801b909104900b602083015260018101549282018390526002015460608201529150612f4e9085614c08565b8160200151612f5d9190614ad3565b81518290612f6c908390614b67565b600f90810b90915282516000910b12159050612f8757600081525b51600f0b9150610d219050565b60006001600160a01b038316612fac57612fac614816565b612fba600061276985611615565b612fc48383613d0f565b60405182906001600160a01b03851690600090600080516020614d24833981519152908290a450600192915050565b60145482906130028682614882565b6014556040805180820190915260008082526020820152825160208085015190830152600f0b815282518790849061303b908390614bb7565b600f0b905250851561304f57602083018690525b6000888152601160209081526040909120845181546001600160801b0319166001600160801b039091161781559084015160019091015561309188828561281b565b3387158015906130b3575060048560058111156130b0576130b0614c47565b14155b80156130d1575060058560058111156130ce576130ce614c47565b14155b1561317b576040516323b872dd60e01b81526001600160a01b038281166004830152306024830152604482018a90527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906064016020604051808303816000875af115801561314b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061316f9190614865565b61317b5761317b614816565b8360200151816001600160a01b03167fff04ccafc360e16b67d682d17bd9503c4c6b9a131f6be6325762dc9ffc7de6248b8b89426040516131bf9493929190614c5d565b60405180910390a37f5e2aa66efd74cce82b21852e317e5490d9ecc9e6bb953ae24d90851258cc2f5c836131f38a82614882565b6040805192835260208301919091520160405180910390a1505050505050505050565b600061322183611615565b6001600160a01b0384811660008181526017602052604080822080546001600160a01b031916888616908117909155905194955093928516927f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610edd838284613d8e565b60008062093a808061329b8642614882565b6132a5919061494f565b6132af9190614930565b9050600085116132be57600080fd5b4281116132dd5760405162461bcd60e51b8152600401610f5e906148b3565b6132eb6303c2670042614882565b81111561330a5760405162461bcd60e51b8152600401610f5e906148f9565b6006600081546133199061489a565b9091555060065461332a8482612f94565b5060008181526011602090815260409182902082518084019093528054600f0b83526001908101549183019190915261336891839189918691612ff3565b95945050505050565b6001600160a01b031660009081526009602052604090205490565b600080839050600062093a808083604001516133a8919061494f565b6133b29190614930565b905060005b60ff811015613465576133cd62093a8083614882565b91506000858311156133e1578592506133f5565b50600082815260136020526040902054600f0b5b6040840151613404908461484e565b84602001516134139190614ad3565b84518590613422908390614b67565b600f0b9052508583036134355750613465565b80846020018181516134479190614bb7565b600f0b905250506040830182905261345e8161489a565b90506133b7565b5060008260000151600f0b121561347b57600082525b50516001600160801b03169392505050565b60004382111561349f5761349f614816565b6000838152600f6020526040812054815b608081101561353f578183101561353f57600060026134cf8486614882565b6134da906001614882565b6134e4919061494f565b6000888152601060205260409020909150869082633b9aca00811061350b5761350b614800565b6003020160020154116135205780935061352e565b61352b60018261484e565b92505b506135388161489a565b90506134b0565b50600085815260106020526040812083633b9aca00811061356257613562614800565b60408051608081018252600392909202929092018054600f81810b8452600160801b909104900b6020830152600181015492820192909252600290910154606082015260125490915060006135b78783613766565b600081815260046020908152604080832081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060820152919250808484101561369657600060048161361b876001614882565b8152602080820192909252604090810160002081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060808301829052860151919250613678919061484e565b92508360400151816040015161368e919061484e565b9150506136ba565b60608301516136a5904361484e565b91508260400151426136b7919061484e565b90505b604083015182156136f7578284606001518c6136d6919061484e565b6136e09084614930565b6136ea919061494f565b6136f49082614882565b90505b6040870151613706908261484e565b87602001516137159190614ad3565b87518890613724908390614b67565b600f90810b90915288516000910b12905061375457505093516001600160801b03169650610d2195505050505050565b60009950505050505050505050610d21565b60008082815b60808110156137e257818310156137e2576000600261378b8486614882565b613796906001614882565b6137a0919061494f565b60008181526004602052604090206002015490915087106137c3578093506137d1565b6137ce60018261484e565b92505b506137db8161489a565b905061376c565b5090949350505050565b60008060009054906101000a90046001600160a01b03166001600160a01b031663075461726040518163ffffffff1660e01b8152600401602060405180830381865afa158015613840573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138649190614c9b565b6001600160a01b0316634b1cd5da6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156138a1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9a9190614c9b565b6000818152600860205260409020546001600160a01b038381169116146138ee576138ee614816565b6000818152600a60205260409020546001600160a01b031615613928576000818152600a6020526040902080546001600160a01b03191690555b5050565b6000818152600860205260409020546001600160a01b0383811691161461395557613955614816565b600081815260086020526040902080546001600160a01b031916905561397b828261414a565b6001600160a01b03821660009081526009602052604081208054600192906139a490849061484e565b90915550505050565b816001600160a01b0316836001600160a01b0316141580156139cf5750600081115b15610edd576001600160a01b03831615613b50576001600160a01b03831660009081526019602052604081205463ffffffff169081613a33576001600160a01b03851660009081526018602090815260408083208380529091529020600101613a75565b6001600160a01b038516600090815260186020526040812090613a576001856147a2565b63ffffffff1663ffffffff1681526020019081526020016000206001015b90506000613a82866141fb565b6001600160a01b038716600090815260186020908152604080832063ffffffff8516845290915281209192506001909101905b8354811015613b0f576000848281548110613ad257613ad2614800565b90600052602060002001549050868114613afc578254600181018455600084815260209020018190555b5080613b078161489a565b915050613ab5565b50613b1b846001614cb8565b6001600160a01b0388166000908152601960205260409020805463ffffffff191663ffffffff92909216919091179055505050505b6001600160a01b03821615610edd576001600160a01b03821660009081526019602052604081205463ffffffff169081613baf576001600160a01b03841660009081526018602090815260408083208380529091529020600101613bf1565b6001600160a01b038416600090815260186020526040812090613bd36001856147a2565b63ffffffff1663ffffffff1681526020019081526020016000206001015b90506000613bfe856141fb565b6001600160a01b038616600090815260186020908152604080832063ffffffff851684529091529020835491925060019081019161040091613c409190614882565b1115613c5e5760405162461bcd60e51b8152600401610f5e90614ce0565b60005b8354811015613cb0576000848281548110613c7e57613c7e614800565b600091825260208083209091015485546001810187558684529190922001555080613ca88161489a565b915050613c61565b50805460018181018355600083815260209020909101869055613cd4908590614cb8565b6001600160a01b0387166000908152601960205260409020805463ffffffff9290921663ffffffff1990921691909117905550505050505050565b6000818152600860205260409020546001600160a01b031615613d3457613d34614816565b600081815260086020526040902080546001600160a01b0319166001600160a01b038416179055613d658282614274565b6001600160a01b03821660009081526009602052604081208054600192906139a4908490614882565b806001600160a01b0316826001600160a01b031614610edd576001600160a01b03821615613f41576001600160a01b03821660009081526019602052604081205463ffffffff169081613e06576001600160a01b03841660009081526018602090815260408083208380529091529020600101613e48565b6001600160a01b038416600090815260186020526040812090613e2a6001856147a2565b63ffffffff1663ffffffff1681526020019081526020016000206001015b90506000613e55856141fb565b6001600160a01b038616600090815260186020908152604080832063ffffffff8516845290915281209192506001909101905b8354811015613f00576000848281548110613ea557613ea5614800565b600091825260208083209091015480835260089091526040909120549091506001600160a01b03908116908a1614613eed578254600181018455600084815260209020018190555b5080613ef88161489a565b915050613e88565b50613f0c846001614cb8565b6001600160a01b0387166000908152601960205260409020805463ffffffff191663ffffffff92909216919091179055505050505b6001600160a01b03811615610edd576001600160a01b03811660009081526019602052604081205463ffffffff169081613fa0576001600160a01b03831660009081526018602090815260408083208380529091529020600101613fe2565b6001600160a01b038316600090815260186020526040812090613fc46001856147a2565b63ffffffff1663ffffffff1681526020019081526020016000206001015b90506000613fef846141fb565b6001600160a01b03808616600090815260186020908152604080832063ffffffff861684528252808320938b1683526009909152902054845492935060019091019161040090614040908390614882565b111561405e5760405162461bcd60e51b8152600401610f5e90614ce0565b60005b84548110156140b057600085828154811061407e5761407e614800565b6000918252602080832090910154865460018101885587845291909220015550806140a88161489a565b915050614061565b5060005b81811015614102576001600160a01b0389166000908152600d6020908152604080832084845282528220548554600181018755868452919092200155806140fa8161489a565b9150506140b4565b5061410e856001614cb8565b6001600160a01b0387166000908152601960205260409020805463ffffffff9290921663ffffffff199092169190911790555050505050505050565b6000600161415784613371565b614161919061484e565b6000838152600e60205260409020549091508082036141b0576001600160a01b0384166000908152600d602090815260408083208584528252808320839055858352600e909152812055611e88565b6001600160a01b03939093166000908152600d6020908152604080832093835292815282822080548684528484208190558352600e9091528282209490945592839055908252812055565b6001600160a01b038116600090815260196020526040812054429063ffffffff16801580159061426457506001600160a01b0384166000908152601860205260408120839161424b6001856147a2565b63ffffffff168152602081019190915260400160002054145b156112af576117086001826147a2565b600061427f83613371565b6001600160a01b039093166000908152600d602090815260408083208684528252808320859055938252600e9052919091209190915550565b60405180608001604052806000600f0b81526020016000600f0b815260200160008152602001600081525090565b6001600160e01b03198116811461166057600080fd5b60006020828403121561430e57600080fd5b81356112af816142e6565b60005b8381101561433457818101518382015260200161431c565b83811115611e885750506000910152565b6000815180845261435d816020860160208601614319565b601f01601f19169290920160200192915050565b6020815260006112af6020830184614345565b6001600160a01b038116811461166057600080fd5b600080604083850312156143ac57600080fd5b82356143b781614384565b946020939093013593505050565b6000602082840312156143d757600080fd5b5035919050565b6000602082840312156143f057600080fd5b81356112af81614384565b6000806040838503121561440e57600080fd5b50508035926020909101359150565b60008060006060848603121561443257600080fd5b833561443d81614384565b9250602084013561444d81614384565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561449d5761449d61445e565b604052919050565b600080604083850312156144b857600080fd5b823567ffffffffffffffff808211156144d057600080fd5b818501915085601f8301126144e457600080fd5b81356020828211156144f8576144f861445e565b8160051b9250614509818401614474565b828152928401810192818101908985111561452357600080fd5b948201945b8486101561454157853582529482019490820190614528565b9997909101359750505050505050565b801515811461166057600080fd5b60006020828403121561457157600080fd5b81356112af81614551565b6000806040838503121561458f57600080fd5b823561459a81614384565b915060208301356145aa81614551565b809150509250929050565b600067ffffffffffffffff8211156145cf576145cf61445e565b50601f01601f191660200190565b600080600080608085870312156145f357600080fd5b84356145fe81614384565b9350602085013561460e81614384565b925060408501359150606085013567ffffffffffffffff81111561463157600080fd5b8501601f8101871361464257600080fd5b8035614655614650826145b5565b614474565b81815288602083850101111561466a57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b60008060008060008060c087890312156146a557600080fd5b86356146b081614384565b95506020870135945060408701359350606087013560ff811681146146d457600080fd5b9598949750929560808101359460a0909101359350915050565b60008060006060848603121561470357600080fd5b8335925060208401359150604084013561471c81614384565b809150509250925092565b6000806040838503121561473a57600080fd5b823561474581614384565b915060208301356145aa81614384565b6000806040838503121561476857600080fd5b823561477381614384565b9150602083013563ffffffff811681146145aa57600080fd5b634e487b7160e01b600052601160045260246000fd5b600063ffffffff838116908316818110156147bf576147bf61478c565b039392505050565b634e487b7160e01b600052601260045260246000fd5b600063ffffffff808416806147f4576147f46147c7565b92169190910492915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052600160045260246000fd5b602080825260089082015267185d1d1858da195960c21b604082015260600190565b6000828210156148605761486061478c565b500390565b60006020828403121561487757600080fd5b81516112af81614551565b600082198211156148955761489561478c565b500190565b6000600182016148ac576148ac61478c565b5060010190565b60208082526026908201527f43616e206f6e6c79206c6f636b20756e74696c2074696d6520696e207468652060408201526566757475726560d01b606082015260800190565b6020808252601e908201527f566f74696e67206c6f636b2063616e2062652032207965617273206d61780000604082015260600190565b600081600019048311821515161561494a5761494a61478c565b500290565b60008261495e5761495e6147c7565b500490565b602080825260169082015275139bc8195e1a5cdd1a5b99c81b1bd8dac8199bdd5b9960521b604082015260600190565b60208082526024908201527f43616e6e6f742061646420746f2065787069726564206c6f636b2e20576974686040820152636472617760e01b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906118bf90830184614345565b600060208284031215614a1c57600080fd5b81516112af816142e6565b600060208284031215614a3957600080fd5b815167ffffffffffffffff811115614a5057600080fd5b8201601f81018413614a6157600080fd5b8051614a6f614650826145b5565b818152856020838501011115614a8457600080fd5b613368826020830160208601614319565b600081600f0b83600f0b80614aac57614aac6147c7565b60016001607f1b0319821460001982141615614aca57614aca61478c565b90059392505050565b6000600f82810b9084900b60016001607f1b0383821384841380821684840486111615614b0257614b0261478c565b60016001607f1b03196000851282811687830587121615614b2557614b2561478c565b60008712925085820587128484161615614b4157614b4161478c565b85850587128184161615614b5757614b5761478c565b5050509290910295945050505050565b6000600f82810b9084900b828112801560016001607f1b0319830184121615614b9257614b9261478c565b60016001607f1b0382018313811615614bad57614bad61478c565b5090039392505050565b6000600f82810b9084900b828212801560016001607f1b0384900383131615614be257614be261478c565b60016001607f1b03198390038212811615614bff57614bff61478c565b50019392505050565b60008083128015600160ff1b850184121615614c2657614c2661478c565b6001600160ff1b0384018313811615614c4157614c4161478c565b50500390565b634e487b7160e01b600052602160045260246000fd5b848152602081018490526080810160068410614c8957634e487b7160e01b600052602160045260246000fd5b60408201939093526060015292915050565b600060208284031215614cad57600080fd5b81516112af81614384565b600063ffffffff808316818516808303821115614cd757614cd761478c565b01949350505050565b60208082526023908201527f64737452657020776f756c64206861766520746f6f206d616e7920746f6b656e60408201526249647360e81b60608201526080019056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220b899c7825c5b935fa08f91ecbc336057be6bb89c0b96dd0ca2ae46bfaeb98d1564736f6c634300080d0033ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef000000000000000000000000f1b5e599be51bc0266abfb028a1776984d7f1bc9000000000000000000000000494d48358eea84f0868cc1ecdba51962aa4ed3f8

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103de5760003560e01c806370a0823111610206578063c1f0fb9f1161012b578063e7a324dc116100c3578063f1127ed811610087578063f1127ed814610b19578063f8a0576314610b44578063fbd3a29d14610b67578063fc0c546a14610b7a578063fd4a77f114610ba157600080fd5b8063e7a324dc14610a7c578063e7e242d414610aa3578063e985e9c514610ab6578063ea043fe514610af2578063ee99fe2814610b0657600080fd5b8063c1f0fb9f146109a4578063c2c4c5c1146109b7578063c3cda520146109bf578063c87b56dd146109d2578063d1c2babb146109e5578063d1febfb9146109f8578063d4e54c3b14610a36578063e0514aba14610a49578063e441135c14610a5c57600080fd5b806395d89b411161019e57806395d89b41146108b2578063981b24d0146108d7578063986b7d8a146108ea5780639ab24eb0146108fd578063a183af5214610910578063a22cb46514610923578063a4d855df14610936578063b45a3c0e14610949578063b88d4fde1461099157600080fd5b806370a08231146107e45780637116c60c146107f7578063711974841461080a5780637ecebe001461082d57806385f2aef21461084d5780638c2c9baf146108605780638e539e8c146108735780638fbb38ff14610886578063900cf0cf146108a957600080fd5b8063313ce567116103075780635594a0451161029f5780635f5b0c32116102635780635f5b0c32146107595780636352211e1461076257806365fc38731461078b5780636f5488371461079e5780636fcfff45146107be57600080fd5b80635594a045146106fa57806356afe7441461070d57806356f184e814610720578063587cde1e146107335780635c19a95c1461074657600080fd5b8063313ce567146106245780633a46b1a81461063e57806342842e0e14610651578063430c208114610664578063461f711c1461067757806346c96aac1461069d5780634bc2a657146106b05780634f06e0f7146106c357806354fd4d50146106d657600080fd5b806318160ddd1161037a57806318160ddd1461055a5780631c984bc31461056257806320606b701461057557806323b872dd1461059c57806325a58b56146105af5780632bab754b146105b55780632e1a7d4d146105c85780632e720f7d146105db5780632f745c59146105ee57600080fd5b806301ffc9a7146103e3578063047fc9aa1461042557806306fdde031461043c5780630758c7d81461046e578063081812fc14610496578063095cf5c6146104d7578063095ea7b3146104ec5780630d6a2033146104ff5780631376f3da1461051f575b600080fd5b6104106103f13660046142fc565b6001600160e01b03191660009081526005602052604090205460ff1690565b60405190151581526020015b60405180910390f35b61042e60145481565b60405190815260200161041c565b610461604051806040016040528060068152602001657665426c756560d01b81525081565b60405161041c9190614371565b61048161047c366004614399565b610bb4565b60405163ffffffff909116815260200161041c565b6104bf6104a43660046143c5565b6000908152600a60205260409020546001600160a01b031690565b6040516001600160a01b03909116815260200161041c565b6104ea6104e53660046143de565b610d27565b005b6104ea6104fa366004614399565b610d60565b61042e61050d3660046143c5565b60156020526000908152604090205481565b61053261052d3660046143fb565b610e48565b60408051600f95860b81529390940b602084015292820152606081019190915260800161041c565b61042e610e8f565b61042e6105703660046143fb565b610e9f565b61042e7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6104ea6105aa36600461441d565b610ed1565b4361042e565b6003546104bf906001600160a01b031681565b6104ea6105d63660046143c5565b610ee2565b6104ea6105e93660046143de565b6111b0565b61042e6105fc366004614399565b6001600160a01b03919091166000908152600d60209081526040808320938352929052205490565b61062c601281565b60405160ff909116815260200161041c565b61042e61064c366004614399565b6111e9565b6104ea61065f36600461441d565b611288565b610410610672366004614399565b6112a3565b61068a6106853660046143c5565b6112b6565b604051600f9190910b815260200161041c565b6000546104bf906001600160a01b031681565b6104ea6106be3660046143de565b6112f9565b6104ea6106d13660046143de565b611332565b610461604051806040016040528060058152602001640312e302e360dc1b81525081565b6002546104bf906001600160a01b031681565b6104ea61071b3660046144a5565b61136b565b6104ea61072e36600461455f565b6115e0565b6104bf6107413660046143de565b611615565b6104ea6107543660046143de565b611645565b61042e61040081565b6104bf6107703660046143c5565b6000908152600860205260409020546001600160a01b031690565b61042e6107993660046143fb565b611663565b61042e6107ac3660046143c5565b600c6020526000908152604090205481565b6104816107cc3660046143de565b60196020526000908152604090205463ffffffff1681565b61042e6107f23660046143de565b6116a5565b61042e6108053660046143c5565b6116b0565b61068a6108183660046143c5565b601360205260009081526040902054600f0b81565b61042e61083b3660046143de565b601a6020526000908152604090205481565b6001546104bf906001600160a01b031681565b61042e61086e3660046143fb565b611710565b61042e6108813660046143c5565b61171c565b6104106108943660046143c5565b60166020526000908152604090205460ff1681565b61042e60125481565b610461604051806040016040528060068152602001657665424c554560d01b81525081565b61042e6108e53660046143c5565b611727565b6104ea6108f83660046143c5565b6118c9565b61042e61090b3660046143de565b61190d565b6104ea61091e3660046143fb565b6119e0565b6104ea61093136600461457c565b611ab6565b6104ea6109443660046143fb565b611b3a565b6109776109573660046143c5565b60116020526000908152604090208054600190910154600f9190910b9082565b60408051600f9390930b835260208301919091520161041c565b6104ea61099f3660046145dd565b611cef565b6104ea6109b23660046143c5565b611e8e565b6104ea611ebd565b6104ea6109cd36600461468c565b611efd565b6104616109e03660046143c5565b612261565b6104ea6109f33660046143fb565b61238d565b610532610a063660046143c5565b600460205260009081526040902080546001820154600290920154600f82810b93600160801b909304900b919084565b61042e610a443660046146ee565b6124f2565b61042e610a573660046143fb565b612535565b61042e610a6a3660046143c5565b600f6020526000908152604090205481565b61042e7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b61042e610ab13660046143c5565b612541565b610410610ac4366004614727565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b60035461041090600160a01b900460ff1681565b6104ea610b143660046143fb565b612569565b61042e610b27366004614755565b601860209081526000928352604080842090915290825290205481565b61042e610b523660046143c5565b60009081526011602052604090206001015490565b6104ea610b753660046143c5565b612683565b6104bf7f000000000000000000000000f1b5e599be51bc0266abfb028a1776984d7f1bc981565b6104ea610baf3660046143c5565b6126b4565b6001600160a01b03821660009081526019602052604081205463ffffffff16808203610be4576000915050610d21565b6001600160a01b03841660009081526018602052604081208491610c096001856147a2565b63ffffffff16815260208101919091526040016000205411610c3857610c306001826147a2565b915050610d21565b6001600160a01b0384166000908152601860209081526040808320838052909152902054831015610c6d576000915050610d21565b600080610c7b6001846147a2565b90505b8163ffffffff168163ffffffff161115610d1c5760006002610ca084846147a2565b610caa91906147dd565b610cb490836147a2565b6001600160a01b038816600090815260186020908152604080832063ffffffff851684529091529020805491925090879003610cf657509350610d2192505050565b8054871115610d0757819350610d15565b610d126001836147a2565b92505b5050610c7e565b509150505b92915050565b6001546001600160a01b03163314610d3e57600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600860205260409020546001600160a01b031680610d8257600080fd5b806001600160a01b0316836001600160a01b031603610da057600080fd5b6000828152600860209081526040808320546001600160a01b038581168552600b845282852033808752945291909320549216149060ff168180610de15750805b610dea57600080fd5b6000848152600a602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918716917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a45050505050565b601060205281600052604060002081633b9aca008110610e6757600080fd5b6003020180546001820154600290920154600f82810b9550600160801b90920490910b925084565b6000610e9a426116b0565b905090565b600082815260106020526040812082633b9aca008110610ec157610ec1614800565b6003020160010154905092915050565b610edd838383336126e6565b505050565b60075460ff16600114610ef457600080fd5b6007805460ff19166002179055610f0b33826127b5565b610f1757610f17614816565b600081815260156020526040902054158015610f42575060008181526016602052604090205460ff16155b610f675760405162461bcd60e51b8152600401610f5e9061482c565b60405180910390fd5b60008181526011602090815260409182902082518084019093528054600f0b835260010154908201526003546001600160a01b0316331480610fad575080602001514210155b610ff25760405162461bcd60e51b8152602060048201526016602482015275546865206c6f636b206469646e27742065787069726560501b6044820152606401610f5e565b8051604080518082018252600080825260208083018281528783526011909152929020905181546001600160801b0319166001600160801b039091161781559051600190910155601454600f9190910b9061104d828261484e565b6014556040805180820190915260008082526020820152611071908590859061281b565b60405163a9059cbb60e01b8152336004820152602481018390527f000000000000000000000000f1b5e599be51bc0266abfb028a1776984d7f1bc96001600160a01b03169063a9059cbb906044016020604051808303816000875af11580156110de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111029190614865565b61110e5761110e614816565b61111784612dff565b60408051858152602081018490524281830152905133917f02f25270a4d87bea75db541cdfe559334a275b4a233520ed6c0a2429667cca94919081900360600190a27f5e2aa66efd74cce82b21852e317e5490d9ecc9e6bb953ae24d90851258cc2f5c81611185848261484e565b6040805192835260208301919091520160405180910390a150506007805460ff191660011790555050565b6001546001600160a01b031633146111c757600080fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000806111f68484610bb4565b6001600160a01b038516600090815260186020908152604080832063ffffffff851684529091528120919250600190910190805b825481101561127e57600083828154811061124757611247614800565b9060005260206000200154905061125e8188612ec0565b6112689084614882565b92505080806112769061489a565b91505061122a565b5095945050505050565b610edd83838360405180602001604052806000815250611cef565b60006112af83836127b5565b9392505050565b6000818152600f60209081526040808320546010909252822081633b9aca0081106112e3576112e3614800565b6003020154600160801b9004600f0b9392505050565b6001546001600160a01b0316331461131057600080fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b0316331461134957600080fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b600081815260156020526040902054158015611396575060008181526016602052604090205460ff16155b6113b25760405162461bcd60e51b8152600401610f5e9061482c565b6113bc33826127b5565b6113c557600080fd5b600081815260086020908152604080832054601183529281902081518083019092528054600f0b8083526001909101549282018390526001600160a01b03909316929091908061141457600080fd5b80601454611422919061484e565b6014556000805b875182101561146b5787828151811061144457611444614800565b6020026020010151816114579190614882565b9050816114638161489a565b925050611429565b604080518082018252600080825260208083018281528b835260118252848320935184546001600160801b0319166001600160801b03909116178455516001909301929092558251808401909352808352908201526114cd908890879061281b565b6114d687612dff565b834281116114f65760405162461bcd60e51b8152600401610f5e906148b3565b6115046303c2670042614882565b8111156115235760405162461bcd60e51b8152600401610f5e906148f9565b60008093505b89518410156115d4576006600081546115419061489a565b909155506006549850611554888a612f94565b50828a858151811061156857611568614800565b60200260200101518661157b9190614930565b611585919061494f565b60008a81526011602090815260409182902082518084019093528054600f0b835260010154908201529091506115c2908a90839085906005612ff3565b836115cc8161489a565b945050611529565b50505050505050505050565b6001546001600160a01b031633146115f757600080fd5b60038054911515600160a01b0260ff60a01b19909216919091179055565b6001600160a01b03808216600090815260176020526040812054909116801561163e57806112af565b5090919050565b6001600160a01b0381166116565750335b6116603382613216565b50565b60075460009060ff1660011461167857600080fd5b6007805460ff19166002179055611690838333613289565b90506007805460ff1916600117905592915050565b6000610d2182613371565b601254600081815260046020908152604080832081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060820152909190611708818561338c565b949350505050565b60006112af838361348d565b6000610d21826116b0565b60004382111561173957611739614816565b60125460006117488483613766565b600081815260046020908152604080832081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060820152919250838310156118575760006004816117ab866001614882565b8152602080820192909252604090810160002081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060808301829052850151919250146118515782606001518160600151611817919061484e565b8360400151826040015161182b919061484e565b606085015161183a908a61484e565b6118449190614930565b61184e919061494f565b91505b506118a6565b438260600151146118a6576060820151611871904361484e565b6040830151611880904261484e565b606084015161188f908961484e565b6118999190614930565b6118a3919061494f565b90505b6118bf828284604001516118ba9190614882565b61338c565b9695505050505050565b6000546001600160a01b031633146118e057600080fd5b6000818152601560205260409020546118fb9060019061484e565b60009182526015602052604090912055565b6001600160a01b03811660009081526019602052604081205463ffffffff1680820361193c5750600092915050565b6001600160a01b0383166000908152601860205260408120816119606001856147a2565b63ffffffff1663ffffffff16815260200190815260200160002060010190506000805b82548110156119d75760008382815481106119a0576119a0614800565b906000526020600020015490506119b78142612ec0565b6119c19084614882565b92505080806119cf9061489a565b915050611983565b50949350505050565b60075460ff166001146119f257600080fd5b6007805460ff19166002179055611a0933836127b5565b611a1557611a15614816565b60008281526011602090815260409182902082518084019093528054600f0b8352600101549082015281611a4b57611a4b614816565b60008160000151600f0b13611a725760405162461bcd60e51b8152600401610f5e90614963565b42816020015111611a955760405162461bcd60e51b8152600401610f5e90614993565b611aa483836000846002612ff3565b50506007805460ff1916600117905550565b336001600160a01b03831603611ace57611ace614816565b336000818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60075460ff16600114611b4c57600080fd5b6007805460ff19166002179055611b6333836127b5565b611b6f57611b6f614816565b600082815260116020908152604080832081518083019092528054600f0b825260010154918101919091529062093a8080611baa8542614882565b611bb4919061494f565b611bbe9190614930565b905042826020015111611c025760405162461bcd60e51b815260206004820152600c60248201526b131bd8dac8195e1c1a5c995960a21b6044820152606401610f5e565b60008260000151600f0b13611c4d5760405162461bcd60e51b8152602060048201526011602482015270139bdd1a1a5b99c81a5cc81b1bd8dad959607a1b6044820152606401610f5e565b81602001518111611ca05760405162461bcd60e51b815260206004820152601f60248201527f43616e206f6e6c7920696e637265617365206c6f636b206475726174696f6e006044820152606401610f5e565b611cae6303c2670042614882565b811115611ccd5760405162461bcd60e51b8152600401610f5e906148f9565b611cdc84600083856003612ff3565b50506007805460ff191660011790555050565b611cfb848484336126e6565b823b15611e8857604051630a85bd0160e11b81526001600160a01b0384169063150b7a0290611d349033908890879087906004016149d7565b6020604051808303816000875af1925050508015611d6f575060408051601f3d908101601f19168201909252611d6c91810190614a0a565b60015b611e17573d808015611d9d576040519150601f19603f3d011682016040523d82523d6000602084013e611da2565b606091505b508051600003611e0f5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6064820152608401610f5e565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b14611e865760405162461bcd60e51b815260206004820152602660248201527f4552433732313a2045524337323152656365697665722072656a656374656420604482015265746f6b656e7360d01b6064820152608401610f5e565b505b50505050565b6000546001600160a01b03163314611ea557600080fd5b6000908152601660205260409020805460ff19169055565b611efb600060405180604001604052806000600f0b8152602001600081525060405180604001604052806000600f0b8152602001600081525061281b565b565b336001600160a01b03871603611f1257600080fd5b6001600160a01b038616611f2557600080fd5b60408051808201825260068152657665426c756560d01b6020918201528151808301835260058152640312e302e360dc1b9082015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527f47a336bc0aa525742f7a63780d512ead9d13972f64a4169451be60f42795cc8b818401527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c60608201524660808201523060a0808301919091528351808303909101815260c0820184528051908301207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60e08301526001600160a01b038a1661010083015261012082018990526101408083018990528451808403909101815261016083019094528351939092019290922061190160f01b61018084015261018283018290526101a2830181905290916000906101c20160408051601f198184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa1580156120e5573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661215f5760405162461bcd60e51b815260206004820152602e60248201527f566f74696e67457363726f773a3a64656c656761746542795369673a20696e7660448201526d616c6964207369676e617475726560901b6064820152608401610f5e565b6001600160a01b0381166000908152601a602052604081208054916121838361489a565b9190505589146121e85760405162461bcd60e51b815260206004820152602a60248201527f566f74696e67457363726f773a3a64656c656761746542795369673a20696e76604482015269616c6964206e6f6e636560b01b6064820152608401610f5e565b8742111561224f5760405162461bcd60e51b815260206004820152602e60248201527f566f74696e67457363726f773a3a64656c656761746542795369673a2073696760448201526d1b985d1d5c9948195e1c1a5c995960921b6064820152608401610f5e565b6115d4818b613216565b505050505050565b6000818152600860205260409020546060906001600160a01b03166122c85760405162461bcd60e51b815260206004820152601b60248201527f517565727920666f72206e6f6e6578697374656e7420746f6b656e00000000006044820152606401610f5e565b60008281526011602090815260409182902082518084019093528054600f0b835260010154908201526002546001600160a01b031663dd9ec1498461230d8142612ec0565b6020850151855160405160e086901b6001600160e01b0319168152600481019490945260248401929092526044830152600f0b6064820152608401600060405180830381865afa158015612365573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112af9190810190614a27565b6000828152601560205260409020541580156123b8575060008281526016602052604090205460ff16155b6123d45760405162461bcd60e51b8152600401610f5e9061482c565b8082036123e057600080fd5b6123ea33836127b5565b6123f357600080fd5b6123fd33826127b5565b61240657600080fd5b6000828152601160208181526040808420815180830183528154600f90810b825260019283015482860190815288885295855283872084518086019095528054820b855290920154938301849052805194519095929490910b921115612470578260200151612476565b83602001515b604080518082018252600080825260208083018281528b835260118252848320935184546001600160801b0319166001600160801b03909116178455516001909301929092558251808401909352808352908201529091506124db908790869061281b565b6124e486612dff565b612259858383866004612ff3565b60075460009060ff1660011461250757600080fd5b6007805460ff1916600217905561251f848484613289565b90506007805460ff191660011790559392505050565b60006112af8383612ec0565b6000818152600c602052604081205443900361255f57506000919050565b610d218242612ec0565b60075460ff1660011461257b57600080fd5b6007805460ff1916600217905560008281526011602090815260409182902082518084019093528054600f0b83526001015490820152816125bb57600080fd5b60008160000151600f0b136125e25760405162461bcd60e51b8152600401610f5e90614963565b428160200151116126055760405162461bcd60e51b8152600401610f5e90614993565b600354600160a01b900460ff16801561263657506126216137ec565b6001600160a01b0316336001600160a01b0316145b156126745761266f838362093a80806126536303c2670042614882565b61265d919061494f565b6126679190614930565b846000612ff3565b611aa4565b611aa483836000846000612ff3565b6000546001600160a01b0316331461269a57600080fd5b6000818152601560205260409020546118fb906001614882565b6000546001600160a01b031633146126cb57600080fd5b6000908152601660205260409020805460ff19166001179055565b600082815260156020526040902054158015612711575060008281526016602052604090205460ff16155b61272d5760405162461bcd60e51b8152600401610f5e9061482c565b61273781836127b5565b61274057600080fd5b61274a84836138c5565b612754848361392c565b61276f61276085611615565b61276985611615565b846139ad565b6127798383613d0f565b6000828152600c60205260408082204390555183916001600160a01b038087169290881691600080516020614d2483398151915291a450505050565b600081815260086020908152604080832054600a8352818420546001600160a01b03918216808652600b855283862088841680885295529285205492938085149392909116149060ff1682806128085750815b806128105750805b979650505050505050565b6128236142b8565b61282b6142b8565b6012546000908190871561294e57428760200151118015612853575060008760000151600f0b135b15612898578651612869906303c2670090614a95565b600f0b60208087019190915287015161288390429061484e565b85602001516128929190614ad3565b600f0b85525b4286602001511180156128b2575060008660000151600f0b135b156128f75785516128c8906303c2670090614a95565b600f0b6020808601919091528601516128e290429061484e565b84602001516128f19190614ad3565b600f0b84525b602080880151600090815260138252604090205490870151600f9190910b93501561294e5786602001518660200151036129335782915061294e565b602080870151600090815260139091526040902054600f0b91505b6040805160808101825260008082526020820152429181019190915243606082015281156129c3575060008181526004602090815260409182902082516080810184528154600f81810b8352600160801b909104900b9281019290925260018101549282019290925260029091015460608201525b604081015181600042831015612a105760408401516129e2904261484e565b60608501516129f1904361484e565b612a0390670de0b6b3a7640000614930565b612a0d919061494f565b90505b600062093a80612a20818661494f565b612a2a9190614930565b905060005b60ff811015612ba457612a4562093a8083614882565b9150600042831115612a5957429250612a6d565b50600082815260136020526040902054600f0b5b612a77868461484e565b8760200151612a869190614ad3565b87518890612a95908390614b67565b600f0b905250602087018051829190612aaf908390614bb7565b600f90810b90915288516000910b12159050612aca57600087525b60008760200151600f0b1215612ae257600060208801525b60408088018490528501519295508592670de0b6b3a764000090612b06908561484e565b612b109086614930565b612b1a919061494f565b8560600151612b299190614882565b6060880152612b39600189614882565b9750428303612b4e5750436060870152612ba4565b6000888152600460209081526040918290208951918a01516001600160801b03908116600160801b029216919091178155908801516001820155606088015160029091015550612b9d8161489a565b9050612a2f565b505060128590558b15612c2f5788602001518860200151612bc59190614b67565b84602001818151612bd69190614bb7565b600f0b90525088518851612bea9190614b67565b84518590612bf9908390614bb7565b600f90810b90915260208601516000910b12159050612c1a57600060208501525b60008460000151600f0b1215612c2f57600084525b6000858152600460209081526040918290208651918701516001600160801b03908116600160801b02921691909117815590850151600182015560608501516002909101558b15612df157428b602001511115612ce6576020890151612c959088614bb7565b96508a602001518a6020015103612cb8576020880151612cb59088614b67565b96505b60208b810151600090815260139091526040902080546001600160801b0319166001600160801b0389161790555b428a602001511115612d41578a602001518a602001511115612d41576020880151612d119087614b67565b60208b810151600090815260139091526040902080546001600160801b0319166001600160801b03831617905595505b60008c8152600f6020526040812054612d5b906001614882565b905080600f60008f815260200190815260200160002081905550428960400181815250504389606001818152505088601060008f815260200190815260200160002082633b9aca008110612db157612db1614800565b825160208401516001600160801b03908116600160801b029116176003919091029190910190815560408201516001820155606090910151600290910155505b505050505050505050505050565b612e0933826127b5565b612e555760405162461bcd60e51b815260206004820181905260248201527f63616c6c6572206973206e6f74206f776e6572206e6f7220617070726f7665646044820152606401610f5e565b6000818152600860205260408120546001600160a01b031690612e789083610d60565b612e8c612e8482611615565b6000846139ad565b612e96818361392c565b60405182906000906001600160a01b03841690600080516020614d24833981519152908390a45050565b6000828152600f6020526040812054808203612ee0576000915050610d21565b600084815260106020526040812082633b9aca008110612f0257612f02614800565b60408051608081018252600392909202929092018054600f81810b8452600160801b909104900b602083015260018101549282018390526002015460608201529150612f4e9085614c08565b8160200151612f5d9190614ad3565b81518290612f6c908390614b67565b600f90810b90915282516000910b12159050612f8757600081525b51600f0b9150610d219050565b60006001600160a01b038316612fac57612fac614816565b612fba600061276985611615565b612fc48383613d0f565b60405182906001600160a01b03851690600090600080516020614d24833981519152908290a450600192915050565b60145482906130028682614882565b6014556040805180820190915260008082526020820152825160208085015190830152600f0b815282518790849061303b908390614bb7565b600f0b905250851561304f57602083018690525b6000888152601160209081526040909120845181546001600160801b0319166001600160801b039091161781559084015160019091015561309188828561281b565b3387158015906130b3575060048560058111156130b0576130b0614c47565b14155b80156130d1575060058560058111156130ce576130ce614c47565b14155b1561317b576040516323b872dd60e01b81526001600160a01b038281166004830152306024830152604482018a90527f000000000000000000000000f1b5e599be51bc0266abfb028a1776984d7f1bc916906323b872dd906064016020604051808303816000875af115801561314b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061316f9190614865565b61317b5761317b614816565b8360200151816001600160a01b03167fff04ccafc360e16b67d682d17bd9503c4c6b9a131f6be6325762dc9ffc7de6248b8b89426040516131bf9493929190614c5d565b60405180910390a37f5e2aa66efd74cce82b21852e317e5490d9ecc9e6bb953ae24d90851258cc2f5c836131f38a82614882565b6040805192835260208301919091520160405180910390a1505050505050505050565b600061322183611615565b6001600160a01b0384811660008181526017602052604080822080546001600160a01b031916888616908117909155905194955093928516927f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610edd838284613d8e565b60008062093a808061329b8642614882565b6132a5919061494f565b6132af9190614930565b9050600085116132be57600080fd5b4281116132dd5760405162461bcd60e51b8152600401610f5e906148b3565b6132eb6303c2670042614882565b81111561330a5760405162461bcd60e51b8152600401610f5e906148f9565b6006600081546133199061489a565b9091555060065461332a8482612f94565b5060008181526011602090815260409182902082518084019093528054600f0b83526001908101549183019190915261336891839189918691612ff3565b95945050505050565b6001600160a01b031660009081526009602052604090205490565b600080839050600062093a808083604001516133a8919061494f565b6133b29190614930565b905060005b60ff811015613465576133cd62093a8083614882565b91506000858311156133e1578592506133f5565b50600082815260136020526040902054600f0b5b6040840151613404908461484e565b84602001516134139190614ad3565b84518590613422908390614b67565b600f0b9052508583036134355750613465565b80846020018181516134479190614bb7565b600f0b905250506040830182905261345e8161489a565b90506133b7565b5060008260000151600f0b121561347b57600082525b50516001600160801b03169392505050565b60004382111561349f5761349f614816565b6000838152600f6020526040812054815b608081101561353f578183101561353f57600060026134cf8486614882565b6134da906001614882565b6134e4919061494f565b6000888152601060205260409020909150869082633b9aca00811061350b5761350b614800565b6003020160020154116135205780935061352e565b61352b60018261484e565b92505b506135388161489a565b90506134b0565b50600085815260106020526040812083633b9aca00811061356257613562614800565b60408051608081018252600392909202929092018054600f81810b8452600160801b909104900b6020830152600181015492820192909252600290910154606082015260125490915060006135b78783613766565b600081815260046020908152604080832081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060820152919250808484101561369657600060048161361b876001614882565b8152602080820192909252604090810160002081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060808301829052860151919250613678919061484e565b92508360400151816040015161368e919061484e565b9150506136ba565b60608301516136a5904361484e565b91508260400151426136b7919061484e565b90505b604083015182156136f7578284606001518c6136d6919061484e565b6136e09084614930565b6136ea919061494f565b6136f49082614882565b90505b6040870151613706908261484e565b87602001516137159190614ad3565b87518890613724908390614b67565b600f90810b90915288516000910b12905061375457505093516001600160801b03169650610d2195505050505050565b60009950505050505050505050610d21565b60008082815b60808110156137e257818310156137e2576000600261378b8486614882565b613796906001614882565b6137a0919061494f565b60008181526004602052604090206002015490915087106137c3578093506137d1565b6137ce60018261484e565b92505b506137db8161489a565b905061376c565b5090949350505050565b60008060009054906101000a90046001600160a01b03166001600160a01b031663075461726040518163ffffffff1660e01b8152600401602060405180830381865afa158015613840573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138649190614c9b565b6001600160a01b0316634b1cd5da6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156138a1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9a9190614c9b565b6000818152600860205260409020546001600160a01b038381169116146138ee576138ee614816565b6000818152600a60205260409020546001600160a01b031615613928576000818152600a6020526040902080546001600160a01b03191690555b5050565b6000818152600860205260409020546001600160a01b0383811691161461395557613955614816565b600081815260086020526040902080546001600160a01b031916905561397b828261414a565b6001600160a01b03821660009081526009602052604081208054600192906139a490849061484e565b90915550505050565b816001600160a01b0316836001600160a01b0316141580156139cf5750600081115b15610edd576001600160a01b03831615613b50576001600160a01b03831660009081526019602052604081205463ffffffff169081613a33576001600160a01b03851660009081526018602090815260408083208380529091529020600101613a75565b6001600160a01b038516600090815260186020526040812090613a576001856147a2565b63ffffffff1663ffffffff1681526020019081526020016000206001015b90506000613a82866141fb565b6001600160a01b038716600090815260186020908152604080832063ffffffff8516845290915281209192506001909101905b8354811015613b0f576000848281548110613ad257613ad2614800565b90600052602060002001549050868114613afc578254600181018455600084815260209020018190555b5080613b078161489a565b915050613ab5565b50613b1b846001614cb8565b6001600160a01b0388166000908152601960205260409020805463ffffffff191663ffffffff92909216919091179055505050505b6001600160a01b03821615610edd576001600160a01b03821660009081526019602052604081205463ffffffff169081613baf576001600160a01b03841660009081526018602090815260408083208380529091529020600101613bf1565b6001600160a01b038416600090815260186020526040812090613bd36001856147a2565b63ffffffff1663ffffffff1681526020019081526020016000206001015b90506000613bfe856141fb565b6001600160a01b038616600090815260186020908152604080832063ffffffff851684529091529020835491925060019081019161040091613c409190614882565b1115613c5e5760405162461bcd60e51b8152600401610f5e90614ce0565b60005b8354811015613cb0576000848281548110613c7e57613c7e614800565b600091825260208083209091015485546001810187558684529190922001555080613ca88161489a565b915050613c61565b50805460018181018355600083815260209020909101869055613cd4908590614cb8565b6001600160a01b0387166000908152601960205260409020805463ffffffff9290921663ffffffff1990921691909117905550505050505050565b6000818152600860205260409020546001600160a01b031615613d3457613d34614816565b600081815260086020526040902080546001600160a01b0319166001600160a01b038416179055613d658282614274565b6001600160a01b03821660009081526009602052604081208054600192906139a4908490614882565b806001600160a01b0316826001600160a01b031614610edd576001600160a01b03821615613f41576001600160a01b03821660009081526019602052604081205463ffffffff169081613e06576001600160a01b03841660009081526018602090815260408083208380529091529020600101613e48565b6001600160a01b038416600090815260186020526040812090613e2a6001856147a2565b63ffffffff1663ffffffff1681526020019081526020016000206001015b90506000613e55856141fb565b6001600160a01b038616600090815260186020908152604080832063ffffffff8516845290915281209192506001909101905b8354811015613f00576000848281548110613ea557613ea5614800565b600091825260208083209091015480835260089091526040909120549091506001600160a01b03908116908a1614613eed578254600181018455600084815260209020018190555b5080613ef88161489a565b915050613e88565b50613f0c846001614cb8565b6001600160a01b0387166000908152601960205260409020805463ffffffff191663ffffffff92909216919091179055505050505b6001600160a01b03811615610edd576001600160a01b03811660009081526019602052604081205463ffffffff169081613fa0576001600160a01b03831660009081526018602090815260408083208380529091529020600101613fe2565b6001600160a01b038316600090815260186020526040812090613fc46001856147a2565b63ffffffff1663ffffffff1681526020019081526020016000206001015b90506000613fef846141fb565b6001600160a01b03808616600090815260186020908152604080832063ffffffff861684528252808320938b1683526009909152902054845492935060019091019161040090614040908390614882565b111561405e5760405162461bcd60e51b8152600401610f5e90614ce0565b60005b84548110156140b057600085828154811061407e5761407e614800565b6000918252602080832090910154865460018101885587845291909220015550806140a88161489a565b915050614061565b5060005b81811015614102576001600160a01b0389166000908152600d6020908152604080832084845282528220548554600181018755868452919092200155806140fa8161489a565b9150506140b4565b5061410e856001614cb8565b6001600160a01b0387166000908152601960205260409020805463ffffffff9290921663ffffffff199092169190911790555050505050505050565b6000600161415784613371565b614161919061484e565b6000838152600e60205260409020549091508082036141b0576001600160a01b0384166000908152600d602090815260408083208584528252808320839055858352600e909152812055611e88565b6001600160a01b03939093166000908152600d6020908152604080832093835292815282822080548684528484208190558352600e9091528282209490945592839055908252812055565b6001600160a01b038116600090815260196020526040812054429063ffffffff16801580159061426457506001600160a01b0384166000908152601860205260408120839161424b6001856147a2565b63ffffffff168152602081019190915260400160002054145b156112af576117086001826147a2565b600061427f83613371565b6001600160a01b039093166000908152600d602090815260408083208684528252808320859055938252600e9052919091209190915550565b60405180608001604052806000600f0b81526020016000600f0b815260200160008152602001600081525090565b6001600160e01b03198116811461166057600080fd5b60006020828403121561430e57600080fd5b81356112af816142e6565b60005b8381101561433457818101518382015260200161431c565b83811115611e885750506000910152565b6000815180845261435d816020860160208601614319565b601f01601f19169290920160200192915050565b6020815260006112af6020830184614345565b6001600160a01b038116811461166057600080fd5b600080604083850312156143ac57600080fd5b82356143b781614384565b946020939093013593505050565b6000602082840312156143d757600080fd5b5035919050565b6000602082840312156143f057600080fd5b81356112af81614384565b6000806040838503121561440e57600080fd5b50508035926020909101359150565b60008060006060848603121561443257600080fd5b833561443d81614384565b9250602084013561444d81614384565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561449d5761449d61445e565b604052919050565b600080604083850312156144b857600080fd5b823567ffffffffffffffff808211156144d057600080fd5b818501915085601f8301126144e457600080fd5b81356020828211156144f8576144f861445e565b8160051b9250614509818401614474565b828152928401810192818101908985111561452357600080fd5b948201945b8486101561454157853582529482019490820190614528565b9997909101359750505050505050565b801515811461166057600080fd5b60006020828403121561457157600080fd5b81356112af81614551565b6000806040838503121561458f57600080fd5b823561459a81614384565b915060208301356145aa81614551565b809150509250929050565b600067ffffffffffffffff8211156145cf576145cf61445e565b50601f01601f191660200190565b600080600080608085870312156145f357600080fd5b84356145fe81614384565b9350602085013561460e81614384565b925060408501359150606085013567ffffffffffffffff81111561463157600080fd5b8501601f8101871361464257600080fd5b8035614655614650826145b5565b614474565b81815288602083850101111561466a57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b60008060008060008060c087890312156146a557600080fd5b86356146b081614384565b95506020870135945060408701359350606087013560ff811681146146d457600080fd5b9598949750929560808101359460a0909101359350915050565b60008060006060848603121561470357600080fd5b8335925060208401359150604084013561471c81614384565b809150509250925092565b6000806040838503121561473a57600080fd5b823561474581614384565b915060208301356145aa81614384565b6000806040838503121561476857600080fd5b823561477381614384565b9150602083013563ffffffff811681146145aa57600080fd5b634e487b7160e01b600052601160045260246000fd5b600063ffffffff838116908316818110156147bf576147bf61478c565b039392505050565b634e487b7160e01b600052601260045260246000fd5b600063ffffffff808416806147f4576147f46147c7565b92169190910492915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052600160045260246000fd5b602080825260089082015267185d1d1858da195960c21b604082015260600190565b6000828210156148605761486061478c565b500390565b60006020828403121561487757600080fd5b81516112af81614551565b600082198211156148955761489561478c565b500190565b6000600182016148ac576148ac61478c565b5060010190565b60208082526026908201527f43616e206f6e6c79206c6f636b20756e74696c2074696d6520696e207468652060408201526566757475726560d01b606082015260800190565b6020808252601e908201527f566f74696e67206c6f636b2063616e2062652032207965617273206d61780000604082015260600190565b600081600019048311821515161561494a5761494a61478c565b500290565b60008261495e5761495e6147c7565b500490565b602080825260169082015275139bc8195e1a5cdd1a5b99c81b1bd8dac8199bdd5b9960521b604082015260600190565b60208082526024908201527f43616e6e6f742061646420746f2065787069726564206c6f636b2e20576974686040820152636472617760e01b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906118bf90830184614345565b600060208284031215614a1c57600080fd5b81516112af816142e6565b600060208284031215614a3957600080fd5b815167ffffffffffffffff811115614a5057600080fd5b8201601f81018413614a6157600080fd5b8051614a6f614650826145b5565b818152856020838501011115614a8457600080fd5b613368826020830160208601614319565b600081600f0b83600f0b80614aac57614aac6147c7565b60016001607f1b0319821460001982141615614aca57614aca61478c565b90059392505050565b6000600f82810b9084900b60016001607f1b0383821384841380821684840486111615614b0257614b0261478c565b60016001607f1b03196000851282811687830587121615614b2557614b2561478c565b60008712925085820587128484161615614b4157614b4161478c565b85850587128184161615614b5757614b5761478c565b5050509290910295945050505050565b6000600f82810b9084900b828112801560016001607f1b0319830184121615614b9257614b9261478c565b60016001607f1b0382018313811615614bad57614bad61478c565b5090039392505050565b6000600f82810b9084900b828212801560016001607f1b0384900383131615614be257614be261478c565b60016001607f1b03198390038212811615614bff57614bff61478c565b50019392505050565b60008083128015600160ff1b850184121615614c2657614c2661478c565b6001600160ff1b0384018313811615614c4157614c4161478c565b50500390565b634e487b7160e01b600052602160045260246000fd5b848152602081018490526080810160068410614c8957634e487b7160e01b600052602160045260246000fd5b60408201939093526060015292915050565b600060208284031215614cad57600080fd5b81516112af81614384565b600063ffffffff808316818516808303821115614cd757614cd761478c565b01949350505050565b60208082526023908201527f64737452657020776f756c64206861766520746f6f206d616e7920746f6b656e60408201526249647360e81b60608201526080019056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220b899c7825c5b935fa08f91ecbc336057be6bb89c0b96dd0ca2ae46bfaeb98d1564736f6c634300080d0033

Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.