Aave.

Publication

Partagez vos connaissances.

Aaveator.
Feb 07, 2023
Questions et Réponses avec des Experts

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
Partager
Commentaires
.
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?

Réponses

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
Commentaires
.

Connaissez-vous la réponse ?

Veuillez vous connecter et la partager.

Aave is a decentralized non-custodial liquidity protocol where users can participate as depositors or borrowers.

213Publications230Réponses
Sui.X.Peera.

Gagne ta part de 1000 Sui

Gagne des points de réputation et obtiens des récompenses pour avoir aidé la communauté Sui à se développer.