I created a simple button in my dapp to make a deposit in aave. I am in Kovan testnet, and I am depositing 50 DAI. The amount of estimated gas fee is 0.000805ETH. This is the code:
const aaveDepositHandler = () => {
lendingPoolInstance.methods.deposit('0xff795577d9ac8bd7d90ee22b6c1703490b6512fd', '50000000000000000000', account, 0).send({from: account})
.on('transactionHash', (hash) => {
console.log(hash);
});
};
Now, when I make a deposit directly in Aave interface, the amount of estimated gas fee is 0.000279ETH.
I don't really understand why my dapp is consuming more gas than the Aave interface, if I am only calling the deposit function, same as Aave interface does. I even compared the "data" and it is exactly the same in both cases:
0xe8eda9df000000000000000000000000ff795577d9ac8bd7d90ee22b6c1703490b6512fd000000000000000000000000000000000000000000000002b5e3af16b188000000000000000000000000000084550e6023be1a35babbeadbfaa0fe586aaff5b10000000000000000000000000000000000000000000000000000000000000000
I would like to understand why this happens, and how I can reduce the amount of gas fee to the same level as Aave interface when I deposit.