Post
Share your knowledge.
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
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
1This 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
;
Do you know the answer?
Please log in and share it.
Aave is a decentralized non-custodial liquidity protocol where users can participate as depositors or borrowers.
- Error "No matching key" when trying to unstake USDC on BNB chain32
- How to tell the code to, rather than "deposit 1 eth worth of WBTC" deposit "500$ worth of WBTC"?22
- How to interpret configuration field in a response from the getReserveData view function in Aave v2?21
- Getting a return value of '25 - INVALID BURN AMOUNT'21
- Is there any way to stake in the security module on Görli?23