supply
Documentation for eth_defi.aave_v3.loan.supply function.
- supply(aave_v3_deployment, *, token, amount, wallet_address)[source]
Opens a loan position in Aave v3 by depositing any Aave v3 reserve token and receiving aToken back.
Example:
# build transactions to supply USDC to Aave v3 approve_fn, supply_fn = supply( aave_v3_deployment=aave_v3_deployment, token=usdc.contract, amount=amount, wallet_address=hot_wallet.address, ) # approve tx = approve_fn.build_transaction({"from": hot_wallet.address}) signed = hot_wallet.sign_transaction_with_new_nonce(tx) tx_hash = web3.eth.send_raw_transaction(signed.rawTransaction) assert_transaction_success_with_explanation(web3, tx_hash) # supply tx = supply_fn.build_transaction({"from": hot_wallet.address}) signed = hot_wallet_account.sign_transaction_with_new_nonce(tx) tx_hash = web3.eth.send_raw_transaction(signed.rawTransaction) assert_transaction_success_with_explanation(web3, tx_hash)
- Parameters
aave_v3_deployment – Instance of
eth_defi.aave_v3.deployment.AaveV3Deployment
.token (web3.contract.contract.Contract) – Aave v3 reserve token you want to supply.
amount (int) – The amount of token to supply.
wallet_address (eth_typing.evm.HexAddress) – Your wallet address.
- Returns
A tuple of 2 contract functions for approve and supply transaction.
- Return type
tuple[web3.contract.contract.ContractFunction, web3.contract.contract.ContractFunction]