> For the complete documentation index, see [llms.txt](https://docs.teller.org/teller-diamond/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.teller.org/teller-diamond/facets-aka-mini-contracts/nft.md).

# NFT

#### `distributor`

There are 2 distributor files, one in `internal` and one in `external`.

* `internal` contains abstracted functions used in `claim`
* `external` contains functions get the NFT and merkle roots from the distribution store. It also checks if an NFT is already claimed

#### `library`

The library directory contains the `NFTLib`, which help link with the NFT and App storage while also adding functionalities. Functions include:

* `stake` stakes an NFT by transferring it to the diamond and adding it to the list of claimed NFTs by the owner
* `unstake` unstakes the NFT by removing the NFT from the owner's list of claimed NFTs
* `stakedNFTs` retrieves the list of staked NFTs from the owner
* `liquidateNFT` if the user fails to pay the loan, it liquidates the NFT by transferring it to the NFT liquidation controller
* `applyToLoan` unstakes an NFT and uses it to apply to a loan
* `restakeLinked` retrieves the loan's NFTs and adds them back to the list of owner's staked NFTs
* `verifyLoanSize` it verifies the NFT id to base loan size using the merkle proof

#### `ITellerNFT`

The interface that defines functions to do the following:

* `getTier` returns information about a Tier with from a tier index
* `getTokenTier` returns information about a Tier for a token ID
* `getTierHashes` returns an array of image hashes stored on IPFS in a tier
* `getOwnedTokens` returns an array of token IDs owned by an address
* `mint` mints a new token for a Tier index
* `addTier` adds a new Tier to be minted with the given information
* `setContractURIHash` sets the contract level metadata URI hash
* `initialize` initializes the TellerNFT

#### `NFTFacet`

The NFT facet uses the NFTLib functionalities to help with:

* `getStakedNFTs` which gets the staked NFTs mapped to an owner's address
* `getLoanNFTs` returns the NFTs mapped to a loan
* `stakeNFTs` transfers multiple Teller NFTs to Diamond and applies user stake
* `setNFTMerkleRoot` sets a merkle root that is used to verify an NFT ID to its predetermined base loan size
