No video

Code Flash Swaps & Arbitrage on Uniswap V3 Pools | Solidity & JavaScript | Borrow, Arbitrage & Repay

  Рет қаралды 29,014

Blockman Codes

Blockman Codes

Күн бұрын

Get my free EthersJS cheatsheet to master web3!
👉 blockman-codes...
------------------------------------------
Courses:
👉 Build a Uniswap V3 interface that can do swaps: bit.ly/3JkXYqL
------------------------------------------
Do you know how to take a flash loan from a Uniswap V3 pool, use it to make swaps on other pools, and then pay back the loan in a single transaction?
That's what flash swaps in Uniswap V3 allow you to do. I'll walk you through code to implement this.
We are going to take a flash loan from one Uniswap pool, generate profits via arbitrage on two other pools, and then pay back the loan.
We'll do all this programmatically with JavaScript and Solidity.
----------------------------------------------
Code: gist.github.co...

Пікірлер: 98
@blockmancodes
@blockmancodes Жыл бұрын
Learn to use all of Uniswap's swap and liquidity functionality with code. bit.ly/3JkXYqL
@LORDWASEEMMALIK
@LORDWASEEMMALIK 3 ай бұрын
I am interested in this, can you tell me will you be teaching this?
@fitzroyw1
@fitzroyw1 18 күн бұрын
At last i find a Developer who isnt a scammer. Good work sir.
@user-ef9zk6np2e
@user-ef9zk6np2e 16 күн бұрын
Is keeping some eth or other crypto, i am intended to arbitrage,in my wallet necessary to pay for gas fee using this code to execute successfully? Can the gas fee be deduced from the profit I gain through the loan?
@jerrywang3225
@jerrywang3225 Жыл бұрын
This is the best flashloan tutorial on youtube, period!
@blockmancodes
@blockmancodes Жыл бұрын
Thanks brother
@davetube75
@davetube75 Жыл бұрын
Gorgeous tutorial! Code is simple to understand and so is the explanation!
@blockmancodes
@blockmancodes Жыл бұрын
Thanks brother!
@metakulnft
@metakulnft Жыл бұрын
Did flash loan help you?
@id104335409
@id104335409 Жыл бұрын
The real question is how do people find arbitrage opportunities. The spots are already taken by the people who most likely wrote the code originally or do this for a living. They know it well and they know how to use it. Lots of smart people out there are writing their own bots that will frontrun you on any deal. IF you get lucky to find any deal at all. The best cases I have seen is usually some obscure crazy swaps that are on the border of hacks or just plain robberies. That's where they punish the people who missed a flaw in their code and take millions out of their dapps.
@davetube75
@davetube75 Жыл бұрын
This is an important question. Do these arbs actually exist, and if they do, do they get front run?
@blockmancodes
@blockmancodes Жыл бұрын
Honestly, it's harder and harder to make money on arbitrage. I just wanted to show the mechanics of it, but people I know making arb profits treat it like a full time job
@davetube75
@davetube75 Жыл бұрын
@@blockmancodes do you have any or will you produce any videos on examining the mempool?
@blockmancodes
@blockmancodes Жыл бұрын
@@davetube75 Yes but I don't know when... my tutorial todo list is getting out of hand lol
@KingYenny
@KingYenny 6 ай бұрын
Whats the minimum, average & highest amount of gasFees needed for pairs on the uniswap V3 interface? From your experiences and observance?
@himotara
@himotara 10 ай бұрын
Great explanation! Quick question: Is it possible to create an arbitrage bot without relying on flash loans or any external funds, simply using my own ETH? And what's the ideal ETH threshold for profitability?
@JV-gf3ee
@JV-gf3ee 8 ай бұрын
Yes, sample: const params = { tokenIn: immutables.token1, tokenOut: immutables.token0, fee: immutables.fee, recipient: acct2, deadline: Math.floor(Date.now() / 200) + (60 * 10), amountIn: amountIn, amountOutMinimum: 0, sqrtPriceLimitX96: 0, } const transaction = swapRouterContract.connect(account).exactInputSingle( params,
@fawazshak
@fawazshak Жыл бұрын
Thank u! One of the best videos on flashloans
@blockmancodes
@blockmancodes Жыл бұрын
Thank you!
@wanhonglau779
@wanhonglau779 Жыл бұрын
This is absolutely great content Many KZbinr publish content on crypto algo trading but very few do in defi space! I have a question: why most defi bot is written in javascript instead of Python?
Жыл бұрын
there are more js libraries you can reuse
@blockmancodes
@blockmancodes Жыл бұрын
Yea. You can use the same JS libraries used on the frontend of dapps, so developers already have experience with them
@user-ef9zk6np2e
@user-ef9zk6np2e 16 күн бұрын
Is keeping some eth or other crypto, i am intended to arbitrage,in my wallet necessary to pay for gas fee using your code? Can the gas fee be deduced from the profit I gain through the loan?
@vaibhavkulkarni9926
@vaibhavkulkarni9926 11 ай бұрын
Do I need to paste my metamask address inside the code to get the profit from arbitrage?
@JV-gf3ee
@JV-gf3ee 8 ай бұрын
Thanks. for all your videos. You have helped me so much.
@viktorcortez5706
@viktorcortez5706 Жыл бұрын
Thanks for your video. Maybe you can make a video about DFS in crypto arbitrage?
@austinewilliams7795
@austinewilliams7795 Жыл бұрын
Hello, Greetings from Nigeria, I have gone through most your videos in you channel (just subbed), and I think your channel is underrated, it has alot gems that could be very helpful for a beginner like me. That being said am a complete noob to programming. I mean a complete blank slate when it comes to coding, and I finding staring to be very overwhelming, pls I need your advise on where to start as a complete beginner. Pls your response will be highly appreciated.
@blockmancodes
@blockmancodes Жыл бұрын
Thank you! I'd start JS web development, then web3 on the frontend, and then solidity. But it's important to prioritize your interest as well, to help stay motivated
@Jawzi
@Jawzi Жыл бұрын
Great tutorials, any chance you can do a tutorial on how some coins add fees to their transfers? Also how to encapsulate coins as NFTS?
@harsh_pathak27
@harsh_pathak27 7 ай бұрын
is it still possible in 2024?
@fitzroyw1
@fitzroyw1 18 күн бұрын
Could you update the coding as i see that many are having problems installing.
@xAA-pl4fd
@xAA-pl4fd Жыл бұрын
it would be interesting to understand how to use permit and permit2 with ethereum tokens with javascript and what are the differences
@blockmancodes
@blockmancodes Жыл бұрын
Hey. I've gotten a few questions about permit lately. Adding to my todo list
@ABCDEFGH-or2eb
@ABCDEFGH-or2eb 8 ай бұрын
Do you need to add liquidity to certain pools on Mainnet (like the 0% selected)? If so, how much liquidity?
@blockmancodes
@blockmancodes Жыл бұрын
What other Uniswap tutorials would you like to see?
@bando8086
@bando8086 Жыл бұрын
Coming from a non coder...some ChatGPT tutorials would be cool! Maybe test around with some requests that can help to build a basic uniswap project in javascript/solidity!
@user-ph8pd2lc8y
@user-ph8pd2lc8y Жыл бұрын
Super nice video. What about : how to copy trade a specific wallet in pending transaction? Same value, same gasprice. Thanks a lot
@DevMode951
@DevMode951 Жыл бұрын
All of them!😮
@SuperDividenz
@SuperDividenz Жыл бұрын
Great video thanks!
@blockmancodes
@blockmancodes Жыл бұрын
Glad you liked it!
@ArthurXtm
@ArthurXtm 11 ай бұрын
Im getting "Error: invalid bytecode" when deploying contracts. have any idea of what i could do?
@buzzboo6442
@buzzboo6442 10 ай бұрын
Can you help me? when running 06_flashSwap.js I got this Error: VM Exception while processing transaction: reverted with reason string 'TF'
@cheesebeef890114
@cheesebeef890114 Жыл бұрын
Thanks for your great video? Do I need my own node for implementing this? and also will this work with other dexes like solidity type fork or uniV2?
@blockmancodes
@blockmancodes Жыл бұрын
You don't need your own node. And yes, it can be implemented for other DEXs
@frontpage235
@frontpage235 Жыл бұрын
Good day boss, nice content. I have a question. I followed the exact step you did in the video, at the end lf the flashloan i check the usdt address ln etherscan but I didn't see the $0.89 theres but in the code it showed the previous balance and the recent balance after the flsah loan. Secondly, i when i input my own wallet address it's still showing uour wallet address instead of mine.
@MrLawalker
@MrLawalker 6 ай бұрын
Oh damn!
@frankeke8541
@frankeke8541 Жыл бұрын
Now we need a tutorial on a screener to automatically find arbitrage opportunities
@blockmancodes
@blockmancodes Жыл бұрын
Working on a few scripts to find arbitrage now :)
@R3nzoku
@R3nzoku Жыл бұрын
Great Tutorial! Is it possible to take a flashloan of 1 token(usdc) swap it in the first pool and then in the second pool use the output from 1st pool swap to take out usdc at the end? this will imply that when using the function exactinputsingle the second time you will have to use the output from the first one.
@blockmancodes
@blockmancodes Жыл бұрын
As long as you pay back the original token, you can do anything with it, including swap on other protocols
@abc_12333
@abc_12333 Жыл бұрын
@@blockmancodes What if I want to use a Balancer or dYdX Flashloan (external Flashloans) and combine that loan with swaps or adding/removing liquidity on Uniswap V3?
@fcum5
@fcum5 Жыл бұрын
Could you do a tutorial on kyberswap?
@blockmancodes
@blockmancodes Жыл бұрын
Yes. Maybe after I do AAVE
@gobindapaul8506
@gobindapaul8506 Жыл бұрын
Great job 👍
@blockmancodes
@blockmancodes Жыл бұрын
Thank you!
@villainonline
@villainonline Жыл бұрын
Fantastic video. You’re very knowledgeable and passionate about your work, love to see it. How long have you been coding to be this good at it?
@blockmancodes
@blockmancodes Жыл бұрын
Thanks brother. Getting close to 10 years :)
@metakulnft
@metakulnft Жыл бұрын
Did flash loan help you?
@danis1840
@danis1840 Жыл бұрын
Great work thank you. Just to get ist: You are deploying these 3 pools, because they are not available on testnet. If you would do it on mainnet, you don't need to deploy pools and tokens, right?
@blockmancodes
@blockmancodes Жыл бұрын
Exactly. For most tokens, all the pools for the token will already exist on mainnet
@ohhu6098
@ohhu6098 Жыл бұрын
this just confused me lol. so we don't need to deploy 3 pools? what do we need to do differently if we're on mainnet? thanku
@viktorcortez5706
@viktorcortez5706 Жыл бұрын
Can I ask you a stupid question? Why don't you launch your file a simple way : node scripts/06_flashswap.js ?
@leon-do
@leon-do 8 ай бұрын
you have a community like tg or slack?
@_mil0__
@_mil0__ Жыл бұрын
Great content thank you
@blockmancodes
@blockmancodes Жыл бұрын
My pleasure
@demarcuswalker257
@demarcuswalker257 Жыл бұрын
What token and how much do I need for the flashloan to work for Uniswap V3 Flashloans and Arbitrage
@blockmancodes
@blockmancodes Жыл бұрын
You can do this with any tokens. Do you mean that the code is not working for you?
@davetube75
@davetube75 Жыл бұрын
Serious question ... are you making consistent profits from arbitraging or is this just an "educational" thing.
@blockmancodes
@blockmancodes Жыл бұрын
Educational. Nowadays, you need to put in a huge amount of effort to find real arb opportunities
@davetube75
@davetube75 Жыл бұрын
@@blockmancodes Ya I think you’d need to look at other networks and scan the mempool and have some sophisticated algos to get ahead of the competition. I’m still trying tho …
@youssefloyd2060
@youssefloyd2060 Жыл бұрын
Hello brother I have a question. I’m interested to do some arbitrage. Did you suceed and if yes what are you advice me to do ? I did one formation in solidity and one in javaScript. I think now I need a formation in algorithm and Defi.
@Barbershoppod
@Barbershoppod 11 ай бұрын
Do you do consults?
@AllJokesAsideBenKirby
@AllJokesAsideBenKirby Жыл бұрын
Is there a code you've written like this but for flash swaps on Bsc chain using Pancakeswap?
@blockmancodes
@blockmancodes Жыл бұрын
I have not, but I'll add to my todo list
@ThePlankton5165
@ThePlankton5165 Жыл бұрын
I have a Chromebook, so I probably won’t be able to use Hardhat. Does that mean I cannot use this code?
@blockmancodes
@blockmancodes Жыл бұрын
I'm not familiar with chromebook. Does it run linux? It think you can make it work
@ThePlankton5165
@ThePlankton5165 Жыл бұрын
@@blockmancodes I think it does, but for some strange reason, I’m not able to go to settings to be able to turn on Linux (which is off by default). I click the gear by the clock, nothing happens.
@ThePlankton5165
@ThePlankton5165 Жыл бұрын
⁠@@blockmancodes I decided to try to compile PairFlash on Remix IDE after copying and pasting the gist link, and got seven errors. I already commented that this morning. I hate to be a bother, but I’m still waiting for a response from you. Are you there?
@ThePlankton5165
@ThePlankton5165 Жыл бұрын
I figured I would just try to run the scripts on Remix IDE. I tried compiling PairFlash and was given seven errors.
@ThePlankton5165
@ThePlankton5165 Жыл бұрын
Why aren’t you answering me? Are you going to answer me?
@blockmancodes
@blockmancodes Жыл бұрын
I don't use remix. Are you using exactly the same versions I used in the tutorial?
@ThePlankton5165
@ThePlankton5165 11 ай бұрын
@@blockmancodes Yes. I ran again, and weirdly enough, only got one error: Error: not found @uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol You said to use 0.7.6, I used 0.7.6.
@user-fk5fx2kl9e
@user-fk5fx2kl9e Жыл бұрын
when i try to deploy it invalid byttcode error issue ,and i also check weth.json file ,json file is good then why
@blockmancodes
@blockmancodes Жыл бұрын
This is caused by changes in different versions on the npm packages. Can you confirm you're using the exact same versions as me?
@user-fk5fx2kl9e
@user-fk5fx2kl9e Жыл бұрын
@@blockmancodes some are same but some are updated
@mikhailgolovach8115
@mikhailgolovach8115 Жыл бұрын
@@blockmancodes change "@uniswap/v3-periphery": "^1.0.1", to "@uniswap/v3-periphery": "1.0.1"
@block_hacks
@block_hacks Жыл бұрын
Do you have Patreon or Discord community? I fucking love this
@blockmancodes
@blockmancodes Жыл бұрын
Good reminder to get one set up
@atrox7685
@atrox7685 Жыл бұрын
nice work
@blockmancodes
@blockmancodes Жыл бұрын
Thanks for watching!
@tonkihonks3430
@tonkihonks3430 Жыл бұрын
Do you have the source code published on GitHub?
@blockmancodes
@blockmancodes Жыл бұрын
Just what's in the description
@TDi.Traders
@TDi.Traders Жыл бұрын
Hey bro is it possible to paste it in remix ide?
@blockmancodes
@blockmancodes Жыл бұрын
I've only ever used Remix for simple code, so I can't say. But I suspect it would take a lot of effort
@jboyce007
@jboyce007 4 ай бұрын
Anyone successfully doing this with flashbots here?
@user-km6ur8qm7b
@user-km6ur8qm7b Жыл бұрын
Psyop
Flash Loan Arbitrage | Aave Flash Loan Tutorial
48:34
Block Explorer
Рет қаралды 143 М.
Кадр сыртындағы қызықтар | Келінжан
00:16
Unveiling my winning secret to defeating Maxim!😎| Free Fire Official
00:14
Garena Free Fire Global
Рет қаралды 10 МЛН
7 Days Stranded In A Cave
17:59
MrBeast
Рет қаралды 96 МЛН
Parenting hacks and gadgets against mosquitoes 🦟👶
00:21
Let's GLOW!
Рет қаралды 13 МЛН
I Built a Trading Bot with ChatGPT
18:33
Siraj Raval
Рет қаралды 1,9 МЛН
Uniswap V3 Flash Borrow
9:45
Smart Contract Programmer
Рет қаралды 2,1 М.
The Story of Next.js
12:13
uidotdev
Рет қаралды 568 М.
But how does bitcoin actually work?
25:16
3Blue1Brown
Рет қаралды 15 МЛН
I spent six months rewriting everything in Rust
15:11
chris biscardi
Рет қаралды 423 М.
How to Borrow $16,000,000 in Cryptocurrency for FREE
12:28
Dapp University
Рет қаралды 347 М.
Using 'SaaS Arbitrage' to Make $3,000/Month Sending Texts
7:00
Millionaire Millennial
Рет қаралды 101 М.
Кадр сыртындағы қызықтар | Келінжан
00:16