Lesson 10: issue with Aave borrowing function (Görli testnet) #1703
-
Hi folks! Today something bizarre... As kovan testnet is no longer an option for Aave borrowing script, I've adjusted a few things. Before I'm gonna dive into the details, special thanks to @Neftyr for sharing a hint for locating the Aave WETH token addresses, it helped me a lot! Up here: #30 (reply in thread) So, besides amending WETH and DAI token addresses, since we don't have DAI/ETH price feeds in Chainlink for görli network, I've made some workaround for that and created a cross ccy pair using ETH/USD and DAI/USD in the following way (main function): # DAI in terms of ETH
dai_usd_price = get_asset_price(
config["networks"][network.show_active()]["dai_usd_price_feed"]
)
eth_usd_price = get_asset_price(
config["networks"][network.show_active()]["eth_usd_price_feed"]
)
dai_eth_price = dai_usd_price / eth_usd_price
amount_dai_to_borrow = (1 / dai_eth_price) * (borrowable_eth * 0.95) Obviously, price feeds in the config file were updated accordingly, including mainnet ones for forked testing: networks:
default: mainnet-fork
goerli:
weth_token: '0xCCa7d1416518D095E729904aAeA087dBA749A4dC'
lending_pool_addresses_provider: '0x5E52dEc931FFb32f609681B8438A51c675cc232d'
eth_usd_price_feed: '0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e'
dai_usd_price_feed: '0x0d79df66BE487753B02D015Fb622DED7f0E9798d'
dai_token: '0x75Ab5AB1Eef154C0352Fc31D2428Cef80C7F8B33'
mainnet-fork:
weth_token: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
lending_pool_addresses_provider: '0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5'
eth_usd_price_feed: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419'
dai_usd_price_feed: '0xAed0c38402a5d19df6E4c03F4E2DceD6e29c1ee9'
dai_token: '0x6B175474E89094C44Da98b954EedeAC495271d0F' Now, when I run this on görli network - before doing so, crediting my acc. with 0.1 WETH by running get_weth.py on görli - execution crashes on borrowing function (coded 121 as it is presented in the course), returning this error: # Now we will borrow!
dai_address = config["networks"][network.show_active()]["dai_token"]
borrow_tx = lending_pool.borrow(
dai_address,
Web3.toWei(amount_dai_to_borrow, "ether"),
1,
0,
account.address,
{"from": account},
) Not sure why. I've checked every argument there and it looks fine... What is weird though, is the fact that when I borrow DAI "manually" in Aave interface, repay_all function works perfectly fine, so it could not be an issue with lending pool address (unless mistaken). Anyone interested in solving this riddle? P.S. That's my 1st discussion raised in this incredible community :) Extremely excited for the journey towards becoming a blockchain dev one day! Cheers! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Hello @MarkizOrias |
Beta Was this translation helpful? Give feedback.
-
Hello @MarkizOrias and @cromewar, First of all @MarkizOrias great idea for getting DAI/ETH correct price feed, that's very clever approach! I have made some reaserches on it as I was able to test it on kovan and everything was working for me. I'm pretty sure this error pop's because of incorrect And here is the thing as for Goerli there is no such .json file, look below: So the conclusion here is that we cannot borrow any assets for Goerli testnet programmatically unless Aave add .json assets file for Goerli network. Regarding repay function working I think it is because DAI address exists on Aave (So you can repay it), but it doesn't exist for |
Beta Was this translation helpful? Give feedback.
-
@Neftyr it makes sense to me now, thank you for your insights! Hopefully Aave will include a new DAI address in borrowing function shortly. |
Beta Was this translation helpful? Give feedback.
-
so glad I found this, was banging my head against the wall trying to figure out why it wouldn't work, thank you! |
Beta Was this translation helpful? Give feedback.
Hello @MarkizOrias and @cromewar,
First of all @MarkizOrias great idea for getting DAI/ETH correct price feed, that's very clever approach!
I have made some reaserches on it as I was able to test it on kovan and everything was working for me. I'm pretty sure this error pop's because of incorrect
dai_address
. As Patrick showed us we should take DAI address from lending pool available addresses saved in .json file as showed below:Kovan:
Mainnet:
And here is the thing as for Goerli there is no such .json file, look below:
So the conclusion here is that we cannot borrow any assets for Goerli testnet programmatically unless Aave add .json assets file for Goerli network.
Regarding repay…