Intro to Defi Flash Loan Lab - Questions

Hi all, opening this for my upcoming video.


Hello… Great proyect!!! This can be used in others chains?

Yes, Absolutely, as long as the Network is supported by AAVE staging server. Also remember that the arbitrage is in the wrapped native token of the respective network.
The token address of this token and the address of the address provider change according to the network. The references file in the github repo has values for kovan and for ethereum mainnet.

Thanks!!! Daniel :pray::pray::wink::wink:

Monthly sub here - this post is why I placed my monthly Morales membership fee on AUTO BILL PAY!!! Thank you and much love from New Orleans!

1 Like

Can you also cover how to tie in proxy contracts to approved smart contract transactions? PLEASE :weary:

I am currently struggling to get my bot and upgradable on the same timing with the trigger and mempool. For clarity - I’m not asking for info on ‘front running’ but more interest in building an AI database of successfull flash loans.

Once again - thank you guys for all you do and I have a pot of New Orleans Seafood Gumbo for you!

1 Like

Hey Spoonman.

The subject of smart contract automation is right down my alley of interest. I’m building a protocol on that, but is mainly related to cronjobs which is not what I think you need.
Let me see if I understand this scenario, and let me know if I’ve got it right.

  • You are trying to build an AI to take arbitrage opportunities.
  • You have a contract that executes a flashloan.
    – Of course the exact logic to execute with the flashloaned amount will vary depending on the arbitrage and for this you have some proxy that you can upgrade on demand.
  • I guess you have a bot for performing the following tasks:
    – Be sort of a contract factory that creates a different proxy on demand, deploys it, upgrades the main contract to use it and then executes the corresponding function.
  • I guess your problem is:
    – By the time the transactions related to upgrading the proxy are finished (after a certain trigger). It is too late to execute the flashloan function because the state that served as a trigger has already changed.

It is an interesting problem to solve. I might do some research on this, mainly because smart contract automation is a subject that intrigues me. hahaha.

Have you taken a look at Chainlink Keepers, not that I have for this specific case. However, I think the key on this scenario is to be able to avoid the deployment transaction, sort of finding a way to run your logic offchain. And then return the flashloan. I remember keepers allow you to have certain solidity code that runs offchain.

Well let’s keep in touch, I wish I could have helped you more than offering the proverbial. “Interesting question” hahaha.

I’m all down for the Gumbo and the Jambalaya.

Thanks so much for the reply - and I have not checked out chain Link lately but maybe it’s time. Finding up-to-date content on flash loans has been a major challenge - I am even considering the course offered by Morales just to make sure I have covered all areas of opportunities. I am still confused as to how to execute a flash loan on Remix IDE so if one of you could post a video on that topic I would really appreciate your insight.

Another topic of interest is flash swaps via Uniswap - is it still worth the effort or has it become too saturated?

Hi Spoon,

On the remix question, you can actually interact with your Flashloan contract on Remix. It is similar to how you interact with the Arbitrage contract in the Lab on the video.

On the flash swaps, I’m not sure, will take a look on the topic for sure.

unable to recieve WAVAX after depositing 0.2 as in the video, kindly advise

Hi there,

Sometimes Metamask doesn’t show tokens by default.

Go to the assets tab in metamask and look for this.

You will need the address of the Wavax contract which is in several lines in the codebase and also in the page were you bridged your tokens.

Best Regards

1 Like

yee follow what @DanielWeb3 mentioned if you wanna see WAVAX in metamask, if it’s not already there :raised_hands:

Alternatively, you can check your address in to see your token balance and the transaction history~

hello team morales… I have the following error … I deployed the MOCKARBITRAGE.SOL contract, but when it came time to finance it, I got an error

see the link below

Ciao Bruno.

Short answer. The arbitrage is in wrapped avax you have to wrap your avax first as shown in the video and then transfer to the contract.

Long answer.

For defi it is very common to wrap native tokens, avax in this case, to allow uniformity in the contract behavior and code. Wrapping is sending native tokens to a contract that returns you an ERC-20 token.

Contracts cannot receive native tokens just like that. The EVM has assurances built in to avoid native tokens being locked. You can only send native tokens to a contract through a payable function, or when the contract implements a receive() or a fallback() function.
This is not the case in this contract and that is the reason your transaction is reverted.

1 Like