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
aave_v3_deployment – Instance of
eth_defi.aave_v3.deployment.AaveV3Deployment
.token (web3.contract.contract.Contract) – Aave v3 reserve token you want to pay back.
amount (int) – The amount of token to pay back. Set to MAX_AMOUNT to fully repay your loan.
wallet_address (eth_typing.evm.HexAddress) – Your wallet address.
interest_rate_mode (eth_defi.aave_v3.constants.AaveV3InterestRateMode) – Stable or variable borrow rate mode, default to variable borrow rate.
- Returns
A tuple of 2 contract functions for approve and repay transaction.
- Return type
tuple[web3.contract.contract.ContractFunction, web3.contract.contract.ContractFunction]