Credit Delegation
Credit delegation enables a liquidity supplier to deposit assets into the Nexus protocol, earning interest while also granting their borrowing power (i.e., their credit) to other users. The supplier and borrower establish the borrow position and its terms either through offchain legal agreements or onchain smart contracts. This setup allows:
The supplier (delegator) to generate additional yield on top of the protocol’s standard interest.
The borrower (delegatee) to access liquidity without needing collateral.
The delegatee cannot misuse the credit delegation to liquidate the delegator.
For example, if a borrowing action would drop the delegator’s health factor below the HEALTH_FACTOR_LIQUIDATION_THRESHOLD
, the borrow will be rejected.
Approving the delegation
The approveDelegation or delegationWithSig function on the VariableDebtToken contract must be called by the supplier (delegator), approving the borrower (delegatee) a certain amount.
This is done for each debt token that needs to be delegated.
The delegator does not need to already have supplied funds in the protocol to approveDelegation. However, before the delegatee executes borrow, there must be sufficient collateral supplied by delegator in the protocol.
Borrowing the credit
The borrower (delegatee) calls the borrow function on the Pool, using the supplier's (delegator's) address in final parameter onBehalfOf.
The borrower's available credit is reduced by the borrowed amount.
Repaying the credit
Anyone can repay the borrow position OnBehalf of the user, by calling one of the following Pool functions - repay or repayWithPermit. The supplier (aka creditor) can also use the repayWithZTokens function to repay a borrow position with their zTokens of the underlying asset in the same pool.
Last updated
Was this helpful?