Skip to content

Commit

Permalink
bugfix: can only withdraw from aave if ltv == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoch05 committed Feb 26, 2025
1 parent 181e903 commit a2c2534
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/liquidity/lend/aave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,9 @@ export class Aave extends LendMarket {
}

const accountInfo = await this.poolContract.getUserAccountData(account);
if (accountInfo.ltv === BigInt(0)) {
return { withdraw: aTokenBalance, borrow: BigInt(0) };
}
// (totalCollateralBase - x) * ltv / BigInt(10000) / BigInt(this.healthFactorLimit) >= totalDebtBase
// x <= totalCollateralBase - totalDebtBase * BigInt(this.healthFactorLimit) * BigInt(10000) / ltv
const availableBase =
Expand Down

0 comments on commit a2c2534

Please sign in to comment.