Uniswap V3 Tutorial | Uniswap Smart Contract (Single Swap) | DeFi Tutorial

  Рет қаралды 43,622

Block Explorer

Block Explorer

Жыл бұрын

In this Uniswap tutorial create a smart contract that implements a simple ERC20 token swap (Uniswap single swap) using the Uniswap V3 protocol. This DeFi tutorial explores the Uniswap V3 ISwapRouter interface for executing token swaps from Uinswap liquidity pools. Follow along and learn about this important DeFi primitive.
GitHub repo for this tutorial:
github.com/jspruance/uniswap-...
LINK:
0x326C977E6efc84E512bB9C30f76E30c160eD06FB
WETH:
0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6
USDC:
0x07865c6E87B9F70255377e024ace6630C1Eaa37F
Uniswap Swap Router address:
0xE592427A0AEce92De3Edee1F18E0157C05861564
SingleSwap.sol deployed:
0xBdfCf1e48Fb8E7C66Fd7E0541BF9b1cf67558c49
Deploy contract:
npx hardhat run --network goerli scripts/deploySingleSwap.js
GitHub direct link for Remix:
import "github.com/Uniswap/v3-periphe...";

Пікірлер: 94
@code.badger
@code.badger Жыл бұрын
This channel is a hidden gem
@BlockExplorerMedia
@BlockExplorerMedia Жыл бұрын
Thanks my friend!
@ouailtayarth4012
@ouailtayarth4012 Жыл бұрын
I've been looking for this type of high-quality DeFi content for almost a month, and I just found it! Thank you for your efforts, and please keep up the good work
@quantaraum
@quantaraum Жыл бұрын
i lovr the red string pullinh through your tutorial. you help us really understand the different sections and connecting each point on our own. Big props! much appreciated
@dannithomx
@dannithomx Жыл бұрын
Thanks for this video, I was stuck up on this tiny thing that I just couldn't see it. It caused my swaps to keep reverting, thanks to you I was able to spot it and move past it. Great work, keep up the good work chief!!!
@redbeet4772
@redbeet4772 11 ай бұрын
My swap also keep reverting, do you happen to know what I missed?
@luiscallero6288
@luiscallero6288 5 ай бұрын
Love it how you go step by step and give it a clear and simple explanation of the contract provided by Uniswap. Uniswap should attach this video to better explain the documentation. Uniswap documentation is very poor. So your review is awesome!! Thanks!!
@BitcoinAndCryptoCurrency
@BitcoinAndCryptoCurrency 10 ай бұрын
I have watched many videos on crypto and this is the first one I watched twice - loved it
@codywatt7775
@codywatt7775 4 ай бұрын
Awesome work my friend. Thank you for putting in the time to make this for us. It has been super helpful!
@user-ir9xc3gg4v
@user-ir9xc3gg4v 23 күн бұрын
Thanks bro . great video !
@pratyushchauhan6944
@pratyushchauhan6944 29 күн бұрын
amazing contribution ser!!!
@LoreBaculima
@LoreBaculima 10 ай бұрын
Super helpful, thank you!!!
@samadams4751
@samadams4751 Жыл бұрын
Another great tutorial🙏
@BlockExplorerMedia
@BlockExplorerMedia Жыл бұрын
Thanks brother!
@matinjiryaeisharahi4294
@matinjiryaeisharahi4294 8 ай бұрын
I appreciate you , It was very useful
@josephdelgiorgio3997
@josephdelgiorgio3997 Жыл бұрын
Great video. I just applied to work at UniSwap, chances of getting hired are slim, but they have a great product and its awesome to see it work in realtime through the lens of these tutorials. Thank you!
@BlockExplorerMedia
@BlockExplorerMedia Жыл бұрын
Awesome! Glad you liked it and good luck : )
@harris998
@harris998 8 ай бұрын
​@@BlockExplorerMedia hello there, is there a way I can contact you regarding a Coding service question, maybe tw or email
@BitcoinAndCryptoCurrency
@BitcoinAndCryptoCurrency 10 ай бұрын
very good to learn the currency future
@BitcoinAndCryptoCurrency
@BitcoinAndCryptoCurrency 9 ай бұрын
informative and educational thanks
@sahbibayari7133
@sahbibayari7133 Жыл бұрын
Thanks for sharing this diamonds infos ❤️
@BitcoinAndCryptoCurrency
@BitcoinAndCryptoCurrency 11 ай бұрын
very good and informative video
@oreosworldxp9654
@oreosworldxp9654 3 ай бұрын
Bro this channel is based asf. Good shit bro. You’re smart dev. Let me find out you launch Pepe
@BitcoinAndCryptoCurrency
@BitcoinAndCryptoCurrency 10 ай бұрын
easy to understand thanks
@BitcoinAndCryptoCurrency
@BitcoinAndCryptoCurrency 11 ай бұрын
pleased I chose this video to learn from
@Abdulkadir-vb3vj
@Abdulkadir-vb3vj Жыл бұрын
Thanks for the great tutorial. Where can I get those test tokens? I mean LINK and USDC especially. I found no faucet for addresses you used.
@basitkhan3853
@basitkhan3853 Жыл бұрын
Good content
@vinayakshukla2653
@vinayakshukla2653 Жыл бұрын
thanksAloT very usefull
@BitcoinAndCryptoCurrency
@BitcoinAndCryptoCurrency Жыл бұрын
my questions have been answered
@user-tt7hl2fb6i
@user-tt7hl2fb6i 3 ай бұрын
Thank you for this video! It provides a great explanation! However I have one question. This example perfectly works on my edu project, but contract can`t take and return money directly to the "owner", metamask account. The swap works great before i try to connect it with the client metamask. I will be so grateful if you can help me to pair contract with metamask. Thanks in advance.
@xheikhfazi5481
@xheikhfazi5481 Жыл бұрын
Great Content learning lots of stuff....
@thedemonlord300
@thedemonlord300 7 ай бұрын
Hey could you tell me why we chose to write the functions of the IERC20 interface at the start of the contract instead of just importing the entire IERC20 contract like in the Flash Loan contract?
@dtory
@dtory 9 ай бұрын
Hey, can you explain the use of ask Incase we want to deployed it on other network and Testnet other than bsc and Eth/tesnet
@xlogic5020
@xlogic5020 Жыл бұрын
That's a great educational video ! l have a question. For example we have a wallet and l have eth in it. l want to swap eth to "x" token with a transfer prosess with this system. If l send eths to this contract. Can this contract do this for me or should l do some different changes ? l am looking forward your respond.
@roxanabraescu6180
@roxanabraescu6180 Жыл бұрын
Hi, Thanks for your videos they are very educational..... Question ⁉️ I want a flashloan but I don't know how to code it or if it's possible... Example I want to buy eg, Eth from binance at lower price and then sell the Eth to eg, Kucoin for more. How can I specify in the code to buy from binance and sell on kucoin and then pay the flashloan??.
@diiialee7012
@diiialee7012 Жыл бұрын
Do you prefer email? Or nah? Also is your patreon still accessible and you still use it.
@kurdvevoofficial
@kurdvevoofficial Жыл бұрын
first thanks for you content tutu hope you make tut about erc20 token and full video and include all function such as : Tax Transferable Tradable Mintable Burnable Transfer Ownership Secure
@paraipan-rq2sj
@paraipan-rq2sj Ай бұрын
very initeresting, but goerli is deprecated. how do i do to change to sepolia? im new to this . thank you .
@user-tx6hc8el1r
@user-tx6hc8el1r 7 ай бұрын
Have you made a video where u can unclog the smart contract ?
@xheikhfazi5481
@xheikhfazi5481 Жыл бұрын
Sir if you can help us that how we can get price of a pair on different exchanges like uniswap,sushiswap it will be a great favour...
@user-hl6hv3qu9c
@user-hl6hv3qu9c 11 ай бұрын
where can i get copious amoutn of test tokens for usdc / weth ; unable to start with a 1000 each; any pointers will help even for polygon testnetwork
@velafresh
@velafresh 2 ай бұрын
My token got split up into two routes 90% and 10% but I never received the 10% so basically I instantly lost $106 what exactly happen here do you think?
@amalnathsathyan6029
@amalnathsathyan6029 11 ай бұрын
30:27 I think the Quoter contract can get the reserves and give the prices.
@shankarmettur1551
@shankarmettur1551 Жыл бұрын
I will create token new contract but I can not swap to another contract how to posible than liqudity pool make
@juanmosqueda2210
@juanmosqueda2210 3 ай бұрын
I know this is kind an off topic but I'll take my shoot here too. Is possible to get the routerAddress by code? I am trying to replicate this in to the Fuji testnet but I can't find it in any documentation (Uniswap or Avalanche) so I'm wondering if it possible to code something that return that address but based in what I researched it looks like is simple not possible. Any help I will really appreciate it.
@ashishjanghel9340
@ashishjanghel9340 Жыл бұрын
I am facing issue on your flashloan tutorial while running on mainnet polygon....can you please help
@stepchild5453
@stepchild5453 10 ай бұрын
So I just need to import the github link to remix? That's gona run the universal router?
@ViralKiller
@ViralKiller Жыл бұрын
is there a Python version of this?
@ramonmarino9396
@ramonmarino9396 Жыл бұрын
Is it possible to do all this directly from etherscan?
@Codewriter5482
@Codewriter5482 Жыл бұрын
sir how to add faucet in goerli link token and usdc
@konkard9503
@konkard9503 Жыл бұрын
Can you code a front run bot?
@improvingmuslim
@improvingmuslim Жыл бұрын
what if i want to do this on the polygon network?
@baselkelziye4552
@baselkelziye4552 Жыл бұрын
hey man can you list some mid-advanced common projects that would improve my skills in sol, thanks for the great content btw
@BlockExplorerMedia
@BlockExplorerMedia Жыл бұрын
absolutely. i have been thinking about what level to target as I'm not quite sure if most of the viewers are beginner, intermediate or advanced. i think I need to do all of the above. anything in particular you'd like to see? I have some ideas for intermediate / common tutorials and maybe even do some more beginner ones. thanks!
@baselkelziye4552
@baselkelziye4552 Жыл бұрын
@@BlockExplorerMedia im thinking of a multisig wallet as a practice for myself not sure if it will fit for the audience :D
@BlockExplorerMedia
@BlockExplorerMedia Жыл бұрын
No I think that would be a good one. Let me see what I can do.
@milanis7a
@milanis7a Жыл бұрын
@@BlockExplorerMedia A tutorail for a makerdao clone would be dope!
@deethekingstevens7146
@deethekingstevens7146 Жыл бұрын
Another good tutorial on Dex, but how can I get commission for every swap?
@BlockExplorerMedia
@BlockExplorerMedia Жыл бұрын
Thank you! When you become a liquidity provider you would earn interest based on the fees paid by other users doing swaps.
@razorjhon2622
@razorjhon2622 Жыл бұрын
@@BlockExplorerMedia do you mean if i created a token whenever someone swap my token to another i will get fees ? can you explain please
@douglasduarte360
@douglasduarte360 5 ай бұрын
And how about Uniswap Swap Router address SEPOLIA ? I Can't find
@nocareit
@nocareit Жыл бұрын
Hi, this code work for pancakeswap?
@feff232
@feff232 Жыл бұрын
This is absolutely 10million dollar knowledge and all it gets is 57 comments. Hilarious. Thanks man
@astrofoundation
@astrofoundation Жыл бұрын
Hi block Explore.... Can you make a tut where we can get buy and sell transactions for a token just like poocoin does
@TheGaneshshow
@TheGaneshshow Жыл бұрын
hello sir, 3.08 seconds, why you will get 4 lp shares or 12 pool tokens? Thank you sir.
@BlockExplorerMedia
@BlockExplorerMedia Жыл бұрын
I don't think the numbers in this slide are technically 100% accurate - the main idea is to show that in v2 liquidity tokens are distributed to liquidity providers in proportion to their contribution. Also note that in v3 they don't use liquidity tokens at all - instead an ERC-721 is issued representing the provider's share of the pool.
@TheGaneshshow
@TheGaneshshow Жыл бұрын
@@BlockExplorerMedia Thank you sir very much! Sir, Please do a complete video on hardhat Testing.
@BlockExplorerMedia
@BlockExplorerMedia Жыл бұрын
I am planning to do a dedicated Hardhat video sometime soon.
@astrofoundation
@astrofoundation Жыл бұрын
When are you back ?
@shq-cali6111
@shq-cali6111 Жыл бұрын
hey man how r u . havent seen u active. i hope everything is okay
@harrydare8191
@harrydare8191 Жыл бұрын
Why has he not been posting?
@diiialee7012
@diiialee7012 Жыл бұрын
How can I reach you sir?
@user-we6ri4gi9y
@user-we6ri4gi9y Ай бұрын
Smart contrat in The video différent in your repo😂
@TheGaneshshow
@TheGaneshshow Жыл бұрын
Hello sir, poolFee = 3000, what is 3000 here? Thank you.
@BlockExplorerMedia
@BlockExplorerMedia Жыл бұрын
Expression of "0.3%" in Solidity since Solidity doesn't support floating point numbers. The conversion must take place in the Uniswap Pool contract.
@TheGaneshshow
@TheGaneshshow Жыл бұрын
@@BlockExplorerMedia Thank you sir. I got it. There will no floating numbers.
@TheGaneshshow
@TheGaneshshow Жыл бұрын
Hello Sir, 14.47 secs, pool fee is 0.3%, But of which amount, it is 0.3%? Thank you sir.
@BlockExplorerMedia
@BlockExplorerMedia Жыл бұрын
The middle-tier fee is 0.3% of the desired token swap price. More info here: docs.uniswap.org/protocol/concepts/V3-overview/fees
@TheGaneshshow
@TheGaneshshow Жыл бұрын
@@BlockExplorerMedia Thank you sir. My doubt is cleared.
@BlockExplorerMedia
@BlockExplorerMedia Жыл бұрын
Anytime!
@TheGaneshshow
@TheGaneshshow Жыл бұрын
@@BlockExplorerMedia Hello sir, I want to talk to you one on one, Please reply sir. Thank you.
@BlockExplorerMedia
@BlockExplorerMedia Жыл бұрын
hey 20s - it's difficult for me to provide any support outside of the channel due to other obligations but you can reach me at my personal email at 'jgspruance' at g mail and I will try my best to get to it. thanks!
@-bolboi1676
@-bolboi1676 Жыл бұрын
write a dex arbitrage trade bot
@difference018
@difference018 Жыл бұрын
I keep getting this error Source "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol" not found: File import callback not supported. I think it is a problem with the remappings. Any help would be appreciated
@BlockExplorerMedia
@BlockExplorerMedia Жыл бұрын
hi, what are you doing at the time when this error occurs and are you encountering it in Visual Code or in Remix. Please check that you are using the correct import for each environment - relative for VC and direct github url for Remix. You can find both in the video description.
@difference018
@difference018 Жыл бұрын
@@BlockExplorerMedia I solved the problem. In the remappings settings you should put "@uniswap/=node_modules/@uniswap/", "@openzeppelin/=node_modules/@openzeppelin/" Just thought others should know if they are having problems as well. Also set the optimizer to true in your hardhat config if you are getting the "stack too deep" error
@BlockExplorerMedia
@BlockExplorerMedia Жыл бұрын
Great - thanks for sharing.
ERC4626 Vault Smart Contract tutorial | DeFi Vault tutorial
1:05:35
Block Explorer
Рет қаралды 7 М.
UNISWAP V3 - New Era Of AMMs? Architecture Explained
16:49
Finematics
Рет қаралды 171 М.
He tried to save his parking spot, instant karma
00:28
Zach King
Рет қаралды 23 МЛН
She ruined my dominos! 😭 Cool train tool helps me #gadget
00:40
Go Gizmo!
Рет қаралды 17 МЛН
We Got Expelled From Scholl After This...
00:10
Jojo Sim
Рет қаралды 22 МЛН
Flash Loan Arbitrage | Aave Flash Loan Tutorial
48:34
Block Explorer
Рет қаралды 131 М.
Honeypot Token Smart Contract | Create Scam Token
9:58
Defi Dragon
Рет қаралды 705
How to Become a Blockchain Developer
25:33
Block Explorer
Рет қаралды 52 М.
Master CrewAI: Your Ultimate Beginner's Guide!
1:00:18
Sam Witteveen
Рет қаралды 60 М.
Uniswap V3 Explained - Concentrated Liquidity, NFT LP Tokens, Licensing…
11:44
Build and Deploy a Web3 Blockchain Crowdfunding Platform (Kickstarter)
3:33:51
JavaScript Mastery
Рет қаралды 853 М.
Девушка и AirPods Max 😳
0:59
ОТЛИЧНИКИ
Рет қаралды 15 М.
AI от Apple - ОБЪЯСНЯЕМ
24:19
Droider
Рет қаралды 98 М.
МОЩНЕЕ ТВОЕГО ПК - iPad Pro M4 (feat. Brickspacer)
28:01
ЗЕ МАККЕРС
Рет қаралды 69 М.