Overview

Native Credit Delegation (CD) is a new feature in Aave v2. It allows a depositor to deposit funds in the protocol to earn interest, and delegate borrowing power (i.e. their credit) to other users. The enforcement of the loan and its terms are agreed upon between the depositor and borrowers, which can be either off-chain via legal agreements or on-chain via smart contracts.

This enables:

Follow the below steps to create your first Credit Delegation.

TL;DR: A starter example contract can be found on Kovan etherscan and Github code examples repo, with a twitter discussion here.

In the following guide, we refer to borrower and delegatee. However credit delegation allows the delegation to multiple users, so it can also be read as borrowers and delegatees.

Integration Example Code

Approving the delegation

The [approveDelegation()](notion://www.notion.so/developers/the-core-protocol/debt-tokens#approvedelegation) method must be called by the depositor (delegator), approving the borrower (delegatee) a certain amount.

This is done for each debt token that needs to be delegated.

The depositor (delegator) does not need to already have deposited funds in the protocol to approveDelegation(). However, before the borrower (delegatee) executes borrow(), there must be sufficient collateral assigned to the depositor (delegator) in the protocol.

Borrowing the credit