Skip to content

Instantly share code, notes, and snippets.

@mookim-eth
Last active June 23, 2023 12:01
Show Gist options
  • Save mookim-eth/72f185019e8c4df3a1edba637067f734 to your computer and use it in GitHub Desktop.
Save mookim-eth/72f185019e8c4df3a1edba637067f734 to your computer and use it in GitHub Desktop.

Problem

User cannot withdraw ETH/BTC/USDT/MATIC from AAVE v2 Pool

root cause

AAVE wrongly set an incompatible InterestRateStrategy for WETH

the new InterestRateStrategy is: https://polygonscan.com/address/0x492dcef1fc5253413fc5576b9522840a1a774dce

which interface is:

  function calculateInterestRates(
    address reserve,
    uint256 utilizationRate,
    uint256 totalStableDebt,
    uint256 totalVariableDebt,
    uint256 averageStableBorrowRate,
    uint256 reserveFactor
  )
    external
    view
    returns (
      uint256 liquidityRate,
      uint256 stableBorrowRate,
      uint256 variableBorrowRate
    );

but AAVE v2 (LendingPool Impl https://polygonscan.com/address/0x6a8730f54b8c69ab096c43ff217ca0a350726ac7#code) is expecting this interface:

function calculateInterestRates(
    address reserve,
    address aToken,
    uint256 liquidityAdded,
    uint256 liquidityTaken,
    uint256 totalStableDebt,
    uint256 totalVariableDebt,
    uint256 averageStableBorrowRate,
    uint256 reserveFactor
  )
    external
    view
    returns (
      uint256 liquidityRate,
      uint256 stableBorrowRate,
      uint256 variableBorrowRate
    );

so this change breaks AAVE v2 WETH pool, no one can deposit/withdraw ETH from AAVE v2 now

the change is made by this tx: https://polygonscan.com/tx/0x6172ae452fb2c6abab7aef013e33cf899e3de09e4933433eeeae5fa41be46457#eventlog

goverance link: https://app.aave.com/governance/proposal/224/

affected assets

USDT 5.5m https://polygonscan.com/token/0xc2132d05d31c914a87c6611c10748aeb04b58e8f?a=0x60D55F02A771d515e077c9C2403a1ef324885CeC

ETH 35k = $63m https://polygonscan.com/token/0x7ceb23fd6bc0add59e62ac25578270cff1b9f619?a=0x28424507fefb6f7f8e9d3860f56504e4e5f5f390

BTC 1.5k = $42m https://polygonscan.com/token/0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6?a=0x5c2ed810328349100A66B82b78a1791B101C9D61

MATIC 11m.4 = $9.9m https://polygonscan.com/token/0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270?a=0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4

@zkWizard
Copy link

So this is impacting deposits and withdrawals right now ??

Damn, that's a really huge catch by you if so!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment