ETH Price: $2,938.95 (-0.67%)

Token

veCoffee (veCOFFEE)

Overview

Max Total Supply

248,968.92218156586036297 veCOFFEE

Holders

18

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Balance
0.000000000000000001 veCOFFEE
0x2c9c3050b242df683c5db26a0c5874c938e06b8f
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information

Contract Source Code Verified (Exact Match)

Contract Name:
VotingEscrow

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 10 : 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";
import {IVoter} from "./interfaces/IVoter.sol";


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

    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 `THENA` 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 = "veCoffee";
    string constant public symbol = "veCOFFEE";
    string constant public version = "1.0.0";
    uint8 constant public decimals = 18;

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

    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(!IVoter(voter).stale(_tokenId), "STALE");
        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 {
        require(!IVoter(voter).stale(_tokenId), "STALE");
        _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 WEEK = 30 minutes;

    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');
        _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(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);
    }

    /// @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 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(!IVoter(voter).stale(_from) && !IVoter(voter).stale(_to), "!ACTIVE");
        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);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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 a specific moment in the past. If the `clock()` is
     * configured to use block numbers, this will return the value at the end of the corresponding block.
     */
    function getPastVotes(address account, uint256 timepoint) external view returns (uint256);

    /**
     * @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is
     * configured to use block numbers, this will return the value at the end of the corresponding block.
     *
     * 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 timepoint) 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;
}

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 5 of 10 : 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);
}

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

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

// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

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

// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IVoter {
    function _ve() external view returns (address);
    function gauges(address _pair) external view returns (address);
    function isGauge(address _gauge) external view returns (bool);
    function poolForGauge(address _gauge) external view returns (address);
    function factory() external view returns (address);
    function minter() external view returns(address);
    function isWhitelisted(address token) external view returns (bool);
    function notifyRewardAmount(uint amount) external;
    function distributeAll() external;
    function distributeFees(address[] memory _gauges) external;

    function internal_bribes(address _gauge) external view returns (address);
    function external_bribes(address _gauge) external view returns (address);

    function usedWeights(uint id) external view returns(uint);
    function lastVoted(uint id) external view returns(uint);
    function poolVote(uint id, uint _index) external view returns(address _pair);
    function votes(uint id, address _pool) external view returns(uint votes);
    function poolVoteLength(uint tokenId) external view returns(uint);
    
    function permissionRegistry() external view returns(address);

    function stale(uint256 _tokenID) external view returns (bool);

    function partnerNFT(uint256 _tokenID) external view returns (bool);
    
}

// 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_for(uint _value, uint _lock_duration, address _to) external returns (uint);

    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 ownerOf(uint) external view returns (address);
    function isApprovedOrOwner(address, uint) external view returns (bool);
    function transferFrom(address, address, uint) 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 balanceOfNFTAt(uint _tokenId, uint _t) 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 balanceOfAtNFT(uint _tokenId, uint _block) external view returns (uint) ;

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

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

Contract Security Audit

Contract ABI

API
[{"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":[{"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":"_team","type":"address"}],"name":"setTeam","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":"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"}]

60a06040526006805460ff191660011790553480156200001e57600080fd5b5060405162005005380380620050058339810160408190526200004191620001b8565b6001600160a01b0382811660805260008054336001600160a01b031991821681178355600180548316909117815560028054909216938516939093179055437f3617319a054d772f909f7c479a2cebe5066e836a939412e32403c99029b92f0155427f3617319a054d772f909f7c479a2cebe5066e836a939412e32403c99029b92f005560046020527f9fe05126d2d9ecf60592e254dead906a4b2e492f36cca727682c38e9008c6ac1805460ff1990811684179091557f4267c0a6fd96b7a87f183ee8744f24d011423cd0e0142b3f563f183d8d9a456b8054821684179055635b5e139f60e01b82527e24030bcf4927897dffe721c2d8dda4bfd8910861687c42b03a463b43b0414780549091169092179091556005546040519091309160008051602062004fe5833981519152908290a4600554604051600090309060008051602062004fe5833981519152908390a45050620001f0565b80516001600160a01b0381168114620001b357600080fd5b919050565b60008060408385031215620001cc57600080fd5b620001d7836200019b565b9150620001e7602084016200019b565b90509250929050565b608051614dcb6200021a60003960008181610b6a01528181611060015261332b0152614dcb6000f3fe608060405234801561001057600080fd5b50600436106104125760003560e01c80637116c60c11610220578063c1f0fb9f11610130578063e7a324dc116100b8578063f1127ed811610087578063f1127ed814610b04578063f8a0576314610b2f578063fbd3a29d14610b52578063fc0c546a14610b65578063fd4a77f114610b8c57600080fd5b8063e7a324dc14610a7b578063e7e242d414610aa2578063e985e9c514610ab5578063ee99fe2814610af157600080fd5b8063d1c2babb116100ff578063d1c2babb146109e4578063d1febfb9146109f7578063d4e54c3b14610a35578063e0514aba14610a48578063e441135c14610a5b57600080fd5b8063c1f0fb9f146109a3578063c2c4c5c1146109b6578063c3cda520146109be578063c87b56dd146109d157600080fd5b806395d89b41116101b3578063a183af5211610182578063a183af521461090f578063a22cb46514610922578063a4d855df14610935578063b45a3c0e14610948578063b88d4fde1461099057600080fd5b806395d89b41146108af578063981b24d0146108d6578063986b7d8a146108e95780639ab24eb0146108fc57600080fd5b80638c2c9baf116101ef5780638c2c9baf1461085d5780638e539e8c146108705780638fbb38ff14610883578063900cf0cf146108a657600080fd5b80637116c60c146107f457806371197484146108075780637ecebe001461082a57806385f2aef21461084a57600080fd5b8063313ce5671161032657806356afe744116102ae5780636352211e1161027d5780636352211e1461075f57806365fc3873146107885780636f5488371461079b5780636fcfff45146107bb57806370a08231146107e157600080fd5b806356afe7441461071d578063587cde1e146107305780635c19a95c146107435780635f5b0c321461075657600080fd5b8063461f711c116102f5578063461f711c1461069a57806346c96aac146106c05780634bc2a657146106d357806354fd4d50146106e65780635594a0451461070a57600080fd5b8063313ce567146106475780633a46b1a81461066157806342842e0e14610674578063430c20811461068757600080fd5b80631376f3da116103a957806323b872dd1161037857806323b872dd146105d257806325a58b56146105e55780632e1a7d4d146105eb5780632e720f7d146105fe5780632f745c591461061157600080fd5b80631376f3da1461055557806318160ddd146105905780631c984bc31461059857806320606b70146105ab57600080fd5b8063081812fc116103e5578063081812fc146104cc578063095cf5c61461050d578063095ea7b3146105225780630d6a20331461053557600080fd5b806301ffc9a714610417578063047fc9aa1461045957806306fdde03146104705780630758c7d8146104a4575b600080fd5b6104446104253660046143e4565b6001600160e01b03191660009081526004602052604090205460ff1690565b60405190151581526020015b60405180910390f35b61046260135481565b604051908152602001610450565b610497604051806040016040528060088152602001677665436f6666656560c01b81525081565b6040516104509190614459565b6104b76104b2366004614488565b610b9f565b60405163ffffffff9091168152602001610450565b6104f56104da3660046144b2565b6000908152600960205260409020546001600160a01b031690565b6040516001600160a01b039091168152602001610450565b61052061051b3660046144cb565b610d12565b005b610520610530366004614488565b610d4b565b6104626105433660046144b2565b60146020526000908152604090205481565b6105686105633660046144e6565b610e33565b60408051600f95860b81529390940b6020840152928201526060810191909152608001610450565b610462610e7a565b6104626105a63660046144e6565b610e8a565b6104627f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6105206105e0366004614508565b610ebc565b43610462565b6105206105f93660046144b2565b610ecd565b61052061060c3660046144cb565b611183565b61046261061f366004614488565b6001600160a01b03919091166000908152600c60209081526040808320938352929052205490565b61064f601281565b60405160ff9091168152602001610450565b61046261066f366004614488565b6111bc565b610520610682366004614508565b61125b565b610444610695366004614488565b611276565b6106ad6106a83660046144b2565b611289565b604051600f9190910b8152602001610450565b6000546104f5906001600160a01b031681565b6105206106e13660046144cb565b6112cc565b610497604051806040016040528060058152602001640312e302e360dc1b81525081565b6002546104f5906001600160a01b031681565b61052061072b36600461458b565b611305565b6104f561073e3660046144cb565b61157a565b6105206107513660046144cb565b6115aa565b61046261040081565b6104f561076d3660046144b2565b6000908152600760205260409020546001600160a01b031690565b6104626107963660046144e6565b6115c8565b6104626107a93660046144b2565b600b6020526000908152604090205481565b6104b76107c93660046144cb565b60186020526000908152604090205463ffffffff1681565b6104626107ef3660046144cb565b61160a565b6104626108023660046144b2565b611628565b6106ad6108153660046144b2565b601260205260009081526040902054600f0b81565b6104626108383660046144cb565b60196020526000908152604090205481565b6001546104f5906001600160a01b031681565b61046261086b3660046144e6565b611688565b61046261087e3660046144b2565b611694565b6104446108913660046144b2565b60156020526000908152604090205460ff1681565b61046260115481565b610497604051806040016040528060088152602001677665434f4646454560c01b81525081565b6104626108e43660046144b2565b61169f565b6105206108f73660046144b2565b611841565b61046261090a3660046144cb565b611885565b61052061091d3660046144e6565b611958565b610520610930366004614645565b611a57565b6105206109433660046144e6565b611adb565b6109766109563660046144b2565b60106020526000908152604090208054600190910154600f9190910b9082565b60408051600f9390930b8352602083019190915201610450565b61052061099e3660046146a4565b611c90565b6105206109b13660046144b2565b611ed1565b610520611f00565b6105206109cc36600461474f565b611f40565b6104976109df3660046144b2565b6122a6565b6105206109f23660046144e6565b6123d2565b610568610a053660046144b2565b600360205260009081526040902080546001820154600290920154600f82810b93600160801b909304900b919084565b610462610a433660046147af565b612651565b610462610a563660046144e6565b612694565b610462610a693660046144b2565b600e6020526000908152604090205481565b6104627fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b610462610ab03660046144b2565b6126a0565b610444610ac33660046147e4565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205460ff1690565b610520610aff3660046144e6565b6126c8565b610462610b12366004614817565b601760209081526000928352604080842090915290825290205481565b610462610b3d3660046144b2565b60009081526010602052604090206001015490565b610520610b603660046144b2565b61279c565b6104f57f000000000000000000000000000000000000000000000000000000000000000081565b610520610b9a3660046144b2565b6127cd565b6001600160a01b03821660009081526018602052604081205463ffffffff16808203610bcf576000915050610d0c565b6001600160a01b03841660009081526017602052604081208491610bf4600185614862565b63ffffffff16815260208101919091526040016000205411610c2357610c1b600182614862565b915050610d0c565b6001600160a01b0384166000908152601760209081526040808320838052909152902054831015610c58576000915050610d0c565b600080610c66600184614862565b90505b8163ffffffff168163ffffffff161115610d075760006002610c8b8484614862565b610c95919061489d565b610c9f9083614862565b6001600160a01b038816600090815260176020908152604080832063ffffffff851684529091529020805491925090879003610ce157509350610d0c92505050565b8054871115610cf257819350610d00565b610cfd600183614862565b92505b5050610c69565b509150505b92915050565b6001546001600160a01b03163314610d2957600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600760205260409020546001600160a01b031680610d6d57600080fd5b806001600160a01b0316836001600160a01b031603610d8b57600080fd5b6000828152600760209081526040808320546001600160a01b038581168552600a845282852033808752945291909320549216149060ff168180610dcc5750805b610dd557600080fd5b60008481526009602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918716917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a45050505050565b600f60205281600052604060002081633b9aca008110610e5257600080fd5b6003020180546001820154600290920154600f82810b9550600160801b90920490910b925084565b6000610e8542611628565b905090565b6000828152600f6020526040812082633b9aca008110610eac57610eac6148c0565b6003020160010154905092915050565b610ec8838383336127ff565b505050565b60065460ff16600114610edf57600080fd5b6006805460ff19166002179055610ef63382612982565b610f0257610f026148d6565b600081815260146020526040902054158015610f2d575060008181526015602052604090205460ff16155b610f525760405162461bcd60e51b8152600401610f49906148ec565b60405180910390fd5b60008181526010602090815260409182902082518084019093528054600f0b835260010154908201819052421015610fc55760405162461bcd60e51b8152602060048201526016602482015275546865206c6f636b206469646e27742065787069726560501b6044820152606401610f49565b8051604080518082018252600080825260208083018281528783526010909152929020905181546001600160801b0319166001600160801b039091161781559051600190910155601354600f9190910b90611020828261490e565b601355604080518082019091526000808252602082015261104490859085906129e8565b60405163a9059cbb60e01b8152336004820152602481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a9059cbb906044016020604051808303816000875af11580156110b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d59190614925565b6110e1576110e16148d6565b6110ea84613004565b60408051858152602081018490524281830152905133917f02f25270a4d87bea75db541cdfe559334a275b4a233520ed6c0a2429667cca94919081900360600190a27f5e2aa66efd74cce82b21852e317e5490d9ecc9e6bb953ae24d90851258cc2f5c81611158848261490e565b6040805192835260208301919091520160405180910390a150506006805460ff191660011790555050565b6001546001600160a01b0316331461119a57600080fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000806111c98484610b9f565b6001600160a01b038516600090815260176020908152604080832063ffffffff851684529091528120919250600190910190805b825481101561125157600083828154811061121a5761121a6148c0565b9060005260206000200154905061123181886130d7565b61123b9084614942565b92505080806112499061495a565b9150506111fd565b5095945050505050565b610ec883838360405180602001604052806000815250611c90565b60006112828383612982565b9392505050565b6000818152600e6020908152604080832054600f909252822081633b9aca0081106112b6576112b66148c0565b6003020154600160801b9004600f0b9392505050565b6001546001600160a01b031633146112e357600080fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600081815260146020526040902054158015611330575060008181526015602052604090205460ff16155b61134c5760405162461bcd60e51b8152600401610f49906148ec565b6113563382612982565b61135f57600080fd5b600081815260076020908152604080832054601083529281902081518083019092528054600f0b8083526001909101549282018390526001600160a01b0390931692909190806113ae57600080fd5b806013546113bc919061490e565b6013556000805b8751821015611405578782815181106113de576113de6148c0565b6020026020010151816113f19190614942565b9050816113fd8161495a565b9250506113c3565b604080518082018252600080825260208083018281528b835260108252848320935184546001600160801b0319166001600160801b039091161784555160019093019290925582518084019093528083529082015261146790889087906129e8565b61147087613004565b834281116114905760405162461bcd60e51b8152600401610f4990614973565b61149e6303c2670042614942565b8111156114bd5760405162461bcd60e51b8152600401610f49906149b9565b60008093505b895184101561156e576005600081546114db9061495a565b9091555060055498506114ee888a6131ab565b50828a8581518110611502576115026148c0565b60200260200101518661151591906149f0565b61151f9190614a0f565b60008a81526010602090815260409182902082518084019093528054600f0b8352600101549082015290915061155c908a9083908590600561321c565b836115668161495a565b9450506114c3565b50505050505050505050565b6001600160a01b0380821660009081526016602052604081205490911680156115a35780611282565b5090919050565b6001600160a01b0381166115bb5750335b6115c5338261343f565b50565b60065460009060ff166001146115dd57600080fd5b6006805460ff191660021790556115f58383336134b2565b90506006805460ff1916600117905592915050565b6001600160a01b038116600090815260086020526040812054610d0c565b601154600081815260036020908152604080832081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060820152909190611680818561359a565b949350505050565b6000611282838361369b565b6000610d0c82611628565b6000438211156116b1576116b16148d6565b60115460006116c08483613974565b600081815260036020908152604080832081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060820152919250838310156117cf576000600381611723866001614942565b8152602080820192909252604090810160002081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060808301829052850151919250146117c9578260600151816060015161178f919061490e565b836040015182604001516117a3919061490e565b60608501516117b2908a61490e565b6117bc91906149f0565b6117c69190614a0f565b91505b5061181e565b4382606001511461181e5760608201516117e9904361490e565b60408301516117f8904261490e565b6060840151611807908961490e565b61181191906149f0565b61181b9190614a0f565b90505b611837828284604001516118329190614942565b61359a565b9695505050505050565b6000546001600160a01b0316331461185857600080fd5b6000818152601460205260409020546118739060019061490e565b60009182526014602052604090912055565b6001600160a01b03811660009081526018602052604081205463ffffffff168082036118b45750600092915050565b6001600160a01b0383166000908152601760205260408120816118d8600185614862565b63ffffffff1663ffffffff16815260200190815260200160002060010190506000805b825481101561194f576000838281548110611918576119186148c0565b9060005260206000200154905061192f81426130d7565b6119399084614942565b92505080806119479061495a565b9150506118fb565b50949350505050565b60065460ff1660011461196a57600080fd5b6006805460ff191660021790556119813383612982565b61198d5761198d6148d6565b60008281526010602090815260409182902082518084019093528054600f0b83526001015490820152816119c3576119c36148d6565b60008160000151600f0b13611a135760405162461bcd60e51b8152602060048201526016602482015275139bc8195e1a5cdd1a5b99c81b1bd8dac8199bdd5b9960521b6044820152606401610f49565b42816020015111611a365760405162461bcd60e51b8152600401610f4990614a23565b611a458383600084600261321c565b50506006805460ff1916600117905550565b336001600160a01b03831603611a6f57611a6f6148d6565b336000818152600a602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60065460ff16600114611aed57600080fd5b6006805460ff19166002179055611b043383612982565b611b1057611b106148d6565b600082815260106020908152604080832081518083019092528054600f0b825260010154918101919091529062093a8080611b4b8542614942565b611b559190614a0f565b611b5f91906149f0565b905042826020015111611ba35760405162461bcd60e51b815260206004820152600c60248201526b131bd8dac8195e1c1a5c995960a21b6044820152606401610f49565b60008260000151600f0b13611bee5760405162461bcd60e51b8152602060048201526011602482015270139bdd1a1a5b99c81a5cc81b1bd8dad959607a1b6044820152606401610f49565b81602001518111611c415760405162461bcd60e51b815260206004820152601f60248201527f43616e206f6e6c7920696e637265617365206c6f636b206475726174696f6e006044820152606401610f49565b611c4f6303c2670042614942565b811115611c6e5760405162461bcd60e51b8152600401610f49906149b9565b611c7d8460008385600361321c565b50506006805460ff191660011790555050565b600054604051635b2fa89360e11b8152600481018490526001600160a01b039091169063b65f512690602401602060405180830381865afa158015611cd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cfd9190614925565b15611d325760405162461bcd60e51b81526020600482015260056024820152645354414c4560d81b6044820152606401610f49565b611d3e848484336127ff565b823b15611ecb57604051630a85bd0160e11b81526001600160a01b0384169063150b7a0290611d77903390889087908790600401614a67565b6020604051808303816000875af1925050508015611db2575060408051601f3d908101601f19168201909252611daf91810190614a9a565b60015b611e5a573d808015611de0576040519150601f19603f3d011682016040523d82523d6000602084013e611de5565b606091505b508051600003611e525760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6064820152608401610f49565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b14611ec95760405162461bcd60e51b815260206004820152602660248201527f4552433732313a2045524337323152656365697665722072656a656374656420604482015265746f6b656e7360d01b6064820152608401610f49565b505b50505050565b6000546001600160a01b03163314611ee857600080fd5b6000908152601560205260409020805460ff19169055565b611f3e600060405180604001604052806000600f0b8152602001600081525060405180604001604052806000600f0b815260200160008152506129e8565b565b336001600160a01b03871603611f5557600080fd5b6001600160a01b038616611f6857600080fd5b60408051808201825260088152677665436f6666656560c01b6020918201528151808301835260058152640312e302e360dc1b9082015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527f3fb3334800bcdbf350214d4c4409875da341deace8f6683838dfdaaef1849586818401527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c60608201524660808201523060a0808301919091528351808303909101815260c0820184528051908301207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60e08301526001600160a01b038a1661010083015261012082018990526101408083018990528451808403909101815261016083019094528351939092019290922061190160f01b61018084015261018283018290526101a2830181905290916000906101c20160408051601f198184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa15801561212a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166121a45760405162461bcd60e51b815260206004820152602e60248201527f566f74696e67457363726f773a3a64656c656761746542795369673a20696e7660448201526d616c6964207369676e617475726560901b6064820152608401610f49565b6001600160a01b03811660009081526019602052604081208054916121c88361495a565b91905055891461222d5760405162461bcd60e51b815260206004820152602a60248201527f566f74696e67457363726f773a3a64656c656761746542795369673a20696e76604482015269616c6964206e6f6e636560b01b6064820152608401610f49565b874211156122945760405162461bcd60e51b815260206004820152602e60248201527f566f74696e67457363726f773a3a64656c656761746542795369673a2073696760448201526d1b985d1d5c9948195e1c1a5c995960921b6064820152608401610f49565b61156e818b61343f565b505050505050565b6000818152600760205260409020546060906001600160a01b031661230d5760405162461bcd60e51b815260206004820152601b60248201527f517565727920666f72206e6f6e6578697374656e7420746f6b656e00000000006044820152606401610f49565b60008281526010602090815260409182902082518084019093528054600f0b835260010154908201526002546001600160a01b031663dd9ec1498461235281426130d7565b6020850151855160405160e086901b6001600160e01b0319168152600481019490945260248401929092526044830152600f0b6064820152608401600060405180830381865afa1580156123aa573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112829190810190614ab7565b600054604051635b2fa89360e11b8152600481018490526001600160a01b039091169063b65f512690602401602060405180830381865afa15801561241b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061243f9190614925565b1580156124b65750600054604051635b2fa89360e11b8152600481018390526001600160a01b039091169063b65f512690602401602060405180830381865afa158015612490573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124b49190614925565b155b6124ec5760405162461bcd60e51b81526020600482015260076024820152662141435449564560c81b6044820152606401610f49565b600082815260146020526040902054158015612517575060008281526015602052604090205460ff16155b6125335760405162461bcd60e51b8152600401610f49906148ec565b80820361253f57600080fd5b6125493383612982565b61255257600080fd5b61255c3382612982565b61256557600080fd5b6000828152601060208181526040808420815180830183528154600f90810b825260019283015482860190815288885295855283872084518086019095528054820b855290920154938301849052805194519095929490910b9211156125cf5782602001516125d5565b83602001515b604080518082018252600080825260208083018281528b835260108252848320935184546001600160801b0319166001600160801b039091161784555160019093019290925582518084019093528083529082015290915061263a90879086906129e8565b61264386613004565b61229e85838386600461321c565b60065460009060ff1660011461266657600080fd5b6006805460ff1916600217905561267e8484846134b2565b90506006805460ff191660011790559392505050565b600061128283836130d7565b6000818152600b60205260408120544390036126be57506000919050565b610d0c82426130d7565b60065460ff166001146126da57600080fd5b6006805460ff1916600217905560008281526010602090815260409182902082518084019093528054600f0b835260010154908201528161271a57600080fd5b60008160000151600f0b1361276a5760405162461bcd60e51b8152602060048201526016602482015275139bc8195e1a5cdd1a5b99c81b1bd8dac8199bdd5b9960521b6044820152606401610f49565b4281602001511161278d5760405162461bcd60e51b8152600401610f4990614a23565b611a458383600084600061321c565b6000546001600160a01b031633146127b357600080fd5b600081815260146020526040902054611873906001614942565b6000546001600160a01b031633146127e457600080fd5b6000908152601560205260409020805460ff19166001179055565b600054604051635b2fa89360e11b8152600481018490526001600160a01b039091169063b65f512690602401602060405180830381865afa158015612848573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061286c9190614925565b156128a15760405162461bcd60e51b81526020600482015260056024820152645354414c4560d81b6044820152606401610f49565b6000828152601460205260409020541580156128cc575060008281526015602052604090205460ff16155b6128e85760405162461bcd60e51b8152600401610f49906148ec565b6128f28183612982565b6128fb57600080fd5b61290584836139fa565b61290f8483613a61565b61292a61291b8561157a565b6129248561157a565b84613ae2565b6129348383613e44565b6000828152600b60205260408082204390555183916001600160a01b0380871692908816917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a450505050565b60008181526007602090815260408083205460098352818420546001600160a01b03918216808652600a855283862088841680885295529285205492938085149392909116149060ff1682806129d55750815b806129dd5750805b979650505050505050565b60408051608081018252600080825260208201819052918101829052606081019190915260408051608081018252600080825260208201819052918101829052606081019190915260115460009081908715612b5357428760200151118015612a58575060008760000151600f0b135b15612a9d578651612a6e906303c2670090614b25565b600f0b602080870191909152870151612a8890429061490e565b8560200151612a979190614b63565b600f0b85525b428660200151118015612ab7575060008660000151600f0b135b15612afc578551612acd906303c2670090614b25565b600f0b602080860191909152860151612ae790429061490e565b8460200151612af69190614b63565b600f0b84525b602080880151600090815260128252604090205490870151600f9190910b935015612b53578660200151866020015103612b3857829150612b53565b602080870151600090815260129091526040902054600f0b91505b604080516080810182526000808252602082015242918101919091524360608201528115612bc8575060008181526003602090815260409182902082516080810184528154600f81810b8352600160801b909104900b9281019290925260018101549282019290925260029091015460608201525b604081015181600042831015612c15576040840151612be7904261490e565b6060850151612bf6904361490e565b612c0890670de0b6b3a76400006149f0565b612c129190614a0f565b90505b600062093a80612c258186614a0f565b612c2f91906149f0565b905060005b60ff811015612da957612c4a62093a8083614942565b9150600042831115612c5e57429250612c72565b50600082815260126020526040902054600f0b5b612c7c868461490e565b8760200151612c8b9190614b63565b87518890612c9a908390614bf8565b600f0b905250602087018051829190612cb4908390614c48565b600f90810b90915288516000910b12159050612ccf57600087525b60008760200151600f0b1215612ce757600060208801525b60408088018490528501519295508592670de0b6b3a764000090612d0b908561490e565b612d1590866149f0565b612d1f9190614a0f565b8560600151612d2e9190614942565b6060880152612d3e600189614942565b9750428303612d535750436060870152612da9565b6000888152600360209081526040918290208951918a01516001600160801b03908116600160801b029216919091178155908801516001820155606088015160029091015550612da28161495a565b9050612c34565b505060118590558b15612e345788602001518860200151612dca9190614bf8565b84602001818151612ddb9190614c48565b600f0b90525088518851612def9190614bf8565b84518590612dfe908390614c48565b600f90810b90915260208601516000910b12159050612e1f57600060208501525b60008460000151600f0b1215612e3457600084525b6000858152600360209081526040918290208651918701516001600160801b03908116600160801b02921691909117815590850151600182015560608501516002909101558b15612ff657428b602001511115612eeb576020890151612e9a9088614c48565b96508a602001518a6020015103612ebd576020880151612eba9088614bf8565b96505b60208b810151600090815260129091526040902080546001600160801b0319166001600160801b0389161790555b428a602001511115612f46578a602001518a602001511115612f46576020880151612f169087614bf8565b60208b810151600090815260129091526040902080546001600160801b0319166001600160801b03831617905595505b60008c8152600e6020526040812054612f60906001614942565b905080600e60008f815260200190815260200160002081905550428960400181815250504389606001818152505088600f60008f815260200190815260200160002082633b9aca008110612fb657612fb66148c0565b825160208401516001600160801b03908116600160801b029116176003919091029190910190815560408201516001820155606090910151600290910155505b505050505050505050505050565b61300e3382612982565b61305a5760405162461bcd60e51b815260206004820181905260248201527f63616c6c6572206973206e6f74206f776e6572206e6f7220617070726f7665646044820152606401610f49565b6000818152600760205260408120546001600160a01b03169061307d9083610d4b565b6130916130898261157a565b600084613ae2565b61309b8183613a61565b60405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000828152600e60205260408120548082036130f7576000915050610d0c565b6000848152600f6020526040812082633b9aca008110613119576131196148c0565b60408051608081018252600392909202929092018054600f81810b8452600160801b909104900b6020830152600181015492820183905260020154606082015291506131659085614c97565b81602001516131749190614b63565b81518290613183908390614bf8565b600f90810b90915282516000910b1215905061319e57600081525b51600f0b9150610d0c9050565b60006001600160a01b0383166131c3576131c36148d6565b6131d160006129248561157a565b6131db8383613e44565b60405182906001600160a01b038516906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a450600192915050565b601354829061322b8682614942565b6013556040805180820190915260008082526020820152825160208085015190830152600f0b8152825187908490613264908390614c48565b600f0b905250851561327857602083018690525b6000888152601060209081526040909120845181546001600160801b0319166001600160801b03909116178155908401516001909101556132ba8882856129e8565b3387158015906132dc575060048560058111156132d9576132d9614cd6565b14155b80156132fa575060058560058111156132f7576132f7614cd6565b14155b156133a4576040516323b872dd60e01b81526001600160a01b038281166004830152306024830152604482018a90527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906064016020604051808303816000875af1158015613374573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133989190614925565b6133a4576133a46148d6565b8360200151816001600160a01b03167fff04ccafc360e16b67d682d17bd9503c4c6b9a131f6be6325762dc9ffc7de6248b8b89426040516133e89493929190614cec565b60405180910390a37f5e2aa66efd74cce82b21852e317e5490d9ecc9e6bb953ae24d90851258cc2f5c8361341c8a82614942565b6040805192835260208301919091520160405180910390a1505050505050505050565b600061344a8361157a565b6001600160a01b0384811660008181526016602052604080822080546001600160a01b031916888616908117909155905194955093928516927f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610ec8838284613eda565b60008062093a80806134c48642614942565b6134ce9190614a0f565b6134d891906149f0565b9050600085116134e757600080fd5b4281116135065760405162461bcd60e51b8152600401610f4990614973565b6135146303c2670042614942565b8111156135335760405162461bcd60e51b8152600401610f49906149b9565b6005600081546135429061495a565b9091555060055461355384826131ab565b5060008181526010602090815260409182902082518084019093528054600f0b8352600190810154918301919091526135919183918991869161321c565b95945050505050565b600080839050600062093a808083604001516135b69190614a0f565b6135c091906149f0565b905060005b60ff811015613673576135db62093a8083614942565b91506000858311156135ef57859250613603565b50600082815260126020526040902054600f0b5b6040840151613612908461490e565b84602001516136219190614b63565b84518590613630908390614bf8565b600f0b9052508583036136435750613673565b80846020018181516136559190614c48565b600f0b905250506040830182905261366c8161495a565b90506135c5565b5060008260000151600f0b121561368957600082525b50516001600160801b03169392505050565b6000438211156136ad576136ad6148d6565b6000838152600e6020526040812054815b608081101561374d578183101561374d57600060026136dd8486614942565b6136e8906001614942565b6136f29190614a0f565b6000888152600f60205260409020909150869082633b9aca008110613719576137196148c0565b60030201600201541161372e5780935061373c565b61373960018261490e565b92505b506137468161495a565b90506136be565b506000858152600f6020526040812083633b9aca008110613770576137706148c0565b60408051608081018252600392909202929092018054600f81810b8452600160801b909104900b6020830152600181015492820192909252600290910154606082015260115490915060006137c58783613974565b600081815260036020908152604080832081516080810183528154600f81810b8352600160801b909104900b9381019390935260018101549183019190915260020154606082015291925080848410156138a4576000600381613829876001614942565b8152602080820192909252604090810160002081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060808301829052860151919250613886919061490e565b92508360400151816040015161389c919061490e565b9150506138c8565b60608301516138b3904361490e565b91508260400151426138c5919061490e565b90505b60408301518215613905578284606001518c6138e4919061490e565b6138ee90846149f0565b6138f89190614a0f565b6139029082614942565b90505b6040870151613914908261490e565b87602001516139239190614b63565b87518890613932908390614bf8565b600f90810b90915288516000910b12905061396257505093516001600160801b03169650610d0c95505050505050565b60009950505050505050505050610d0c565b60008082815b60808110156139f057818310156139f057600060026139998486614942565b6139a4906001614942565b6139ae9190614a0f565b60008181526003602052604090206002015490915087106139d1578093506139df565b6139dc60018261490e565b92505b506139e98161495a565b905061397a565b5090949350505050565b6000818152600760205260409020546001600160a01b03838116911614613a2357613a236148d6565b6000818152600960205260409020546001600160a01b031615613a5d57600081815260096020526040902080546001600160a01b03191690555b5050565b6000818152600760205260409020546001600160a01b03838116911614613a8a57613a8a6148d6565b600081815260076020526040902080546001600160a01b0319169055613ab08282614296565b6001600160a01b0382166000908152600860205260408120805460019290613ad990849061490e565b90915550505050565b816001600160a01b0316836001600160a01b031614158015613b045750600081115b15610ec8576001600160a01b03831615613c85576001600160a01b03831660009081526018602052604081205463ffffffff169081613b68576001600160a01b03851660009081526017602090815260408083208380529091529020600101613baa565b6001600160a01b038516600090815260176020526040812090613b8c600185614862565b63ffffffff1663ffffffff1681526020019081526020016000206001015b90506000613bb786614355565b6001600160a01b038716600090815260176020908152604080832063ffffffff8516845290915281209192506001909101905b8354811015613c44576000848281548110613c0757613c076148c0565b90600052602060002001549050868114613c31578254600181018455600084815260209020018190555b5080613c3c8161495a565b915050613bea565b50613c50846001614d2a565b6001600160a01b0388166000908152601860205260409020805463ffffffff191663ffffffff92909216919091179055505050505b6001600160a01b03821615610ec8576001600160a01b03821660009081526018602052604081205463ffffffff169081613ce4576001600160a01b03841660009081526017602090815260408083208380529091529020600101613d26565b6001600160a01b038416600090815260176020526040812090613d08600185614862565b63ffffffff1663ffffffff1681526020019081526020016000206001015b90506000613d3385614355565b6001600160a01b038616600090815260176020908152604080832063ffffffff851684529091529020835491925060019081019161040091613d759190614942565b1115613d935760405162461bcd60e51b8152600401610f4990614d52565b60005b8354811015613de5576000848281548110613db357613db36148c0565b600091825260208083209091015485546001810187558684529190922001555080613ddd8161495a565b915050613d96565b50805460018181018355600083815260209020909101869055613e09908590614d2a565b6001600160a01b0387166000908152601860205260409020805463ffffffff9290921663ffffffff1990921691909117905550505050505050565b6000818152600760205260409020546001600160a01b031615613e6957613e696148d6565b600081815260076020908152604080832080546001600160a01b0319166001600160a01b03871690811790915580845260088084528285208054600c86528487208188528652848720889055878752600d865293862093909355908452909152805460019290613ad9908490614942565b806001600160a01b0316826001600160a01b031614610ec8576001600160a01b0382161561408d576001600160a01b03821660009081526018602052604081205463ffffffff169081613f52576001600160a01b03841660009081526017602090815260408083208380529091529020600101613f94565b6001600160a01b038416600090815260176020526040812090613f76600185614862565b63ffffffff1663ffffffff1681526020019081526020016000206001015b90506000613fa185614355565b6001600160a01b038616600090815260176020908152604080832063ffffffff8516845290915281209192506001909101905b835481101561404c576000848281548110613ff157613ff16148c0565b600091825260208083209091015480835260079091526040909120549091506001600160a01b03908116908a1614614039578254600181018455600084815260209020018190555b50806140448161495a565b915050613fd4565b50614058846001614d2a565b6001600160a01b0387166000908152601860205260409020805463ffffffff191663ffffffff92909216919091179055505050505b6001600160a01b03811615610ec8576001600160a01b03811660009081526018602052604081205463ffffffff1690816140ec576001600160a01b0383166000908152601760209081526040808320838052909152902060010161412e565b6001600160a01b038316600090815260176020526040812090614110600185614862565b63ffffffff1663ffffffff1681526020019081526020016000206001015b9050600061413b84614355565b6001600160a01b03808616600090815260176020908152604080832063ffffffff861684528252808320938b168352600890915290205484549293506001909101916104009061418c908390614942565b11156141aa5760405162461bcd60e51b8152600401610f4990614d52565b60005b84548110156141fc5760008582815481106141ca576141ca6148c0565b6000918252602080832090910154865460018101885587845291909220015550806141f48161495a565b9150506141ad565b5060005b8181101561424e576001600160a01b0389166000908152600c6020908152604080832084845282528220548554600181018755868452919092200155806142468161495a565b915050614200565b5061425a856001614d2a565b6001600160a01b0387166000908152601860205260409020805463ffffffff9290921663ffffffff199092169190911790555050505050505050565b6001600160a01b0382166000908152600860205260408120546142bb9060019061490e565b6000838152600d602052604090205490915080820361430a576001600160a01b0384166000908152600c602090815260408083208584528252808320839055858352600d909152812055611ecb565b6001600160a01b03939093166000908152600c6020908152604080832093835292815282822080548684528484208190558352600d9091528282209490945592839055908252812055565b6001600160a01b038116600090815260186020526040812054429063ffffffff1680158015906143be57506001600160a01b038416600090815260176020526040812083916143a5600185614862565b63ffffffff168152602081019190915260400160002054145b1561128257611680600182614862565b6001600160e01b0319811681146115c557600080fd5b6000602082840312156143f657600080fd5b8135611282816143ce565b60005b8381101561441c578181015183820152602001614404565b83811115611ecb5750506000910152565b60008151808452614445816020860160208601614401565b601f01601f19169290920160200192915050565b602081526000611282602083018461442d565b80356001600160a01b038116811461448357600080fd5b919050565b6000806040838503121561449b57600080fd5b6144a48361446c565b946020939093013593505050565b6000602082840312156144c457600080fd5b5035919050565b6000602082840312156144dd57600080fd5b6112828261446c565b600080604083850312156144f957600080fd5b50508035926020909101359150565b60008060006060848603121561451d57600080fd5b6145268461446c565b92506145346020850161446c565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561458357614583614544565b604052919050565b6000806040838503121561459e57600080fd5b823567ffffffffffffffff808211156145b657600080fd5b818501915085601f8301126145ca57600080fd5b81356020828211156145de576145de614544565b8160051b92506145ef81840161455a565b828152928401810192818101908985111561460957600080fd5b948201945b848610156146275785358252948201949082019061460e565b9997909101359750505050505050565b80151581146115c557600080fd5b6000806040838503121561465857600080fd5b6146618361446c565b9150602083013561467181614637565b809150509250929050565b600067ffffffffffffffff82111561469657614696614544565b50601f01601f191660200190565b600080600080608085870312156146ba57600080fd5b6146c38561446c565b93506146d16020860161446c565b925060408501359150606085013567ffffffffffffffff8111156146f457600080fd5b8501601f8101871361470557600080fd5b80356147186147138261467c565b61455a565b81815288602083850101111561472d57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b60008060008060008060c0878903121561476857600080fd5b6147718761446c565b95506020870135945060408701359350606087013560ff8116811461479557600080fd5b9598949750929560808101359460a0909101359350915050565b6000806000606084860312156147c457600080fd5b83359250602084013591506147db6040850161446c565b90509250925092565b600080604083850312156147f757600080fd5b6148008361446c565b915061480e6020840161446c565b90509250929050565b6000806040838503121561482a57600080fd5b6148338361446c565b9150602083013563ffffffff8116811461467157600080fd5b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8381169083168181101561487f5761487f61484c565b039392505050565b634e487b7160e01b600052601260045260246000fd5b600063ffffffff808416806148b4576148b4614887565b92169190910492915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052600160045260246000fd5b602080825260089082015267185d1d1858da195960c21b604082015260600190565b6000828210156149205761492061484c565b500390565b60006020828403121561493757600080fd5b815161128281614637565b600082198211156149555761495561484c565b500190565b60006001820161496c5761496c61484c565b5060010190565b60208082526026908201527f43616e206f6e6c79206c6f636b20756e74696c2074696d6520696e207468652060408201526566757475726560d01b606082015260800190565b6020808252601e908201527f566f74696e67206c6f636b2063616e2062652032207965617273206d61780000604082015260600190565b6000816000190483118215151615614a0a57614a0a61484c565b500290565b600082614a1e57614a1e614887565b500490565b60208082526024908201527f43616e6e6f742061646420746f2065787069726564206c6f636b2e20576974686040820152636472617760e01b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906118379083018461442d565b600060208284031215614aac57600080fd5b8151611282816143ce565b600060208284031215614ac957600080fd5b815167ffffffffffffffff811115614ae057600080fd5b8201601f81018413614af157600080fd5b8051614aff6147138261467c565b818152856020838501011115614b1457600080fd5b613591826020830160208601614401565b600081600f0b83600f0b80614b3c57614b3c614887565b60016001607f1b0319821460001982141615614b5a57614b5a61484c565b90059392505050565b600081600f0b83600f0b60016001607f1b03600082136000841383830485118282161615614b9357614b9361484c565b60016001607f1b03196000851282811687830587121615614bb657614bb661484c565b60008712925085820587128484161615614bd257614bd261484c565b85850587128184161615614be857614be861484c565b5050509290910295945050505050565b600081600f0b83600f0b600081128160016001607f1b031901831281151615614c2357614c2361484c565b8160016001607f1b03018313811615614c3e57614c3e61484c565b5090039392505050565b600081600f0b83600f0b600082128260016001607f1b0303821381151615614c7257614c7261484c565b8260016001607f1b0319038212811615614c8e57614c8e61484c565b50019392505050565b60008083128015600160ff1b850184121615614cb557614cb561484c565b6001600160ff1b0384018313811615614cd057614cd061484c565b50500390565b634e487b7160e01b600052602160045260246000fd5b848152602081018490526080810160068410614d1857634e487b7160e01b600052602160045260246000fd5b60408201939093526060015292915050565b600063ffffffff808316818516808303821115614d4957614d4961484c565b01949350505050565b60208082526023908201527f64737452657020776f756c64206861766520746f6f206d616e7920746f6b656e60408201526249647360e81b60608201526080019056fea2646970667358221220dac93b34ac7e133b524143063b307177341a39b88b2585c9edc9d61337f07f1264736f6c634300080d0033ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef0000000000000000000000003fd9c3d2fa427993033eeb163df7e98a22f5a255000000000000000000000000dd457ea9faf3e43c36b6b7335878cb462fe69e9a

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106104125760003560e01c80637116c60c11610220578063c1f0fb9f11610130578063e7a324dc116100b8578063f1127ed811610087578063f1127ed814610b04578063f8a0576314610b2f578063fbd3a29d14610b52578063fc0c546a14610b65578063fd4a77f114610b8c57600080fd5b8063e7a324dc14610a7b578063e7e242d414610aa2578063e985e9c514610ab5578063ee99fe2814610af157600080fd5b8063d1c2babb116100ff578063d1c2babb146109e4578063d1febfb9146109f7578063d4e54c3b14610a35578063e0514aba14610a48578063e441135c14610a5b57600080fd5b8063c1f0fb9f146109a3578063c2c4c5c1146109b6578063c3cda520146109be578063c87b56dd146109d157600080fd5b806395d89b41116101b3578063a183af5211610182578063a183af521461090f578063a22cb46514610922578063a4d855df14610935578063b45a3c0e14610948578063b88d4fde1461099057600080fd5b806395d89b41146108af578063981b24d0146108d6578063986b7d8a146108e95780639ab24eb0146108fc57600080fd5b80638c2c9baf116101ef5780638c2c9baf1461085d5780638e539e8c146108705780638fbb38ff14610883578063900cf0cf146108a657600080fd5b80637116c60c146107f457806371197484146108075780637ecebe001461082a57806385f2aef21461084a57600080fd5b8063313ce5671161032657806356afe744116102ae5780636352211e1161027d5780636352211e1461075f57806365fc3873146107885780636f5488371461079b5780636fcfff45146107bb57806370a08231146107e157600080fd5b806356afe7441461071d578063587cde1e146107305780635c19a95c146107435780635f5b0c321461075657600080fd5b8063461f711c116102f5578063461f711c1461069a57806346c96aac146106c05780634bc2a657146106d357806354fd4d50146106e65780635594a0451461070a57600080fd5b8063313ce567146106475780633a46b1a81461066157806342842e0e14610674578063430c20811461068757600080fd5b80631376f3da116103a957806323b872dd1161037857806323b872dd146105d257806325a58b56146105e55780632e1a7d4d146105eb5780632e720f7d146105fe5780632f745c591461061157600080fd5b80631376f3da1461055557806318160ddd146105905780631c984bc31461059857806320606b70146105ab57600080fd5b8063081812fc116103e5578063081812fc146104cc578063095cf5c61461050d578063095ea7b3146105225780630d6a20331461053557600080fd5b806301ffc9a714610417578063047fc9aa1461045957806306fdde03146104705780630758c7d8146104a4575b600080fd5b6104446104253660046143e4565b6001600160e01b03191660009081526004602052604090205460ff1690565b60405190151581526020015b60405180910390f35b61046260135481565b604051908152602001610450565b610497604051806040016040528060088152602001677665436f6666656560c01b81525081565b6040516104509190614459565b6104b76104b2366004614488565b610b9f565b60405163ffffffff9091168152602001610450565b6104f56104da3660046144b2565b6000908152600960205260409020546001600160a01b031690565b6040516001600160a01b039091168152602001610450565b61052061051b3660046144cb565b610d12565b005b610520610530366004614488565b610d4b565b6104626105433660046144b2565b60146020526000908152604090205481565b6105686105633660046144e6565b610e33565b60408051600f95860b81529390940b6020840152928201526060810191909152608001610450565b610462610e7a565b6104626105a63660046144e6565b610e8a565b6104627f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6105206105e0366004614508565b610ebc565b43610462565b6105206105f93660046144b2565b610ecd565b61052061060c3660046144cb565b611183565b61046261061f366004614488565b6001600160a01b03919091166000908152600c60209081526040808320938352929052205490565b61064f601281565b60405160ff9091168152602001610450565b61046261066f366004614488565b6111bc565b610520610682366004614508565b61125b565b610444610695366004614488565b611276565b6106ad6106a83660046144b2565b611289565b604051600f9190910b8152602001610450565b6000546104f5906001600160a01b031681565b6105206106e13660046144cb565b6112cc565b610497604051806040016040528060058152602001640312e302e360dc1b81525081565b6002546104f5906001600160a01b031681565b61052061072b36600461458b565b611305565b6104f561073e3660046144cb565b61157a565b6105206107513660046144cb565b6115aa565b61046261040081565b6104f561076d3660046144b2565b6000908152600760205260409020546001600160a01b031690565b6104626107963660046144e6565b6115c8565b6104626107a93660046144b2565b600b6020526000908152604090205481565b6104b76107c93660046144cb565b60186020526000908152604090205463ffffffff1681565b6104626107ef3660046144cb565b61160a565b6104626108023660046144b2565b611628565b6106ad6108153660046144b2565b601260205260009081526040902054600f0b81565b6104626108383660046144cb565b60196020526000908152604090205481565b6001546104f5906001600160a01b031681565b61046261086b3660046144e6565b611688565b61046261087e3660046144b2565b611694565b6104446108913660046144b2565b60156020526000908152604090205460ff1681565b61046260115481565b610497604051806040016040528060088152602001677665434f4646454560c01b81525081565b6104626108e43660046144b2565b61169f565b6105206108f73660046144b2565b611841565b61046261090a3660046144cb565b611885565b61052061091d3660046144e6565b611958565b610520610930366004614645565b611a57565b6105206109433660046144e6565b611adb565b6109766109563660046144b2565b60106020526000908152604090208054600190910154600f9190910b9082565b60408051600f9390930b8352602083019190915201610450565b61052061099e3660046146a4565b611c90565b6105206109b13660046144b2565b611ed1565b610520611f00565b6105206109cc36600461474f565b611f40565b6104976109df3660046144b2565b6122a6565b6105206109f23660046144e6565b6123d2565b610568610a053660046144b2565b600360205260009081526040902080546001820154600290920154600f82810b93600160801b909304900b919084565b610462610a433660046147af565b612651565b610462610a563660046144e6565b612694565b610462610a693660046144b2565b600e6020526000908152604090205481565b6104627fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b610462610ab03660046144b2565b6126a0565b610444610ac33660046147e4565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205460ff1690565b610520610aff3660046144e6565b6126c8565b610462610b12366004614817565b601760209081526000928352604080842090915290825290205481565b610462610b3d3660046144b2565b60009081526010602052604090206001015490565b610520610b603660046144b2565b61279c565b6104f57f0000000000000000000000003fd9c3d2fa427993033eeb163df7e98a22f5a25581565b610520610b9a3660046144b2565b6127cd565b6001600160a01b03821660009081526018602052604081205463ffffffff16808203610bcf576000915050610d0c565b6001600160a01b03841660009081526017602052604081208491610bf4600185614862565b63ffffffff16815260208101919091526040016000205411610c2357610c1b600182614862565b915050610d0c565b6001600160a01b0384166000908152601760209081526040808320838052909152902054831015610c58576000915050610d0c565b600080610c66600184614862565b90505b8163ffffffff168163ffffffff161115610d075760006002610c8b8484614862565b610c95919061489d565b610c9f9083614862565b6001600160a01b038816600090815260176020908152604080832063ffffffff851684529091529020805491925090879003610ce157509350610d0c92505050565b8054871115610cf257819350610d00565b610cfd600183614862565b92505b5050610c69565b509150505b92915050565b6001546001600160a01b03163314610d2957600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600760205260409020546001600160a01b031680610d6d57600080fd5b806001600160a01b0316836001600160a01b031603610d8b57600080fd5b6000828152600760209081526040808320546001600160a01b038581168552600a845282852033808752945291909320549216149060ff168180610dcc5750805b610dd557600080fd5b60008481526009602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918716917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a45050505050565b600f60205281600052604060002081633b9aca008110610e5257600080fd5b6003020180546001820154600290920154600f82810b9550600160801b90920490910b925084565b6000610e8542611628565b905090565b6000828152600f6020526040812082633b9aca008110610eac57610eac6148c0565b6003020160010154905092915050565b610ec8838383336127ff565b505050565b60065460ff16600114610edf57600080fd5b6006805460ff19166002179055610ef63382612982565b610f0257610f026148d6565b600081815260146020526040902054158015610f2d575060008181526015602052604090205460ff16155b610f525760405162461bcd60e51b8152600401610f49906148ec565b60405180910390fd5b60008181526010602090815260409182902082518084019093528054600f0b835260010154908201819052421015610fc55760405162461bcd60e51b8152602060048201526016602482015275546865206c6f636b206469646e27742065787069726560501b6044820152606401610f49565b8051604080518082018252600080825260208083018281528783526010909152929020905181546001600160801b0319166001600160801b039091161781559051600190910155601354600f9190910b90611020828261490e565b601355604080518082019091526000808252602082015261104490859085906129e8565b60405163a9059cbb60e01b8152336004820152602481018390527f0000000000000000000000003fd9c3d2fa427993033eeb163df7e98a22f5a2556001600160a01b03169063a9059cbb906044016020604051808303816000875af11580156110b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d59190614925565b6110e1576110e16148d6565b6110ea84613004565b60408051858152602081018490524281830152905133917f02f25270a4d87bea75db541cdfe559334a275b4a233520ed6c0a2429667cca94919081900360600190a27f5e2aa66efd74cce82b21852e317e5490d9ecc9e6bb953ae24d90851258cc2f5c81611158848261490e565b6040805192835260208301919091520160405180910390a150506006805460ff191660011790555050565b6001546001600160a01b0316331461119a57600080fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000806111c98484610b9f565b6001600160a01b038516600090815260176020908152604080832063ffffffff851684529091528120919250600190910190805b825481101561125157600083828154811061121a5761121a6148c0565b9060005260206000200154905061123181886130d7565b61123b9084614942565b92505080806112499061495a565b9150506111fd565b5095945050505050565b610ec883838360405180602001604052806000815250611c90565b60006112828383612982565b9392505050565b6000818152600e6020908152604080832054600f909252822081633b9aca0081106112b6576112b66148c0565b6003020154600160801b9004600f0b9392505050565b6001546001600160a01b031633146112e357600080fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600081815260146020526040902054158015611330575060008181526015602052604090205460ff16155b61134c5760405162461bcd60e51b8152600401610f49906148ec565b6113563382612982565b61135f57600080fd5b600081815260076020908152604080832054601083529281902081518083019092528054600f0b8083526001909101549282018390526001600160a01b0390931692909190806113ae57600080fd5b806013546113bc919061490e565b6013556000805b8751821015611405578782815181106113de576113de6148c0565b6020026020010151816113f19190614942565b9050816113fd8161495a565b9250506113c3565b604080518082018252600080825260208083018281528b835260108252848320935184546001600160801b0319166001600160801b039091161784555160019093019290925582518084019093528083529082015261146790889087906129e8565b61147087613004565b834281116114905760405162461bcd60e51b8152600401610f4990614973565b61149e6303c2670042614942565b8111156114bd5760405162461bcd60e51b8152600401610f49906149b9565b60008093505b895184101561156e576005600081546114db9061495a565b9091555060055498506114ee888a6131ab565b50828a8581518110611502576115026148c0565b60200260200101518661151591906149f0565b61151f9190614a0f565b60008a81526010602090815260409182902082518084019093528054600f0b8352600101549082015290915061155c908a9083908590600561321c565b836115668161495a565b9450506114c3565b50505050505050505050565b6001600160a01b0380821660009081526016602052604081205490911680156115a35780611282565b5090919050565b6001600160a01b0381166115bb5750335b6115c5338261343f565b50565b60065460009060ff166001146115dd57600080fd5b6006805460ff191660021790556115f58383336134b2565b90506006805460ff1916600117905592915050565b6001600160a01b038116600090815260086020526040812054610d0c565b601154600081815260036020908152604080832081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060820152909190611680818561359a565b949350505050565b6000611282838361369b565b6000610d0c82611628565b6000438211156116b1576116b16148d6565b60115460006116c08483613974565b600081815260036020908152604080832081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060820152919250838310156117cf576000600381611723866001614942565b8152602080820192909252604090810160002081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060808301829052850151919250146117c9578260600151816060015161178f919061490e565b836040015182604001516117a3919061490e565b60608501516117b2908a61490e565b6117bc91906149f0565b6117c69190614a0f565b91505b5061181e565b4382606001511461181e5760608201516117e9904361490e565b60408301516117f8904261490e565b6060840151611807908961490e565b61181191906149f0565b61181b9190614a0f565b90505b611837828284604001516118329190614942565b61359a565b9695505050505050565b6000546001600160a01b0316331461185857600080fd5b6000818152601460205260409020546118739060019061490e565b60009182526014602052604090912055565b6001600160a01b03811660009081526018602052604081205463ffffffff168082036118b45750600092915050565b6001600160a01b0383166000908152601760205260408120816118d8600185614862565b63ffffffff1663ffffffff16815260200190815260200160002060010190506000805b825481101561194f576000838281548110611918576119186148c0565b9060005260206000200154905061192f81426130d7565b6119399084614942565b92505080806119479061495a565b9150506118fb565b50949350505050565b60065460ff1660011461196a57600080fd5b6006805460ff191660021790556119813383612982565b61198d5761198d6148d6565b60008281526010602090815260409182902082518084019093528054600f0b83526001015490820152816119c3576119c36148d6565b60008160000151600f0b13611a135760405162461bcd60e51b8152602060048201526016602482015275139bc8195e1a5cdd1a5b99c81b1bd8dac8199bdd5b9960521b6044820152606401610f49565b42816020015111611a365760405162461bcd60e51b8152600401610f4990614a23565b611a458383600084600261321c565b50506006805460ff1916600117905550565b336001600160a01b03831603611a6f57611a6f6148d6565b336000818152600a602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60065460ff16600114611aed57600080fd5b6006805460ff19166002179055611b043383612982565b611b1057611b106148d6565b600082815260106020908152604080832081518083019092528054600f0b825260010154918101919091529062093a8080611b4b8542614942565b611b559190614a0f565b611b5f91906149f0565b905042826020015111611ba35760405162461bcd60e51b815260206004820152600c60248201526b131bd8dac8195e1c1a5c995960a21b6044820152606401610f49565b60008260000151600f0b13611bee5760405162461bcd60e51b8152602060048201526011602482015270139bdd1a1a5b99c81a5cc81b1bd8dad959607a1b6044820152606401610f49565b81602001518111611c415760405162461bcd60e51b815260206004820152601f60248201527f43616e206f6e6c7920696e637265617365206c6f636b206475726174696f6e006044820152606401610f49565b611c4f6303c2670042614942565b811115611c6e5760405162461bcd60e51b8152600401610f49906149b9565b611c7d8460008385600361321c565b50506006805460ff191660011790555050565b600054604051635b2fa89360e11b8152600481018490526001600160a01b039091169063b65f512690602401602060405180830381865afa158015611cd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cfd9190614925565b15611d325760405162461bcd60e51b81526020600482015260056024820152645354414c4560d81b6044820152606401610f49565b611d3e848484336127ff565b823b15611ecb57604051630a85bd0160e11b81526001600160a01b0384169063150b7a0290611d77903390889087908790600401614a67565b6020604051808303816000875af1925050508015611db2575060408051601f3d908101601f19168201909252611daf91810190614a9a565b60015b611e5a573d808015611de0576040519150601f19603f3d011682016040523d82523d6000602084013e611de5565b606091505b508051600003611e525760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6064820152608401610f49565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b14611ec95760405162461bcd60e51b815260206004820152602660248201527f4552433732313a2045524337323152656365697665722072656a656374656420604482015265746f6b656e7360d01b6064820152608401610f49565b505b50505050565b6000546001600160a01b03163314611ee857600080fd5b6000908152601560205260409020805460ff19169055565b611f3e600060405180604001604052806000600f0b8152602001600081525060405180604001604052806000600f0b815260200160008152506129e8565b565b336001600160a01b03871603611f5557600080fd5b6001600160a01b038616611f6857600080fd5b60408051808201825260088152677665436f6666656560c01b6020918201528151808301835260058152640312e302e360dc1b9082015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527f3fb3334800bcdbf350214d4c4409875da341deace8f6683838dfdaaef1849586818401527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c60608201524660808201523060a0808301919091528351808303909101815260c0820184528051908301207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60e08301526001600160a01b038a1661010083015261012082018990526101408083018990528451808403909101815261016083019094528351939092019290922061190160f01b61018084015261018283018290526101a2830181905290916000906101c20160408051601f198184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa15801561212a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166121a45760405162461bcd60e51b815260206004820152602e60248201527f566f74696e67457363726f773a3a64656c656761746542795369673a20696e7660448201526d616c6964207369676e617475726560901b6064820152608401610f49565b6001600160a01b03811660009081526019602052604081208054916121c88361495a565b91905055891461222d5760405162461bcd60e51b815260206004820152602a60248201527f566f74696e67457363726f773a3a64656c656761746542795369673a20696e76604482015269616c6964206e6f6e636560b01b6064820152608401610f49565b874211156122945760405162461bcd60e51b815260206004820152602e60248201527f566f74696e67457363726f773a3a64656c656761746542795369673a2073696760448201526d1b985d1d5c9948195e1c1a5c995960921b6064820152608401610f49565b61156e818b61343f565b505050505050565b6000818152600760205260409020546060906001600160a01b031661230d5760405162461bcd60e51b815260206004820152601b60248201527f517565727920666f72206e6f6e6578697374656e7420746f6b656e00000000006044820152606401610f49565b60008281526010602090815260409182902082518084019093528054600f0b835260010154908201526002546001600160a01b031663dd9ec1498461235281426130d7565b6020850151855160405160e086901b6001600160e01b0319168152600481019490945260248401929092526044830152600f0b6064820152608401600060405180830381865afa1580156123aa573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112829190810190614ab7565b600054604051635b2fa89360e11b8152600481018490526001600160a01b039091169063b65f512690602401602060405180830381865afa15801561241b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061243f9190614925565b1580156124b65750600054604051635b2fa89360e11b8152600481018390526001600160a01b039091169063b65f512690602401602060405180830381865afa158015612490573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124b49190614925565b155b6124ec5760405162461bcd60e51b81526020600482015260076024820152662141435449564560c81b6044820152606401610f49565b600082815260146020526040902054158015612517575060008281526015602052604090205460ff16155b6125335760405162461bcd60e51b8152600401610f49906148ec565b80820361253f57600080fd5b6125493383612982565b61255257600080fd5b61255c3382612982565b61256557600080fd5b6000828152601060208181526040808420815180830183528154600f90810b825260019283015482860190815288885295855283872084518086019095528054820b855290920154938301849052805194519095929490910b9211156125cf5782602001516125d5565b83602001515b604080518082018252600080825260208083018281528b835260108252848320935184546001600160801b0319166001600160801b039091161784555160019093019290925582518084019093528083529082015290915061263a90879086906129e8565b61264386613004565b61229e85838386600461321c565b60065460009060ff1660011461266657600080fd5b6006805460ff1916600217905561267e8484846134b2565b90506006805460ff191660011790559392505050565b600061128283836130d7565b6000818152600b60205260408120544390036126be57506000919050565b610d0c82426130d7565b60065460ff166001146126da57600080fd5b6006805460ff1916600217905560008281526010602090815260409182902082518084019093528054600f0b835260010154908201528161271a57600080fd5b60008160000151600f0b1361276a5760405162461bcd60e51b8152602060048201526016602482015275139bc8195e1a5cdd1a5b99c81b1bd8dac8199bdd5b9960521b6044820152606401610f49565b4281602001511161278d5760405162461bcd60e51b8152600401610f4990614a23565b611a458383600084600061321c565b6000546001600160a01b031633146127b357600080fd5b600081815260146020526040902054611873906001614942565b6000546001600160a01b031633146127e457600080fd5b6000908152601560205260409020805460ff19166001179055565b600054604051635b2fa89360e11b8152600481018490526001600160a01b039091169063b65f512690602401602060405180830381865afa158015612848573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061286c9190614925565b156128a15760405162461bcd60e51b81526020600482015260056024820152645354414c4560d81b6044820152606401610f49565b6000828152601460205260409020541580156128cc575060008281526015602052604090205460ff16155b6128e85760405162461bcd60e51b8152600401610f49906148ec565b6128f28183612982565b6128fb57600080fd5b61290584836139fa565b61290f8483613a61565b61292a61291b8561157a565b6129248561157a565b84613ae2565b6129348383613e44565b6000828152600b60205260408082204390555183916001600160a01b0380871692908816917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a450505050565b60008181526007602090815260408083205460098352818420546001600160a01b03918216808652600a855283862088841680885295529285205492938085149392909116149060ff1682806129d55750815b806129dd5750805b979650505050505050565b60408051608081018252600080825260208201819052918101829052606081019190915260408051608081018252600080825260208201819052918101829052606081019190915260115460009081908715612b5357428760200151118015612a58575060008760000151600f0b135b15612a9d578651612a6e906303c2670090614b25565b600f0b602080870191909152870151612a8890429061490e565b8560200151612a979190614b63565b600f0b85525b428660200151118015612ab7575060008660000151600f0b135b15612afc578551612acd906303c2670090614b25565b600f0b602080860191909152860151612ae790429061490e565b8460200151612af69190614b63565b600f0b84525b602080880151600090815260128252604090205490870151600f9190910b935015612b53578660200151866020015103612b3857829150612b53565b602080870151600090815260129091526040902054600f0b91505b604080516080810182526000808252602082015242918101919091524360608201528115612bc8575060008181526003602090815260409182902082516080810184528154600f81810b8352600160801b909104900b9281019290925260018101549282019290925260029091015460608201525b604081015181600042831015612c15576040840151612be7904261490e565b6060850151612bf6904361490e565b612c0890670de0b6b3a76400006149f0565b612c129190614a0f565b90505b600062093a80612c258186614a0f565b612c2f91906149f0565b905060005b60ff811015612da957612c4a62093a8083614942565b9150600042831115612c5e57429250612c72565b50600082815260126020526040902054600f0b5b612c7c868461490e565b8760200151612c8b9190614b63565b87518890612c9a908390614bf8565b600f0b905250602087018051829190612cb4908390614c48565b600f90810b90915288516000910b12159050612ccf57600087525b60008760200151600f0b1215612ce757600060208801525b60408088018490528501519295508592670de0b6b3a764000090612d0b908561490e565b612d1590866149f0565b612d1f9190614a0f565b8560600151612d2e9190614942565b6060880152612d3e600189614942565b9750428303612d535750436060870152612da9565b6000888152600360209081526040918290208951918a01516001600160801b03908116600160801b029216919091178155908801516001820155606088015160029091015550612da28161495a565b9050612c34565b505060118590558b15612e345788602001518860200151612dca9190614bf8565b84602001818151612ddb9190614c48565b600f0b90525088518851612def9190614bf8565b84518590612dfe908390614c48565b600f90810b90915260208601516000910b12159050612e1f57600060208501525b60008460000151600f0b1215612e3457600084525b6000858152600360209081526040918290208651918701516001600160801b03908116600160801b02921691909117815590850151600182015560608501516002909101558b15612ff657428b602001511115612eeb576020890151612e9a9088614c48565b96508a602001518a6020015103612ebd576020880151612eba9088614bf8565b96505b60208b810151600090815260129091526040902080546001600160801b0319166001600160801b0389161790555b428a602001511115612f46578a602001518a602001511115612f46576020880151612f169087614bf8565b60208b810151600090815260129091526040902080546001600160801b0319166001600160801b03831617905595505b60008c8152600e6020526040812054612f60906001614942565b905080600e60008f815260200190815260200160002081905550428960400181815250504389606001818152505088600f60008f815260200190815260200160002082633b9aca008110612fb657612fb66148c0565b825160208401516001600160801b03908116600160801b029116176003919091029190910190815560408201516001820155606090910151600290910155505b505050505050505050505050565b61300e3382612982565b61305a5760405162461bcd60e51b815260206004820181905260248201527f63616c6c6572206973206e6f74206f776e6572206e6f7220617070726f7665646044820152606401610f49565b6000818152600760205260408120546001600160a01b03169061307d9083610d4b565b6130916130898261157a565b600084613ae2565b61309b8183613a61565b60405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000828152600e60205260408120548082036130f7576000915050610d0c565b6000848152600f6020526040812082633b9aca008110613119576131196148c0565b60408051608081018252600392909202929092018054600f81810b8452600160801b909104900b6020830152600181015492820183905260020154606082015291506131659085614c97565b81602001516131749190614b63565b81518290613183908390614bf8565b600f90810b90915282516000910b1215905061319e57600081525b51600f0b9150610d0c9050565b60006001600160a01b0383166131c3576131c36148d6565b6131d160006129248561157a565b6131db8383613e44565b60405182906001600160a01b038516906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a450600192915050565b601354829061322b8682614942565b6013556040805180820190915260008082526020820152825160208085015190830152600f0b8152825187908490613264908390614c48565b600f0b905250851561327857602083018690525b6000888152601060209081526040909120845181546001600160801b0319166001600160801b03909116178155908401516001909101556132ba8882856129e8565b3387158015906132dc575060048560058111156132d9576132d9614cd6565b14155b80156132fa575060058560058111156132f7576132f7614cd6565b14155b156133a4576040516323b872dd60e01b81526001600160a01b038281166004830152306024830152604482018a90527f0000000000000000000000003fd9c3d2fa427993033eeb163df7e98a22f5a25516906323b872dd906064016020604051808303816000875af1158015613374573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133989190614925565b6133a4576133a46148d6565b8360200151816001600160a01b03167fff04ccafc360e16b67d682d17bd9503c4c6b9a131f6be6325762dc9ffc7de6248b8b89426040516133e89493929190614cec565b60405180910390a37f5e2aa66efd74cce82b21852e317e5490d9ecc9e6bb953ae24d90851258cc2f5c8361341c8a82614942565b6040805192835260208301919091520160405180910390a1505050505050505050565b600061344a8361157a565b6001600160a01b0384811660008181526016602052604080822080546001600160a01b031916888616908117909155905194955093928516927f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610ec8838284613eda565b60008062093a80806134c48642614942565b6134ce9190614a0f565b6134d891906149f0565b9050600085116134e757600080fd5b4281116135065760405162461bcd60e51b8152600401610f4990614973565b6135146303c2670042614942565b8111156135335760405162461bcd60e51b8152600401610f49906149b9565b6005600081546135429061495a565b9091555060055461355384826131ab565b5060008181526010602090815260409182902082518084019093528054600f0b8352600190810154918301919091526135919183918991869161321c565b95945050505050565b600080839050600062093a808083604001516135b69190614a0f565b6135c091906149f0565b905060005b60ff811015613673576135db62093a8083614942565b91506000858311156135ef57859250613603565b50600082815260126020526040902054600f0b5b6040840151613612908461490e565b84602001516136219190614b63565b84518590613630908390614bf8565b600f0b9052508583036136435750613673565b80846020018181516136559190614c48565b600f0b905250506040830182905261366c8161495a565b90506135c5565b5060008260000151600f0b121561368957600082525b50516001600160801b03169392505050565b6000438211156136ad576136ad6148d6565b6000838152600e6020526040812054815b608081101561374d578183101561374d57600060026136dd8486614942565b6136e8906001614942565b6136f29190614a0f565b6000888152600f60205260409020909150869082633b9aca008110613719576137196148c0565b60030201600201541161372e5780935061373c565b61373960018261490e565b92505b506137468161495a565b90506136be565b506000858152600f6020526040812083633b9aca008110613770576137706148c0565b60408051608081018252600392909202929092018054600f81810b8452600160801b909104900b6020830152600181015492820192909252600290910154606082015260115490915060006137c58783613974565b600081815260036020908152604080832081516080810183528154600f81810b8352600160801b909104900b9381019390935260018101549183019190915260020154606082015291925080848410156138a4576000600381613829876001614942565b8152602080820192909252604090810160002081516080810183528154600f81810b8352600160801b909104900b93810193909352600181015491830191909152600201546060808301829052860151919250613886919061490e565b92508360400151816040015161389c919061490e565b9150506138c8565b60608301516138b3904361490e565b91508260400151426138c5919061490e565b90505b60408301518215613905578284606001518c6138e4919061490e565b6138ee90846149f0565b6138f89190614a0f565b6139029082614942565b90505b6040870151613914908261490e565b87602001516139239190614b63565b87518890613932908390614bf8565b600f90810b90915288516000910b12905061396257505093516001600160801b03169650610d0c95505050505050565b60009950505050505050505050610d0c565b60008082815b60808110156139f057818310156139f057600060026139998486614942565b6139a4906001614942565b6139ae9190614a0f565b60008181526003602052604090206002015490915087106139d1578093506139df565b6139dc60018261490e565b92505b506139e98161495a565b905061397a565b5090949350505050565b6000818152600760205260409020546001600160a01b03838116911614613a2357613a236148d6565b6000818152600960205260409020546001600160a01b031615613a5d57600081815260096020526040902080546001600160a01b03191690555b5050565b6000818152600760205260409020546001600160a01b03838116911614613a8a57613a8a6148d6565b600081815260076020526040902080546001600160a01b0319169055613ab08282614296565b6001600160a01b0382166000908152600860205260408120805460019290613ad990849061490e565b90915550505050565b816001600160a01b0316836001600160a01b031614158015613b045750600081115b15610ec8576001600160a01b03831615613c85576001600160a01b03831660009081526018602052604081205463ffffffff169081613b68576001600160a01b03851660009081526017602090815260408083208380529091529020600101613baa565b6001600160a01b038516600090815260176020526040812090613b8c600185614862565b63ffffffff1663ffffffff1681526020019081526020016000206001015b90506000613bb786614355565b6001600160a01b038716600090815260176020908152604080832063ffffffff8516845290915281209192506001909101905b8354811015613c44576000848281548110613c0757613c076148c0565b90600052602060002001549050868114613c31578254600181018455600084815260209020018190555b5080613c3c8161495a565b915050613bea565b50613c50846001614d2a565b6001600160a01b0388166000908152601860205260409020805463ffffffff191663ffffffff92909216919091179055505050505b6001600160a01b03821615610ec8576001600160a01b03821660009081526018602052604081205463ffffffff169081613ce4576001600160a01b03841660009081526017602090815260408083208380529091529020600101613d26565b6001600160a01b038416600090815260176020526040812090613d08600185614862565b63ffffffff1663ffffffff1681526020019081526020016000206001015b90506000613d3385614355565b6001600160a01b038616600090815260176020908152604080832063ffffffff851684529091529020835491925060019081019161040091613d759190614942565b1115613d935760405162461bcd60e51b8152600401610f4990614d52565b60005b8354811015613de5576000848281548110613db357613db36148c0565b600091825260208083209091015485546001810187558684529190922001555080613ddd8161495a565b915050613d96565b50805460018181018355600083815260209020909101869055613e09908590614d2a565b6001600160a01b0387166000908152601860205260409020805463ffffffff9290921663ffffffff1990921691909117905550505050505050565b6000818152600760205260409020546001600160a01b031615613e6957613e696148d6565b600081815260076020908152604080832080546001600160a01b0319166001600160a01b03871690811790915580845260088084528285208054600c86528487208188528652848720889055878752600d865293862093909355908452909152805460019290613ad9908490614942565b806001600160a01b0316826001600160a01b031614610ec8576001600160a01b0382161561408d576001600160a01b03821660009081526018602052604081205463ffffffff169081613f52576001600160a01b03841660009081526017602090815260408083208380529091529020600101613f94565b6001600160a01b038416600090815260176020526040812090613f76600185614862565b63ffffffff1663ffffffff1681526020019081526020016000206001015b90506000613fa185614355565b6001600160a01b038616600090815260176020908152604080832063ffffffff8516845290915281209192506001909101905b835481101561404c576000848281548110613ff157613ff16148c0565b600091825260208083209091015480835260079091526040909120549091506001600160a01b03908116908a1614614039578254600181018455600084815260209020018190555b50806140448161495a565b915050613fd4565b50614058846001614d2a565b6001600160a01b0387166000908152601860205260409020805463ffffffff191663ffffffff92909216919091179055505050505b6001600160a01b03811615610ec8576001600160a01b03811660009081526018602052604081205463ffffffff1690816140ec576001600160a01b0383166000908152601760209081526040808320838052909152902060010161412e565b6001600160a01b038316600090815260176020526040812090614110600185614862565b63ffffffff1663ffffffff1681526020019081526020016000206001015b9050600061413b84614355565b6001600160a01b03808616600090815260176020908152604080832063ffffffff861684528252808320938b168352600890915290205484549293506001909101916104009061418c908390614942565b11156141aa5760405162461bcd60e51b8152600401610f4990614d52565b60005b84548110156141fc5760008582815481106141ca576141ca6148c0565b6000918252602080832090910154865460018101885587845291909220015550806141f48161495a565b9150506141ad565b5060005b8181101561424e576001600160a01b0389166000908152600c6020908152604080832084845282528220548554600181018755868452919092200155806142468161495a565b915050614200565b5061425a856001614d2a565b6001600160a01b0387166000908152601860205260409020805463ffffffff9290921663ffffffff199092169190911790555050505050505050565b6001600160a01b0382166000908152600860205260408120546142bb9060019061490e565b6000838152600d602052604090205490915080820361430a576001600160a01b0384166000908152600c602090815260408083208584528252808320839055858352600d909152812055611ecb565b6001600160a01b03939093166000908152600c6020908152604080832093835292815282822080548684528484208190558352600d9091528282209490945592839055908252812055565b6001600160a01b038116600090815260186020526040812054429063ffffffff1680158015906143be57506001600160a01b038416600090815260176020526040812083916143a5600185614862565b63ffffffff168152602081019190915260400160002054145b1561128257611680600182614862565b6001600160e01b0319811681146115c557600080fd5b6000602082840312156143f657600080fd5b8135611282816143ce565b60005b8381101561441c578181015183820152602001614404565b83811115611ecb5750506000910152565b60008151808452614445816020860160208601614401565b601f01601f19169290920160200192915050565b602081526000611282602083018461442d565b80356001600160a01b038116811461448357600080fd5b919050565b6000806040838503121561449b57600080fd5b6144a48361446c565b946020939093013593505050565b6000602082840312156144c457600080fd5b5035919050565b6000602082840312156144dd57600080fd5b6112828261446c565b600080604083850312156144f957600080fd5b50508035926020909101359150565b60008060006060848603121561451d57600080fd5b6145268461446c565b92506145346020850161446c565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561458357614583614544565b604052919050565b6000806040838503121561459e57600080fd5b823567ffffffffffffffff808211156145b657600080fd5b818501915085601f8301126145ca57600080fd5b81356020828211156145de576145de614544565b8160051b92506145ef81840161455a565b828152928401810192818101908985111561460957600080fd5b948201945b848610156146275785358252948201949082019061460e565b9997909101359750505050505050565b80151581146115c557600080fd5b6000806040838503121561465857600080fd5b6146618361446c565b9150602083013561467181614637565b809150509250929050565b600067ffffffffffffffff82111561469657614696614544565b50601f01601f191660200190565b600080600080608085870312156146ba57600080fd5b6146c38561446c565b93506146d16020860161446c565b925060408501359150606085013567ffffffffffffffff8111156146f457600080fd5b8501601f8101871361470557600080fd5b80356147186147138261467c565b61455a565b81815288602083850101111561472d57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b60008060008060008060c0878903121561476857600080fd5b6147718761446c565b95506020870135945060408701359350606087013560ff8116811461479557600080fd5b9598949750929560808101359460a0909101359350915050565b6000806000606084860312156147c457600080fd5b83359250602084013591506147db6040850161446c565b90509250925092565b600080604083850312156147f757600080fd5b6148008361446c565b915061480e6020840161446c565b90509250929050565b6000806040838503121561482a57600080fd5b6148338361446c565b9150602083013563ffffffff8116811461467157600080fd5b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8381169083168181101561487f5761487f61484c565b039392505050565b634e487b7160e01b600052601260045260246000fd5b600063ffffffff808416806148b4576148b4614887565b92169190910492915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052600160045260246000fd5b602080825260089082015267185d1d1858da195960c21b604082015260600190565b6000828210156149205761492061484c565b500390565b60006020828403121561493757600080fd5b815161128281614637565b600082198211156149555761495561484c565b500190565b60006001820161496c5761496c61484c565b5060010190565b60208082526026908201527f43616e206f6e6c79206c6f636b20756e74696c2074696d6520696e207468652060408201526566757475726560d01b606082015260800190565b6020808252601e908201527f566f74696e67206c6f636b2063616e2062652032207965617273206d61780000604082015260600190565b6000816000190483118215151615614a0a57614a0a61484c565b500290565b600082614a1e57614a1e614887565b500490565b60208082526024908201527f43616e6e6f742061646420746f2065787069726564206c6f636b2e20576974686040820152636472617760e01b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906118379083018461442d565b600060208284031215614aac57600080fd5b8151611282816143ce565b600060208284031215614ac957600080fd5b815167ffffffffffffffff811115614ae057600080fd5b8201601f81018413614af157600080fd5b8051614aff6147138261467c565b818152856020838501011115614b1457600080fd5b613591826020830160208601614401565b600081600f0b83600f0b80614b3c57614b3c614887565b60016001607f1b0319821460001982141615614b5a57614b5a61484c565b90059392505050565b600081600f0b83600f0b60016001607f1b03600082136000841383830485118282161615614b9357614b9361484c565b60016001607f1b03196000851282811687830587121615614bb657614bb661484c565b60008712925085820587128484161615614bd257614bd261484c565b85850587128184161615614be857614be861484c565b5050509290910295945050505050565b600081600f0b83600f0b600081128160016001607f1b031901831281151615614c2357614c2361484c565b8160016001607f1b03018313811615614c3e57614c3e61484c565b5090039392505050565b600081600f0b83600f0b600082128260016001607f1b0303821381151615614c7257614c7261484c565b8260016001607f1b0319038212811615614c8e57614c8e61484c565b50019392505050565b60008083128015600160ff1b850184121615614cb557614cb561484c565b6001600160ff1b0384018313811615614cd057614cd061484c565b50500390565b634e487b7160e01b600052602160045260246000fd5b848152602081018490526080810160068410614d1857634e487b7160e01b600052602160045260246000fd5b60408201939093526060015292915050565b600063ffffffff808316818516808303821115614d4957614d4961484c565b01949350505050565b60208082526023908201527f64737452657020776f756c64206861766520746f6f206d616e7920746f6b656e60408201526249647360e81b60608201526080019056fea2646970667358221220dac93b34ac7e133b524143063b307177341a39b88b2585c9edc9d61337f07f1264736f6c634300080d0033

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

0000000000000000000000003fd9c3d2fa427993033eeb163df7e98a22f5a255000000000000000000000000dd457ea9faf3e43c36b6b7335878cb462fe69e9a

-----Decoded View---------------
Arg [0] : token_addr (address): 0x3fd9c3D2fa427993033eeb163Df7e98a22f5A255
Arg [1] : art_proxy (address): 0xDd457EA9FAF3E43C36B6B7335878Cb462Fe69E9a

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000003fd9c3d2fa427993033eeb163df7e98a22f5a255
Arg [1] : 000000000000000000000000dd457ea9faf3e43c36b6b7335878cb462fe69e9a


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ 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.