The LendingPool contract is the main contract of the protocol. It exposes all the user-oriented actions that can be invoked using either Solidity or web3 libraries. The source code can be found here.


Methods

Untitled

Untitled

Untitled

/// Retrieve the LendingPool address
LendingPoolAddressesProvider provider = LendingPoolAddressesProvider(address(0x24a42fD28C976A61Df5D00D0599C34c4f90748c8)); // mainnet address, for other addresses: <https://docs.aave.com/developers/developing-on-aave/deployed-contract-instances>
LendingPool lendingPool = LendingPool(provider.getLendingPool());

/// Input variables
address daiAddress = address(0x6B175474E89094C44Da98b954EedeAC495271d0F); // mainnet DAI

/// swapBorrowRateMode method call
lendingPool.swapBorrowRateMode(daiAddress);
/// Retrieve the LendingPool address
LendingPoolAddressesProvider provider = LendingPoolAddressesProvider(address(0x24a42fD28C976A61Df5D00D0599C34c4f90748c8)); // mainnet address, for other addresses: <https://docs.aave.com/developers/developing-on-aave/deployed-contract-instances>
LendingPool lendingPool = LendingPool(provider.getLendingPool());

/// Input variables
address daiAddress = address(0x6B175474E89094C44Da98b954EedeAC495271d0F); // mainnet DAI
address rebalancedUser = /*address_to_rebalance*/;

/// rebalanceStableBorrowRate method call
lendingPool.rebalanceStableBorrowRate(daiAddress, rebalancedUser);

Untitled

/// Import interface for ERC20 standard
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";

/// Retrieve the LendingPool address
LendingPoolAddressesProvider provider = LendingPoolAddressesProvider(address(0x24a42fD28C976A61Df5D00D0599C34c4f90748c8)); // mainnet address, for other addresses: <https://docs.aave.com/developers/developing-on-aave/deployed-contract-instances>
LendingPool lendingPool = LendingPool(provider.getLendingPool());

/// Input variables
address collateralAddress = /*collateral_address*/;
address daiAddress = address(0x6B175474E89094C44Da98b954EedeAC495271d0F); // mainnet DAI
address userAddress = /*user_address_being_liquidated*/;
uint256 purchaseAmount = 100 * 1e18;
bool receiveATokens = true;

/// Approve LendingPool contract to move your DAI
IERC20(daiAddress).approve(provider.getLendingPoolCore(), purchaseAmount);

/// LiquidationCall method call
lendingPool.liquidationCall(
    collateralAddress,
    daiAddress,
    userAddress,
    purchaseAmount,
    receiveATokens
);

Untitled

/**
* Flash Loan of 1000 DAI.
* See the full tutorial here: <https://docs.aave.com/developers/tutorials/performing-a-flash-loan>
*/

/// Retrieve the LendingPool address
LendingPoolAddressesProvider provider = LendingPoolAddressesProvider(address(0x24a42fD28C976A61Df5D00D0599C34c4f90748c8)); // mainnet address, for other addresses: <https://docs.aave.com/developers/developing-on-aave/deployed-contract-instances>
LendingPool lendingPool = LendingPool(provider.getLendingPool());

/// Input variables

/* the receiver is a contract that implements the IFLashLoanReceiver interface */
address receiver = /*contract_address*/;
address daiAddress = address(0x6B175474E89094C44Da98b954EedeAC495271d0F); // mainnet DAI
uint256 amount = 1000 * 1e18;

// If no params are needed, use an empty params:
bytes memory params = "";
// Else encode the params like below (bytes encoded param of type `address` and `uint`)
// bytes memory params = abi.encode(address(this), 1234);

/// flashLoan method call
lendingPool.flashLoan(receiver, daiAddress, amount, params);

Untitled

View Methods