ETH Price: $3,066.72 (-7.29%)
 

Overview

Max Total Supply

4 DPT

Holders

4

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Balance
1 DPT
0xae653682dee958914a82c9628de794dcbbee3d04
Loading...
Loading
Loading...
Loading
Loading...
Loading

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

Contract Source Code Verified (Exact Match)

Contract Name:
PToken

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 9 : PToken.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

import "../interface/IERC721.sol";
import "../interface/IPToken.sol";
import "./ERC721.sol";
import "../math/UnsignedSafeMath.sol";

/**
 * @title Deri Protocol non-fungible position token implementation
 */
contract PToken is IERC721, IPToken, ERC721 {

    using UnsignedSafeMath for uint256;

    // Pool address this PToken associated with
    address private _pool;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Total ever minted PToken
    uint256 private _totalMinted;

    // Total existent PToken
    uint256 private _totalSupply;

    // Mapping from tokenId to Position
    mapping (uint256 => Position) private _tokenIdPosition;

    modifier _pool_() {
        require(msg.sender == _pool, "PToken: called by non-associative pool, probably the original pool has been migrated");
        _;
    }

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection
     */
    constructor (string memory name_, string memory symbol_, address pool_) {
        require(pool_ != address(0), "PToken: construct with 0 address pool");
        _name = name_;
        _symbol = symbol_;
        _pool = pool_;
    }

    /**
     * @dev See {IPToken}.{setPool}
     */
    function setPool(address newPool) public override {
        require(newPool != address(0), "PToken: setPool to 0 address");
        require(msg.sender == _pool, "PToken: setPool caller is not current pool");
        _pool = newPool;
    }

    /**
     * @dev See {IPToken}.{pool}
     */
    function pool() public view override returns (address) {
        return _pool;
    }

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

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

    /**
     * @dev See {IPToken}.{totalMinted}
     */
    function totalMinted() public view override returns (uint256) {
        return _totalMinted;
    }

    /**
     * @dev See {IPToken}.{totalSupply}
     */
    function totalSupply() public view override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IPToken}.{exists}
     */
    function exists(address owner) public view override returns (bool) {
        return _exists(owner);
    }

    /**
     * @dev See {IPToken}.{exists}
     */
    function exists(uint256 tokenId) public view override returns (bool) {
        return _exists(tokenId);
    }

    /**
     * @dev See {IPToken}.{getPosition}
     */
    function getPosition(address owner) public view override returns (
        int256 volume,
        int256 cost,
        int256 lastCumuFundingRate,
        uint256 margin,
        uint256 lastUpdateTimestamp
    ) {
        require(_exists(owner), "PToken: getPosition for nonexistent owner");
        Position storage p = _tokenIdPosition[_ownerTokenId[owner]];
        return (
            p.volume,
            p.cost,
            p.lastCumuFundingRate,
            p.margin,
            p.lastUpdateTimestamp
        );
    }

    /**
     * @dev See {IPToken}.{getPosition}
     */
    function getPosition(uint256 tokenId) public view override returns (
        int256 volume,
        int256 cost,
        int256 lastCumuFundingRate,
        uint256 margin,
        uint256 lastUpdateTimestamp
    ) {
        require(_exists(tokenId), "PToken: getPosition for nonexistent tokenId");
        Position storage p = _tokenIdPosition[tokenId];
        return (
            p.volume,
            p.cost,
            p.lastCumuFundingRate,
            p.margin,
            p.lastUpdateTimestamp
        );
    }

    /**
     * @dev See {IPToken}.{mint}
     */
    function mint(address owner, uint256 margin) public override _pool_ {
        require(owner != address(0), "PToken: mint to 0 address");
        require(!_exists(owner), "PToken: mint to existent owner");

        _totalMinted = _totalMinted.add(1);
        _totalSupply = _totalSupply.add(1);
        uint256 tokenId = _totalMinted;
        require(!_exists(tokenId), "PToken: mint to existent tokenId");

        _ownerTokenId[owner] = tokenId;
        _tokenIdOwner[tokenId] = owner;
        Position storage p = _tokenIdPosition[tokenId];
        p.margin = margin;

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

    /**
     * @dev See {IPToken}.{update}
     */
    function update(
        address owner,
        int256 volume,
        int256 cost,
        int256 lastCumuFundingRate,
        uint256 margin,
        uint256 lastUpdateTimestamp
    ) public override _pool_
    {
        require(_exists(owner), "PToken: update to nonexistent owner");
        Position storage p = _tokenIdPosition[_ownerTokenId[owner]];
        p.volume = volume;
        p.cost = cost;
        p.lastCumuFundingRate = lastCumuFundingRate;
        p.margin = margin;
        p.lastUpdateTimestamp = lastUpdateTimestamp;

        emit Update(owner, volume, cost, lastCumuFundingRate, margin, lastUpdateTimestamp);
    }

    /**
     * @dev See {IPToken}.{burn}
     */
    function burn(address owner) public override _pool_ {
        require(_exists(owner), "PToken: burn nonexistent owner");
        uint256 tokenId = _ownerTokenId[owner];
        Position storage p = _tokenIdPosition[tokenId];
        require(p.volume == 0, "PToken: burn non empty token");

        _totalSupply = _totalSupply.sub(1);

        // clear ownership and approvals
        delete _ownerTokenId[owner];
        delete _tokenIdOwner[tokenId];
        delete _tokenIdPosition[tokenId];
        delete _tokenIdOperator[tokenId];

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

}

File 2 of 9 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

import "./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 `operator` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed operator, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables `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);

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

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

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

    /**
     * @dev Gives permission to `operator` 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 operator, 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 Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token
     *   by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

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

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

File 3 of 9 : IPToken.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

import "./IERC721.sol";

/**
 * @title Deri Protocol non-fungible position token interface
 */
interface IPToken is IERC721 {

    /**
     * @dev Emitted when `owner`'s position is updated
     */
    event Update(
        address indexed owner,
        int256 volume,
        int256 cost,
        int256 lastCumuFundingRate,
        uint256 margin,
        uint256 lastUpdateTimestamp
    );

    /**
     * @dev Position struct
     */
    struct Position {
        // Position volume, long is positive and short is negative
        int256 volume;
        // Position cost, long position cost is positive, short position cost is negative
        int256 cost;
        // The last cumuFundingRate since last funding settlement for this position
        // The overflow for this value is intended
        int256 lastCumuFundingRate;
        // Margin associated with this position
        uint256 margin;
        // Last timestamp this position updated
        uint256 lastUpdateTimestamp;
    }

    /**
     * @dev Set pool address of position token
     * pool is the only controller of this contract
     * can only be called by current pool
     */
    function setPool(address newPool) external;

    /**
     * @dev Returns address of current pool
     */
    function pool() external view returns (address);

    /**
     * @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 total number of ever minted position tokens, including those burned
     */
    function totalMinted() external view returns (uint256);

    /**
     * @dev Returns the total number of existent position tokens
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns if `owner` owns a position token in this contract
     */
    function exists(address owner) external view returns (bool);

    /**
     * @dev Returns if position token of `tokenId` exists
     */
    function exists(uint256 tokenId) external view returns (bool);

    /**
     * @dev Returns the position of owner `owner`
     *
     * `owner` must exist
     */
    function getPosition(address owner) external view returns (
        int256 volume,
        int256 cost,
        int256 lastCumuFundingRate,
        uint256 margin,
        uint256 lastUpdateTimestamp
    );

    /**
     * @dev Returns the position of token `tokenId`
     *
     * `tokenId` must exist
     */
    function getPosition(uint256 tokenId) external view returns (
        int256 volume,
        int256 cost,
        int256 lastCumuFundingRate,
        uint256 margin,
        uint256 lastUpdateTimestamp
    );

    /**
     * @dev Mint a position token for `owner` with intial margin of `margin`
     *
     * Can only be called by pool
     * `owner` cannot be zero address
     * `owner` must not exist before calling
     */
    function mint(address owner, uint256 margin) external;

    /**
     * @dev Update the position token for `owner`
     *
     * Can only be called by pool
     * `owner` must exist
     */
    function update(
        address owner,
        int256 volume,
        int256 cost,
        int256 lastCumuFundingRate,
        uint256 margin,
        uint256 lastUpdateTimestamp
    ) external;

    /**
     * @dev Burn the position token owned of `owner`
     *
     * Can only be called by pool
     * `owner` must exist
     */
    function burn(address owner) external;

}

File 4 of 9 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

import "../interface/IERC721.sol";
import "../interface/IERC721Receiver.sol";
import "../utils/Address.sol";
import "./ERC165.sol";

/**
 * @dev ERC721 Non-Fungible Token Implementation
 *
 * Exert uniqueness of owner: one owner can only have one token
 */
contract ERC721 is IERC721, ERC165 {

    using Address for address;

    /*
     * Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
     * which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
     */
    bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;

    /*
     *     bytes4(keccak256('balanceOf(address)')) == 0x70a08231
     *     bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
     *     bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
     *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
     *     bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
     *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
     *     bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
     *
     *     => 0x70a08231 ^ 0x6352211e ^ 0x081812fc ^ 0xe985e9c5 ^
     *        0x095ea7b3 ^ 0xa22cb465 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
     */
    bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;

    // Mapping from owner address to tokenId
    // tokenId starts from 1, 0 is reserved for nonexistent token
    // One owner can only own one token in this contract
    mapping (address => uint256) _ownerTokenId;

    // Mapping from tokenId to owner
    mapping (uint256 => address) _tokenIdOwner;

    // Mapping from tokenId to approved operator
    mapping (uint256 => address) _tokenIdOperator;

    // Mapping from owner to operator for all approval
    mapping (address => mapping (address => bool)) _ownerOperator;


    constructor () {
        // register the supported interfaces to conform to ERC721 via ERC165
        _registerInterface(_INTERFACE_ID_ERC721);
    }

    /**
     * @dev See {IERC721}.{balanceOf}
     */
    function balanceOf(address owner) public view override returns (uint256) {
        if (_exists(owner)) {
            return 1;
        } else {
            return 0;
        }
    }

    /**
     * @dev See {IERC721}.{ownerOf}
     */
    function ownerOf(uint256 tokenId) public view override returns (address) {
        require(_exists(tokenId), "ERC721: ownerOf for nonexistent tokenId");
        return _tokenIdOwner[tokenId];
    }

    /**
     * @dev See {IERC721}.{getApproved}
     */
    function getApproved(uint256 tokenId) public view override returns (address) {
        require(_exists(tokenId), "ERC721: getApproved for nonexistent tokenId");
        return _tokenIdOperator[tokenId];
    }

    /**
     * @dev See {IERC721}.{isApprovedForAll}
     */
    function isApprovedForAll(address owner, address operator) public view override returns (bool) {
        require(_exists(owner), "ERC721: isApprovedForAll for nonexistent owner");
        return _ownerOperator[owner][operator];
    }

    /**
     * @dev See {IERC721}.{approve}
     */
    function approve(address operator, uint256 tokenId) public override {
        require(msg.sender == ownerOf(tokenId), "ERC721: approve caller is not owner");
        _approve(msg.sender, operator, tokenId);
    }

    /**
     * @dev See {IERC721}.{setApprovalForAll}
     */
    function setApprovalForAll(address operator, bool approved) public override {
        require(_exists(msg.sender), "ERC721: setApprovalForAll caller is not existent owner");
        _ownerOperator[msg.sender][operator] = approved;
        emit ApprovalForAll(msg.sender, operator, approved);
    }

    /**
     * @dev See {IERC721}.{transferFrom}
     */
    function transferFrom(address from, address to, uint256 tokenId) public override {
        _validateTransfer(msg.sender, from, to, tokenId);
        _transfer(from, to, tokenId);
    }

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

    /**
     * @dev See {IERC721}.{safeTransferFrom}
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
        public override
    {
        _validateTransfer(msg.sender, from, to, tokenId);
        _safeTransfer(from, to, tokenId, data);
    }


    /**
     * @dev Returns if owner exists.
     */
    function _exists(address owner) internal view returns (bool) {
        return _ownerTokenId[owner] != 0;
    }

    /**
     * @dev Returns if tokenId exists.
     */
    function _exists(uint256 tokenId) internal view returns (bool) {
        return _tokenIdOwner[tokenId] != address(0);
    }

    /**
     * @dev Approve `operator` to manage `tokenId`, owned by `owner`
     *
     * Validation check on parameters should be carried out before calling this function.
     */
    function _approve(address owner, address operator, uint256 tokenId) internal {
        _tokenIdOperator[tokenId] = operator;
        emit Approval(owner, operator, tokenId);
    }

    /**
     * @dev Validate transferFrom parameters
     */
    function _validateTransfer(address operator, address from, address to, uint256 tokenId)
        internal view
    {
        require(from == ownerOf(tokenId), "ERC721: transfer not owned token");
        require(to != address(0), "ERC721: transfer to 0 address");
        require(!_exists(to), "ERC721: transfer to already existent owner");
        require(
            operator == from || _tokenIdOperator[tokenId] == operator || _ownerOperator[from][operator],
            "ERC721: transfer caller is not owner nor approved"
        );
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * Validation check on parameters should be carried out before calling this function.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal {
        // clear previous ownership and approvals
        delete _ownerTokenId[from];
        delete _tokenIdOperator[tokenId];

        // set up new owner
        _ownerTokenId[to] = tokenId;
        _tokenIdOwner[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

    /**
     * @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.
     *
     * Validation check on parameters should be carried out before calling this function.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal {
        _transfer(from, to, tokenId);
        require(
            _checkOnERC721Received(from, to, tokenId, data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     *      The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID.
     * @param to target address that will receive the tokens.
     * @param tokenId uint256 ID of the token to be transferred.
     * @param data bytes optional data to send along with the call.
     * @return bool whether the call correctly returned the expected magic value.
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data)
        internal returns (bool)
    {
        if (!to.isContract()) {
            return true;
        }
        bytes memory returndata = to.functionCall(abi.encodeWithSelector(
            IERC721Receiver(to).onERC721Received.selector,
            msg.sender,
            from,
            tokenId,
            data
        ), "ERC721: transfer to non ERC721Receiver implementer");
        bytes4 retval = abi.decode(returndata, (bytes4));
        return (retval == _ERC721_RECEIVED);
    }

}

File 5 of 9 : UnsignedSafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @title Unsigned safe math
 */
library UnsignedSafeMath {

    /**
     * @dev Addition of unsigned integers, counterpart to `+`
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "UnsignedSafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Subtraction of unsigned integers, counterpart to `-`
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(a >= b, "UnsignedSafeMath: subtraction overflow");
        uint256 c = a - b;
        return c;
    }

    /**
     * @dev Multiplication of unsigned integers, counterpart to `*`
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero,
        // but the benefit is lost if 'b' is also tested
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }
        uint256 c = a * b;
        require(c / a == b, "UnsignedSafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Division of unsigned integers, counterpart to `/`
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b != 0, "UnsignedSafeMath: division by zero");
        uint256 c = a / b;
        return c;
    }

    /**
     * @dev Modulo of unsigned integers, counterpart to `%`
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b != 0, "UnsignedSafeMath: modulo by zero");
        uint256 c = a % b;
        return c;
    }

}

File 6 of 9 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

pragma solidity >=0.6.0 <0.8.0;

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

File 8 of 9 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

pragma solidity >=0.6.0 <0.8.0;

import "../interface/IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
abstract contract ERC165 is IERC165 {
    /*
     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
     */
    bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;

    /**
     * @dev Mapping of interface ids to whether or not it's supported.
     */
    mapping(bytes4 => bool) private _supportedInterfaces;

    constructor () {
        // Derived contracts need only register support for their own interfaces,
        // we register support for ERC165 itself here
        _registerInterface(_INTERFACE_ID_ERC165);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     *
     * Time complexity O(1), guaranteed to always use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
        return _supportedInterfaces[interfaceId];
    }

    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal virtual {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"address","name":"pool_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","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":"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":"owner","type":"address"},{"indexed":false,"internalType":"int256","name":"volume","type":"int256"},{"indexed":false,"internalType":"int256","name":"cost","type":"int256"},{"indexed":false,"internalType":"int256","name":"lastCumuFundingRate","type":"int256"},{"indexed":false,"internalType":"uint256","name":"margin","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lastUpdateTimestamp","type":"uint256"}],"name":"Update","type":"event"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getPosition","outputs":[{"internalType":"int256","name":"volume","type":"int256"},{"internalType":"int256","name":"cost","type":"int256"},{"internalType":"int256","name":"lastCumuFundingRate","type":"int256"},{"internalType":"uint256","name":"margin","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getPosition","outputs":[{"internalType":"int256","name":"volume","type":"int256"},{"internalType":"int256","name":"cost","type":"int256"},{"internalType":"int256","name":"lastCumuFundingRate","type":"int256"},{"internalType":"uint256","name":"margin","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"margin","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"newPool","type":"address"}],"name":"setPool","outputs":[],"stateMutability":"nonpayable","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":"totalMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","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":"address","name":"owner","type":"address"},{"internalType":"int256","name":"volume","type":"int256"},{"internalType":"int256","name":"cost","type":"int256"},{"internalType":"int256","name":"lastCumuFundingRate","type":"int256"},{"internalType":"uint256","name":"margin","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTimestamp","type":"uint256"}],"name":"update","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405162001e5138038062001e51833981810160405260608110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b9083019060208201858111156200006e57600080fd5b82516401000000008111828201881017156200008957600080fd5b82525081516020918201929091019080838360005b83811015620000b85781810151838201526020016200009e565b50505050905090810190601f168015620000e65780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200010a57600080fd5b9083019060208201858111156200012057600080fd5b82516401000000008111828201881017156200013b57600080fd5b82525081516020918201929091019080838360005b838110156200016a57818101518382015260200162000150565b50505050905090810190601f168015620001985780820380516001836020036101000a031916815260200191505b50604052602001519150620001b690506301ffc9a760e01b62000264565b620001c86380ac58cd60e01b62000264565b6001600160a01b0381166200020f5760405162461bcd60e51b815260040180806020018281038252602581526020018062001e2c6025913960400191505060405180910390fd5b825162000224906006906020860190620002e9565b5081516200023a906007906020850190620002e9565b50600580546001600160a01b0319166001600160a01b039290921691909117905550620003959050565b6001600160e01b03198082161415620002c4576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152602081905260409020805460ff19166001179055565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826200032157600085556200036c565b82601f106200033c57805160ff19168380011785556200036c565b828001600101855582156200036c579182015b828111156200036c5782518255916020019190600101906200034f565b506200037a9291506200037e565b5090565b5b808211156200037a57600081556001016200037f565b611a8780620003a56000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c80634f558e79116100c3578063a22cb4651161007c578063a22cb46514610474578063a2309ff8146104a2578063b88d4fde146104aa578063e985e9c514610570578063eb02c3011461059e578063f6a3d24e146105bb5761014d565b80634f558e79146103a25780636352211e146103bf57806370a08231146103dc57806389afcb441461040257806395d89b41146104285780639a9f9226146104305761014d565b806316f0115b1161011557806316f0115b146102c257806318160ddd146102ca57806323b872dd146102e457806340c10f191461031a57806342842e0e146103465780634437152a1461037c5761014d565b806301ffc9a71461015257806306fdde031461018d578063081812fc1461020a578063095ea7b31461024357806316c1973914610271575b600080fd5b6101796004803603602081101561016857600080fd5b50356001600160e01b0319166105e1565b604080519115158252519081900360200190f35b610195610604565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101cf5781810151838201526020016101b7565b50505050905090810190601f1680156101fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102276004803603602081101561022057600080fd5b503561069a565b604080516001600160a01b039092168252519081900360200190f35b61026f6004803603604081101561025957600080fd5b506001600160a01b0381351690602001356106fc565b005b6102976004803603602081101561028757600080fd5b50356001600160a01b0316610763565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b6102276107fa565b6102d2610809565b60408051918252519081900360200190f35b61026f600480360360608110156102fa57600080fd5b506001600160a01b0381358116916020810135909116906040013561080f565b61026f6004803603604081101561033057600080fd5b506001600160a01b03813516906020013561082b565b61026f6004803603606081101561035c57600080fd5b506001600160a01b03813581169160208101359091169060400135610a24565b61026f6004803603602081101561039257600080fd5b50356001600160a01b0316610a3f565b610179600480360360208110156103b857600080fd5b5035610b05565b610227600480360360208110156103d557600080fd5b5035610b16565b6102d2600480360360208110156103f257600080fd5b50356001600160a01b0316610b78565b61026f6004803603602081101561041857600080fd5b50356001600160a01b0316610b98565b610195610d64565b61026f600480360360c081101561044657600080fd5b506001600160a01b038135169060208101359060408101359060608101359060808101359060a00135610dc5565b61026f6004803603604081101561048a57600080fd5b506001600160a01b0381351690602001351515610eee565b6102d2610fa0565b61026f600480360360808110156104c057600080fd5b6001600160a01b038235811692602081013590911691604082013591908101906080810160608201356401000000008111156104fb57600080fd5b82018360208201111561050d57600080fd5b8035906020019184600183028401116401000000008311171561052f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610fa6945050505050565b6101796004803603604081101561058657600080fd5b506001600160a01b0381358116916020013516610fc4565b610297600480360360208110156105b457600080fd5b5035611039565b610179600480360360208110156105d157600080fd5b50356001600160a01b03166110b9565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106905780601f1061066557610100808354040283529160200191610690565b820191906000526020600020905b81548152906001019060200180831161067357829003601f168201915b5050505050905090565b60006106a5826110c4565b6106e05760405162461bcd60e51b815260040180806020018281038252602b815260200180611940602b913960400191505060405180910390fd5b506000908152600360205260409020546001600160a01b031690565b61070581610b16565b6001600160a01b0316336001600160a01b0316146107545760405162461bcd60e51b81526004018080602001828103825260238152602001806118336023913960400191505060405180910390fd5b61075f3383836110e1565b5050565b60008060008060006107748661113d565b6107af5760405162461bcd60e51b815260040180806020018281038252602981526020018061180a6029913960400191505060405180910390fd5b505050506001600160a01b03919091166000908152600160208181526040808420548452600a9091529091208054918101546002820154600383015460049093015493959194509290565b6005546001600160a01b031690565b60095490565b61081b3384848461115a565b61082683838361130c565b505050565b6005546001600160a01b031633146108745760405162461bcd60e51b81526004018080602001828103825260548152602001806118796054913960600191505060405180910390fd5b6001600160a01b0382166108cf576040805162461bcd60e51b815260206004820152601960248201527f50546f6b656e3a206d696e7420746f2030206164647265737300000000000000604482015290519081900360640190fd5b6108d88261113d565b1561092a576040805162461bcd60e51b815260206004820152601e60248201527f50546f6b656e3a206d696e7420746f206578697374656e74206f776e65720000604482015290519081900360640190fd5b600854610938906001611398565b600855600954610949906001611398565b600955600854610958816110c4565b156109aa576040805162461bcd60e51b815260206004820181905260248201527f50546f6b656e3a206d696e7420746f206578697374656e7420746f6b656e4964604482015290519081900360640190fd5b6001600160a01b03831660008181526001602090815260408083208590558483526002825280832080546001600160a01b03191685179055600a9091528082206003810186905590519092849290917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a450505050565b61082683838360405180602001604052806000815250610fa6565b6001600160a01b038116610a9a576040805162461bcd60e51b815260206004820152601c60248201527f50546f6b656e3a20736574506f6f6c20746f2030206164647265737300000000604482015290519081900360640190fd5b6005546001600160a01b03163314610ae35760405162461bcd60e51b815260040180806020018281038252602a8152602001806118cd602a913960400191505060405180910390fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6000610b10826110c4565b92915050565b6000610b21826110c4565b610b5c5760405162461bcd60e51b815260040180806020018281038252602781526020018061196b6027913960400191505060405180910390fd5b506000908152600260205260409020546001600160a01b031690565b6000610b838261113d565b15610b90575060016105ff565b5060006105ff565b6005546001600160a01b03163314610be15760405162461bcd60e51b81526004018080602001828103825260548152602001806118796054913960600191505060405180910390fd5b610bea8161113d565b610c3b576040805162461bcd60e51b815260206004820152601e60248201527f50546f6b656e3a206275726e206e6f6e6578697374656e74206f776e65720000604482015290519081900360640190fd5b6001600160a01b038116600090815260016020908152604080832054808452600a909252909120805415610cb6576040805162461bcd60e51b815260206004820152601c60248201527f50546f6b656e3a206275726e206e6f6e20656d70747920746f6b656e00000000604482015290519081900360640190fd5b600954610cc49060016113e3565b6009556001600160a01b0383166000818152600160208181526040808420849055868452600280835281852080546001600160a01b0319908116909155600a845282862086815594850186905590840185905560038085018690556004909401859055929091528083208054909216909155518492907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4505050565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106905780601f1061066557610100808354040283529160200191610690565b6005546001600160a01b03163314610e0e5760405162461bcd60e51b81526004018080602001828103825260548152602001806118796054913960600191505060405180910390fd5b610e178661113d565b610e525760405162461bcd60e51b815260040180806020018281038252602381526020018061191d6023913960400191505060405180910390fd5b6001600160a01b0386166000818152600160208181526040808420548452600a8252928390208981559182018890556002820187905560038201869055600482018590558251898152908101889052808301879052606081018690526080810185905291519092917f7a332042c748235010930dedeef46f766246d2fbb27fe88189038c39ed9dbb47919081900360a00190a250505050505050565b610ef73361113d565b610f325760405162461bcd60e51b81526004018080602001828103825260368152602001806119c06036913960400191505060405180910390fd5b3360008181526004602090815260408083206001600160a01b03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b60085490565b610fb23385858561115a565b610fbe8484848461142a565b50505050565b6000610fcf8361113d565b61100a5760405162461bcd60e51b815260040180806020018281038252602e815260200180611992602e913960400191505060405180910390fd5b506001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b600080600080600061104a866110c4565b6110855760405162461bcd60e51b815260040180806020018281038252602b8152602001806119f6602b913960400191505060405180910390fd5b50505060009283525050600a6020526040902080546001820154600283015460038401546004909401549294919390929091565b6000610b108261113d565b6000908152600260205260409020546001600160a01b0316151590565b60008181526003602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6001600160a01b0316600090815260016020526040902054151590565b61116381610b16565b6001600160a01b0316836001600160a01b0316146111c8576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a207472616e73666572206e6f74206f776e656420746f6b656e604482015290519081900360640190fd5b6001600160a01b038216611223576040805162461bcd60e51b815260206004820152601d60248201527f4552433732313a207472616e7366657220746f20302061646472657373000000604482015290519081900360640190fd5b61122c8261113d565b156112685760405162461bcd60e51b815260040180806020018281038252602a8152602001806117ae602a913960400191505060405180910390fd5b826001600160a01b0316846001600160a01b031614806112a157506000818152600360205260409020546001600160a01b038581169116145b806112d157506001600160a01b0380841660009081526004602090815260408083209388168352929052205460ff165b610fbe5760405162461bcd60e51b8152600401808060200182810382526031815260200180611a216031913960400191505060405180910390fd5b6001600160a01b0380841660008181526001602081815260408084208490558684526003825280842080546001600160a01b03199081169091559588168085529282528084208790558684526002909152808320805490951682179094559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000828201838110156113dc5760405162461bcd60e51b81526004018080602001828103825260238152602001806118566023913960400191505060405180910390fd5b9392505050565b6000818310156114245760405162461bcd60e51b81526004018080602001828103825260268152602001806118f76026913960400191505060405180910390fd5b50900390565b61143584848461130c565b6114418484848461147c565b610fbe5760405162461bcd60e51b81526004018080602001828103825260328152602001806117d86032913960400191505060405180910390fd5b6000611490846001600160a01b03166115de565b61149c575060016115d6565b60006115a363150b7a0260e01b3388878760405160240180856001600160a01b03168152602001846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156115115781810151838201526020016114f9565b50505050905090810190601f16801561153e5780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050506040518060600160405280603281526020016117d8603291396001600160a01b03881691906115e4565b905060008180602001905160208110156115bc57600080fd5b50516001600160e01b031916630a85bd0160e11b14925050505b949350505050565b3b151590565b60606115d68484600085856115f8856115de565b611649576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106116875780518252601f199092019160209182019101611668565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146116e9576040519150601f19603f3d011682016040523d82523d6000602084013e6116ee565b606091505b50915091506116fe828286611709565b979650505050505050565b606083156117185750816113dc565b8251156117285782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561177257818101518382015260200161175a565b50505050905090810190601f16801561179f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe4552433732313a207472616e7366657220746f20616c7265616479206578697374656e74206f776e65724552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e74657250546f6b656e3a20676574506f736974696f6e20666f72206e6f6e6578697374656e74206f776e65724552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572556e7369676e6564536166654d6174683a206164646974696f6e206f766572666c6f7750546f6b656e3a2063616c6c6564206279206e6f6e2d6173736f6369617469766520706f6f6c2c2070726f6261626c7920746865206f726967696e616c20706f6f6c20686173206265656e206d6967726174656450546f6b656e3a20736574506f6f6c2063616c6c6572206973206e6f742063757272656e7420706f6f6c556e7369676e6564536166654d6174683a207375627472616374696f6e206f766572666c6f7750546f6b656e3a2075706461746520746f206e6f6e6578697374656e74206f776e65724552433732313a20676574417070726f76656420666f72206e6f6e6578697374656e7420746f6b656e49644552433732313a206f776e65724f6620666f72206e6f6e6578697374656e7420746f6b656e49644552433732313a206973417070726f766564466f72416c6c20666f72206e6f6e6578697374656e74206f776e65724552433732313a20736574417070726f76616c466f72416c6c2063616c6c6572206973206e6f74206578697374656e74206f776e657250546f6b656e3a20676574506f736974696f6e20666f72206e6f6e6578697374656e7420746f6b656e49644552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a2646970667358221220ad99f725f74adb5f942b91938538ca85ebcc6a20aace4fade28fb81ff13f770264736f6c6343000706003350546f6b656e3a20636f6e73747275637420776974682030206164647265737320706f6f6c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000007137cc9f252dc405dadc35f597da8b32e865360300000000000000000000000000000000000000000000000000000000000000134465726920506f736974696f6e20546f6b656e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034450540000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061014d5760003560e01c80634f558e79116100c3578063a22cb4651161007c578063a22cb46514610474578063a2309ff8146104a2578063b88d4fde146104aa578063e985e9c514610570578063eb02c3011461059e578063f6a3d24e146105bb5761014d565b80634f558e79146103a25780636352211e146103bf57806370a08231146103dc57806389afcb441461040257806395d89b41146104285780639a9f9226146104305761014d565b806316f0115b1161011557806316f0115b146102c257806318160ddd146102ca57806323b872dd146102e457806340c10f191461031a57806342842e0e146103465780634437152a1461037c5761014d565b806301ffc9a71461015257806306fdde031461018d578063081812fc1461020a578063095ea7b31461024357806316c1973914610271575b600080fd5b6101796004803603602081101561016857600080fd5b50356001600160e01b0319166105e1565b604080519115158252519081900360200190f35b610195610604565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101cf5781810151838201526020016101b7565b50505050905090810190601f1680156101fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102276004803603602081101561022057600080fd5b503561069a565b604080516001600160a01b039092168252519081900360200190f35b61026f6004803603604081101561025957600080fd5b506001600160a01b0381351690602001356106fc565b005b6102976004803603602081101561028757600080fd5b50356001600160a01b0316610763565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b6102276107fa565b6102d2610809565b60408051918252519081900360200190f35b61026f600480360360608110156102fa57600080fd5b506001600160a01b0381358116916020810135909116906040013561080f565b61026f6004803603604081101561033057600080fd5b506001600160a01b03813516906020013561082b565b61026f6004803603606081101561035c57600080fd5b506001600160a01b03813581169160208101359091169060400135610a24565b61026f6004803603602081101561039257600080fd5b50356001600160a01b0316610a3f565b610179600480360360208110156103b857600080fd5b5035610b05565b610227600480360360208110156103d557600080fd5b5035610b16565b6102d2600480360360208110156103f257600080fd5b50356001600160a01b0316610b78565b61026f6004803603602081101561041857600080fd5b50356001600160a01b0316610b98565b610195610d64565b61026f600480360360c081101561044657600080fd5b506001600160a01b038135169060208101359060408101359060608101359060808101359060a00135610dc5565b61026f6004803603604081101561048a57600080fd5b506001600160a01b0381351690602001351515610eee565b6102d2610fa0565b61026f600480360360808110156104c057600080fd5b6001600160a01b038235811692602081013590911691604082013591908101906080810160608201356401000000008111156104fb57600080fd5b82018360208201111561050d57600080fd5b8035906020019184600183028401116401000000008311171561052f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610fa6945050505050565b6101796004803603604081101561058657600080fd5b506001600160a01b0381358116916020013516610fc4565b610297600480360360208110156105b457600080fd5b5035611039565b610179600480360360208110156105d157600080fd5b50356001600160a01b03166110b9565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106905780601f1061066557610100808354040283529160200191610690565b820191906000526020600020905b81548152906001019060200180831161067357829003601f168201915b5050505050905090565b60006106a5826110c4565b6106e05760405162461bcd60e51b815260040180806020018281038252602b815260200180611940602b913960400191505060405180910390fd5b506000908152600360205260409020546001600160a01b031690565b61070581610b16565b6001600160a01b0316336001600160a01b0316146107545760405162461bcd60e51b81526004018080602001828103825260238152602001806118336023913960400191505060405180910390fd5b61075f3383836110e1565b5050565b60008060008060006107748661113d565b6107af5760405162461bcd60e51b815260040180806020018281038252602981526020018061180a6029913960400191505060405180910390fd5b505050506001600160a01b03919091166000908152600160208181526040808420548452600a9091529091208054918101546002820154600383015460049093015493959194509290565b6005546001600160a01b031690565b60095490565b61081b3384848461115a565b61082683838361130c565b505050565b6005546001600160a01b031633146108745760405162461bcd60e51b81526004018080602001828103825260548152602001806118796054913960600191505060405180910390fd5b6001600160a01b0382166108cf576040805162461bcd60e51b815260206004820152601960248201527f50546f6b656e3a206d696e7420746f2030206164647265737300000000000000604482015290519081900360640190fd5b6108d88261113d565b1561092a576040805162461bcd60e51b815260206004820152601e60248201527f50546f6b656e3a206d696e7420746f206578697374656e74206f776e65720000604482015290519081900360640190fd5b600854610938906001611398565b600855600954610949906001611398565b600955600854610958816110c4565b156109aa576040805162461bcd60e51b815260206004820181905260248201527f50546f6b656e3a206d696e7420746f206578697374656e7420746f6b656e4964604482015290519081900360640190fd5b6001600160a01b03831660008181526001602090815260408083208590558483526002825280832080546001600160a01b03191685179055600a9091528082206003810186905590519092849290917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a450505050565b61082683838360405180602001604052806000815250610fa6565b6001600160a01b038116610a9a576040805162461bcd60e51b815260206004820152601c60248201527f50546f6b656e3a20736574506f6f6c20746f2030206164647265737300000000604482015290519081900360640190fd5b6005546001600160a01b03163314610ae35760405162461bcd60e51b815260040180806020018281038252602a8152602001806118cd602a913960400191505060405180910390fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6000610b10826110c4565b92915050565b6000610b21826110c4565b610b5c5760405162461bcd60e51b815260040180806020018281038252602781526020018061196b6027913960400191505060405180910390fd5b506000908152600260205260409020546001600160a01b031690565b6000610b838261113d565b15610b90575060016105ff565b5060006105ff565b6005546001600160a01b03163314610be15760405162461bcd60e51b81526004018080602001828103825260548152602001806118796054913960600191505060405180910390fd5b610bea8161113d565b610c3b576040805162461bcd60e51b815260206004820152601e60248201527f50546f6b656e3a206275726e206e6f6e6578697374656e74206f776e65720000604482015290519081900360640190fd5b6001600160a01b038116600090815260016020908152604080832054808452600a909252909120805415610cb6576040805162461bcd60e51b815260206004820152601c60248201527f50546f6b656e3a206275726e206e6f6e20656d70747920746f6b656e00000000604482015290519081900360640190fd5b600954610cc49060016113e3565b6009556001600160a01b0383166000818152600160208181526040808420849055868452600280835281852080546001600160a01b0319908116909155600a845282862086815594850186905590840185905560038085018690556004909401859055929091528083208054909216909155518492907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4505050565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106905780601f1061066557610100808354040283529160200191610690565b6005546001600160a01b03163314610e0e5760405162461bcd60e51b81526004018080602001828103825260548152602001806118796054913960600191505060405180910390fd5b610e178661113d565b610e525760405162461bcd60e51b815260040180806020018281038252602381526020018061191d6023913960400191505060405180910390fd5b6001600160a01b0386166000818152600160208181526040808420548452600a8252928390208981559182018890556002820187905560038201869055600482018590558251898152908101889052808301879052606081018690526080810185905291519092917f7a332042c748235010930dedeef46f766246d2fbb27fe88189038c39ed9dbb47919081900360a00190a250505050505050565b610ef73361113d565b610f325760405162461bcd60e51b81526004018080602001828103825260368152602001806119c06036913960400191505060405180910390fd5b3360008181526004602090815260408083206001600160a01b03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b60085490565b610fb23385858561115a565b610fbe8484848461142a565b50505050565b6000610fcf8361113d565b61100a5760405162461bcd60e51b815260040180806020018281038252602e815260200180611992602e913960400191505060405180910390fd5b506001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b600080600080600061104a866110c4565b6110855760405162461bcd60e51b815260040180806020018281038252602b8152602001806119f6602b913960400191505060405180910390fd5b50505060009283525050600a6020526040902080546001820154600283015460038401546004909401549294919390929091565b6000610b108261113d565b6000908152600260205260409020546001600160a01b0316151590565b60008181526003602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6001600160a01b0316600090815260016020526040902054151590565b61116381610b16565b6001600160a01b0316836001600160a01b0316146111c8576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a207472616e73666572206e6f74206f776e656420746f6b656e604482015290519081900360640190fd5b6001600160a01b038216611223576040805162461bcd60e51b815260206004820152601d60248201527f4552433732313a207472616e7366657220746f20302061646472657373000000604482015290519081900360640190fd5b61122c8261113d565b156112685760405162461bcd60e51b815260040180806020018281038252602a8152602001806117ae602a913960400191505060405180910390fd5b826001600160a01b0316846001600160a01b031614806112a157506000818152600360205260409020546001600160a01b038581169116145b806112d157506001600160a01b0380841660009081526004602090815260408083209388168352929052205460ff165b610fbe5760405162461bcd60e51b8152600401808060200182810382526031815260200180611a216031913960400191505060405180910390fd5b6001600160a01b0380841660008181526001602081815260408084208490558684526003825280842080546001600160a01b03199081169091559588168085529282528084208790558684526002909152808320805490951682179094559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000828201838110156113dc5760405162461bcd60e51b81526004018080602001828103825260238152602001806118566023913960400191505060405180910390fd5b9392505050565b6000818310156114245760405162461bcd60e51b81526004018080602001828103825260268152602001806118f76026913960400191505060405180910390fd5b50900390565b61143584848461130c565b6114418484848461147c565b610fbe5760405162461bcd60e51b81526004018080602001828103825260328152602001806117d86032913960400191505060405180910390fd5b6000611490846001600160a01b03166115de565b61149c575060016115d6565b60006115a363150b7a0260e01b3388878760405160240180856001600160a01b03168152602001846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156115115781810151838201526020016114f9565b50505050905090810190601f16801561153e5780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050506040518060600160405280603281526020016117d8603291396001600160a01b03881691906115e4565b905060008180602001905160208110156115bc57600080fd5b50516001600160e01b031916630a85bd0160e11b14925050505b949350505050565b3b151590565b60606115d68484600085856115f8856115de565b611649576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106116875780518252601f199092019160209182019101611668565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146116e9576040519150601f19603f3d011682016040523d82523d6000602084013e6116ee565b606091505b50915091506116fe828286611709565b979650505050505050565b606083156117185750816113dc565b8251156117285782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561177257818101518382015260200161175a565b50505050905090810190601f16801561179f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe4552433732313a207472616e7366657220746f20616c7265616479206578697374656e74206f776e65724552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e74657250546f6b656e3a20676574506f736974696f6e20666f72206e6f6e6578697374656e74206f776e65724552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572556e7369676e6564536166654d6174683a206164646974696f6e206f766572666c6f7750546f6b656e3a2063616c6c6564206279206e6f6e2d6173736f6369617469766520706f6f6c2c2070726f6261626c7920746865206f726967696e616c20706f6f6c20686173206265656e206d6967726174656450546f6b656e3a20736574506f6f6c2063616c6c6572206973206e6f742063757272656e7420706f6f6c556e7369676e6564536166654d6174683a207375627472616374696f6e206f766572666c6f7750546f6b656e3a2075706461746520746f206e6f6e6578697374656e74206f776e65724552433732313a20676574417070726f76656420666f72206e6f6e6578697374656e7420746f6b656e49644552433732313a206f776e65724f6620666f72206e6f6e6578697374656e7420746f6b656e49644552433732313a206973417070726f766564466f72416c6c20666f72206e6f6e6578697374656e74206f776e65724552433732313a20736574417070726f76616c466f72416c6c2063616c6c6572206973206e6f74206578697374656e74206f776e657250546f6b656e3a20676574506f736974696f6e20666f72206e6f6e6578697374656e7420746f6b656e49644552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a2646970667358221220ad99f725f74adb5f942b91938538ca85ebcc6a20aace4fade28fb81ff13f770264736f6c63430007060033

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

000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000007137cc9f252dc405dadc35f597da8b32e865360300000000000000000000000000000000000000000000000000000000000000134465726920506f736974696f6e20546f6b656e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034450540000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : name_ (string): Deri Position Token
Arg [1] : symbol_ (string): DPT
Arg [2] : pool_ (address): 0x7137cc9f252dc405dadc35F597dA8B32e8653603

-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [2] : 0000000000000000000000007137cc9f252dc405dadc35f597da8b32e8653603
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000013
Arg [4] : 4465726920506f736974696f6e20546f6b656e00000000000000000000000000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [6] : 4450540000000000000000000000000000000000000000000000000000000000


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.