ETH Price: $3,502.64 (+1.08%)

Token

Antfarm Positions (ANTPOS)

Overview

Max Total Supply

13,931 ANTPOS

Holders

12,113

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-
Balance
1 ANTPOS
0x04446ebe17164793a1f69480487fb7a9078ae3dd
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information

Contract Source Code Verified (Exact Match)

Contract Name:
AntfarmPosition

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 25 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        _requireMinted(tokenId);

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

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

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

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

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        _requireMinted(tokenId);

        return _tokenApprovals[tokenId];
    }

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

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

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

        _transfer(from, to, tokenId);
    }

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
    }

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

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

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

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

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

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

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

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

        _afterTokenTransfer(address(0), to, tokenId);
    }

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

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

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

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

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

        _afterTokenTransfer(owner, address(0), tokenId);
    }

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

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

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

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

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

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

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

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

pragma solidity ^0.8.0;

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

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 3 of 25 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

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

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

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 5 of 25 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

    /**
     * @dev 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 6 of 25 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

File 7 of 25 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 8 of 25 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 9 of 25 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 10 of 25 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

File 12 of 25 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

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

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

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

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

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 13 of 25 : AntfarmPosition.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;

import "../interfaces/IAntfarmPair.sol";
import "../interfaces/IAntfarmPosition.sol";
import "../interfaces/IAntfarmFactory.sol";
import "../interfaces/IWETH.sol";
import "../libraries/TransferHelper.sol";
import "../utils/AntfarmPositionErrors.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

/// @title NFT positions
/// @notice Wraps Antfarm positions in ERC721
contract AntfarmPosition is IAntfarmPosition, ERC721Enumerable {
    address public immutable factory;
    address public immutable WETH;
    address public immutable antfarmToken;

    using Counters for Counters.Counter;
    Counters.Counter private _positionIds;

    mapping(uint256 => Position) public positions;

    modifier ensure(uint256 deadline) {
        if (deadline < block.timestamp) revert Expired();
        _;
    }

    modifier isOwner(uint256 positionId) {
        // ownerOf will revert if positionId isn't a position owned
        if (msg.sender != ownerOf(positionId)) revert NotOwner();
        _;
    }

    modifier isOwnerOrAllowed(uint256 positionId) {
        // check if sender is owner or delegate, used to claim dividends
        if (
            msg.sender != ownerOf(positionId) &&
            msg.sender != positions[positionId].delegate
        ) revert NotAllowed();
        _;
    }

    constructor(
        address _factory,
        address _WETH,
        address _antfarmToken
    ) ERC721("Antfarm Positions", "ANTPOS") {
        require(_factory != address(0), "NULL_FACTORY_ADDRESS");
        require(_WETH != address(0), "NULL_WETH_ADDRESS");
        require(_antfarmToken != address(0), "NULL_ATF_ADDRESS");
        factory = _factory;
        WETH = _WETH;
        antfarmToken = _antfarmToken;
    }

    receive() external payable {
        assert(msg.sender == WETH); // only accept ETH via fallback from the WETH contract
    }

    /// @notice Create a position in an AntFarmPair. Create an NFT for this position
    /// @param tokenA Token of the AntfarmPair
    /// @param tokenB Token of the AntfarmPair
    /// @param fee Associated fee to the AntFarmPair
    /// @param amountADesired tokenA amount to be added as liquidity
    /// @param amountBDesired tokenB amount to be added as liquidity
    /// @param amountAMin Minimum tokenA amount to be added as liquidity
    /// @param amountBMin Minimum tokenB amount to be added as liquidity
    /// @param to The address to be used to mint the NFT position
    /// @param deadline Unix timestamp after which the transaction will revert
    /// @return amountA tokenA amount added to the AntfarmPair as liquidity
    /// @return amountB tokenB amount added to the AntfarmPair as liquidity
    /// @return liquidity Liquidity minted
    function createPosition(
        address tokenA,
        address tokenB,
        uint16 fee,
        uint256 amountADesired,
        uint256 amountBDesired,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline
    )
        external
        virtual
        ensure(deadline)
        returns (
            uint256 amountA,
            uint256 amountB,
            uint256 liquidity
        )
    {
        address pair = pairFor(tokenA, tokenB, fee);
        _positionIds.increment();
        positions[_positionIds.current()] = Position(
            pair,
            address(0),
            false,
            0,
            0
        );

        (amountA, amountB) = _addLiquidity(
            tokenA,
            tokenB,
            fee,
            amountADesired,
            amountBDesired,
            amountAMin,
            amountBMin
        );

        TransferHelper.safeTransferFrom(tokenA, msg.sender, pair, amountA);
        TransferHelper.safeTransferFrom(tokenB, msg.sender, pair, amountB);

        liquidity = IAntfarmPair(pair).mint(
            address(this),
            _positionIds.current()
        );

        _safeMint(to, _positionIds.current());
        emit Create(
            to,
            _positionIds.current(),
            pair,
            amountA,
            amountB,
            liquidity
        );
    }

    /// @notice Create a position in an AntFarmPair using WETH. Create an NFT for this position
    /// @param token Token of the AntfarmPair
    /// @param fee associated fee to the AntFarmPair
    /// @param amountTokenDesired token amount to be added as liquidity
    /// @param amountTokenMin Minimum token amount to be added as liquidity
    /// @param amountETHMin Minimum ETH amount to be added as liquidity
    /// @param to The address to be used to mint the NFT position
    /// @param deadline Unix timestamp after which the transaction will revert
    /// @return amountToken token amount added to the AntfarmPair as liquidity
    /// @return amountETH ETH amount added to the AntfarmPair as liquidity
    /// @return liquidity Liquidity minted
    function createPositionETH(
        address token,
        uint16 fee,
        uint256 amountTokenDesired,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    )
        external
        payable
        virtual
        ensure(deadline)
        returns (
            uint256 amountToken,
            uint256 amountETH,
            uint256 liquidity
        )
    {
        _positionIds.increment();
        address pair = pairFor(token, WETH, fee);
        positions[_positionIds.current()] = Position(
            pair,
            address(0),
            false,
            0,
            0
        );

        (amountToken, amountETH) = _addLiquidity(
            token,
            WETH,
            fee,
            amountTokenDesired,
            msg.value,
            amountTokenMin,
            amountETHMin
        );

        TransferHelper.safeTransferFrom(token, msg.sender, pair, amountToken);
        IWETH(WETH).deposit{value: amountETH}();
        assert(IWETH(WETH).transfer(pair, amountETH));

        liquidity = IAntfarmPair(pair).mint(
            address(this),
            _positionIds.current()
        );

        _safeMint(to, _positionIds.current());

        // refund dust ETH, if any
        if (msg.value > amountETH)
            TransferHelper.safeTransferETH(msg.sender, msg.value - amountETH);

        emit Create(
            to,
            _positionIds.current(),
            pair,
            amountToken,
            amountETH,
            liquidity
        );
    }

    /// @notice Increase liquidity for an existing position
    /// @param params Predefined parameters struct
    // @param tokenA Base token from the AntfarmPair
    // @param tokenB Quote token from the AntfarmPair
    // @param fee Associated fee to the AntFarmPair
    // @param amountADesired tokenA amount to be added as liquidity
    // @param amountBDesired tokenB amount to be added as liquidity
    // @param amountAMin Minimum tokenA amount to be added as liquidity
    // @param amountBMin Minimum tokenB amount to be added as liquidity
    // @param deadline Unix timestamp after which the transaction will revert
    // @param positionId position ID
    /// @return amountA tokenA amount added to the AntfarmPair as liquidity
    /// @return amountB tokenB amount added to the AntfarmPair as liquidity
    /// @return liquidity Liquidity minted
    function increasePosition(IncreasePositionParams calldata params)
        external
        virtual
        isOwnerOrAllowed(params.positionId)
        ensure(params.deadline)
        returns (
            uint256 amountA,
            uint256 amountB,
            uint256 liquidity
        )
    {
        (amountA, amountB) = _addLiquidity(
            params.tokenA,
            params.tokenB,
            params.fee,
            params.amountADesired,
            params.amountBDesired,
            params.amountAMin,
            params.amountBMin
        );

        address pair = pairFor(params.tokenA, params.tokenB, params.fee);

        TransferHelper.safeTransferFrom(
            params.tokenA,
            msg.sender,
            pair,
            amountA
        );
        TransferHelper.safeTransferFrom(
            params.tokenB,
            msg.sender,
            pair,
            amountB
        );

        liquidity = IAntfarmPair(pair).mint(address(this), params.positionId);

        emit Increase(
            ownerOf(params.positionId),
            params.positionId,
            pair,
            amountA,
            amountB,
            liquidity
        );
    }

    /// @notice Increase liquidity for an existing position for an ETH Antfarmpair
    /// @param params Predefined parameters struct
    // @param token Token from the AntfarmPair
    // @param fee Associated fee to the AntFarmPair
    // @param amountTokenDesired Token amount to be added as liquidity
    // @param amountTokenMin Minimum token amount to be added as liquidity
    // @param amountETHMin Minimum ETH amount to be added as liquidity
    // @param deadline Unix timestamp after which the transaction will revert
    // @param positionId Position ID
    /// @return amountToken Token amount added to the AntfarmPair as liquidity
    /// @return amountETH ETH amount added to the AntfarmPair as liquidity
    /// @return liquidity Liquidity minted
    function increasePositionETH(IncreasePositionETHParams calldata params)
        external
        payable
        virtual
        isOwnerOrAllowed(params.positionId)
        ensure(params.deadline)
        returns (
            uint256 amountToken,
            uint256 amountETH,
            uint256 liquidity
        )
    {
        (amountToken, amountETH) = _addLiquidity(
            params.token,
            WETH,
            params.fee,
            params.amountTokenDesired,
            msg.value,
            params.amountTokenMin,
            params.amountETHMin
        );

        address pair = pairFor(params.token, WETH, params.fee);

        TransferHelper.safeTransferFrom(
            params.token,
            msg.sender,
            pair,
            amountToken
        );
        IWETH(WETH).deposit{value: amountETH}();
        assert(IWETH(WETH).transfer(pair, amountETH));

        liquidity = IAntfarmPair(pair).mint(address(this), params.positionId);
        // refund dust ETH, if any
        if (msg.value > amountETH)
            TransferHelper.safeTransferETH(msg.sender, msg.value - amountETH);

        emit Increase(
            ownerOf(params.positionId),
            params.positionId,
            pair,
            amountToken,
            amountETH,
            liquidity
        );
    }

    /// @notice Enable lock option for a position
    /// @param positionId Position ID to enable lock
    /// @param deadline Unix timestamp after which the transaction will revert
    function enableLock(uint256 positionId, uint256 deadline)
        external
        virtual
        isOwner(positionId)
        ensure(deadline)
    {
        if (positions[positionId].enableLock) revert AlreadyAllowed();
        positions[positionId].enableLock = true;
    }

    /// @notice Disable lock option for a position
    /// @param positionId Position ID to enable lock
    /// @param deadline Unix timestamp after which the transaction will revert
    function disableLock(uint256 positionId, uint256 deadline)
        external
        virtual
        isOwner(positionId)
        ensure(deadline)
    {
        if (!positions[positionId].enableLock) revert AlreadyDisallowed();
        if (positions[positionId].lock > block.timestamp) {
            revert LockedLiquidity();
        }
        positions[positionId].enableLock = false;
    }

    /// @notice Lock a position for a custom period
    /// @param locktime Timestamp until liquidity is locked
    /// @param positionId Position ID to enable lock
    /// @param deadline Unix timestamp after which the transaction will revert
    function lockPosition(
        uint32 locktime,
        uint256 positionId,
        uint256 deadline
    ) external virtual isOwner(positionId) ensure(deadline) {
        if (!positions[positionId].enableLock) revert LockNotAllowed();
        if (
            locktime <= block.timestamp ||
            locktime <= positions[positionId].lock
        ) revert WrongLocktime();
        positions[positionId].lock = locktime;

        emit Lock(msg.sender, positionId, positions[positionId].pair, locktime);
    }

    /// @notice Burn a position NFT if it has no liquidity nor claimable dividends
    /// @param positionId Owner postion ID to burn
    function burn(uint256 positionId) external isOwner(positionId) {
        IAntfarmPair pair = IAntfarmPair(positions[positionId].pair);
        if (pair.getPositionLP(address(this), positionId) != 0) {
            revert LiquidityToClaim();
        }
        if (pair.claimableDividends(address(this), positionId) != 0) {
            revert DividendsToClaim();
        }
        emit Burn(msg.sender, positionId);
        _burn(positionId);
    }

    /// @notice Claim dividends for multiple positions
    /// @param positionIds Owner position IDs array to claim
    /// @return claimedAmount Claimed amount from positions given
    function claimDividendGrouped(uint256[] calldata positionIds)
        external
        returns (uint256 claimedAmount)
    {
        uint256 positionsLength = positionIds.length;
        for (uint256 i; i < positionsLength; ++i) {
            claimedAmount = claimedAmount + claimDividend(positionIds[i]);
        }
    }

    function setDelegate(uint256 positionId, address delegate)
        public
        isOwner(positionId)
    {
        positions[positionId].delegate = delegate;
    }

    function setDelegates(uint256[] calldata positionIds, address delegate)
        external
    {
        uint256 numPositions = positionIds.length;

        for (uint256 i; i < numPositions; ++i) {
            setDelegate(positionIds[i], delegate);
        }
    }

    function getPositionsDetails(uint256[] calldata positionIds)
        external
        view
        returns (PositionDetails[] memory)
    {
        PositionDetails[] memory positionsDetails = new PositionDetails[](
            positionIds.length
        );
        for (uint256 i; i < positionIds.length; ++i) {
            positionsDetails[i] = getPositionDetails(positionIds[i]);
        }

        return positionsDetails;
    }

    function getPositionDetails(uint256 positionId)
        public
        view
        returns (PositionDetails memory positionDetails)
    {
        Position memory position = positions[positionId];
        IAntfarmPair pair = IAntfarmPair(position.pair);

        uint256 lp = pair.getPositionLP(address(this), positionId);
        (uint256 reserve0, uint256 reserve1, ) = pair.getReserves();

        uint256 positionReserve0 = (lp * reserve0) / pair.totalSupply();
        uint256 positionReserve1 = (lp * reserve1) / pair.totalSupply();

        positionDetails = PositionDetails(
            positionId, // uint256 id;
            ownerOf(positionId), // address owner;
            position.delegate, // address delegate;
            position.pair, // address pair;
            pair.token0(), // address token0;
            pair.token1(), // address token1;
            lp, // uint256 lp;
            positionReserve0, // uint256 reserve0;
            positionReserve1, // uint256 reserve1;
            getDividend(positionId), // uint256 dividend;
            position.claimedAmount, // uint256 cumulatedDividend;
            pair.fee(), // uint16 fee;
            position.enableLock, // bool enableLock;
            position.lock // uint32 lock;
        );
    }

    /// @notice Get dividend for each position given
    /// @param owner Positions's owner
    /// @return uint[] Positions IDs
    /// @return uint[] Dividends
    function getDividendPerPosition(address owner)
        external
        view
        returns (uint256[] memory, uint256[] memory)
    {
        uint256[] memory positionIds = getPositionsIds(owner);
        uint256[] memory dividends = new uint256[](positionIds.length);

        uint256 positionsLength = positionIds.length;
        for (uint256 i; i < positionsLength; ++i) {
            dividends[i] = getDividend(positionIds[i]);
        }

        return (positionIds, dividends);
    }

    /// @notice Decrease LP for a position
    /// @param params Predefined parameters struct
    // @param tokenA Base token from the AntfarmPair
    // @param tokenB Quote token from the AntfarmPair
    // @param fee Associated fee to the AntFarmPair
    // @param liquidity Liquidity to be burned
    // @param amountAMin Minimum tokenA amount to be withdrawn from the position
    // @param amountBMin Minimum tokenB amount to be withdrawn from the position
    // @param to Address owner associated to the position
    // @param deadline Unix timestamp after which the transaction will revert
    // @param positionId Position ID
    /// @return amountA tokenA amount received
    /// @return amountB tokenB amount received
    function decreasePosition(DecreasePositionParams calldata params)
        external
        virtual
        isOwner(params.positionId)
        ensure(params.deadline)
        returns (uint256 amountA, uint256 amountB)
    {
        if (block.timestamp <= positions[params.positionId].lock) {
            revert LockedLiquidity();
        }

        (uint256 amount0, uint256 amount1) = IAntfarmPair(
            pairFor(params.tokenA, params.tokenB, params.fee)
        ).burn(params.to, params.positionId, params.liquidity);
        (address token0, ) = sortTokens(params.tokenA, params.tokenB);
        (amountA, amountB) = params.tokenA == token0
            ? (amount0, amount1)
            : (amount1, amount0);
        if (amountA < params.amountAMin) revert InsufficientAAmount();
        if (amountB < params.amountBMin) revert InsufficientBAmount();

        emit Decrease(
            msg.sender,
            params.positionId,
            positions[params.positionId].pair,
            amountA,
            amountB,
            params.liquidity
        );
    }

    /// @notice Decrease LP for a position in an AntFarmPair with ETH
    /// @param params Predefined parameters struct
    // @param token Token from the AntfarmPair
    // @param fee Associated fee to the AntFarmPair
    // @param liquidity Liquidity to be burned
    // @param amountTokenMin Minimum token amount to be withdrawn from the position
    // @param amountETHMin Minimum ETH amount to be withdrawn from the position
    // @param to Address owner associated to the position
    // @param deadline Unix timestamp after which the transaction will revert
    // @param positionId Position ID
    /// @return amountToken Token amount received
    /// @return amountETH ETH amount received
    function decreasePositionETH(DecreasePositionETHParams calldata params)
        external
        isOwner(params.positionId)
        ensure(params.deadline)
        returns (uint256 amountToken, uint256 amountETH)
    {
        if (block.timestamp <= positions[params.positionId].lock) {
            revert LockedLiquidity();
        }

        (uint256 amount0, uint256 amount1) = IAntfarmPair(
            pairFor(params.token, WETH, params.fee)
        ).burn(address(this), params.positionId, params.liquidity);
        (address token0, ) = sortTokens(params.token, WETH);
        (amountToken, amountETH) = params.token == token0
            ? (amount0, amount1)
            : (amount1, amount0);
        if (amountToken < params.amountTokenMin) revert InsufficientAAmount();
        if (amountETH < params.amountETHMin) revert InsufficientBAmount();

        TransferHelper.safeTransfer(params.token, params.to, amountToken);
        IWETH(WETH).withdraw(amountETH);
        TransferHelper.safeTransferETH(params.to, amountETH);

        emit Decrease(
            msg.sender,
            params.positionId,
            positions[params.positionId].pair,
            amountToken,
            amountETH,
            params.liquidity
        );
    }

    function _baseURI() internal view virtual override returns (string memory) {
        uint256 chainId = block.chainid;
        return
            string(
                abi.encodePacked(
                    "https://metadata.antfarm.finance/positions/",
                    Strings.toString(chainId),
                    "/"
                )
            );
    }

    /// @notice Claim dividend for a position
    /// @param positionId Position ID to claim
    /// @return claimedAmount Dividend amount claimed
    function claimDividend(uint256 positionId)
        public
        isOwnerOrAllowed(positionId)
        returns (uint256 claimedAmount)
    {
        IAntfarmPair pair = IAntfarmPair(positions[positionId].pair);
        positions[positionId].claimedAmount += pair.claimableDividends(
            address(this),
            positionId
        );
        claimedAmount = pair.claimDividend(msg.sender, positionId);
        emit Claim(
            ownerOf(positionId),
            positionId,
            positions[positionId].pair,
            claimedAmount
        );
    }

    /// @notice Get all position IDs for an address
    /// @param owner Owner address
    /// @return positionIds Position IDs array associated with the owner address
    function getPositionsIds(address owner)
        public
        view
        returns (uint256[] memory positionIds)
    {
        uint256 balance = balanceOf(owner);
        positionIds = new uint256[](balance);

        for (uint256 i; i < balance; ++i) {
            positionIds[i] = tokenOfOwnerByIndex(owner, i);
        }
    }

    // ADD LIQUIDITY
    function _addLiquidity(
        address tokenA,
        address tokenB,
        uint16 fee,
        uint256 amountADesired,
        uint256 amountBDesired,
        uint256 amountAMin,
        uint256 amountBMin
    ) internal virtual returns (uint256 amountA, uint256 amountB) {
        // create pair if it doesn't exist
        if (
            IAntfarmFactory(factory).getPair(tokenA, tokenB, fee) == address(0)
        ) {
            IAntfarmFactory(factory).createPair(tokenA, tokenB, fee);
        }
        (uint256 reserveA, uint256 reserveB) = getReserves(tokenA, tokenB, fee);
        if (reserveA == 0 && reserveB == 0) {
            // pool is a new one
            (amountA, amountB) = (amountADesired, amountBDesired);
        } else {
            uint256 amountBOptimal = quote(amountADesired, reserveA, reserveB);
            if (amountBOptimal <= amountBDesired) {
                if (amountBOptimal < amountBMin) revert InsufficientBAmount();
                (amountA, amountB) = (amountADesired, amountBOptimal);
            } else {
                uint256 amountAOptimal = quote(
                    amountBDesired,
                    reserveB,
                    reserveA
                );
                assert(amountAOptimal <= amountADesired);
                if (amountAOptimal < amountAMin) revert InsufficientAAmount();
                (amountA, amountB) = (amountAOptimal, amountBDesired);
            }
        }
    }

    /// @notice Get the dividend of a single position
    /// @param positionId Position ID
    /// @return dividend Dividends owed
    function getDividend(uint256 positionId)
        internal
        view
        returns (uint256 dividend)
    {
        IAntfarmPair pair = IAntfarmPair(positions[positionId].pair);
        dividend = pair.claimableDividends(address(this), positionId);
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 positionId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, positionId);
        positions[positionId].delegate = address(0);
    }

    // **** LIBRARY FUNCTIONS ADDED INTO THE CONTRACT ****
    // returns sorted token addresses, used to handle return values from pairs sorted in this order
    function sortTokens(address tokenA, address tokenB)
        internal
        view
        returns (address token0, address token1)
    {
        if (tokenA == tokenB) revert IdenticalAddresses();
        if (tokenA == antfarmToken || tokenB == antfarmToken) {
            (token0, token1) = tokenA == antfarmToken
                ? (antfarmToken, tokenB)
                : (antfarmToken, tokenA);
            if (token1 == address(0)) revert ZeroAddress();
        } else {
            (token0, token1) = tokenA < tokenB
                ? (tokenA, tokenB)
                : (tokenB, tokenA);
            if (token0 == address(0)) revert ZeroAddress();
        }
    }

    // calculates the CREATE2 address for a pair without making any external calls
    function pairFor(
        address tokenA,
        address tokenB,
        uint16 fee
    ) internal view returns (address pair) {
        (address token0, address token1) = sortTokens(tokenA, tokenB);
        pair = address(
            uint160(
                uint256(
                    keccak256(
                        abi.encodePacked(
                            hex"ff",
                            factory,
                            keccak256(
                                abi.encodePacked(
                                    token0,
                                    token1,
                                    fee,
                                    antfarmToken
                                )
                            ),
                            token0 == antfarmToken
                                ? hex"99c189a5ef3d337612cf0ce2bd055546e23b91fea9e9e54201b23f14d763f333" // AtfPair init code hash
                                : hex"3b29ecd4cb06592a81cac4799fb24ef6a176fe95ecb50f304972882b150f3f3a" // Pair init code hash
                        )
                    )
                )
            )
        );
    }

    // fetches and sorts the reserves for a pair
    function getReserves(
        address tokenA,
        address tokenB,
        uint16 fee
    ) internal view returns (uint256 reserveA, uint256 reserveB) {
        (address token0, ) = sortTokens(tokenA, tokenB);
        (uint256 reserve0, uint256 reserve1, ) = IAntfarmPair(
            pairFor(tokenA, tokenB, fee)
        ).getReserves();
        (reserveA, reserveB) = tokenA == token0
            ? (reserve0, reserve1)
            : (reserve1, reserve0);
    }

    // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
    function quote(
        uint256 amountA,
        uint256 reserveA,
        uint256 reserveB
    ) internal pure returns (uint256) {
        if (amountA == 0) revert InsufficientAmount();
        if (reserveA == 0 || reserveB == 0) revert InsufficientLiquidity();
        return (amountA * reserveB) / reserveA;
    }
}

File 14 of 25 : IAntfarmBase.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;

import "./pair/IAntfarmPairState.sol";
import "./pair/IAntfarmPairEvents.sol";
import "./pair/IAntfarmPairActions.sol";
import "./pair/IAntfarmPairDerivedState.sol";

interface IAntfarmBase is
    IAntfarmPairState,
    IAntfarmPairEvents,
    IAntfarmPairActions,
    IAntfarmPairDerivedState
{}

File 15 of 25 : IAntfarmFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;

interface IAntfarmFactory {
    event PairCreated(
        address indexed token0,
        address indexed token1,
        address pair,
        uint16 fee,
        uint256 allPairsLength
    );

    function possibleFees(uint256) external view returns (uint16);

    function allPairs(uint256) external view returns (address);

    function antfarmToken() external view returns (address);

    function getPairs(uint256 startIndex, uint256 numOfPairs)
        external
        view
        returns (address[] memory, uint256);

    function getPair(
        address tokenA,
        address tokenB,
        uint16 fee
    ) external view returns (address pair);

    function feesForPair(
        address tokenA,
        address tokenB,
        uint256
    ) external view returns (uint16);

    function getFeesForPair(address tokenA, address tokenB)
        external
        view
        returns (uint16[8] memory fees);

    function allPairsLength() external view returns (uint256);

    function createPair(
        address tokenA,
        address tokenB,
        uint16 fee
    ) external returns (address pair);
}

File 16 of 25 : IAntfarmPair.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;

import "./IAntfarmBase.sol";

interface IAntfarmPair is IAntfarmBase {
    /// @notice Initialize the pair
    /// @dev Can only be called by the factory
    function initialize(
        address,
        address,
        uint16,
        address
    ) external;

    /// @notice The Antfarm token address
    /// @return address Address
    function antfarmToken() external view returns (address);

    /// @notice The Oracle instance used to compute swap's fees
    /// @return AntfarmOracle Oracle instance
    function antfarmOracle() external view returns (address);

    /// @notice Calcul fee to pay
    /// @param amount0Out The token0 amount going out of the pool
    /// @param amount0In The token0 amount going in the pool
    /// @param amount1Out The token1 amount going out of the pool
    /// @param amount1In The token1 amount going in the pool
    /// @return feeToPay Calculated fee to be paid
    function getFees(
        uint256 amount0Out,
        uint256 amount0In,
        uint256 amount1Out,
        uint256 amount1In
    ) external view returns (uint256 feeToPay);

    /// @notice Check for the best Oracle to use to perform fee calculation for a swap
    /// @dev Returns address(0) if no better oracle is found.
    /// @param maxReserve Actual oracle reserve0
    /// @return bestOracle Address from the best oracle found
    function scanOracles(uint112 maxReserve)
        external
        view
        returns (address bestOracle);

    /// @notice Update oracle for token
    /// @custom:usability Update the current Oracle with a more suitable one. Revert if the current Oracle is already the more suitable
    function updateOracle() external;
}

File 17 of 25 : IAntfarmPosition.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;

interface IAntfarmPosition {
    event Create(
        address owner,
        uint256 positionId,
        address pair,
        uint256 amountA,
        uint256 amountB,
        uint256 liquidity
    );

    event Increase(
        address owner,
        uint256 positionId,
        address pair,
        uint256 amountA,
        uint256 amountB,
        uint256 liquidity
    );

    event Decrease(
        address owner,
        uint256 positionId,
        address pair,
        uint256 amountA,
        uint256 amountB,
        uint256 liquidity
    );

    event Claim(
        address owner,
        uint256 positionId,
        address pair,
        uint256 amount
    );

    event Lock(
        address owner,
        uint256 positionId,
        address pair,
        uint256 locktime
    );

    event Burn(address owner, uint256 positionId);

    struct Position {
        address pair;
        address delegate;
        bool enableLock;
        uint32 lock;
        uint256 claimedAmount;
    }

    function factory() external view returns (address);

    function WETH() external view returns (address);

    function antfarmToken() external view returns (address);

    struct PositionDetails {
        uint256 id;
        address owner;
        address delegate;
        address pair;
        address token0;
        address token1;
        uint256 lp;
        uint256 reserve0;
        uint256 reserve1;
        uint256 dividend;
        uint256 cumulatedDividend;
        uint16 fee;
        bool enableLock;
        uint32 lock;
    }

    function getPositionDetails(uint256 positionId)
        external
        view
        returns (PositionDetails memory positionDetails);

    function getPositionsDetails(uint256[] calldata positionIds)
        external
        view
        returns (PositionDetails[] memory positionsDetails);

    function createPosition(
        address tokenA,
        address tokenB,
        uint16 fee,
        uint256 amountADesired,
        uint256 amountBDesired,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline
    )
        external
        returns (
            uint256 amountA,
            uint256 amountB,
            uint256 liquidity
        );

    function createPositionETH(
        address token,
        uint16 fee,
        uint256 amountTokenDesired,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    )
        external
        payable
        returns (
            uint256 amountToken,
            uint256 amountETH,
            uint256 liquidity
        );

    struct IncreasePositionParams {
        address tokenA;
        address tokenB;
        uint16 fee;
        uint256 amountADesired;
        uint256 amountBDesired;
        uint256 amountAMin;
        uint256 amountBMin;
        uint256 deadline;
        uint256 positionId;
    }

    function increasePosition(IncreasePositionParams calldata params)
        external
        returns (
            uint256 amountA,
            uint256 amountB,
            uint256 liquidity
        );

    struct IncreasePositionETHParams {
        address token;
        uint16 fee;
        uint256 amountTokenDesired;
        uint256 amountTokenMin;
        uint256 amountETHMin;
        uint256 deadline;
        uint256 positionId;
    }

    function increasePositionETH(IncreasePositionETHParams calldata params)
        external
        payable
        returns (
            uint256 amountToken,
            uint256 amountETH,
            uint256 liquidity
        );

    function enableLock(uint256 positionId, uint256 deadline) external;

    function disableLock(uint256 positionId, uint256 deadline) external;

    function lockPosition(
        uint32 locktime,
        uint256 positionId,
        uint256 deadline
    ) external;

    function burn(uint256 positionId) external;

    function claimDividendGrouped(uint256[] calldata positionIds)
        external
        returns (uint256 claimedAmount);

    function getDividendPerPosition(address owner)
        external
        view
        returns (uint256[] memory, uint256[] memory);

    struct DecreasePositionParams {
        address tokenA;
        address tokenB;
        uint16 fee;
        uint256 liquidity;
        uint256 amountAMin;
        uint256 amountBMin;
        address to;
        uint256 deadline;
        uint256 positionId;
    }

    function decreasePosition(DecreasePositionParams calldata params)
        external
        returns (uint256 amountA, uint256 amountB);

    struct DecreasePositionETHParams {
        address token;
        uint16 fee;
        uint256 liquidity;
        uint256 amountTokenMin;
        uint256 amountETHMin;
        address to;
        uint256 deadline;
        uint256 positionId;
    }

    function decreasePositionETH(DecreasePositionETHParams calldata params)
        external
        returns (uint256 amountToken, uint256 amountETH);

    function claimDividend(uint256 positionId)
        external
        returns (uint256 claimedAmount);

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

File 18 of 25 : IAntfarmToken.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;

interface IAntfarmToken {
    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function decimals() external view returns (uint8);

    function totalSupply() external view returns (uint256);

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

    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    function nonces(address owner) external view returns (uint256);

    function approve(address spender, uint256 amount) external returns (bool);

    function transfer(address recipient, uint256 amount)
        external
        returns (bool);

    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    function DOMAIN_SEPARATOR() external view returns (bytes32);

    function burn(uint256 _amount) external;
}

File 19 of 25 : IWETH.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;

interface IWETH {
    function deposit() external payable;

    function transfer(address to, uint256 value) external returns (bool);

    function withdraw(uint256) external;
}

File 20 of 25 : IAntfarmPairActions.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;

interface IAntfarmPairActions {
    /// @notice Mint liquidity for a specific position
    /// @dev Low-level function. Should be called from another contract which performs all necessary checks
    /// @param to The address to mint liquidity
    /// @param positionId The ID to store the position to allow multiple positions for a single address
    /// @return liquidity Minted liquidity
    function mint(address to, uint256 positionId)
        external
        returns (uint256 liquidity);

    /// @notice Burn liquidity from a specific position
    /// @dev Low-level function. Should be called from another contract which performs all necessary checks
    /// @param to The address to return the liquidity to
    /// @param positionId The ID of the position to burn liquidity from
    /// @param liquidity Liquidity amount to be burned
    /// @return amount0 The token0 amount received from the liquidity burn
    /// @return amount1 The token1 amount received from the liquidity burn
    function burn(
        address to,
        uint256 liquidity,
        uint256 positionId
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Swap tokens
    /// @dev Low-level function. Should be called from another contract which performs all necessary checks
    /// @param amount0Out token0 amount to be swapped
    /// @param amount1Out token1 amount to be swapped
    /// @param to The address to send the swapped tokens
    function swap(
        uint256 amount0Out,
        uint256 amount1Out,
        address to
    ) external;

    /// @notice Force balances to match reserves
    /// @param to The address to send excessive tokens
    function skim(address to) external;

    /// @notice Force reserves to match balances
    function sync() external;

    /// @notice Claim dividends for a specific position
    /// @param to The address to receive claimed dividends
    /// @param positionId The ID of the position to claim
    /// @return claimedAmount The amount claimed
    function claimDividend(address to, uint256 positionId)
        external
        returns (uint256 claimedAmount);
}

File 21 of 25 : IAntfarmPairDerivedState.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;

interface IAntfarmPairDerivedState {
    /// @notice Get position LP tokens
    /// @param operator Position owner
    /// @param positionId ID of the position
    /// @return uint128 LP tokens owned by the operator
    function getPositionLP(address operator, uint256 positionId)
        external
        view
        returns (uint128);

    /// @notice Get pair reserves
    /// @return reserve0 Reserve for token0
    /// @return reserve1 Reserve for token1
    /// @return blockTimestampLast Last block proceeded
    function getReserves()
        external
        view
        returns (
            uint112 reserve0,
            uint112 reserve1,
            uint32 blockTimestampLast
        );

    /// @notice Get Dividend from a specific position
    /// @param operator The address used to get dividends
    /// @param positionId Specific position
    /// @return amount Dividends owned by the address
    function claimableDividends(address operator, uint256 positionId)
        external
        view
        returns (uint256 amount);
}

File 22 of 25 : IAntfarmPairEvents.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;

interface IAntfarmPairEvents {
    /// @notice Emitted when a position's liquidity is removed
    /// @param sender The address that initiated the burn call
    /// @param amount0 The amount of token0 withdrawn
    /// @param amount1 The amount of token1 withdrawn
    /// @param to The address to send token0 & token1
    event Burn(
        address indexed sender,
        uint256 amount0,
        uint256 amount1,
        address indexed to
    );

    /// @notice Emitted when liquidity is minted for a given position
    /// @param sender The address that initiated the mint call
    /// @param amount0 Required token0 for the minted liquidity
    /// @param amount1 Required token1 for the minted liquidity
    event Mint(address indexed sender, uint256 amount0, uint256 amount1);

    /// @notice Emitted by the pool for any swaps between token0 and token1
    /// @param sender The address that initiated the swap call
    /// @param amount0In Amount of token0 sent to the pair
    /// @param amount1In Amount of token1 sent to the pair
    /// @param amount0Out Amount of token0 going out of the pair
    /// @param amount1Out Amount of token1 going out of the pair
    /// @param to Address to transfer the swapped amount
    event Swap(
        address indexed sender,
        uint256 amount0In,
        uint256 amount1In,
        uint256 amount0Out,
        uint256 amount1Out,
        address indexed to
    );

    /// @notice Emitted by the pool for any call to Sync function
    /// @param reserve0 reserve0 updated from the pair
    /// @param reserve1 reserve1 updated from the pair
    event Sync(uint112 reserve0, uint112 reserve1);
}

File 23 of 25 : IAntfarmPairState.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;
import "../IAntfarmToken.sol";

interface IAntfarmPairState {
    /// @notice The contract that deployed the AntfarmPair, which must adhere to the IAntfarmFactory interface
    /// @return address The contract address
    function factory() external view returns (address);

    /// @notice The first of the two tokens of the AntfarmPair, sorted by address
    /// @return address The token contract address
    function token0() external view returns (address);

    /// @notice The second of the two tokens of the AntfarmPair, sorted by address
    /// @return address The token contract address
    function token1() external view returns (address);

    /// @notice Fee associated to the AntfarmPair instance
    /// @return uint16 Fee
    function fee() external view returns (uint16);

    /// @notice The LP tokens total circulating supply
    /// @return uint Total LP tokens
    function totalSupply() external view returns (uint256);

    /// @notice The AntFarmPair AntFarm's tokens cumulated fees
    /// @return uint Total Antfarm tokens
    function antfarmTokenReserve() external view returns (uint256);
}

File 24 of 25 : TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity =0.8.10;

// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes("approve(address,uint256)")));
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(0x095ea7b3, to, value)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "TransferHelper::safeApprove: approve failed"
        );
    }

    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes("transfer(address,uint256)")));
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(0xa9059cbb, to, value)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "TransferHelper::safeTransfer: transfer failed"
        );
    }

    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes("transferFrom(address,address,uint256)")));
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(0x23b872dd, from, to, value)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "TransferHelper::transferFrom: transferFrom failed"
        );
    }

    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(
            success,
            "TransferHelper::safeTransferETH: ETH transfer failed"
        );
    }
}

File 25 of 25 : AntfarmPositionErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;

error Expired();
error NotOwner();
error NotAllowed();
error AlreadyAllowed();
error AlreadyDisallowed();
error LockedLiquidity();
error LockNotAllowed();
error WrongLocktime();
error LiquidityToClaim();
error DividendsToClaim();
error InsufficientAAmount();
error InsufficientBAmount();
error IdenticalAddresses();
error ZeroAddress();
error InsufficientAmount();
error InsufficientLiquidity();

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH","type":"address"},{"internalType":"address","name":"_antfarmToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyAllowed","type":"error"},{"inputs":[],"name":"AlreadyDisallowed","type":"error"},{"inputs":[],"name":"DividendsToClaim","type":"error"},{"inputs":[],"name":"Expired","type":"error"},{"inputs":[],"name":"IdenticalAddresses","type":"error"},{"inputs":[],"name":"InsufficientAAmount","type":"error"},{"inputs":[],"name":"InsufficientAmount","type":"error"},{"inputs":[],"name":"InsufficientBAmount","type":"error"},{"inputs":[],"name":"InsufficientLiquidity","type":"error"},{"inputs":[],"name":"LiquidityToClaim","type":"error"},{"inputs":[],"name":"LockNotAllowed","type":"error"},{"inputs":[],"name":"LockedLiquidity","type":"error"},{"inputs":[],"name":"NotAllowed","type":"error"},{"inputs":[],"name":"NotOwner","type":"error"},{"inputs":[],"name":"WrongLocktime","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"positionId","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"positionId","type":"uint256"},{"indexed":false,"internalType":"address","name":"pair","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"positionId","type":"uint256"},{"indexed":false,"internalType":"address","name":"pair","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountA","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountB","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"liquidity","type":"uint256"}],"name":"Create","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"positionId","type":"uint256"},{"indexed":false,"internalType":"address","name":"pair","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountA","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountB","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"liquidity","type":"uint256"}],"name":"Decrease","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"positionId","type":"uint256"},{"indexed":false,"internalType":"address","name":"pair","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountA","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountB","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"liquidity","type":"uint256"}],"name":"Increase","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"positionId","type":"uint256"},{"indexed":false,"internalType":"address","name":"pair","type":"address"},{"indexed":false,"internalType":"uint256","name":"locktime","type":"uint256"}],"name":"Lock","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"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"antfarmToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"positionId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"positionId","type":"uint256"}],"name":"claimDividend","outputs":[{"internalType":"uint256","name":"claimedAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"positionIds","type":"uint256[]"}],"name":"claimDividendGrouped","outputs":[{"internalType":"uint256","name":"claimedAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint16","name":"fee","type":"uint16"},{"internalType":"uint256","name":"amountADesired","type":"uint256"},{"internalType":"uint256","name":"amountBDesired","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"createPosition","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint16","name":"fee","type":"uint16"},{"internalType":"uint256","name":"amountTokenDesired","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"createPositionETH","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint16","name":"fee","type":"uint16"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"positionId","type":"uint256"}],"internalType":"struct IAntfarmPosition.DecreasePositionParams","name":"params","type":"tuple"}],"name":"decreasePosition","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint16","name":"fee","type":"uint16"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"positionId","type":"uint256"}],"internalType":"struct IAntfarmPosition.DecreasePositionETHParams","name":"params","type":"tuple"}],"name":"decreasePositionETH","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"positionId","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"disableLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"positionId","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"enableLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"getDividendPerPosition","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"positionId","type":"uint256"}],"name":"getPositionDetails","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"address","name":"pair","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint256","name":"lp","type":"uint256"},{"internalType":"uint256","name":"reserve0","type":"uint256"},{"internalType":"uint256","name":"reserve1","type":"uint256"},{"internalType":"uint256","name":"dividend","type":"uint256"},{"internalType":"uint256","name":"cumulatedDividend","type":"uint256"},{"internalType":"uint16","name":"fee","type":"uint16"},{"internalType":"bool","name":"enableLock","type":"bool"},{"internalType":"uint32","name":"lock","type":"uint32"}],"internalType":"struct IAntfarmPosition.PositionDetails","name":"positionDetails","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"positionIds","type":"uint256[]"}],"name":"getPositionsDetails","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"address","name":"pair","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint256","name":"lp","type":"uint256"},{"internalType":"uint256","name":"reserve0","type":"uint256"},{"internalType":"uint256","name":"reserve1","type":"uint256"},{"internalType":"uint256","name":"dividend","type":"uint256"},{"internalType":"uint256","name":"cumulatedDividend","type":"uint256"},{"internalType":"uint16","name":"fee","type":"uint16"},{"internalType":"bool","name":"enableLock","type":"bool"},{"internalType":"uint32","name":"lock","type":"uint32"}],"internalType":"struct IAntfarmPosition.PositionDetails[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getPositionsIds","outputs":[{"internalType":"uint256[]","name":"positionIds","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint16","name":"fee","type":"uint16"},{"internalType":"uint256","name":"amountADesired","type":"uint256"},{"internalType":"uint256","name":"amountBDesired","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"positionId","type":"uint256"}],"internalType":"struct IAntfarmPosition.IncreasePositionParams","name":"params","type":"tuple"}],"name":"increasePosition","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint16","name":"fee","type":"uint16"},{"internalType":"uint256","name":"amountTokenDesired","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"positionId","type":"uint256"}],"internalType":"struct IAntfarmPosition.IncreasePositionETHParams","name":"params","type":"tuple"}],"name":"increasePositionETH","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"payable","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":"uint32","name":"locktime","type":"uint32"},{"internalType":"uint256","name":"positionId","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"lockPosition","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":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"positions","outputs":[{"internalType":"address","name":"pair","type":"address"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"bool","name":"enableLock","type":"bool"},{"internalType":"uint32","name":"lock","type":"uint32"},{"internalType":"uint256","name":"claimedAmount","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":"uint256","name":"positionId","type":"uint256"},{"internalType":"address","name":"delegate","type":"address"}],"name":"setDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"positionIds","type":"uint256[]"},{"internalType":"address","name":"delegate","type":"address"}],"name":"setDelegates","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":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"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"},{"stateMutability":"payable","type":"receive"}]

60e06040523480156200001157600080fd5b506040516200580438038062005804833981016040819052620000349162000278565b6040805180820182526011815270416e746661726d20506f736974696f6e7360781b602080830191825283518085019094526006845265414e54504f5360d01b9084015281519192916200008b91600091620001b5565b508051620000a1906001906020840190620001b5565b5050506001600160a01b038316620001005760405162461bcd60e51b815260206004820152601460248201527f4e554c4c5f464143544f52595f4144445245535300000000000000000000000060448201526064015b60405180910390fd5b6001600160a01b0382166200014c5760405162461bcd60e51b81526020600482015260116024820152704e554c4c5f574554485f4144445245535360781b6044820152606401620000f7565b6001600160a01b038116620001975760405162461bcd60e51b815260206004820152601060248201526f4e554c4c5f4154465f4144445245535360801b6044820152606401620000f7565b6001600160a01b0392831660805290821660a0521660c052620002ff565b828054620001c390620002c2565b90600052602060002090601f016020900481019282620001e7576000855562000232565b82601f106200020257805160ff191683800117855562000232565b8280016001018555821562000232579182015b828111156200023257825182559160200191906001019062000215565b506200024092915062000244565b5090565b5b8082111562000240576000815560010162000245565b80516001600160a01b03811681146200027357600080fd5b919050565b6000806000606084860312156200028e57600080fd5b62000299846200025b565b9250620002a9602085016200025b565b9150620002b9604085016200025b565b90509250925092565b600181811c90821680620002d757607f821691505b60208210811415620002f957634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c051615442620003c26000396000818161078201528181613177015281816131e00152818161330e0152818161334901528181613384015281816133bd01526133e40152600081816102990152818161072e01528181611418015281816115200152818161155c015281816115f101528181611aab01528181611b8b01528181611c8501528181612b9e01528181612c0d0152612ca20152600081816107b6015281816131a50152818161380901526138cf01526154426000f3fe6080604052600436106102895760003560e01c80637cfbd7cc11610153578063b88d4fde116100cb578063d8afab351161007f578063e985e9c511610064578063e985e9c514610865578063ec648265146108ae578063f256135a146108c157600080fd5b8063d8afab3514610825578063e245be441461084557600080fd5b8063c45a0155116100b0578063c45a0155146107a4578063c87b56dd146107d8578063d4630d86146107f857600080fd5b8063b88d4fde14610750578063c12a00a81461077057600080fd5b80639abd357211610122578063a22cb46511610107578063a22cb465146106dc578063a3869587146106fc578063ad5c46481461071c57600080fd5b80639abd35721461068f5780639ecceb5e146106af57600080fd5b80637cfbd7cc1461059957806394dcf2e6146105b957806395d89b41146105d957806399fbab88146105ee57600080fd5b806330f7b1f41161020157806356b70392116101b55780636352211e1161019a5780636352211e1461052c57806370a082311461054c57806376a65a9e1461056c57600080fd5b806356b70392146104ec5780635a4f40e41461050c57600080fd5b806342966c68116101e657806342966c68146104995780634c07c08c146104b95780634f6ccce7146104cc57600080fd5b806330f7b1f41461044b57806342842e0e1461047957600080fd5b8063095ea7b31161025857806323b872dd1161023d57806323b872dd146103d05780632f4bb652146103f05780632f745c591461042b57600080fd5b8063095ea7b31461039157806318160ddd146103b157600080fd5b806301ffc9a7146102cd57806303c126991461030257806306fdde0314610337578063081812fc1461035957600080fd5b366102c857336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146102c6576102c6614895565b005b600080fd5b3480156102d957600080fd5b506102ed6102e83660046148c1565b6108e1565b60405190151581526020015b60405180910390f35b34801561030e57600080fd5b5061032261031d3660046148f7565b610925565b604080519283526020830191909152016102f9565b34801561034357600080fd5b5061034c610bd6565b6040516102f9919061496c565b34801561036557600080fd5b5061037961037436600461497f565b610c68565b6040516001600160a01b0390911681526020016102f9565b34801561039d57600080fd5b506102c66103ac3660046149ad565b610c8f565b3480156103bd57600080fd5b506008545b6040519081526020016102f9565b3480156103dc57600080fd5b506102c66103eb3660046149d9565b610dc6565b3480156103fc57600080fd5b5061041061040b3660046148f7565b610e4d565b604080519384526020840192909252908201526060016102f9565b34801561043757600080fd5b506103c26104463660046149ad565b611069565b34801561045757600080fd5b5061046b610466366004614a1a565b611111565b6040516102f9929190614a72565b34801561048557600080fd5b506102c66104943660046149d9565b6111d2565b3480156104a557600080fd5b506102c66104b436600461497f565b6111ed565b6104106104c7366004614ab0565b6113db565b3480156104d857600080fd5b506103c26104e736600461497f565b61179f565b3480156104f857600080fd5b506102c6610507366004614b34565b611843565b34801561051857600080fd5b50610322610527366004614b69565b6119eb565b34801561053857600080fd5b5061037961054736600461497f565b611d77565b34801561055857600080fd5b506103c2610567366004614a1a565b611ddc565b34801561057857600080fd5b5061058c610587366004614a1a565b611e76565b6040516102f99190614b7c565b3480156105a557600080fd5b506102c66105b4366004614b8f565b611f13565b3480156105c557600080fd5b506102c66105d4366004614bb1565b611fea565b3480156105e557600080fd5b5061034c612057565b3480156105fa57600080fd5b5061065161060936600461497f565b600b602052600090815260409020805460018201546002909201546001600160a01b039182169291821691600160a01b810460ff1691600160a81b90910463ffffffff169085565b604080516001600160a01b0396871681529590941660208601529115159284019290925263ffffffff9091166060830152608082015260a0016102f9565b34801561069b57600080fd5b506103c26106aa36600461497f565b612066565b3480156106bb57600080fd5b506106cf6106ca36600461497f565b612272565b6040516102f99190614cd4565b3480156106e857600080fd5b506102c66106f7366004614cf1565b61272e565b34801561070857600080fd5b506102c6610717366004614b8f565b61273d565b34801561072857600080fd5b506103797f000000000000000000000000000000000000000000000000000000000000000081565b34801561075c57600080fd5b506102c661076b366004614d35565b61284d565b34801561077c57600080fd5b506103797f000000000000000000000000000000000000000000000000000000000000000081565b3480156107b057600080fd5b506103797f000000000000000000000000000000000000000000000000000000000000000081565b3480156107e457600080fd5b5061034c6107f336600461497f565b6128db565b34801561080457600080fd5b50610818610813366004614e5a565b612942565b6040516102f99190614e9c565b34801561083157600080fd5b506103c2610840366004614e5a565b612a63565b34801561085157600080fd5b506102c6610860366004614eeb565b612ab5565b34801561087157600080fd5b506102ed610880366004614f42565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6104106108bc366004614f70565b612afa565b3480156108cd57600080fd5b506104106108dc366004614f82565b612e1a565b60006001600160e01b031982167f780e9d6300000000000000000000000000000000000000000000000000000000148061091f575061091f82613078565b92915050565b60008082610100013561093781611d77565b6001600160a01b0316336001600160a01b031614610968576040516330cd747160e01b815260040160405180910390fd5b8360e001354281101561098e57604051630407b05b60e31b815260040160405180910390fd5b6101008501356000908152600b6020526040902060010154600160a81b900463ffffffff1642116109d257604051635d63063560e01b815260040160405180910390fd5b600080610a0a6109e56020890189614a1a565b6109f560408a0160208b01614a1a565b610a0560608b0160408c01615011565b613113565b6001600160a01b031663f5298aca610a2860e08a0160c08b01614a1a565b6040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526101008a0135602482015260608a0135604482015260640160408051808303816000875af1158015610a82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa6919061502e565b90925090506000610ad2610abd60208a018a614a1a565b610acd60408b0160208c01614a1a565b6132bd565b5090506001600160a01b038116610aec60208a018a614a1a565b6001600160a01b031614610b01578183610b04565b82825b90975095506080880135871015610b2e57604051638dc525d160e01b815260040160405180910390fd5b8760a00135861015610b535760405163ef71d09160e01b815260040160405180910390fd5b6101008801356000818152600b6020908152604091829020548251338152918201939093526001600160a01b039092169082015260608181018990526080820188905289013560a08201527fcab6a6d34ea29d0413683b5f28d595f2485e89fe7de80e62915ac265c4cac82f9060c0015b60405180910390a15050505050915091565b606060008054610be590615052565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1190615052565b8015610c5e5780601f10610c3357610100808354040283529160200191610c5e565b820191906000526020600020905b815481529060010190602001808311610c4157829003601f168201915b5050505050905090565b6000610c738261348c565b506000908152600460205260409020546001600160a01b031690565b6000610c9a82611d77565b9050806001600160a01b0316836001600160a01b03161415610d295760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b0382161480610d455750610d458133610880565b610db75760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c00006064820152608401610d20565b610dc183836134f3565b505050565b610dd03382613561565b610e425760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f7665640000000000000000000000000000000000006064820152608401610d20565b610dc18383836135e0565b6000806000836101000135610e6181611d77565b6001600160a01b0316336001600160a01b031614158015610e9c57506000818152600b60205260409020600101546001600160a01b03163314155b15610eba57604051631eb49d6d60e11b815260040160405180910390fd5b8460e0013542811015610ee057604051630407b05b60e31b815260040160405180910390fd5b610f29610ef06020880188614a1a565b610f006040890160208a01614a1a565b610f1060608a0160408b01615011565b89606001358a608001358b60a001358c60c001356137b8565b90955093506000610f406109e56020890189614a1a565b9050610f5a610f526020890189614a1a565b338389613a06565b610f75610f6d6040890160208a01614a1a565b338388613a06565b6040516340c10f1960e01b815230600482015261010088013560248201526001600160a01b038216906340c10f19906044016020604051808303816000875af1158015610fc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fea9190615087565b93507f0fc6a4778447726fa3199497aaab2d8975554003f75253a8fe23c3c56cff1a8b61101b886101000135611d77565b604080516001600160a01b0392831681526101008b0135602082015291841690820152606081018890526080810187905260a0810186905260c0015b60405180910390a15050509193909250565b600061107483611ddc565b82106110e85760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e64730000000000000000000000000000000000000000006064820152608401610d20565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b606080600061111f84611e76565b90506000815167ffffffffffffffff81111561113d5761113d614d1f565b604051908082528060200260200182016040528015611166578160200160208202803683370190505b50825190915060005b818110156111c65761119984828151811061118c5761118c6150a0565b6020026020010151613b7e565b8382815181106111ab576111ab6150a0565b60209081029190910101526111bf816150cc565b905061116f565b50919590945092505050565b610dc18383836040518060200160405280600081525061284d565b806111f781611d77565b6001600160a01b0316336001600160a01b031614611228576040516330cd747160e01b815260040160405180910390fd5b6000828152600b602052604090819020549051630fcea6d960e11b8152306004820152602481018490526001600160a01b03909116908190631f9d4db290604401602060405180830381865afa158015611286573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112aa91906150e7565b6fffffffffffffffffffffffffffffffff16156112f3576040517f03b85a8600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516339a03a8b60e21b8152306004820152602481018490526001600160a01b0382169063e680ea2c90604401602060405180830381865afa15801561133e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113629190615087565b15611399576040517fc091803c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051338152602081018590527fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5910160405180910390a1610dc183613bff565b6000806000834281101561140257604051630407b05b60e31b815260040160405180910390fd5b611410600a80546001019055565b600061143d8c7f00000000000000000000000000000000000000000000000000000000000000008d613113565b6040805160a0810182526001600160a01b03831681526000602082018190529181018290526060810182905260808101829052919250600b9061147f600a5490565b81526020808201929092526040908101600020835181546001600160a01b039182166001600160a01b03199091161782559284015160018201805493860151606087015163ffffffff16600160a81b0263ffffffff60a81b19911515600160a01b0274ffffffffffffffffffffffffffffffffffffffffff19909616939096169290921793909317169290921790556080909101516002909101556115498c7f00000000000000000000000000000000000000000000000000000000000000008d8d348e8e6137b8565b909550935061155a8c338388613a06565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b1580156115b557600080fd5b505af11580156115c9573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b038581166004830152602482018990527f000000000000000000000000000000000000000000000000000000000000000016935063a9059cbb925060440190506020604051808303816000875af115801561163e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116629190615119565b61166e5761166e614895565b806001600160a01b03166340c10f1930611687600a5490565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156116d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f69190615087565b925061170a87611705600a5490565b613ca6565b8334111561172557611725336117208634615136565b613cc0565b7fbb566f16233ed30c749c278b54784b3d3fe7cd93d3e354840d2946d0e57d473d87611750600a5490565b604080516001600160a01b039384168152602081019290925291841681830152606081018890526080810187905260a0810186905290519081900360c00190a150509750975097945050505050565b60006117aa60085490565b821061181e5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e647300000000000000000000000000000000000000006064820152608401610d20565b60088281548110611831576118316150a0565b90600052602060002001549050919050565b8161184d81611d77565b6001600160a01b0316336001600160a01b03161461187e576040516330cd747160e01b815260040160405180910390fd5b81428110156118a057604051630407b05b60e31b815260040160405180910390fd5b6000848152600b6020526040902060010154600160a01b900460ff166118f2576040517fcf7deff600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b428563ffffffff1611158061192957506000848152600b602052604090206001015463ffffffff600160a81b909104811690861611155b15611960576040517fb0ca8d0c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848152600b602090815260409182902060018101805463ffffffff8a16600160a81b810263ffffffff60a81b1990921691909117909155905483513381529283018890526001600160a01b031682840152606082015290517fb66dadac3190736ac970c9235fdd04d595fcd77865ef1f207f8cd3145165a3249181900360800190a15050505050565b6000808260e001356119fc81611d77565b6001600160a01b0316336001600160a01b031614611a2d576040516330cd747160e01b815260040160405180910390fd5b8360c0013542811015611a5357604051630407b05b60e31b815260040160405180910390fd5b60e08501356000908152600b6020526040902060010154600160a81b900463ffffffff164211611a9657604051635d63063560e01b815260040160405180910390fd5b600080611ada611aa96020890189614a1a565b7f0000000000000000000000000000000000000000000000000000000000000000610a0560408b0160208c01615011565b604080517ff5298aca00000000000000000000000000000000000000000000000000000000815230600482015260e08a013560248201529089013560448201526001600160a01b03919091169063f5298aca9060640160408051808303816000875af1158015611b4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b72919061502e565b90925090506000611baf611b8960208a018a614a1a565b7f00000000000000000000000000000000000000000000000000000000000000006132bd565b5090506001600160a01b038116611bc960208a018a614a1a565b6001600160a01b031614611bde578183611be1565b82825b90975095506060880135871015611c0b57604051638dc525d160e01b815260040160405180910390fd5b8760800135861015611c305760405163ef71d09160e01b815260040160405180910390fd5b611c56611c4060208a018a614a1a565b611c5060c08b0160a08c01614a1a565b89613da3565b6040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018790527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015611cd157600080fd5b505af1158015611ce5573d6000803e3d6000fd5b50611d049250611cfe91505060c08a0160a08b01614a1a565b87613cc0565b60e08801356000818152600b6020908152604091829020548251338152918201939093526001600160a01b0390921682820152606082018990526080820188905289013560a08201527fcab6a6d34ea29d0413683b5f28d595f2485e89fe7de80e62915ac265c4cac82f9060c001610bc4565b6000818152600260205260408120546001600160a01b03168061091f5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610d20565b60006001600160a01b038216611e5a5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e657200000000000000000000000000000000000000000000006064820152608401610d20565b506001600160a01b031660009081526003602052604090205490565b60606000611e8383611ddc565b90508067ffffffffffffffff811115611e9e57611e9e614d1f565b604051908082528060200260200182016040528015611ec7578160200160208202803683370190505b50915060005b81811015611f0c57611edf8482611069565b838281518110611ef157611ef16150a0565b6020908102919091010152611f05816150cc565b9050611ecd565b5050919050565b81611f1d81611d77565b6001600160a01b0316336001600160a01b031614611f4e576040516330cd747160e01b815260040160405180910390fd5b8142811015611f7057604051630407b05b60e31b815260040160405180910390fd5b6000848152600b6020526040902060010154600160a01b900460ff1615611fc3576040517f6a4648d700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050506000908152600b60205260409020600101805460ff60a01b1916600160a01b179055565b81611ff481611d77565b6001600160a01b0316336001600160a01b031614612025576040516330cd747160e01b815260040160405180910390fd5b506000918252600b602052604090912060010180546001600160a01b0319166001600160a01b03909216919091179055565b606060018054610be590615052565b60008161207281611d77565b6001600160a01b0316336001600160a01b0316141580156120ad57506000818152600b60205260409020600101546001600160a01b03163314155b156120cb57604051631eb49d6d60e11b815260040160405180910390fd5b6000838152600b6020526040908190205490516339a03a8b60e21b8152306004820152602481018590526001600160a01b0390911690819063e680ea2c90604401602060405180830381865afa158015612129573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214d9190615087565b6000858152600b60205260408120600201805490919061216e90849061514d565b90915550506040517f5247ab05000000000000000000000000000000000000000000000000000000008152336004820152602481018590526001600160a01b03821690635247ab05906044016020604051808303816000875af11580156121d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121fd9190615087565b92507fad03f837a9207e368d73ec028e1f54428184da8cfea258cc116da2225f3ac5eb61222985611d77565b6000868152600b60209081526040918290205482516001600160a01b03948516815291820189905292909216908201526060810185905260800160405180910390a15050919050565b604080516101c081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081018290526101a08101919091526000828152600b60209081526040808320815160a08101835281546001600160a01b03908116808352600184015491821695830195909552600160a01b810460ff16151582850152600160a81b900463ffffffff16606082015260029091015460808201529051630fcea6d960e11b8152306004820152602481018690529092908290631f9d4db290604401602060405180830381865afa15801561238c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123b091906150e7565b6fffffffffffffffffffffffffffffffff169050600080836001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015612405573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124299190615188565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691506000846001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561248e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124b29190615087565b6124bc84866151c4565b6124c691906151f9565b90506000856001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612508573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061252c9190615087565b61253684876151c4565b61254091906151f9565b9050604051806101c001604052808a815260200161255d8b611d77565b6001600160a01b0316815260200188602001516001600160a01b0316815260200188600001516001600160a01b03168152602001876001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156125cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f3919061520d565b6001600160a01b03168152602001876001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561263f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612663919061520d565b6001600160a01b0316815260200186815260200183815260200182815260200161268c8b613b7e565b815260200188608001518152602001876001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa1580156126d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126fd919061522a565b61ffff168152602001886040015115158152602001886060015163ffffffff16815250975050505050505050919050565b612739338383613ef2565b5050565b8161274781611d77565b6001600160a01b0316336001600160a01b031614612778576040516330cd747160e01b815260040160405180910390fd5b814281101561279a57604051630407b05b60e31b815260040160405180910390fd5b6000848152600b6020526040902060010154600160a01b900460ff166127ec576040517f9f40046100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848152600b602052604090206001015442600160a81b90910463ffffffff16111561282c57604051635d63063560e01b815260040160405180910390fd5b5050506000908152600b60205260409020600101805460ff60a01b19169055565b6128573383613561565b6128c95760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f7665640000000000000000000000000000000000006064820152608401610d20565b6128d584848484613fc1565b50505050565b60606128e68261348c565b60006128f061403f565b90506000815111612910576040518060200160405280600081525061293b565b8061291a84614070565b60405160200161292b929190615247565b6040516020818303038152906040525b9392505050565b606060008267ffffffffffffffff81111561295f5761295f614d1f565b6040519080825280602002602001820160405280156129fe57816020015b604080516101c08101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e08201819052610100820181905261012082018190526101408201819052610160820181905261018082018190526101a0820152825260001990920191018161297d5790505b50905060005b83811015612a5b57612a2d858583818110612a2157612a216150a0565b90506020020135612272565b828281518110612a3f57612a3f6150a0565b602002602001018190525080612a54906150cc565b9050612a04565b509392505050565b600081815b81811015612aad57612a91858583818110612a8557612a856150a0565b90506020020135612066565b612a9b908461514d565b9250612aa6816150cc565b9050612a68565b505092915050565b8160005b81811015612af357612ae3858583818110612ad657612ad66150a0565b9050602002013584611fea565b612aec816150cc565b9050612ab9565b5050505050565b60008060008360c00135612b0d81611d77565b6001600160a01b0316336001600160a01b031614158015612b4857506000818152600b60205260409020600101546001600160a01b03163314155b15612b6657604051631eb49d6d60e11b815260040160405180910390fd5b8460a0013542811015612b8c57604051630407b05b60e31b815260040160405180910390fd5b612be2612b9c6020880188614a1a565b7f0000000000000000000000000000000000000000000000000000000000000000612bcd60408a0160208b01615011565b8960400135348b606001358c608001356137b8565b90955093506000612bf9611aa96020890189614a1a565b9050612c0b610f526020890189614a1a565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0866040518263ffffffff1660e01b81526004016000604051808303818588803b158015612c6657600080fd5b505af1158015612c7a573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b038581166004830152602482018a90527f000000000000000000000000000000000000000000000000000000000000000016935063a9059cbb925060440190506020604051808303816000875af1158015612cef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d139190615119565b612d1f57612d1f614895565b6040516340c10f1960e01b815230600482015260c088013560248201526001600160a01b038216906340c10f19906044016020604051808303816000875af1158015612d6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d939190615087565b935084341115612dab57612dab336117208734615136565b7f0fc6a4778447726fa3199497aaab2d8975554003f75253a8fe23c3c56cff1a8b612dd98860c00135611d77565b604080516001600160a01b03928316815260c0808c0135602083015292851691810191909152606081018990526080810188905260a0810187905201611057565b60008060008342811015612e4157604051630407b05b60e31b815260040160405180910390fd5b6000612e4e8e8e8e613113565b9050612e5e600a80546001019055565b6040805160a0810182526001600160a01b0383168152600060208201819052918101829052606081018290526080810182905290600b90612e9e600a5490565b81526020808201929092526040908101600020835181546001600160a01b039182166001600160a01b03199091161782559284015160018201805493860151606087015163ffffffff16600160a81b0263ffffffff60a81b19911515600160a01b0274ffffffffffffffffffffffffffffffffffffffffff1990961693909616929092179390931716929092179055608090910151600290910155612f488e8e8e8e8e8e8e6137b8565b9095509350612f598e338388613a06565b612f658d338387613a06565b806001600160a01b03166340c10f1930612f7e600a5490565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015612fc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fed9190615087565b9250612ffc87611705600a5490565b7fbb566f16233ed30c749c278b54784b3d3fe7cd93d3e354840d2946d0e57d473d87613027600a5490565b604080516001600160a01b039384168152602081019290925291841681830152606081018890526080810187905260a0810186905290519081900360c00190a1505099509950999650505050505050565b60006001600160e01b031982167f80ac58cd0000000000000000000000000000000000000000000000000000000014806130db57506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061091f57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161461091f565b600080600061312286866132bd565b6040516bffffffffffffffffffffffff19606084811b8216602084015283811b821660348401527fffff00000000000000000000000000000000000000000000000000000000000060f08a901b1660488401527f0000000000000000000000000000000000000000000000000000000000000000901b16604a82015291935091507f000000000000000000000000000000000000000000000000000000000000000090605e01604051602081830303815290604052805190602001207f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b031614613252576040518060400160405280602081526020017f3b29ecd4cb06592a81cac4799fb24ef6a176fe95ecb50f304972882b150f3f3a815250613289565b6040518060400160405280602081526020017f99c189a5ef3d337612cf0ce2bd055546e23b91fea9e9e54201b23f14d763f3338152505b60405160200161329b93929190615276565b60408051601f1981840301815291905280516020909101209695505050505050565b600080826001600160a01b0316846001600160a01b0316141561330c576040517fbd969eb000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316148061337d57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316145b15613436577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316146133e2577f000000000000000000000000000000000000000000000000000000000000000084613405565b7f0000000000000000000000000000000000000000000000000000000000000000835b90925090506001600160a01b0381166134315760405163d92e233d60e01b815260040160405180910390fd5b613485565b826001600160a01b0316846001600160a01b031610613456578284613459565b83835b90925090506001600160a01b0382166134855760405163d92e233d60e01b815260040160405180910390fd5b9250929050565b6000818152600260205260409020546001600160a01b03166134f05760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610d20565b50565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061352882611d77565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061356d83611d77565b9050806001600160a01b0316846001600160a01b031614806135b457506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806135d85750836001600160a01b03166135cd84610c68565b6001600160a01b0316145b949350505050565b826001600160a01b03166135f382611d77565b6001600160a01b03161461366f5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610d20565b6001600160a01b0382166136ea5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610d20565b6136f58383836141a2565b6137006000826134f3565b6001600160a01b0383166000908152600360205260408120805460019290613729908490615136565b90915550506001600160a01b038216600090815260036020526040812080546001929061375790849061514d565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6040517f09175fa70000000000000000000000000000000000000000000000000000000081526001600160a01b038881166004830152878116602483015261ffff87166044830152600091829182917f0000000000000000000000000000000000000000000000000000000000000000909116906309175fa790606401602060405180830381865afa158015613852573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613876919061520d565b6001600160a01b0316141561393e576040517fea3138910000000000000000000000000000000000000000000000000000000081526001600160a01b038a81166004830152898116602483015261ffff891660448301527f0000000000000000000000000000000000000000000000000000000000000000169063ea313891906064016020604051808303816000875af1158015613918573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061393c919061520d565b505b60008061394c8b8b8b6141d0565b9150915081600014801561395e575080155b1561396e578793508692506139f8565b600061397b8984846142a8565b90508781116139b057858110156139a55760405163ef71d09160e01b815260040160405180910390fd5b8894509250826139f6565b60006139bd8984866142a8565b9050898111156139cf576139cf614895565b878110156139f057604051638dc525d160e01b815260040160405180910390fd5b94508793505b505b505097509795505050505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790529151600092839290881691613a9891906152db565b6000604051808303816000865af19150503d8060008114613ad5576040519150601f19603f3d011682016040523d82523d6000602084013e613ada565b606091505b5091509150818015613b04575080511580613b04575080806020019051810190613b049190615119565b613b765760405162461bcd60e51b815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a20747260448201527f616e7366657246726f6d206661696c65640000000000000000000000000000006064820152608401610d20565b505050505050565b6000818152600b60205260408082205490516339a03a8b60e21b8152306004820152602481018490526001600160a01b0390911690819063e680ea2c90604401602060405180830381865afa158015613bdb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061293b9190615087565b6000613c0a82611d77565b9050613c18816000846141a2565b613c236000836134f3565b6001600160a01b0381166000908152600360205260408120805460019290613c4c908490615136565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b612739828260405180602001604052806000815250614338565b604080516000808252602082019092526001600160a01b038416908390604051613cea91906152db565b60006040518083038185875af1925050503d8060008114613d27576040519150601f19603f3d011682016040523d82523d6000602084013e613d2c565b606091505b5050905080610dc15760405162461bcd60e51b815260206004820152603460248201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60448201527f20455448207472616e73666572206661696c65640000000000000000000000006064820152608401610d20565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b1790529151600092839290871691613e1491906152db565b6000604051808303816000865af19150503d8060008114613e51576040519150601f19603f3d011682016040523d82523d6000602084013e613e56565b606091505b5091509150818015613e80575080511580613e80575080806020019051810190613e809190615119565b612af35760405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c6564000000000000000000000000000000000000006064820152608401610d20565b816001600160a01b0316836001600160a01b03161415613f545760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610d20565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b613fcc8484846135e0565b613fd8848484846143b6565b6128d55760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6064820152608401610d20565b60604661404b81614070565b60405160200161405b91906152f7565b60405160208183030381529060405291505090565b6060816140b057505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b81156140da57806140c4816150cc565b91506140d39050600a836151f9565b91506140b4565b60008167ffffffffffffffff8111156140f5576140f5614d1f565b6040519080825280601f01601f19166020018201604052801561411f576020820181803683370190505b5090505b84156135d857614134600183615136565b9150614141600a86615389565b61414c90603061514d565b60f81b818381518110614161576141616150a0565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061419b600a866151f9565b9450614123565b6141ad8383836144ff565b6000908152600b6020526040902060010180546001600160a01b03191690555050565b60008060006141df86866132bd565b5090506000806141f0888888613113565b6001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa15801561422d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142519190615188565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff169150826001600160a01b0316886001600160a01b031614614296578082614299565b81815b90999098509650505050505050565b6000836142e1576040517f5945ea5600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8215806142ec575081155b15614323576040517fbb55fd2700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8261432e83866151c4565b6135d891906151f9565b61434283836145b7565b61434f60008484846143b6565b610dc15760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6064820152608401610d20565b60006001600160a01b0384163b156144f457604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906143fa90339089908890889060040161539d565b6020604051808303816000875af1925050508015614435575060408051601f3d908101601f19168201909252614432918101906153d9565b60015b6144da573d808015614463576040519150601f19603f3d011682016040523d82523d6000602084013e614468565b606091505b5080516144d25760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6064820152608401610d20565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506135d8565b506001949350505050565b6001600160a01b03831661455a5761455581600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b61457d565b816001600160a01b0316836001600160a01b03161461457d5761457d8382614705565b6001600160a01b03821661459457610dc1816147a2565b826001600160a01b0316826001600160a01b031614610dc157610dc18282614851565b6001600160a01b03821661460d5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610d20565b6000818152600260205260409020546001600160a01b0316156146725760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610d20565b61467e600083836141a2565b6001600160a01b03821660009081526003602052604081208054600192906146a790849061514d565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000600161471284611ddc565b61471c9190615136565b60008381526007602052604090205490915080821461476f576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906147b490600190615136565b600083815260096020526040812054600880549394509092849081106147dc576147dc6150a0565b9060005260206000200154905080600883815481106147fd576147fd6150a0565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480614835576148356153f6565b6001900381819060005260206000200160009055905550505050565b600061485c83611ddc565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b634e487b7160e01b600052600160045260246000fd5b6001600160e01b0319811681146134f057600080fd5b6000602082840312156148d357600080fd5b813561293b816148ab565b600061012082840312156148f157600080fd5b50919050565b6000610120828403121561490a57600080fd5b61293b83836148de565b60005b8381101561492f578181015183820152602001614917565b838111156128d55750506000910152565b60008151808452614958816020860160208601614914565b601f01601f19169290920160200192915050565b60208152600061293b6020830184614940565b60006020828403121561499157600080fd5b5035919050565b6001600160a01b03811681146134f057600080fd5b600080604083850312156149c057600080fd5b82356149cb81614998565b946020939093013593505050565b6000806000606084860312156149ee57600080fd5b83356149f981614998565b92506020840135614a0981614998565b929592945050506040919091013590565b600060208284031215614a2c57600080fd5b813561293b81614998565b600081518084526020808501945080840160005b83811015614a6757815187529582019590820190600101614a4b565b509495945050505050565b604081526000614a856040830185614a37565b8281036020840152614a978185614a37565b95945050505050565b61ffff811681146134f057600080fd5b600080600080600080600060e0888a031215614acb57600080fd5b8735614ad681614998565b96506020880135614ae681614aa0565b955060408801359450606088013593506080880135925060a0880135614b0b81614998565b8092505060c0880135905092959891949750929550565b63ffffffff811681146134f057600080fd5b600080600060608486031215614b4957600080fd5b8335614b5481614b22565b95602085013595506040909401359392505050565b600061010082840312156148f157600080fd5b60208152600061293b6020830184614a37565b60008060408385031215614ba257600080fd5b50508035926020909101359150565b60008060408385031215614bc457600080fd5b823591506020830135614bd681614998565b809150509250929050565b805182526020810151614bff60208401826001600160a01b03169052565b506040810151614c1a60408401826001600160a01b03169052565b506060810151614c3560608401826001600160a01b03169052565b506080810151614c5060808401826001600160a01b03169052565b5060a0810151614c6b60a08401826001600160a01b03169052565b5060c0818101519083015260e080820151908301526101008082015190830152610120808201519083015261014080820151908301526101608082015161ffff1690830152610180808201511515908301526101a08082015163ffffffff8116828501526128d5565b6101c0810161091f8284614be1565b80151581146134f057600080fd5b60008060408385031215614d0457600080fd5b8235614d0f81614998565b91506020830135614bd681614ce3565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215614d4b57600080fd5b8435614d5681614998565b93506020850135614d6681614998565b925060408501359150606085013567ffffffffffffffff80821115614d8a57600080fd5b818701915087601f830112614d9e57600080fd5b813581811115614db057614db0614d1f565b604051601f8201601f19908116603f01168101908382118183101715614dd857614dd8614d1f565b816040528281528a6020848701011115614df157600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008083601f840112614e2757600080fd5b50813567ffffffffffffffff811115614e3f57600080fd5b6020830191508360208260051b850101111561348557600080fd5b60008060208385031215614e6d57600080fd5b823567ffffffffffffffff811115614e8457600080fd5b614e9085828601614e15565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b81811015614edf57614ecb838551614be1565b928401926101c09290920191600101614eb8565b50909695505050505050565b600080600060408486031215614f0057600080fd5b833567ffffffffffffffff811115614f1757600080fd5b614f2386828701614e15565b9094509250506020840135614f3781614998565b809150509250925092565b60008060408385031215614f5557600080fd5b8235614f6081614998565b91506020830135614bd681614998565b600060e082840312156148f157600080fd5b60008060008060008060008060006101208a8c031215614fa157600080fd5b8935614fac81614998565b985060208a0135614fbc81614998565b975060408a0135614fcc81614aa0565b965060608a0135955060808a0135945060a08a0135935060c08a0135925060e08a0135614ff881614998565b809250506101008a013590509295985092959850929598565b60006020828403121561502357600080fd5b813561293b81614aa0565b6000806040838503121561504157600080fd5b505080516020909101519092909150565b600181811c9082168061506657607f821691505b602082108114156148f157634e487b7160e01b600052602260045260246000fd5b60006020828403121561509957600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156150e0576150e06150b6565b5060010190565b6000602082840312156150f957600080fd5b81516fffffffffffffffffffffffffffffffff8116811461293b57600080fd5b60006020828403121561512b57600080fd5b815161293b81614ce3565b600082821015615148576151486150b6565b500390565b60008219821115615160576151606150b6565b500190565b80516dffffffffffffffffffffffffffff8116811461518357600080fd5b919050565b60008060006060848603121561519d57600080fd5b6151a684615165565b92506151b460208501615165565b91506040840151614f3781614b22565b60008160001904831182151516156151de576151de6150b6565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615208576152086151e3565b500490565b60006020828403121561521f57600080fd5b815161293b81614998565b60006020828403121561523c57600080fd5b815161293b81614aa0565b60008351615259818460208801614914565b83519083019061526d818360208801614914565b01949350505050565b7fff0000000000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff198460601b166001820152826015820152600082516152cc816035850160208701614914565b91909101603501949350505050565b600082516152ed818460208701614914565b9190910192915050565b7f68747470733a2f2f6d657461646174612e616e746661726d2e66696e616e636581527f2f706f736974696f6e732f00000000000000000000000000000000000000000060208201526000825161535581602b850160208701614914565b7f2f00000000000000000000000000000000000000000000000000000000000000602b939091019283015250602c01919050565b600082615398576153986151e3565b500690565b60006001600160a01b038087168352808616602084015250836040830152608060608301526153cf6080830184614940565b9695505050505050565b6000602082840312156153eb57600080fd5b815161293b816148ab565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220899e52fdbc93da55f18c9d561383005270c59fb5d26a6a1f84fe93ec99e56c7a64736f6c634300080a00330000000000000000000000008af94528fbe3c4c148523e7aad48bcebcc0a71d70000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e900000000000000000000000040df0c3bbaae5ea3a509d8f2aa9e086776c98e6c

Deployed Bytecode

0x6080604052600436106102895760003560e01c80637cfbd7cc11610153578063b88d4fde116100cb578063d8afab351161007f578063e985e9c511610064578063e985e9c514610865578063ec648265146108ae578063f256135a146108c157600080fd5b8063d8afab3514610825578063e245be441461084557600080fd5b8063c45a0155116100b0578063c45a0155146107a4578063c87b56dd146107d8578063d4630d86146107f857600080fd5b8063b88d4fde14610750578063c12a00a81461077057600080fd5b80639abd357211610122578063a22cb46511610107578063a22cb465146106dc578063a3869587146106fc578063ad5c46481461071c57600080fd5b80639abd35721461068f5780639ecceb5e146106af57600080fd5b80637cfbd7cc1461059957806394dcf2e6146105b957806395d89b41146105d957806399fbab88146105ee57600080fd5b806330f7b1f41161020157806356b70392116101b55780636352211e1161019a5780636352211e1461052c57806370a082311461054c57806376a65a9e1461056c57600080fd5b806356b70392146104ec5780635a4f40e41461050c57600080fd5b806342966c68116101e657806342966c68146104995780634c07c08c146104b95780634f6ccce7146104cc57600080fd5b806330f7b1f41461044b57806342842e0e1461047957600080fd5b8063095ea7b31161025857806323b872dd1161023d57806323b872dd146103d05780632f4bb652146103f05780632f745c591461042b57600080fd5b8063095ea7b31461039157806318160ddd146103b157600080fd5b806301ffc9a7146102cd57806303c126991461030257806306fdde0314610337578063081812fc1461035957600080fd5b366102c857336001600160a01b037f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e916146102c6576102c6614895565b005b600080fd5b3480156102d957600080fd5b506102ed6102e83660046148c1565b6108e1565b60405190151581526020015b60405180910390f35b34801561030e57600080fd5b5061032261031d3660046148f7565b610925565b604080519283526020830191909152016102f9565b34801561034357600080fd5b5061034c610bd6565b6040516102f9919061496c565b34801561036557600080fd5b5061037961037436600461497f565b610c68565b6040516001600160a01b0390911681526020016102f9565b34801561039d57600080fd5b506102c66103ac3660046149ad565b610c8f565b3480156103bd57600080fd5b506008545b6040519081526020016102f9565b3480156103dc57600080fd5b506102c66103eb3660046149d9565b610dc6565b3480156103fc57600080fd5b5061041061040b3660046148f7565b610e4d565b604080519384526020840192909252908201526060016102f9565b34801561043757600080fd5b506103c26104463660046149ad565b611069565b34801561045757600080fd5b5061046b610466366004614a1a565b611111565b6040516102f9929190614a72565b34801561048557600080fd5b506102c66104943660046149d9565b6111d2565b3480156104a557600080fd5b506102c66104b436600461497f565b6111ed565b6104106104c7366004614ab0565b6113db565b3480156104d857600080fd5b506103c26104e736600461497f565b61179f565b3480156104f857600080fd5b506102c6610507366004614b34565b611843565b34801561051857600080fd5b50610322610527366004614b69565b6119eb565b34801561053857600080fd5b5061037961054736600461497f565b611d77565b34801561055857600080fd5b506103c2610567366004614a1a565b611ddc565b34801561057857600080fd5b5061058c610587366004614a1a565b611e76565b6040516102f99190614b7c565b3480156105a557600080fd5b506102c66105b4366004614b8f565b611f13565b3480156105c557600080fd5b506102c66105d4366004614bb1565b611fea565b3480156105e557600080fd5b5061034c612057565b3480156105fa57600080fd5b5061065161060936600461497f565b600b602052600090815260409020805460018201546002909201546001600160a01b039182169291821691600160a01b810460ff1691600160a81b90910463ffffffff169085565b604080516001600160a01b0396871681529590941660208601529115159284019290925263ffffffff9091166060830152608082015260a0016102f9565b34801561069b57600080fd5b506103c26106aa36600461497f565b612066565b3480156106bb57600080fd5b506106cf6106ca36600461497f565b612272565b6040516102f99190614cd4565b3480156106e857600080fd5b506102c66106f7366004614cf1565b61272e565b34801561070857600080fd5b506102c6610717366004614b8f565b61273d565b34801561072857600080fd5b506103797f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e981565b34801561075c57600080fd5b506102c661076b366004614d35565b61284d565b34801561077c57600080fd5b506103797f00000000000000000000000040df0c3bbaae5ea3a509d8f2aa9e086776c98e6c81565b3480156107b057600080fd5b506103797f0000000000000000000000008af94528fbe3c4c148523e7aad48bcebcc0a71d781565b3480156107e457600080fd5b5061034c6107f336600461497f565b6128db565b34801561080457600080fd5b50610818610813366004614e5a565b612942565b6040516102f99190614e9c565b34801561083157600080fd5b506103c2610840366004614e5a565b612a63565b34801561085157600080fd5b506102c6610860366004614eeb565b612ab5565b34801561087157600080fd5b506102ed610880366004614f42565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6104106108bc366004614f70565b612afa565b3480156108cd57600080fd5b506104106108dc366004614f82565b612e1a565b60006001600160e01b031982167f780e9d6300000000000000000000000000000000000000000000000000000000148061091f575061091f82613078565b92915050565b60008082610100013561093781611d77565b6001600160a01b0316336001600160a01b031614610968576040516330cd747160e01b815260040160405180910390fd5b8360e001354281101561098e57604051630407b05b60e31b815260040160405180910390fd5b6101008501356000908152600b6020526040902060010154600160a81b900463ffffffff1642116109d257604051635d63063560e01b815260040160405180910390fd5b600080610a0a6109e56020890189614a1a565b6109f560408a0160208b01614a1a565b610a0560608b0160408c01615011565b613113565b6001600160a01b031663f5298aca610a2860e08a0160c08b01614a1a565b6040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526101008a0135602482015260608a0135604482015260640160408051808303816000875af1158015610a82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa6919061502e565b90925090506000610ad2610abd60208a018a614a1a565b610acd60408b0160208c01614a1a565b6132bd565b5090506001600160a01b038116610aec60208a018a614a1a565b6001600160a01b031614610b01578183610b04565b82825b90975095506080880135871015610b2e57604051638dc525d160e01b815260040160405180910390fd5b8760a00135861015610b535760405163ef71d09160e01b815260040160405180910390fd5b6101008801356000818152600b6020908152604091829020548251338152918201939093526001600160a01b039092169082015260608181018990526080820188905289013560a08201527fcab6a6d34ea29d0413683b5f28d595f2485e89fe7de80e62915ac265c4cac82f9060c0015b60405180910390a15050505050915091565b606060008054610be590615052565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1190615052565b8015610c5e5780601f10610c3357610100808354040283529160200191610c5e565b820191906000526020600020905b815481529060010190602001808311610c4157829003601f168201915b5050505050905090565b6000610c738261348c565b506000908152600460205260409020546001600160a01b031690565b6000610c9a82611d77565b9050806001600160a01b0316836001600160a01b03161415610d295760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b0382161480610d455750610d458133610880565b610db75760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c00006064820152608401610d20565b610dc183836134f3565b505050565b610dd03382613561565b610e425760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f7665640000000000000000000000000000000000006064820152608401610d20565b610dc18383836135e0565b6000806000836101000135610e6181611d77565b6001600160a01b0316336001600160a01b031614158015610e9c57506000818152600b60205260409020600101546001600160a01b03163314155b15610eba57604051631eb49d6d60e11b815260040160405180910390fd5b8460e0013542811015610ee057604051630407b05b60e31b815260040160405180910390fd5b610f29610ef06020880188614a1a565b610f006040890160208a01614a1a565b610f1060608a0160408b01615011565b89606001358a608001358b60a001358c60c001356137b8565b90955093506000610f406109e56020890189614a1a565b9050610f5a610f526020890189614a1a565b338389613a06565b610f75610f6d6040890160208a01614a1a565b338388613a06565b6040516340c10f1960e01b815230600482015261010088013560248201526001600160a01b038216906340c10f19906044016020604051808303816000875af1158015610fc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fea9190615087565b93507f0fc6a4778447726fa3199497aaab2d8975554003f75253a8fe23c3c56cff1a8b61101b886101000135611d77565b604080516001600160a01b0392831681526101008b0135602082015291841690820152606081018890526080810187905260a0810186905260c0015b60405180910390a15050509193909250565b600061107483611ddc565b82106110e85760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e64730000000000000000000000000000000000000000006064820152608401610d20565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b606080600061111f84611e76565b90506000815167ffffffffffffffff81111561113d5761113d614d1f565b604051908082528060200260200182016040528015611166578160200160208202803683370190505b50825190915060005b818110156111c65761119984828151811061118c5761118c6150a0565b6020026020010151613b7e565b8382815181106111ab576111ab6150a0565b60209081029190910101526111bf816150cc565b905061116f565b50919590945092505050565b610dc18383836040518060200160405280600081525061284d565b806111f781611d77565b6001600160a01b0316336001600160a01b031614611228576040516330cd747160e01b815260040160405180910390fd5b6000828152600b602052604090819020549051630fcea6d960e11b8152306004820152602481018490526001600160a01b03909116908190631f9d4db290604401602060405180830381865afa158015611286573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112aa91906150e7565b6fffffffffffffffffffffffffffffffff16156112f3576040517f03b85a8600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516339a03a8b60e21b8152306004820152602481018490526001600160a01b0382169063e680ea2c90604401602060405180830381865afa15801561133e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113629190615087565b15611399576040517fc091803c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051338152602081018590527fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5910160405180910390a1610dc183613bff565b6000806000834281101561140257604051630407b05b60e31b815260040160405180910390fd5b611410600a80546001019055565b600061143d8c7f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e98d613113565b6040805160a0810182526001600160a01b03831681526000602082018190529181018290526060810182905260808101829052919250600b9061147f600a5490565b81526020808201929092526040908101600020835181546001600160a01b039182166001600160a01b03199091161782559284015160018201805493860151606087015163ffffffff16600160a81b0263ffffffff60a81b19911515600160a01b0274ffffffffffffffffffffffffffffffffffffffffff19909616939096169290921793909317169290921790556080909101516002909101556115498c7f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e98d8d348e8e6137b8565b909550935061155a8c338388613a06565b7f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e96001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b1580156115b557600080fd5b505af11580156115c9573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b038581166004830152602482018990527f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e916935063a9059cbb925060440190506020604051808303816000875af115801561163e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116629190615119565b61166e5761166e614895565b806001600160a01b03166340c10f1930611687600a5490565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156116d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f69190615087565b925061170a87611705600a5490565b613ca6565b8334111561172557611725336117208634615136565b613cc0565b7fbb566f16233ed30c749c278b54784b3d3fe7cd93d3e354840d2946d0e57d473d87611750600a5490565b604080516001600160a01b039384168152602081019290925291841681830152606081018890526080810187905260a0810186905290519081900360c00190a150509750975097945050505050565b60006117aa60085490565b821061181e5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e647300000000000000000000000000000000000000006064820152608401610d20565b60088281548110611831576118316150a0565b90600052602060002001549050919050565b8161184d81611d77565b6001600160a01b0316336001600160a01b03161461187e576040516330cd747160e01b815260040160405180910390fd5b81428110156118a057604051630407b05b60e31b815260040160405180910390fd5b6000848152600b6020526040902060010154600160a01b900460ff166118f2576040517fcf7deff600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b428563ffffffff1611158061192957506000848152600b602052604090206001015463ffffffff600160a81b909104811690861611155b15611960576040517fb0ca8d0c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848152600b602090815260409182902060018101805463ffffffff8a16600160a81b810263ffffffff60a81b1990921691909117909155905483513381529283018890526001600160a01b031682840152606082015290517fb66dadac3190736ac970c9235fdd04d595fcd77865ef1f207f8cd3145165a3249181900360800190a15050505050565b6000808260e001356119fc81611d77565b6001600160a01b0316336001600160a01b031614611a2d576040516330cd747160e01b815260040160405180910390fd5b8360c0013542811015611a5357604051630407b05b60e31b815260040160405180910390fd5b60e08501356000908152600b6020526040902060010154600160a81b900463ffffffff164211611a9657604051635d63063560e01b815260040160405180910390fd5b600080611ada611aa96020890189614a1a565b7f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e9610a0560408b0160208c01615011565b604080517ff5298aca00000000000000000000000000000000000000000000000000000000815230600482015260e08a013560248201529089013560448201526001600160a01b03919091169063f5298aca9060640160408051808303816000875af1158015611b4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b72919061502e565b90925090506000611baf611b8960208a018a614a1a565b7f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e96132bd565b5090506001600160a01b038116611bc960208a018a614a1a565b6001600160a01b031614611bde578183611be1565b82825b90975095506060880135871015611c0b57604051638dc525d160e01b815260040160405180910390fd5b8760800135861015611c305760405163ef71d09160e01b815260040160405180910390fd5b611c56611c4060208a018a614a1a565b611c5060c08b0160a08c01614a1a565b89613da3565b6040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018790527f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e96001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015611cd157600080fd5b505af1158015611ce5573d6000803e3d6000fd5b50611d049250611cfe91505060c08a0160a08b01614a1a565b87613cc0565b60e08801356000818152600b6020908152604091829020548251338152918201939093526001600160a01b0390921682820152606082018990526080820188905289013560a08201527fcab6a6d34ea29d0413683b5f28d595f2485e89fe7de80e62915ac265c4cac82f9060c001610bc4565b6000818152600260205260408120546001600160a01b03168061091f5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610d20565b60006001600160a01b038216611e5a5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e657200000000000000000000000000000000000000000000006064820152608401610d20565b506001600160a01b031660009081526003602052604090205490565b60606000611e8383611ddc565b90508067ffffffffffffffff811115611e9e57611e9e614d1f565b604051908082528060200260200182016040528015611ec7578160200160208202803683370190505b50915060005b81811015611f0c57611edf8482611069565b838281518110611ef157611ef16150a0565b6020908102919091010152611f05816150cc565b9050611ecd565b5050919050565b81611f1d81611d77565b6001600160a01b0316336001600160a01b031614611f4e576040516330cd747160e01b815260040160405180910390fd5b8142811015611f7057604051630407b05b60e31b815260040160405180910390fd5b6000848152600b6020526040902060010154600160a01b900460ff1615611fc3576040517f6a4648d700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050506000908152600b60205260409020600101805460ff60a01b1916600160a01b179055565b81611ff481611d77565b6001600160a01b0316336001600160a01b031614612025576040516330cd747160e01b815260040160405180910390fd5b506000918252600b602052604090912060010180546001600160a01b0319166001600160a01b03909216919091179055565b606060018054610be590615052565b60008161207281611d77565b6001600160a01b0316336001600160a01b0316141580156120ad57506000818152600b60205260409020600101546001600160a01b03163314155b156120cb57604051631eb49d6d60e11b815260040160405180910390fd5b6000838152600b6020526040908190205490516339a03a8b60e21b8152306004820152602481018590526001600160a01b0390911690819063e680ea2c90604401602060405180830381865afa158015612129573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214d9190615087565b6000858152600b60205260408120600201805490919061216e90849061514d565b90915550506040517f5247ab05000000000000000000000000000000000000000000000000000000008152336004820152602481018590526001600160a01b03821690635247ab05906044016020604051808303816000875af11580156121d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121fd9190615087565b92507fad03f837a9207e368d73ec028e1f54428184da8cfea258cc116da2225f3ac5eb61222985611d77565b6000868152600b60209081526040918290205482516001600160a01b03948516815291820189905292909216908201526060810185905260800160405180910390a15050919050565b604080516101c081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081018290526101a08101919091526000828152600b60209081526040808320815160a08101835281546001600160a01b03908116808352600184015491821695830195909552600160a01b810460ff16151582850152600160a81b900463ffffffff16606082015260029091015460808201529051630fcea6d960e11b8152306004820152602481018690529092908290631f9d4db290604401602060405180830381865afa15801561238c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123b091906150e7565b6fffffffffffffffffffffffffffffffff169050600080836001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015612405573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124299190615188565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691506000846001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561248e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124b29190615087565b6124bc84866151c4565b6124c691906151f9565b90506000856001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612508573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061252c9190615087565b61253684876151c4565b61254091906151f9565b9050604051806101c001604052808a815260200161255d8b611d77565b6001600160a01b0316815260200188602001516001600160a01b0316815260200188600001516001600160a01b03168152602001876001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156125cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f3919061520d565b6001600160a01b03168152602001876001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561263f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612663919061520d565b6001600160a01b0316815260200186815260200183815260200182815260200161268c8b613b7e565b815260200188608001518152602001876001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa1580156126d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126fd919061522a565b61ffff168152602001886040015115158152602001886060015163ffffffff16815250975050505050505050919050565b612739338383613ef2565b5050565b8161274781611d77565b6001600160a01b0316336001600160a01b031614612778576040516330cd747160e01b815260040160405180910390fd5b814281101561279a57604051630407b05b60e31b815260040160405180910390fd5b6000848152600b6020526040902060010154600160a01b900460ff166127ec576040517f9f40046100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848152600b602052604090206001015442600160a81b90910463ffffffff16111561282c57604051635d63063560e01b815260040160405180910390fd5b5050506000908152600b60205260409020600101805460ff60a01b19169055565b6128573383613561565b6128c95760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f7665640000000000000000000000000000000000006064820152608401610d20565b6128d584848484613fc1565b50505050565b60606128e68261348c565b60006128f061403f565b90506000815111612910576040518060200160405280600081525061293b565b8061291a84614070565b60405160200161292b929190615247565b6040516020818303038152906040525b9392505050565b606060008267ffffffffffffffff81111561295f5761295f614d1f565b6040519080825280602002602001820160405280156129fe57816020015b604080516101c08101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e08201819052610100820181905261012082018190526101408201819052610160820181905261018082018190526101a0820152825260001990920191018161297d5790505b50905060005b83811015612a5b57612a2d858583818110612a2157612a216150a0565b90506020020135612272565b828281518110612a3f57612a3f6150a0565b602002602001018190525080612a54906150cc565b9050612a04565b509392505050565b600081815b81811015612aad57612a91858583818110612a8557612a856150a0565b90506020020135612066565b612a9b908461514d565b9250612aa6816150cc565b9050612a68565b505092915050565b8160005b81811015612af357612ae3858583818110612ad657612ad66150a0565b9050602002013584611fea565b612aec816150cc565b9050612ab9565b5050505050565b60008060008360c00135612b0d81611d77565b6001600160a01b0316336001600160a01b031614158015612b4857506000818152600b60205260409020600101546001600160a01b03163314155b15612b6657604051631eb49d6d60e11b815260040160405180910390fd5b8460a0013542811015612b8c57604051630407b05b60e31b815260040160405180910390fd5b612be2612b9c6020880188614a1a565b7f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e9612bcd60408a0160208b01615011565b8960400135348b606001358c608001356137b8565b90955093506000612bf9611aa96020890189614a1a565b9050612c0b610f526020890189614a1a565b7f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e96001600160a01b031663d0e30db0866040518263ffffffff1660e01b81526004016000604051808303818588803b158015612c6657600080fd5b505af1158015612c7a573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b038581166004830152602482018a90527f0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e916935063a9059cbb925060440190506020604051808303816000875af1158015612cef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d139190615119565b612d1f57612d1f614895565b6040516340c10f1960e01b815230600482015260c088013560248201526001600160a01b038216906340c10f19906044016020604051808303816000875af1158015612d6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d939190615087565b935084341115612dab57612dab336117208734615136565b7f0fc6a4778447726fa3199497aaab2d8975554003f75253a8fe23c3c56cff1a8b612dd98860c00135611d77565b604080516001600160a01b03928316815260c0808c0135602083015292851691810191909152606081018990526080810188905260a0810187905201611057565b60008060008342811015612e4157604051630407b05b60e31b815260040160405180910390fd5b6000612e4e8e8e8e613113565b9050612e5e600a80546001019055565b6040805160a0810182526001600160a01b0383168152600060208201819052918101829052606081018290526080810182905290600b90612e9e600a5490565b81526020808201929092526040908101600020835181546001600160a01b039182166001600160a01b03199091161782559284015160018201805493860151606087015163ffffffff16600160a81b0263ffffffff60a81b19911515600160a01b0274ffffffffffffffffffffffffffffffffffffffffff1990961693909616929092179390931716929092179055608090910151600290910155612f488e8e8e8e8e8e8e6137b8565b9095509350612f598e338388613a06565b612f658d338387613a06565b806001600160a01b03166340c10f1930612f7e600a5490565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015612fc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fed9190615087565b9250612ffc87611705600a5490565b7fbb566f16233ed30c749c278b54784b3d3fe7cd93d3e354840d2946d0e57d473d87613027600a5490565b604080516001600160a01b039384168152602081019290925291841681830152606081018890526080810187905260a0810186905290519081900360c00190a1505099509950999650505050505050565b60006001600160e01b031982167f80ac58cd0000000000000000000000000000000000000000000000000000000014806130db57506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061091f57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161461091f565b600080600061312286866132bd565b6040516bffffffffffffffffffffffff19606084811b8216602084015283811b821660348401527fffff00000000000000000000000000000000000000000000000000000000000060f08a901b1660488401527f00000000000000000000000040df0c3bbaae5ea3a509d8f2aa9e086776c98e6c901b16604a82015291935091507f0000000000000000000000008af94528fbe3c4c148523e7aad48bcebcc0a71d790605e01604051602081830303815290604052805190602001207f00000000000000000000000040df0c3bbaae5ea3a509d8f2aa9e086776c98e6c6001600160a01b0316846001600160a01b031614613252576040518060400160405280602081526020017f3b29ecd4cb06592a81cac4799fb24ef6a176fe95ecb50f304972882b150f3f3a815250613289565b6040518060400160405280602081526020017f99c189a5ef3d337612cf0ce2bd055546e23b91fea9e9e54201b23f14d763f3338152505b60405160200161329b93929190615276565b60408051601f1981840301815291905280516020909101209695505050505050565b600080826001600160a01b0316846001600160a01b0316141561330c576040517fbd969eb000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f00000000000000000000000040df0c3bbaae5ea3a509d8f2aa9e086776c98e6c6001600160a01b0316846001600160a01b0316148061337d57507f00000000000000000000000040df0c3bbaae5ea3a509d8f2aa9e086776c98e6c6001600160a01b0316836001600160a01b0316145b15613436577f00000000000000000000000040df0c3bbaae5ea3a509d8f2aa9e086776c98e6c6001600160a01b0316846001600160a01b0316146133e2577f00000000000000000000000040df0c3bbaae5ea3a509d8f2aa9e086776c98e6c84613405565b7f00000000000000000000000040df0c3bbaae5ea3a509d8f2aa9e086776c98e6c835b90925090506001600160a01b0381166134315760405163d92e233d60e01b815260040160405180910390fd5b613485565b826001600160a01b0316846001600160a01b031610613456578284613459565b83835b90925090506001600160a01b0382166134855760405163d92e233d60e01b815260040160405180910390fd5b9250929050565b6000818152600260205260409020546001600160a01b03166134f05760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610d20565b50565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061352882611d77565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061356d83611d77565b9050806001600160a01b0316846001600160a01b031614806135b457506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806135d85750836001600160a01b03166135cd84610c68565b6001600160a01b0316145b949350505050565b826001600160a01b03166135f382611d77565b6001600160a01b03161461366f5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610d20565b6001600160a01b0382166136ea5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610d20565b6136f58383836141a2565b6137006000826134f3565b6001600160a01b0383166000908152600360205260408120805460019290613729908490615136565b90915550506001600160a01b038216600090815260036020526040812080546001929061375790849061514d565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6040517f09175fa70000000000000000000000000000000000000000000000000000000081526001600160a01b038881166004830152878116602483015261ffff87166044830152600091829182917f0000000000000000000000008af94528fbe3c4c148523e7aad48bcebcc0a71d7909116906309175fa790606401602060405180830381865afa158015613852573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613876919061520d565b6001600160a01b0316141561393e576040517fea3138910000000000000000000000000000000000000000000000000000000081526001600160a01b038a81166004830152898116602483015261ffff891660448301527f0000000000000000000000008af94528fbe3c4c148523e7aad48bcebcc0a71d7169063ea313891906064016020604051808303816000875af1158015613918573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061393c919061520d565b505b60008061394c8b8b8b6141d0565b9150915081600014801561395e575080155b1561396e578793508692506139f8565b600061397b8984846142a8565b90508781116139b057858110156139a55760405163ef71d09160e01b815260040160405180910390fd5b8894509250826139f6565b60006139bd8984866142a8565b9050898111156139cf576139cf614895565b878110156139f057604051638dc525d160e01b815260040160405180910390fd5b94508793505b505b505097509795505050505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790529151600092839290881691613a9891906152db565b6000604051808303816000865af19150503d8060008114613ad5576040519150601f19603f3d011682016040523d82523d6000602084013e613ada565b606091505b5091509150818015613b04575080511580613b04575080806020019051810190613b049190615119565b613b765760405162461bcd60e51b815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a20747260448201527f616e7366657246726f6d206661696c65640000000000000000000000000000006064820152608401610d20565b505050505050565b6000818152600b60205260408082205490516339a03a8b60e21b8152306004820152602481018490526001600160a01b0390911690819063e680ea2c90604401602060405180830381865afa158015613bdb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061293b9190615087565b6000613c0a82611d77565b9050613c18816000846141a2565b613c236000836134f3565b6001600160a01b0381166000908152600360205260408120805460019290613c4c908490615136565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b612739828260405180602001604052806000815250614338565b604080516000808252602082019092526001600160a01b038416908390604051613cea91906152db565b60006040518083038185875af1925050503d8060008114613d27576040519150601f19603f3d011682016040523d82523d6000602084013e613d2c565b606091505b5050905080610dc15760405162461bcd60e51b815260206004820152603460248201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60448201527f20455448207472616e73666572206661696c65640000000000000000000000006064820152608401610d20565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b1790529151600092839290871691613e1491906152db565b6000604051808303816000865af19150503d8060008114613e51576040519150601f19603f3d011682016040523d82523d6000602084013e613e56565b606091505b5091509150818015613e80575080511580613e80575080806020019051810190613e809190615119565b612af35760405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c6564000000000000000000000000000000000000006064820152608401610d20565b816001600160a01b0316836001600160a01b03161415613f545760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610d20565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b613fcc8484846135e0565b613fd8848484846143b6565b6128d55760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6064820152608401610d20565b60604661404b81614070565b60405160200161405b91906152f7565b60405160208183030381529060405291505090565b6060816140b057505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b81156140da57806140c4816150cc565b91506140d39050600a836151f9565b91506140b4565b60008167ffffffffffffffff8111156140f5576140f5614d1f565b6040519080825280601f01601f19166020018201604052801561411f576020820181803683370190505b5090505b84156135d857614134600183615136565b9150614141600a86615389565b61414c90603061514d565b60f81b818381518110614161576141616150a0565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061419b600a866151f9565b9450614123565b6141ad8383836144ff565b6000908152600b6020526040902060010180546001600160a01b03191690555050565b60008060006141df86866132bd565b5090506000806141f0888888613113565b6001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa15801561422d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142519190615188565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff169150826001600160a01b0316886001600160a01b031614614296578082614299565b81815b90999098509650505050505050565b6000836142e1576040517f5945ea5600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8215806142ec575081155b15614323576040517fbb55fd2700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8261432e83866151c4565b6135d891906151f9565b61434283836145b7565b61434f60008484846143b6565b610dc15760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6064820152608401610d20565b60006001600160a01b0384163b156144f457604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906143fa90339089908890889060040161539d565b6020604051808303816000875af1925050508015614435575060408051601f3d908101601f19168201909252614432918101906153d9565b60015b6144da573d808015614463576040519150601f19603f3d011682016040523d82523d6000602084013e614468565b606091505b5080516144d25760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6064820152608401610d20565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506135d8565b506001949350505050565b6001600160a01b03831661455a5761455581600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b61457d565b816001600160a01b0316836001600160a01b03161461457d5761457d8382614705565b6001600160a01b03821661459457610dc1816147a2565b826001600160a01b0316826001600160a01b031614610dc157610dc18282614851565b6001600160a01b03821661460d5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610d20565b6000818152600260205260409020546001600160a01b0316156146725760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610d20565b61467e600083836141a2565b6001600160a01b03821660009081526003602052604081208054600192906146a790849061514d565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000600161471284611ddc565b61471c9190615136565b60008381526007602052604090205490915080821461476f576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906147b490600190615136565b600083815260096020526040812054600880549394509092849081106147dc576147dc6150a0565b9060005260206000200154905080600883815481106147fd576147fd6150a0565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480614835576148356153f6565b6001900381819060005260206000200160009055905550505050565b600061485c83611ddc565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b634e487b7160e01b600052600160045260246000fd5b6001600160e01b0319811681146134f057600080fd5b6000602082840312156148d357600080fd5b813561293b816148ab565b600061012082840312156148f157600080fd5b50919050565b6000610120828403121561490a57600080fd5b61293b83836148de565b60005b8381101561492f578181015183820152602001614917565b838111156128d55750506000910152565b60008151808452614958816020860160208601614914565b601f01601f19169290920160200192915050565b60208152600061293b6020830184614940565b60006020828403121561499157600080fd5b5035919050565b6001600160a01b03811681146134f057600080fd5b600080604083850312156149c057600080fd5b82356149cb81614998565b946020939093013593505050565b6000806000606084860312156149ee57600080fd5b83356149f981614998565b92506020840135614a0981614998565b929592945050506040919091013590565b600060208284031215614a2c57600080fd5b813561293b81614998565b600081518084526020808501945080840160005b83811015614a6757815187529582019590820190600101614a4b565b509495945050505050565b604081526000614a856040830185614a37565b8281036020840152614a978185614a37565b95945050505050565b61ffff811681146134f057600080fd5b600080600080600080600060e0888a031215614acb57600080fd5b8735614ad681614998565b96506020880135614ae681614aa0565b955060408801359450606088013593506080880135925060a0880135614b0b81614998565b8092505060c0880135905092959891949750929550565b63ffffffff811681146134f057600080fd5b600080600060608486031215614b4957600080fd5b8335614b5481614b22565b95602085013595506040909401359392505050565b600061010082840312156148f157600080fd5b60208152600061293b6020830184614a37565b60008060408385031215614ba257600080fd5b50508035926020909101359150565b60008060408385031215614bc457600080fd5b823591506020830135614bd681614998565b809150509250929050565b805182526020810151614bff60208401826001600160a01b03169052565b506040810151614c1a60408401826001600160a01b03169052565b506060810151614c3560608401826001600160a01b03169052565b506080810151614c5060808401826001600160a01b03169052565b5060a0810151614c6b60a08401826001600160a01b03169052565b5060c0818101519083015260e080820151908301526101008082015190830152610120808201519083015261014080820151908301526101608082015161ffff1690830152610180808201511515908301526101a08082015163ffffffff8116828501526128d5565b6101c0810161091f8284614be1565b80151581146134f057600080fd5b60008060408385031215614d0457600080fd5b8235614d0f81614998565b91506020830135614bd681614ce3565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215614d4b57600080fd5b8435614d5681614998565b93506020850135614d6681614998565b925060408501359150606085013567ffffffffffffffff80821115614d8a57600080fd5b818701915087601f830112614d9e57600080fd5b813581811115614db057614db0614d1f565b604051601f8201601f19908116603f01168101908382118183101715614dd857614dd8614d1f565b816040528281528a6020848701011115614df157600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008083601f840112614e2757600080fd5b50813567ffffffffffffffff811115614e3f57600080fd5b6020830191508360208260051b850101111561348557600080fd5b60008060208385031215614e6d57600080fd5b823567ffffffffffffffff811115614e8457600080fd5b614e9085828601614e15565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b81811015614edf57614ecb838551614be1565b928401926101c09290920191600101614eb8565b50909695505050505050565b600080600060408486031215614f0057600080fd5b833567ffffffffffffffff811115614f1757600080fd5b614f2386828701614e15565b9094509250506020840135614f3781614998565b809150509250925092565b60008060408385031215614f5557600080fd5b8235614f6081614998565b91506020830135614bd681614998565b600060e082840312156148f157600080fd5b60008060008060008060008060006101208a8c031215614fa157600080fd5b8935614fac81614998565b985060208a0135614fbc81614998565b975060408a0135614fcc81614aa0565b965060608a0135955060808a0135945060a08a0135935060c08a0135925060e08a0135614ff881614998565b809250506101008a013590509295985092959850929598565b60006020828403121561502357600080fd5b813561293b81614aa0565b6000806040838503121561504157600080fd5b505080516020909101519092909150565b600181811c9082168061506657607f821691505b602082108114156148f157634e487b7160e01b600052602260045260246000fd5b60006020828403121561509957600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156150e0576150e06150b6565b5060010190565b6000602082840312156150f957600080fd5b81516fffffffffffffffffffffffffffffffff8116811461293b57600080fd5b60006020828403121561512b57600080fd5b815161293b81614ce3565b600082821015615148576151486150b6565b500390565b60008219821115615160576151606150b6565b500190565b80516dffffffffffffffffffffffffffff8116811461518357600080fd5b919050565b60008060006060848603121561519d57600080fd5b6151a684615165565b92506151b460208501615165565b91506040840151614f3781614b22565b60008160001904831182151516156151de576151de6150b6565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615208576152086151e3565b500490565b60006020828403121561521f57600080fd5b815161293b81614998565b60006020828403121561523c57600080fd5b815161293b81614aa0565b60008351615259818460208801614914565b83519083019061526d818360208801614914565b01949350505050565b7fff0000000000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff198460601b166001820152826015820152600082516152cc816035850160208701614914565b91909101603501949350505050565b600082516152ed818460208701614914565b9190910192915050565b7f68747470733a2f2f6d657461646174612e616e746661726d2e66696e616e636581527f2f706f736974696f6e732f00000000000000000000000000000000000000000060208201526000825161535581602b850160208701614914565b7f2f00000000000000000000000000000000000000000000000000000000000000602b939091019283015250602c01919050565b600082615398576153986151e3565b500690565b60006001600160a01b038087168352808616602084015250836040830152608060608301526153cf6080830184614940565b9695505050505050565b6000602082840312156153eb57600080fd5b815161293b816148ab565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220899e52fdbc93da55f18c9d561383005270c59fb5d26a6a1f84fe93ec99e56c7a64736f6c634300080a0033

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

0000000000000000000000008af94528fbe3c4c148523e7aad48bcebcc0a71d70000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e900000000000000000000000040df0c3bbaae5ea3a509d8f2aa9e086776c98e6c

-----Decoded View---------------
Arg [0] : _factory (address): 0x8aF94528FBE3c4C148523E7aAD48BcEbcC0A71d7
Arg [1] : _WETH (address): 0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9
Arg [2] : _antfarmToken (address): 0x40DF0C3BBAAE5Ea3A509d8F2aa9E086776C98E6c

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000008af94528fbe3c4c148523e7aad48bcebcc0a71d7
Arg [1] : 0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e9
Arg [2] : 00000000000000000000000040df0c3bbaae5ea3a509d8f2aa9e086776c98e6c


[ 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.