Lending Model
The RWA NFT contract is the main contract of the Taker protocol. Also known as lendingV2 contract in Taker Protocol. It exposes all the user-oriented actions that can be invoked using either Solidity or web3 libraries
The lendingV2 contract includes the following types of methods:
Borrow, Repay, Liquidate. Users can use these methods to complete basic lending operations.
CancelOffer, CancelOffers, CancelAllOffers. Users can use these methods to invalidate a signed offer.
RefinanceByLender, RefinanceByBorrow. The lender and borrower can use these methods to initiate a debt transfer.
StartDebtTransfer. The lender can use this method to seek debt transfer from other individuals.
RefinanceDebtTransferByNewLender, RefinanceDebtTransferByOther. After the lender executes the "StartDebtTransfer" method, the new lender and a third party can use these two interfaces for debt transfer. The lender and borrower would need to passively accept the debt transfer.
Method
Borrow
The borrower initiates a loan request based on the loan offer. According to the offer's details, the borrower will either withdraw ETH from the ETH pool pre-deposited by the lender or extract ERC20 tokens from the lender's pre-authorized ERC20 token balance.
call params
Name | Type | Description |
---|---|---|
offer | A custom structure that encompasses all the loan offer information. | |
signature | bytes | The lender signs the loan offer to verify its authenticity and validity. |
loanAmount | uint256 | The amount of funds the borrower wishes to borrow. |
tokenId | uint256 | The token ID of the collateral. |
repay
The borrower repays the loan. If the repayment is in ETH but hasn't been explicitly provided through this method, it can be deducted from the pre-deposited funds in the ETH pool. However, if the repayment is in a standard ERC20 token, the borrower needs to grant authorization in advance for the repayment.
call params
Name | Type | Description |
---|---|---|
order | A custom structure that encompasses all the loan order information. | |
orderId | uint256 | The id of loan order. |
liquidate
When a loan defaults, the lender has the option to liquidate the collateral.
call params
Name | Type | Description |
---|---|---|
order | A custom structure that encompasses all the loan order information. | |
orderId | uint256 | The id of loan order. |
cancelOffer
The lender's created offer information is stored off-chain. Canceling the offer would require an on-chain action to delete the information since the offer has already been signed.
call params
Name | Type | Description |
---|---|---|
salt | uint256 | The unique identifier for a loan offer. |
cancelOffers
Allowing the lender to bulk invalidate loan offers created by self.
call params
Name | Type | Description |
---|---|---|
salts | uint256[] | Array of the unique identifier for a loan offer. |
cancelAllOffers
Allowing the lender to invalidate all loan offers created by self.
call params
no
refinanceByLender
When the lender wishes to extract funds in advance from a loan, they can select a suitable offer and directly initiate a debt transfer.
call params
Name | Type | Description |
---|---|---|
order | A custom structure that encompasses all the loan order information. | |
orderId | uint256 | The id of loan order. |
offer | New offer. A custom structure that encompasses all the loan offer information. | |
signature | byte | The lender signs the loan offer to verify its authenticity and validity. |
refinanceByBorrower
When the borrower wants to consolidate their debt, they can select a suitable offer to initiate a debt transfer.
call params
Name | Type | Description |
---|---|---|
order | A custom structure that encompasses all the loan order information. | |
orderId | uint256 | The id of loan order. |
loanAmount | uint256 | The amount of funds the borrower wishes to borrow. |
offer | New offer. A custom structure that encompasses all the loan offer information. | |
signature | byte | The lender signs the loan offer to verify its authenticity and validity. |
startDebtTransfer
If the lender wants to extract funds from a loan but cannot find a suitable offer, they can use this method to seek debt transfer from other individuals.
If the loan has a fixed duration, then this interface will not be available and the options for debt transfer through "refinanceDebtTransferByNewLender" and "refinanceDebtTransferByOther" may not be available.
call params
Name | Type | Description |
---|---|---|
order | A custom structure that encompasses all the loan order information. | |
orderId | uint256 | The id of loan order. |
refinanceDebtTransferByNewLender
After the lender seeks debt transfer for a loan, the new lender can perform the debt transfer operation without the need to pre-generate an offer specifically for that loan.
call params
Name | Type | Description |
---|---|---|
order | A custom structure that encompasses all the loan order information. | |
orderId | uint256 | The id of loan order. |
rate | uint256 | New rate after dent transfer. |
refinanceDebtTransferByOther
After the lender seeks debt transfer for a loan, a third party can assist in finding suitable offers to facilitate the debt transfer for that specific loan.
call params
Name | Type | Description |
---|---|---|
order | A custom structure that encompasses all the loan order information. | |
orderId | uint256 | The id of loan order. |
offer | New offer. A custom structure that encompasses all the loan offer information. | |
signature | byte | The lender signs the loan offer to verify its authenticity and validity. |
Struct
LoanOffer
Name | type | description |
---|---|---|
lender | address | The lender, creator of the loan offer. |
collection | IERC721 | The address of collection as collateral |
tokenId | uint256 | The token id of collateral. If it is zero, the loan offer accept any token id as collateral. |
loanToken | IERC721 | The token address used for lending. |
totalAmount | uint256 | The total loan amount of the token provided by the loan offer. |
maxAmount | uint256 | The max loan amount of the token provided for once loan. |
loanRate | uint256 | Rate of loan. |
loanDuration | uint256 | Duration of loan. |
expirationTime | uint256 | The Expiration time of the loan offer |
salt | uint256 | The unique identifier for the loan offer. |
LoanOrder
Name | type | description |
---|---|---|
lender | address | The lender of the order. |
borrower | address | The borrower of the order. |
collection | IERC721 | The address of collection as collateral. |
tokenID | uint256 | The token id of nft as collateral. |
loanToken | IERC20 | The address of token in the loan. |
amount | uint256 | The amount of token in the loan. |
startTime | uint256 | The start time of the loan. |
rate | uint256 | Rate of the loan. |
loanDuration | uint256 | Duration of the loan. |
debtTransferStartTime | uint256 | The time when the lender starts seeking debt transfer for this loan. |
debtTransferDuration | uint256 | The duration for which the lender seeks debt transfer for this loan. If this duration is exceeded, the loan will default. |
Last updated