Borrow
getUserAccountData()
def get_borrowable_data(lending_pool,account):
(totalCollateralETH, totalDebtETH, availableBorrowsETH, currentLiquidationThreshold, ltv, healthFactor) = lending_pool.getUserAccountData(account)
# all ETH values are denominated in WEI - convert to ETH
total_collateral_eth = Web3.fromWei(totalCollateralETH, "ether")
total_debt_eth = Web3.fromWei(totalDebtETH, "ether")
available_borrow_ETH = Web3.fromWei(availableBorrowsETH, "ether")
print(f"...You have {total_collateral_eth} worth of ETH deposited...")
print(f"...You have {total_debt_eth} worth of ETH borrowed...")
print(f"...You can borrow {available_borrow_ETH} worth of ETH...")
return (float(available_borrow_ETH), float(total_debt_eth))Into main()
DAI
Price of DAI/ETH
Into main()
Lending_pool.borrow
call borrow() from lendingPool contract
Last updated