DeFi Saver
Search
K
👻

AaveSupply

Supply a token to an AaveV2 market.

Description

Action ID: 0xc380343c
Network mainnet: (Deployed address | Code)
Supply a token to an AaveV2 market.

SDK Action

await approve(tokenAddr, proxy);
const aaveSupplyAction = new dfs.actions.aave.AaveSupplyAction(
market,
tokenAddr,
amount,
from,
onBehalfOf,
);

Contract

This is a DFS STANDARD_ACTION.
User needs to approve the DSProxy to pull the _tokenAddr tokens
If amount == uint.max it will supply whole balance of _from address
Input:
/// @param market Address provider for specific market
/// @param tokenAddr The address of the token to be deposited
/// @param amount Amount of tokens to be deposited
/// @param from Where are we pulling the supply tokens from
/// @param onBehalf On behalf of the address we are borrowing, defaults to proxy
/// @param enableAsColl If the supply asset should be collateral
struct Params {
address market;
address tokenAddr;
uint256 amount;
address from;
address onBehalf;
bool enableAsColl;
}
Return value:
return bytes32(supplyAmount);
Events:
emit ActionEvent("AaveSupply", logData);
logger.logActionDirectEvent("AaveSupply", logData);
bytes memory logData = abi.encode(
_market,
_tokenAddr,
_amount,
_from,
_onBehalf,
_enableAsColl
)