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
Returns

A tuple of 2 contract functions for approve and supply transaction.

Return type

tuple[web3.contract.contract.ContractFunction, web3.contract.contract.ContractFunction]