3. Contract Interactions
Purchase one or many validators
The purchase
function is a payable function. The ETH value required is a multiple of 32 ETH, n*32, n is the number of validators we want to purchase. It returns the ids of purchased vNFTs
Fetch all the metadata of a vNFT
The tokenURI
function will return an api endpoint containing all the data related to the vNFT and the underlying validator of tokenId, including validator state, generated rewards etc.
Rent the NFT
We can set a user by calling the setUser
function. The parameters are the tokenId we rent, the address of the user (cannot be the same as the owner) and the timestamp at which the renting expires (cannot be a timestamp in the past or after an already exiting renting period)
Get the current vNFT active user
The function userOf
returns the current active user of the given vNFT id
Get the end of the renting period
The function userExpires
returns the timestamp of the end of the renting period
Get the current vNFT rewards beneficiary
The function beneficiaryOf
returns the current rewards beneficiary of the given vNFT id
Clear an inactive user
The function clearUsership
clear an usership for which the period has ended in order for a given vNFT id. This function is callable only if userExpires(tokenId) ≠ 0 and userExpires(tokenId) ≤ current timestamp
Request an exit
The exit
function will trigger the exit of the given vNFTs ids. A vNFT cannot be exited if userOf(uint256 tokenId) ≠ address(0)
Last updated