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
Returns

Borrow contract function.

Return type

web3.contract.contract.ContractFunction