Interact with AAVE Deposit function

Hi, I’m confused on how to interact with the AAVE protocol. I want to include on my website the possibility to deposit funds on (or withdraw from) AAVE.

I was following this tutorial on youtube:

Could it be as simple as demonstrated in the video, using this smart contract on Kovan? Is there any boilerplate available?
https://kovan.etherscan.io/address/0xE0fBa4Fc209b4948668006B2bE61711b7f465bAe

Tia

Hey @cleyfe

You can find all needed params there:

So you need to call the deposit method from your frontend and provide needed params.

Aave has dev docs.

You can find full info about the deposit() aave method in their docs https://docs.aave.com/developers/the-core-protocol/lendingpool#deposit

2 Likes

Hey Yomoo! Thanks a lot for the help. I’m glad to find I was not too far from the solution.
However, I am not exactly sure on how to call the function. How should I initialize the connection with the smart contract / import the function?

I saw this solution via ethers.js. Should I go with that or is there an easier solution?

import { Contract, utils } from "ethers"
const LENDING_POOL_ADDRESS = await addressesProvider.getLendingPool();
const weth = new Contract(WETH_ADDRESS, WethAbi, signer);
const lendingPool = new Contract(LENDING_POOL_ADDRESS, LendingPoolAbi, signer);

// Approve LendingPool to spend user's funds
await weth.approve(LENDING_POOL, constants.MaxUint256);

// On successful deposit onBehalf address receives the aToken
await lendingPool.deposit(WETH, utils.parseEther(amount), onBehalf, 0);

This looks generally in the right direction :raised_hands: what you’ll need is the contract addresses and the ABI of those contract you are interacting with

1 Like

Thanks! Getting closer to my goal here. Something I still don’t understand though. There is not the “deposit” function in the contract ABI I sent above (see first image below).

However, there’s this message in the contract, shown on the image below.

Should I use the ABI from this contract mentioned instead?

That seems to be a proxy contract, you need the abi from the final contract.

1 Like

Hi cryptokid, it was indeed a proxy contract. I found the final contract, confirmed with AAVE developers, but I’m still not able to make it work.

The complete abi is in the following link. I’m trying to use the Deposit function but I don’t know what should U import from this abi. Is it obvious to you? Could you please help me on this one?

kovan AAVE Lendingpool.sol abi

tya