Aave.

Post

Share your knowledge.

Marcador.
Oct 18, 2023
Expert Q&A

Error while Interacting with AAVE IPoolAddressesProvider Contract in JavaScript

I am facing issues while working with the IPoolAddressesProvider contract in my JavaScript code for the Aave protocol. I'm trying to create the IPoolAddressesProvider object using the following code:

const POOL_ADDRESSES_PROVIDER = IPoolAddressesProvider("0x012bAC54348C0E635dCAc9D5FB99f06F24136C9A");
However, it seems that the IPoolAddressesProvider object is not exportable in the Aave protocol node package. This is causing problems for me because I need to use the getUserReserveData(IPoolAddressesProvider, address) function, which requires the IPoolAddressesProvider object as an input parameter.

I've attempted to fetch user reserve data using the getUserReserveData function as follows:

const beginLiquidateCall = await poolDataProviderContract.getUserReserveData("0x012bAC54348C0E635dCAc9D5FB99f06F24136C9A","0x67c0378c1D14447013CEe84A54c558864b95B157");
console.log(beginLiquidateCall);

However, I'm encountering the following error:

Error: missing revert data (action="call", data=null, reason=null, transaction={ "data": "0x28dd2d01000000000000000000000000012bac54348c0e635dcac9d5fb99f06f24136c9a00000000000000000000000067c0378c1d14447013cee84a54c558864b95b157", "to": "0x3e9708d80f7B3e43118013075F7e95CE3AB31F31" }, invocation=null, revert=null, code=CALL_EXCEPTION, version=6.7.1)

I've also attempted to update the first variable of SEPOLIA WETH and used the following code:

const beginLiquidateCall = await poolDataProviderContract.getUserReserveData("0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9","0x67c0378c1D14447013CEe84A54c558864b95B157");

But I still receive the same error. I'm having difficulty understanding where the issue might be originating from. Can someone please help me identify the problem or provide code that could help me decipher the data and investigate further? Thank you.

  • Aave Protocol
1
1
Share
Comments
.

Answers

1
Chuba.
Oct 19 2023, 08:57

The error you're encountering is due to passing the wrong parameters to the getUserReserveData function. In both Solidity and JavaScript, function parameters are always addresses, not the object itself. Specifically, the first parameter of this function expects the address of an underlying reserve token (such as WETH, USDC, etc.), not the address of the PoolAddressesProvider contract. The PoolAddressesProvider is not a token address, and that's why you're getting a revert error.

To resolve this issue, you need to provide the correct token address for the first parameter. In the case of the Sepolia V3 market, you can find the addresses of underlying tokens in the Aave V3 Sepolia market documentation. The documentation, usually located at the bottom of the address table, and the address registry list all the underlying token addresses for this market.

It's important to note that all Aave test markets use custom deployments of each underlying token, allowing them to be minted for testing purposes. You can use the Faucet contract also listed in the documentation to obtain these tokens for testing. Make sure to pass the correct token address as the first parameter when calling the getUserReserveData function to avoid the revert error.

1
Best Answer
Comments
.

Do you know the answer?

Please log in and share it.

We use cookies to ensure you get the best experience on our website.
More info