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

Answers 1

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`;