Repay With aTokens
Allows user to repay with aTokens in case the underlying borrowed asset is locked in the Aave liquidity pool.
Example: User have stable DAI debt and also holds aDAI token
The user in this case can use aDAI to repay DAI debt in single transaction without any approvals or having to withdraw their supplied liquidity to the pool using repayWithATokens feature.
1
import { Contract, utils } from "ethers";
2
const poolAbi = require("./abis/pool.json");
3
const pool = new Contract(POOL_ADDRESS, poolAbi, signer);
4
5
// repay amount of DAI debt using aDAI tokens
6
pool.repayWithATokens(DAI.address, amount, 2);
7
8
// User must hold aDAI >= amount being repaid
Copied!
Copy link