Z
Z
Zesty Market
Search…
ZestyNFT

Introduction

ZestyNFT is used by sellers of advertising space to define and financialize a digital space. A ZestyNFT is able to accumulate ZestyTokens which can be retrieved upon burning the ZestyNFT. This helps to set a floor price for ZestyNFTs.
ZestyNFT follows the ERC721 specification adding it on with the ERC721Metadata, ERC721Enumerable extensions. Information on the ERC721 specification can be found on EIP-721. Additional state changing functions are mint, burn, setTokenURI, lockZestyToken. The specifications described below are the functionality that were added.
ZestyNFT's URIs, like other URIs on Zesty Market, will be an IPFS hash. The files can be hosted on IPFS using an IPFS provider, Filecoin, or Arweave.

Specifications

Constructor

ZestyNFT is an Ownable contract. The owner of the ZestyNFT will be set to the deployer initially. The only control the owner has over the ZestyNFT contract is setting the ZestyToken address when ZestyToken is deployed. The zestyTokenAddress will be set to the 0 address initially.
1
constructor(address owner_, address zestyTokenAddress_)
2
Ownable(owner_)
3
ERC721("Zesty Market NFT", "ZESTYNFT")
Copied!

Getter Functions

getTokenData

Returns the creator, time created, amount of locked zesty tokens, and the uri of the token data.
1
function getTokenData(uint256 tokenId)
2
public
3
view
4
returns (
5
address creator,
6
uint256 timeCreated,
7
uint256 zestyTokenValue,
8
string memory uri
9
)
Copied!

getZestyTokenAddress

Returns the address of ZestyToken. This can be the 0 address if ZestyToken has yet to be deployed. If the address is 0, ZestyNFT will not allow the locking of ZestyTokens and retrieval of ZestyTokens.
1
function getZestyTokenAddress() public view returns (address)
Copied!

State Changing Functions

setZestyTokenAddress

Sets the address of ZestyToken. Only the owner of the contract can set the ZestyToken address. After setting the ZestyToken address, the address should not be changed anymore so that there would not be any balance accounting issues with ZestyTokens stored on the contract. The owner of the contract will voluntarily renounce ownership of the contract when ZestyToken address has been set. Renouncing ownership is not done programmatically through the contract.
1
function setZestyTokenAddress(address zestyTokenAddress_) public onlyOwner {
Copied!

mint

Mints a ZestyNFT. The creator of the NFT can set the URI of the ZestyNFT. The URI should be an IPFS hash and should point to a json file which contains other data. The format of the json file would follow the ERC1155 metadata specification with the omission of a decimals field as this is an ERC721 token.
The URI can be modified by the creator of the NFT when the NFT is owned by the creator. The URI cannot be modified once the NFT leaves the creator's address.
1
function mint(string memory _uri) public
Copied!

lockZestyToken

Locks ZestyToken in the contract. Locking of ZestyToken is prohibited if the ZestyToken address has yet to be set. Otherwise, locking ZestyTokens will transfer ZestyTokens from an account or contract to the ZestyNFT contract and increment the balance of ZestyTokens in the ZestyNFT. The nonReentrant modifier is introduced to prevent any form of reentrancy.
1
function lockZestyToken(uint256 _tokenId, uint256 _value) public nonReentrant
Copied!

burn

Burns a ZestyNFT and transfers locked ZestyTokens to the caller of the function. The caller may be an approved address or the owner of the ZestyNFT. Users should ensure that they do not approve unsafe addresses to manage their ZestyNFT.
1
function burn(uint256 _tokenId) public nonReentrant
Copied!
setTokenURI
Allows the creator to modify the URI when the NFT is in the creator's possession
1
function setTokenURI(uint256 _tokenId, string memory _uri) public
Copied!
Last modified 3mo ago