withdraw

Documentation for eth_defi.aave_v3.loan.withdraw function.

withdraw(aave_v3_deployment, *, token, amount, wallet_address)[source]

Withdraw the deposit from Aave v3.

Example:

# build transactions to withdraw all USDC you deposited from Aave v3
withdraw_fn = withdraw(
    aave_v3_deployment=aave_v3_deployment,
    token=usdc.contract,
    amount=MAX_AMOUNT,
    wallet_address=hot_wallet.address,
)

tx = withdraw_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 withdraw.

  • amount (int) – The amount of token to withdraw. Set MAX_AMOUNT if you want to withdraw everything.

  • wallet_address (eth_typing.evm.HexAddress) – Your wallet address.

Returns

Withdraw contract function.

Return type

web3.contract.contract.ContractFunction