Aave.

Publication

Partagez vos connaissances.

Aaveator.
Mar 07, 2023
Questions et Réponses avec des Experts

Fail with error 'SafeERC20: low-level call failed when deposit to Aave v2

Hi,I need help, I try to depoist to Aave lending pool v2 contract from my contract,but fail .

Fail info Fail with error 'SafeERC20: low-level call failed

pragma solidity *@.6.12;
import "https://github.com/aave/protocol-v2/blob/ice/mainnet-dep Loyment-03-12-2020/contracts/protocol/lendingpool/Lendir

contract MyDeposit{l
LendingPool public lendingPool;
address public myUSDCaddress;

constructor() public {
lendingPool = LendingPool(0x4bd5643ac6f66a5237E18bfA7d47cF22f1c9F210) 5
myUSDCaddress = @x9FD21bE27A2B0@59a288229361E2fA632D8D2d074;

function deposit(uint256 _amount) public{

lendingPool.deposit(myUSDCaddress, _amount, 0x9041a80B8fB42f1A2858698925A48EDA268b224A, @) ;
  • Aave Protocol
  • Aave v2
0
2
Partager
Commentaires
.

Réponses

2
Kryptouutiset.
Mar 10 2023, 08:00

Based on the error message you received, it seems like the issue is related to the SafeERC20 library. The error message indicates that a low-level call failed, which may be caused by an issue with the transfer or transferFrom function from the SafeERC20 library.

Here are some possible solutions to this issue:

Make sure that you have approved the LendingPool contract to spend your USDC tokens. You can do this by calling the approve function on the USDC token contract before calling the deposit function on the LendingPool contract.

Check that the address of the USDC token contract and the LendingPool contract are correct.

Ensure that you are passing the correct arguments to the deposit function. The amount parameter should be in the smallest unit of the token (e.g., for USDC, this would be 6 decimal places), and the onBehalfOf parameter should be set to the address that will receive the deposited funds.

Verify that your contract has enough balance of USDC to deposit.

1
Commentaires
.
Aaveator.
Mar 9 2023, 14:00

You can use tenderly.io to debug the failed transaction, but it's most likely that your contract is not approved to spend the user's USDC.

0
Commentaires
.

Connaissez-vous la réponse ?

Veuillez vous connecter et la partager.

Nous utilisons des cookies pour vous assurer la meilleure expérience sur notre site Web.
Plus d'infos