Skip to content

Instantly share code, notes, and snippets.

@alexroan
Created July 10, 2020 10:53
Show Gist options
  • Save alexroan/617dcf77b3bd210ad25b5e8f94679911 to your computer and use it in GitHub Desktop.
Save alexroan/617dcf77b3bd210ad25b5e8f94679911 to your computer and use it in GitHub Desktop.
aave_full_deposit.js
// Load the address provider
const providerInstance = new web3.eth.Contract(addressProviderABI, "0x24a42fD28C976A61Df5D00D0599C34c4f90748c8");
// Get lending pool address
const lendingPoolAddress = await providerInstance.methods.getLendingPool().call()
.catch((e) => {
throw Error(`Error getting lendingPool address: ${e.message}`)
});
// Load lending pool
const lendingPoolInstance = new web3.eth.Contract(lendingPoolABI, lendingPoolAddress);
// Deposit funds
lendingPoolInstance.methods.deposit(
"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", supplyValue, 0).send({from: account, value: supplyValue})
.once('transactionHash', (hash) => {
// transaction hash
})
.on('confirmation', (number, receipt) => {
// number of confirmations
})
.on('error', (error) => {
console.log(error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment