> For the complete documentation index, see [llms.txt](https://otherworld-1.gitbook.io/protocol-1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://otherworld-1.gitbook.io/protocol-1/smart-contracts/nft-erc-721-contract.md).

# NFT(ERC-721) Contract

## Address

> Address : (Address is different for each collection)
>
> on Klaytn Blockchain Main-net

## Summary

> **An NFT contract defines an NFT mapped to a collection. Otherworld's NFTs are issued at the request of a minting contract based on the offering data generated in the offering contract.**

* Defines a 'name'.
* Defines a 'symbol'.
* Defines the maximum supply.
* Defines the mint-able state.
* Defines the token-transferable state.
* Issues 'NFT'.
  * Defines the token ID.
  * Defines the token URI.

## Data

### Base

<table><thead><tr><th width="310.04311152764757">Name</th><th width="150">Type<select><option value="f59a4491161a4b9dbe758183bdcc8abe" label="Uint" color="blue"></option><option value="e60501f3a0c44f8b8e12409d4cb13cea" label="Boolean" color="blue"></option><option value="c1cc68a96f1640d0b3ee6c54288abf06" label="Address" color="blue"></option><option value="5a93deb4e03e4bb6b2cad62cef005788" label="String" color="blue"></option><option value="989f2aed8ec847658e1f3262650032fb" label="List (Uint)" color="blue"></option></select></th></tr></thead><tbody><tr><td>Name</td><td><span data-option="5a93deb4e03e4bb6b2cad62cef005788">String</span></td></tr><tr><td>Symbol</td><td><span data-option="5a93deb4e03e4bb6b2cad62cef005788">String</span></td></tr><tr><td>Max Supply</td><td><span data-option="f59a4491161a4b9dbe758183bdcc8abe">Uint</span></td></tr><tr><td>Mint Enabled</td><td><span data-option="e60501f3a0c44f8b8e12409d4cb13cea">Boolean</span></td></tr><tr><td>Paused</td><td><span data-option="e60501f3a0c44f8b8e12409d4cb13cea">Boolean</span></td></tr><tr><td>Base Token URI</td><td><span data-option="5a93deb4e03e4bb6b2cad62cef005788">String</span></td></tr><tr><td>Created Timestamp</td><td><span data-option="f59a4491161a4b9dbe758183bdcc8abe">Uint</span></td></tr></tbody></table>

### NFT

<table><thead><tr><th width="319.3912577073985">Name</th><th width="150">Type<select><option value="f59a4491161a4b9dbe758183bdcc8abe" label="Uint" color="blue"></option><option value="e60501f3a0c44f8b8e12409d4cb13cea" label="Boolean" color="blue"></option><option value="c1cc68a96f1640d0b3ee6c54288abf06" label="Address" color="blue"></option><option value="5a93deb4e03e4bb6b2cad62cef005788" label="String" color="blue"></option><option value="b97b905bb0a844919c6c31611e10771d" label="List (Uint)" color="blue"></option></select></th></tr></thead><tbody><tr><td>ID</td><td><span data-option="f59a4491161a4b9dbe758183bdcc8abe">Uint</span></td></tr><tr><td>Token URI</td><td><span data-option="5a93deb4e03e4bb6b2cad62cef005788">String</span></td></tr></tbody></table>

### NFT Metadata (IPFS URL)

<table><thead><tr><th width="280.9670010728205">Name</th><th width="150">Type<select><option value="f59a4491161a4b9dbe758183bdcc8abe" label="Uint" color="blue"></option><option value="e60501f3a0c44f8b8e12409d4cb13cea" label="Boolean" color="blue"></option><option value="c1cc68a96f1640d0b3ee6c54288abf06" label="Address" color="blue"></option><option value="5a93deb4e03e4bb6b2cad62cef005788" label="String" color="blue"></option><option value="b97b905bb0a844919c6c31611e10771d" label="List (Uint)" color="blue"></option></select></th></tr></thead><tbody><tr><td>Name</td><td><span data-option="5a93deb4e03e4bb6b2cad62cef005788">String</span></td></tr><tr><td>Description EN</td><td><span data-option="5a93deb4e03e4bb6b2cad62cef005788">String</span></td></tr><tr><td>Description KR</td><td><span data-option="5a93deb4e03e4bb6b2cad62cef005788">String</span></td></tr><tr><td>Description JP</td><td><span data-option="5a93deb4e03e4bb6b2cad62cef005788">String</span></td></tr><tr><td>License</td><td><span data-option="5a93deb4e03e4bb6b2cad62cef005788">String</span></td></tr><tr><td>External URL</td><td><span data-option="5a93deb4e03e4bb6b2cad62cef005788">String</span></td></tr><tr><td>Image</td><td><span data-option="5a93deb4e03e4bb6b2cad62cef005788">String</span></td></tr><tr><td>Background Color</td><td><span data-option="5a93deb4e03e4bb6b2cad62cef005788">String</span></td></tr><tr><td>Animation URL</td><td><span data-option="5a93deb4e03e4bb6b2cad62cef005788">String</span></td></tr><tr><td>Youtube URL</td><td><span data-option="5a93deb4e03e4bb6b2cad62cef005788">String</span></td></tr><tr><td>Attributes</td><td><span data-option="5a93deb4e03e4bb6b2cad62cef005788">String</span></td></tr></tbody></table>

## Event

### Transfer

<table><thead><tr><th width="254.9670010728205">Name</th><th width="150">Type<select><option value="f59a4491161a4b9dbe758183bdcc8abe" label="Uint" color="blue"></option><option value="e60501f3a0c44f8b8e12409d4cb13cea" label="Boolean" color="blue"></option><option value="c1cc68a96f1640d0b3ee6c54288abf06" label="Address" color="blue"></option><option value="5a93deb4e03e4bb6b2cad62cef005788" label="String" color="blue"></option><option value="b97b905bb0a844919c6c31611e10771d" label="List (Uint)" color="blue"></option></select></th></tr></thead><tbody><tr><td>From</td><td><span data-option="c1cc68a96f1640d0b3ee6c54288abf06">Address</span></td></tr><tr><td>To</td><td><span data-option="c1cc68a96f1640d0b3ee6c54288abf06">Address</span></td></tr><tr><td>Token ID</td><td><span data-option="f59a4491161a4b9dbe758183bdcc8abe">Uint</span></td></tr></tbody></table>

### Approval

<table><thead><tr><th width="319.3912577073985">Name</th><th width="150">Type<select><option value="f59a4491161a4b9dbe758183bdcc8abe" label="Uint" color="blue"></option><option value="e60501f3a0c44f8b8e12409d4cb13cea" label="Boolean" color="blue"></option><option value="c1cc68a96f1640d0b3ee6c54288abf06" label="Address" color="blue"></option><option value="5a93deb4e03e4bb6b2cad62cef005788" label="String" color="blue"></option><option value="b97b905bb0a844919c6c31611e10771d" label="List (Uint)" color="blue"></option></select></th></tr></thead><tbody><tr><td>Owner</td><td><span data-option="c1cc68a96f1640d0b3ee6c54288abf06">Address</span></td></tr><tr><td>Approved</td><td><span data-option="c1cc68a96f1640d0b3ee6c54288abf06">Address</span></td></tr><tr><td>Token ID</td><td><span data-option="f59a4491161a4b9dbe758183bdcc8abe">Uint</span></td></tr></tbody></table>

### Approval For All

<table><thead><tr><th width="319.3912577073985">Name</th><th width="150">Type<select><option value="f59a4491161a4b9dbe758183bdcc8abe" label="Uint" color="blue"></option><option value="e60501f3a0c44f8b8e12409d4cb13cea" label="Boolean" color="blue"></option><option value="c1cc68a96f1640d0b3ee6c54288abf06" label="Address" color="blue"></option><option value="5a93deb4e03e4bb6b2cad62cef005788" label="String" color="blue"></option><option value="b97b905bb0a844919c6c31611e10771d" label="List (Uint)" color="blue"></option></select></th></tr></thead><tbody><tr><td>Owner</td><td><span data-option="c1cc68a96f1640d0b3ee6c54288abf06">Address</span></td></tr><tr><td>Operator</td><td><span data-option="c1cc68a96f1640d0b3ee6c54288abf06">Address</span></td></tr><tr><td>Approved</td><td><span data-option="e60501f3a0c44f8b8e12409d4cb13cea">Boolean</span></td></tr></tbody></table>

### Paused

<table><thead><tr><th width="319.3912577073985">Name</th><th width="150">Type<select><option value="f59a4491161a4b9dbe758183bdcc8abe" label="Uint" color="blue"></option><option value="e60501f3a0c44f8b8e12409d4cb13cea" label="Boolean" color="blue"></option><option value="c1cc68a96f1640d0b3ee6c54288abf06" label="Address" color="blue"></option><option value="5a93deb4e03e4bb6b2cad62cef005788" label="String" color="blue"></option><option value="b97b905bb0a844919c6c31611e10771d" label="List (Uint)" color="blue"></option></select></th></tr></thead><tbody><tr><td>Account</td><td><span data-option="c1cc68a96f1640d0b3ee6c54288abf06">Address</span></td></tr></tbody></table>

### Unpaused

<table><thead><tr><th width="319.3912577073985">Name</th><th width="150">Type<select><option value="f59a4491161a4b9dbe758183bdcc8abe" label="Uint" color="blue"></option><option value="e60501f3a0c44f8b8e12409d4cb13cea" label="Boolean" color="blue"></option><option value="c1cc68a96f1640d0b3ee6c54288abf06" label="Address" color="blue"></option><option value="5a93deb4e03e4bb6b2cad62cef005788" label="String" color="blue"></option><option value="b97b905bb0a844919c6c31611e10771d" label="List (Uint)" color="blue"></option></select></th></tr></thead><tbody><tr><td>Account</td><td><span data-option="c1cc68a96f1640d0b3ee6c54288abf06">Address</span></td></tr></tbody></table>

### Burned

<table><thead><tr><th width="319.3912577073985">Name</th><th width="150">Type<select><option value="f59a4491161a4b9dbe758183bdcc8abe" label="Uint" color="blue"></option><option value="e60501f3a0c44f8b8e12409d4cb13cea" label="Boolean" color="blue"></option><option value="c1cc68a96f1640d0b3ee6c54288abf06" label="Address" color="blue"></option><option value="5a93deb4e03e4bb6b2cad62cef005788" label="String" color="blue"></option><option value="b97b905bb0a844919c6c31611e10771d" label="List (Uint)" color="blue"></option></select></th></tr></thead><tbody><tr><td>Account</td><td><span data-option="c1cc68a96f1640d0b3ee6c54288abf06">Address</span></td></tr></tbody></table>

## Interface

{% tabs %}
{% tab title="IOWNFT" %}

```solidity
interface IOWNFT {
    function mintOfOffering(address _to, uint256 _amount)
        external
        returns (bool);

    function mintOfAdmin(address _to, uint256 _amount) external;

    function pause() external;

    function unpause() external;

    function setMaxSupply(uint256 _maxSupply) external;

    function setBaseTokenURI(string calldata _baseURI) external;

    function setMintEnabled(bool _mintEnabled) external;

    function getMaxSupply() external view returns (uint256);

    function getTotalMinting() external view returns (uint256);

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

    function getMintEnabled() external view returns (bool);

    function getPaused() external view returns (bool);

    function setTokenRoyalty(
        uint256 tokenId,
        address recipient,
        uint96 fraction
    ) external;

    function setDefaultRoyalty(address recipient, uint96 fraction) external;

    function getDefaultRoyalty()
        external
        view
        returns (ERC2981.RoyaltyInfo memory);

    function deleteDefaultRoyalty() external;
}
```

{% endtab %}

{% tab title="IERC721AQueryable" %}

```solidity
interface IERC721AQueryable is IERC721A {
    /**
     * Invalid query range (`start` >= `stop`).
     */
    error InvalidQueryRange();

    /**
     * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
     *
     * If the `tokenId` is out of bounds:
     *   - `addr` = `address(0)`
     *   - `startTimestamp` = `0`
     *   - `burned` = `false`
     *
     * If the `tokenId` is burned:
     *   - `addr` = `<Address of owner before token was burned>`
     *   - `startTimestamp` = `<Timestamp when token was burned>`
     *   - `burned = `true`
     *
     * Otherwise:
     *   - `addr` = `<Address of owner>`
     *   - `startTimestamp` = `<Timestamp of start of ownership>`
     *   - `burned = `false`
     */
    function explicitOwnershipOf(uint256 tokenId)
        external
        view
        returns (TokenOwnership memory);

    /**
     * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
     * See {ERC721AQueryable-explicitOwnershipOf}
     */
    function explicitOwnershipsOf(uint256[] memory tokenIds)
        external
        view
        returns (TokenOwnership[] memory);

    /**
     * @dev Returns an array of token IDs owned by `owner`,
     * in the range [`start`, `stop`)
     * (i.e. `start <= tokenId < stop`).
     *
     * This function allows for tokens to be queried if the collection
     * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
     *
     * Requirements:
     *
     * - `start` < `stop`
     */
    function tokensOfOwnerIn(
        address owner,
        uint256 start,
        uint256 stop
    ) external view returns (uint256[] memory);

    /**
     * @dev Returns an array of token IDs owned by `owner`.
     *
     * This function scans the ownership mapping and is O(totalSupply) in complexity.
     * It is meant to be called off-chain.
     *
     * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
     * multiple smaller scans if the collection is large enough to cause
     * an out-of-gas error (10K pfp collections should be fine).
     */
    function tokensOfOwner(address owner)
        external
        view
        returns (uint256[] memory);
}
```

{% endtab %}

{% tab title="IERC71ABurnable" %}

```solidity
interface IERC721ABurnable is IERC721A {
    /**
     * @dev Burns `tokenId`. See {ERC721A-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) external;
}interface IERC721AQueryable is IERC721A {interface IERC721AQueryable is IERC721A {
```

{% endtab %}

{% tab title="IERC721A" %}

```solidity
interface IERC721A {
    /**
     * The caller must own the token or be an approved operator.
     */
    error ApprovalCallerNotOwnerNorApproved();

    /**
     * The token does not exist.
     */
    error ApprovalQueryForNonexistentToken();

    /**
     * The caller cannot approve to their own address.
     */
    error ApproveToCaller();

    /**
     * Cannot query the balance for the zero address.
     */
    error BalanceQueryForZeroAddress();

    /**
     * Cannot mint to the zero address.
     */
    error MintToZeroAddress();

    /**
     * The quantity of tokens minted must be more than zero.
     */
    error MintZeroQuantity();

    /**
     * The token does not exist.
     */
    error OwnerQueryForNonexistentToken();

    /**
     * The caller must own the token or be an approved operator.
     */
    error TransferCallerNotOwnerNorApproved();

    /**
     * The token must be owned by `from`.
     */
    error TransferFromIncorrectOwner();

    /**
     * Cannot safely transfer to a contract that does not implement the
     * ERC721Receiver interface.
     */
    error TransferToNonERC721ReceiverImplementer();

    /**
     * Cannot transfer to the zero address.
     */
    error TransferToZeroAddress();

    /**
     * The token does not exist.
     */
    error URIQueryForNonexistentToken();

    /**
     * The `quantity` minted with ERC2309 exceeds the safety limit.
     */
    error MintERC2309QuantityExceedsLimit();

    /**
     * The `extraData` cannot be set on an unintialized ownership slot.
     */
    error OwnershipNotInitializedForExtraData();

    // =============================================================
    //                            STRUCTS
    // =============================================================

    struct TokenOwnership {
        // The address of the owner.
        address addr;
        // Stores the start time of ownership with minimal overhead for tokenomics.
        uint64 startTimestamp;
        // Whether the token has been burned.
        bool burned;
        // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
        uint24 extraData;
    }

    // =============================================================
    //                         TOKEN COUNTERS
    // =============================================================

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see {_totalMinted}.
     */
    function totalSupply() external view returns (uint256);

    // =============================================================
    //                            IERC165
    // =============================================================

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);

    // =============================================================
    //                            IERC721
    // =============================================================

    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

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

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

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

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

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

    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` 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);

    // =============================================================
    //                        IERC721Metadata
    // =============================================================

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

    // =============================================================
    //                           IERC2309
    // =============================================================

    /**
     * @dev Emitted when tokens in `fromTokenId` to `toTokenId`
     * (inclusive) is transferred from `from` to `to`, as defined in the
     * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
     *
     * See {_mintERC2309} for more details.
     */
    event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}interface IERC721ABurnable is IERC721A {
    /**
     * @dev Burns `tokenId`. See {ERC721A-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) external;
}
```

{% endtab %}
{% endtabs %}
