Skip to content

Instantly share code, notes, and snippets.

@RachBLondon
Created June 11, 2020 11:10
Show Gist options
  • Save RachBLondon/03ccda59c1f0c3b29a6fb123cfb7bd41 to your computer and use it in GitHub Desktop.
Save RachBLondon/03ccda59c1f0c3b29a6fb123cfb7bd41 to your computer and use it in GitHub Desktop.
pragma solidity ^0.5.0;
import 'https://github.com/aave/aave-protocol/blob/master/contracts/interfaces/ILendingPoolAddressesProvider.sol';
import './ILendingPool.sol';
import './IERC20.sol';
contract AaveDeposit {
ILendingPoolAddressesProvider provider;
address dai;
uint amount;
constructor() public {
provider = ILendingPoolAddressesProvider(0x506B0B2CF20FAA8f38a4E2B524EE43e1f4458Cc5);
dai = 0xFf795577d9AC8bD7D90Ee22b6C1703490b6512FD;
amount = 1;
}
function makeDeposit() public payable {
ILendingPool lendingPool = ILendingPool(provider.getLendingPool());
IERC20(dai).approve(provider.getLendingPoolCore(), amount);
lendingPool.deposit(dai, amount, 0);
}
}
@RachBLondon
Copy link
Author

Working with remix and Kovan, I keep getting the following error:

Gas estimation failed
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
The execution failed due to an exception. Reverted

I have also tried:

contract Borrower {
    ILendingPoolAddressesProvider provider;
    address dai;
    uint amount;
    
    
    constructor() public {
        provider = ILendingPoolAddressesProvider(0x506B0B2CF20FAA8f38a4E2B524EE43e1f4458Cc5);
        dai = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
        amount = 1;
    }
    

    function makeDeposit() public payable  {
        ILendingPool lendingPool = ILendingPool(provider.getLendingPool());
        // IERC20(dai).approve(provider.getLendingPoolCore(), msg.value);
        lendingPool.deposit(dai, msg.value, 0);
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment