Castle Crush (Reward Share)
This is a guide on how to use reNFT's SDK to interact with the Wildlife contract directly. This tutorial was written for sdk version 5.0.4.
Last updated
This is a guide on how to use reNFT's SDK to interact with the Wildlife contract directly. This tutorial was written for sdk version 5.0.4.
Last updated
reNFT's SDK is written in Typescript, but we plan to add more languages in the future (Python and Golang, at the very least). You can install the SDK by running yarn add @renft/sdk
.
Wildlife contract takes custody of the Castle Crush NFT. However, the NFT does not get transferred on rent. It sits inside of the Wildlife contract for as long as the lending is active. If there is no active renting, the lender may choose to terminate the lending. However, if there is an active renting, the lender must wait for it to conclude.
Because Wildlife contract takes custody of the NFT, you will need to approve the NFT you wish to lend to be operated by the contract. You can find an example of how to do it . Once you have done that, you can lend NFT(s)
A lender can only stop the lending if there is no active renting associated with the lending. This is why it is important to set a maxRentDuration
to the maximum number of cycles that the lender is happy with. For example, if maxRentDuration
is set to 3
it would mean that someone can come in and rent the lending for up to 3
consecutive cycles. You do not need to approve anything from the lender's side on this step, so you are free to call the stop lending function.
This is handled by reNFT's bot and there is no need to worry about renter's doing this themselves. In fact, only reNFT's bot is able to stop the rentals. It does so at midnight after cycle-end. The bot checks all of the rentings every hour. That means that it is possible that it will stop the renting with up to but not exceeding one hour delay. Due to the indexing solution requiring payments for every query made, one hour is a good value to stick to.
As with renting, you must ensure that the Wildlife contract is approved to operate your ERC20 reward token. Follow the link in the Rent section to see an example on how to do this. Once approved, you are able to simply send a lump sum per lending (along with the renters' addresses), the contract will then handle the reward splitting as per the conditions of the original lending (i.e. taking into account other revenue share parties and their respective shares on this particular lending)
To rent, you must approve the payment token of the lending to be operated by the Wildlife contract. To do so, see an example . Once you have done that for the amount of upfrontRentFee
or more, you can proceed with the renting
To learn about how to query the on-chain data, read .