Comment on page
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:
- 1.Borrow, Repay, Liquidate. Users can use these methods to complete basic lending operations.
- 2.CancelOffer, CancelOffers, CancelAllOffers. Users can use these methods to invalidate a signed offer.
- 3.RefinanceByLender, RefinanceByBorrow. The lender and borrower can use these methods to initiate a debt transfer.
- 4.StartDebtTransfer. The lender can use this method to seek debt transfer from other individuals.
- 5.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.
function borrow(
LoanOffer calldata offer,
bytes calldata signature,
uint256 loanAmount,
uint256 tokenId
) external;
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.
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. |
function repay(
LoanOrder calldata order,
uint256 orderId
) external payable;
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.
Name | Type | Description |
---|---|---|
order | A custom structure that encompasses all the loan order information. | |
orderId | uint256 | The id of loan order. |
function liquidate(
LoanOrder calldata order,
uint256 orderId
) external;
When a loan defaults, the lender has the option to liquidate the collateral.
Name | Type | Description |
---|---|---|
order | A custom structure that encompasses all the loan order information. | |
orderId | uint256 | The id of loan order. |
function cancelOffer(
uint256 salt
) external;
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.
Name | Type | Description |
---|---|---|
salt | uint256 | The unique identifier for a loan offer. |
function cancelOffers(
uint256[] calldata salts[]
) external;
Allowing the lender to bulk invalidate loan offers created by self.
Name | Type | Description |
---|---|---|
salts | uint256[] | Array of the unique identifier for a loan offer. |
function cancelAllOffers() external;
Allowing the lender to invalidate all loan offers created by self.
no
function refinanceByLender(
LoanOrder calldata order,
uint256 orderId,
LoanOffer calldata offer,
bytes calldata signature
) external;
When the lender wishes to extract funds in advance from a loan, they can select a suitable offer and directly initiate a debt transfer.
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. |
function refinanceByBorrower(
LoanOrder calldata order,
uint256 orderId,
uint256 loanAmount,
LoanOffer calldata offer,
bytes calldata signature
) external;
When the borrower wants to consolidate their debt, they can select a suitable offer to initiate a debt transfer.
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. |
function startDebtTransfer(
LoanOrder calldata order,
uint256 orderId
) external;
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.
Name | Type | Description |
---|---|---|
order | A custom structure that encompasses all the loan order information. | |
orderId | uint256 | The id of loan order. |
function refinanceDebtTransferByNewLender(
LoanOrder calldata order,
uint256 orderId,
uint256 rate
) external payable;
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.
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. |
function refinanceDebtTransferByOther(
LoanOrder calldata order,
uint256 orderId,
LoanOffer calldata offer,
bytes calldata signature
) external;
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.
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 {
address lender;
IERC721 collection;
uint256 tokenId;
IERC20 loanToken;
uint256 totalAmount;
uint256 maxAmount;
uint256 loanRate;
uint256 loanDuration;
uint256 expirationTime;
uint256 salt;
}
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. |
struct LoanOrder {
address lender;
address borrower;
IERC721 collection;
uint256 tokenId;
IERC20 loanToken;
uint256 amount;
uint256 startTime;
uint256 rate;
uint256 loanDuration;
uint256 debtTransferStartTime;
uint256 debtTransferDuration;
}
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 modified 1mo ago