Aave.

Post

Share your knowledge.

Aaveator.
Feb 07, 2023
Expert Q&A

Supply in the pool and sends WETH contract Aave error

Hi guys, I'm trying to create a smart contract that does only 1 thing. Call supply in the pool and sends WETH. If I call supply directly using ABI or something else, it works perfectly. But when using my smart contract as a proxy, it always fails. Warning! Error encountered during contract execution [execution reverted]

Can u help me please?

By the way I'm using Goerli network. Here's the list of addresses:

  • My proxy contract: 0x4fa48a2f2de216f6992c2bf9f3f75141ee75c6db
  • Pool: 0x368EedF3f56ad10b9bC57eed4Dac65B26Bb667f6
  • My own address: 0x0117bDb357ddA160b90AB2e082717265B350E705
  • WETH: 0x2e3a2fb8473316a02b8a297b982498e661e1f6f5
  • Aave Protocol
  • Aave Pool
0
1
Share
Comments
.
0x8744...6532.
Feb 8 2023, 20:47

This is a generic error, can you please give more information? What does your contract look like? What are you including during your successful ABI calls?

Answers

1
Aaveator.
Feb 14 2023, 12:09

This contract is calling supply as if the tokens are stored on the contract itself, not msg.sender. To supply on the users behalf you will need the user to call approve on WETH, passing your contract as spender and call transferFrom inside of your supply function.

Before calling supply you must approve the pool to spend these tokens by calling the approve function on the underlying token (i.e. on the USDC contract if you are supplying USDC), passing the poolAddress as the spender parameter

You can either send the tokens to your contract first, or have the user approve your contract to spend their tokens and call transferFrom to send funds from the user to your contract inside of submitOrder;

0
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