repay

Documentation for eth_defi.aave_v3.loan.repay function.

repay(aave_v3_deployment, *, token, amount, wallet_address, interest_rate_mode=AaveV3InterestRateMode.VARIABLE)[source]

Pay back the asset you owned in Aave v3.

Example:

# build transactions to pay back USDC to Aave v3
approve_fn, repay_fn = repay(
    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)

# repay
tx = repay_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 repay transaction.

Return type

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