Access of rental protocol

If the Rentero Market cannot meet the rental needs of project parties, the project parties can self-define their own rental markets by using the SDK of Rentero Protocol. Here, the project parties need to accomplish the first step: NFTs identification and access.

1. Introduction of rental SDK functions

Rentero Protocol focuses on Rentero[王1] class, and currently has lendNFT, reLendNFT, rentNFT, earlyReturn, redeemNFT and other perfect functions, which can be used by the project parties as needed. See SDK document for API.

Initialization of Rentero class relies on two parameters

  • singer: ethers.Signer is used for interaction with contracts and for signing transactions

  • config: configuration item. targetChain specifies the chain name; renteroType specifies different Rentero Markets, which represent different rental models. Currently, there is only the rent installment model, while more models will be developed in the future to support various rental businesses.

import { Rentero } from '@rentero/sdk-js'

const rentero = new Rentero(signer, {
    targetChain: 'bsctestnet', // current support chain 'mainnet' | 'rinkeby' | 'bsc' | 'bsctestnet'
    renteroType: 'installment',
  }
)

2. NFTs lending process

2.1 NFTs lending

Rentero.lendNFT(
		nftAddress: string, 
		tokenId: number, 
		erc20Address: string, 
		whitelist: string, 
		deposit: BigNumber, 
		dailyPrice: BigNumber, 
		paymentCycle: number, 
		minRentalDays: number, 
		maxRentalDays: number) => Promise<an

The NFTs lending interface contains many parameter configurations, of which the meanings and instructions for use are as follows:

  • whitelist: if it is set, only users on the whitelist are allowed to rent the corresponding NFT. Currently, only one wallet address can be set in the whitelist. If no whitelist is needed, you need to enter Zero Address: 0x0000000000000000000000000000000000000000

  • deposit: according to the rental protocol, the deposit will be withheld by Lender as compensation in case of any breach by Renter. Rentero Market sets the deposit as 1 day’s rent. The project parties can self-define the amount of deposit according to their own needs.

  • minRentalDays: the set minimum number of rental days. The minimum value that Lender can set is 1 day.

  • maxRentalDays: the set maximum number of rental days. The maximum value that Lender can set is 65,535 days.

  • nftAddress: the contract address of the NFT lent

  • tokenId: ID of the NFT lent

  • erc20Address: the contract address of ERC20 token for rent payment

  • dailyPrice: daily price of NFT rental

  • paymentCycle: rent payment cycle (days), which means that rent should be paid every x days.

2.2 Update of NFTs rental configurations

For the NFTs that have been lent but not yet been rented, the rental configuration information can be updated, in the same way as Rentero.reLendNFT and lendNFT.

2.3 Lending process

Before the lendNFT function is called, it is necessary to check whether the NFT to be lent has been authorized in the market contract; if not, user authorization is needed; otherwise, the process will be interrupted due to a lack of authority.

2.4 Examples

// lendNFT
const result = await rentero?.lendNFT(
  '0x317caEc5AFd5d43B205683318eC35ed8B063d131',
  573,
  '0x304af20ef7a8497aeed4a4a6ba4601988d5b11f6',
  '0x0000000000000000000000000000000000000000',
  ethers.utils.parseUnits('2.4', 18),
  ethers.utils.parseUnits('2.4', 18),
  5,
  1,
  365
)
console.log(result)ty
// reLendNFT
const result = await rentero?.lendNFT(
  '0x317caEc5AFd5d43B205683318eC35ed8B063d131',
  573,
  '0x304af20ef7a8497aeed4a4a6ba4601988d5b11f6',
  '0x0000000000000000000000000000000000000000',
  ethers.utils.parseUnits('1.2', 18),
  ethers.utils.parseUnits('1.2', 18),
  3,
  1,
  365
)
console.log(result)

3. NFTs renting process

Renter can call the rentNFT function after choosing the NFT and filling in the number of rental days.

3.1 NFT renting method

Rentero.rentNFT(contractAddress: string, tokenId: number, rentDays: number) => Promise<any>

3.2 Authorization of ERC20 Token

Before the Rent function is called, it is necessary to check whether the current user has authorized sufficient ERC20 Token in the market contract; if not, the deduction of rent will fail due to a lack of authority.

4. Default process

Defaults:

  • Lender redeems an NFT in advance by breach (if the NFT is not rented, the normal removal process should apply);

  • Renter returns an NFT in advance;

The project parties can decide whether to provide the default operation capability in the self-built rental market according to their own business needs. The above defaults will not affect the rental business process of the project parties.

In case of breach by either Renter or Lender, the breaching party should pay liquidated damages to the other party (i.e., deposit in the aforesaid lending process), and the rental protocol provider will not deduct the service fee from the liquidated damages.

4.1 Returning by Renter in advance

If Renter returns an NFT in advance, Renter’s deposit will be transferred to Lender as liquidated damages, the renter-lender relationship will be terminated, Renter’s right to use the NFT will cease, and the NFT will continue to be available for renting in the market.

Rentero.earlyReturn(contractAddress: string, tokenId: number) => Promise<any>

4.2 Redemption by Lender by breach

If Lender redeems an NFT by breach, a certain amount of Lender’s deposit will be transferred to Renter as liquidated damages, the renter-lender relationship will be terminated, Renter’s right to use the NFT will cease, and the NFT will go out of the market and be redeemed by Lender.

Rentero.redeemNFT(contractAddress: string, tokenId: number) => Promise<any>

As mentioned above, if an NFT goes out of the market normally, redeemNFT method can apply. If an NFT is redeemed by breach, Lender should first authorize ERC20 Token to the market contract, which will transfer the deposit to Renter before the redemption.

5. Acquisition of rental order data

Currently, RenteroNFT class has an interface for inquiring NFT rental data based on the wallet address. For more complete search and query interface services, you can call our TheGraph service. For details, please refer to the Introduction and Use of Rentero TheGraph Service

6. Commission under rental protocol

At the initial stage, Rentero Protocol will collect 10% of Renter’s rental income, which will be used to pay the transaction fees and the subsequent maintenance, iteration and upgrade costs of the rental protocol. If some project parties need to collect commissions under the rental protocol, they should communicate and negotiate with the rental protocol provider.


Last updated