For the complete documentation index, see llms.txt. This page is also available as Markdown.

Aave V3

Supply, borrow and repay on Aave V3 pools.

Aave V3 methods return a single transaction object, where Morpho uses a two-phase pattern. The SDK does not auto-handle ERC-20 approvals for Aave, so your app needs to manage those separately before calling supply or repay methods.

Supply

Supplies assets into an Aave V3 pool as a lender. Make sure you have already approved the pool to spend the underlying token before executing this transaction.

const tx = await lendingClient.buildAaveSupplyTx({
  pool: "0xYourAavePoolAddress",
  asset: "0xYourReserveAsset",
  amount: 1_000_000n, // Amount in underlying token decimals
});

Note: Approvals are handled separately by your app. You will need to send a standard ERC-20 approve call to the asset contract with the pool address as spender before this transaction will succeed.

Borrow

Borrows assets from an Aave V3 pool. You need collateral supplied to the pool beforehand, and the borrow amount must keep your health factor above 1.

const tx = await lendingClient.buildAaveBorrowTx({
  pool: "0xYourAavePoolAddress",
  asset: "0xYourReserveAsset",
  amount: 500_000n,
});

Repay

Repays a borrow position on Aave V3. As with supply, make sure you approve the pool to spend the repayment token first.

Last updated