borrow
Documentation for eth_defi.aave_v3.loan.borrow function.
- borrow(aave_v3_deployment, *, token, amount, wallet_address, interest_rate_mode=AaveV3InterestRateMode.VARIABLE)[source]
Borrow asset from Aave v3. Requires you have already supplied asset as collateral in advanced.
Example:
# build transactions to borrow WETH from Aave v3 borrow_fn = borrow( aave_v3_deployment=aave_v3_deployment, token=weth.contract, amount=amount, wallet_address=hot_wallet.address, ) tx = borrow_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 borrow.
amount (int) – The amount of token to borrow.
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
Borrow contract function.
- Return type
web3.contract.contract.ContractFunction