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

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ก.ย. 2024
  • 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/jsp...
    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/Uni...";

ความคิดเห็น • 96

  • @PenguinTriedCoding
    @PenguinTriedCoding ปีที่แล้ว +36

    This channel is a hidden gem

  • @ouailtayarth4012
    @ouailtayarth4012 ปีที่แล้ว +6

    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 ปีที่แล้ว +2

    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

  • @luiscallero6288
    @luiscallero6288 8 หลายเดือนก่อน

    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 ปีที่แล้ว

    I have watched many videos on crypto and this is the first one I watched twice - loved it

  • @josephdelgiorgio3997
    @josephdelgiorgio3997 ปีที่แล้ว +3

    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  ปีที่แล้ว +1

      Awesome! Glad you liked it and good luck : )

    • @harris998
      @harris998 ปีที่แล้ว

      ​@@BlockExplorerMedia hello there, is there a way I can contact you regarding a Coding service question, maybe tw or email

  • @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 ปีที่แล้ว

      My swap also keep reverting, do you happen to know what I missed?

  • @codywatt7775
    @codywatt7775 7 หลายเดือนก่อน

    Awesome work my friend. Thank you for putting in the time to make this for us. It has been super helpful!

  • @Letssendit
    @Letssendit หลายเดือนก่อน

    Brilliant presentation

  • @oreosworldxp9654
    @oreosworldxp9654 6 หลายเดือนก่อน

    Bro this channel is based asf. Good shit bro. You’re smart dev. Let me find out you launch Pepe

  • @paraipan-rq2sj
    @paraipan-rq2sj 4 หลายเดือนก่อน +1

    very initeresting, but goerli is deprecated. how do i do to change to sepolia? im new to this . thank you .

  • @samadams4751
    @samadams4751 ปีที่แล้ว +3

    Another great tutorial🙏

  • @ViralKiller
    @ViralKiller ปีที่แล้ว

    is there a Python version of this?

  • @BitcoinAndCryptoCurrency
    @BitcoinAndCryptoCurrency ปีที่แล้ว +1

    informative and educational thanks

  • @BitcoinAndCryptoCurrency
    @BitcoinAndCryptoCurrency ปีที่แล้ว

    very good to learn the currency future

  • @velafresh
    @velafresh 5 หลายเดือนก่อน +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?

  • @pratyushchauhan6944
    @pratyushchauhan6944 4 หลายเดือนก่อน

    amazing contribution ser!!!

  • @user-ir9xc3gg4v
    @user-ir9xc3gg4v 3 หลายเดือนก่อน

    Thanks bro . great video !

  • @konkard9503
    @konkard9503 ปีที่แล้ว +2

    Can you code a front run bot?

  • @LoreBaculima
    @LoreBaculima ปีที่แล้ว

    Super helpful, thank you!!!

  • @user-tt7hl2fb6i
    @user-tt7hl2fb6i 6 หลายเดือนก่อน

    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.

  • @matinjiryaeisharahi4294
    @matinjiryaeisharahi4294 11 หลายเดือนก่อน

    I appreciate you , It was very useful

  • @kurdvevoofficial
    @kurdvevoofficial ปีที่แล้ว +1

    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

  • @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.

  • @BitcoinAndCryptoCurrency
    @BitcoinAndCryptoCurrency ปีที่แล้ว

    pleased I chose this video to learn from

  • @BitcoinAndCryptoCurrency
    @BitcoinAndCryptoCurrency ปีที่แล้ว

    easy to understand thanks

  • @BitcoinAndCryptoCurrency
    @BitcoinAndCryptoCurrency ปีที่แล้ว

    very good and informative video

  • @BitcoinAndCryptoCurrency
    @BitcoinAndCryptoCurrency ปีที่แล้ว

    my questions have been answered

  • @thedemonlord300
    @thedemonlord300 10 หลายเดือนก่อน

    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 ปีที่แล้ว

    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.

  • @user-tx6hc8el1r
    @user-tx6hc8el1r 10 หลายเดือนก่อน

    Have you made a video where u can unclog the smart contract ?

  • @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??.

  • @sahbibayari7133
    @sahbibayari7133 ปีที่แล้ว

    Thanks for sharing this diamonds infos ❤️

  • @amalnathsathyan6029
    @amalnathsathyan6029 ปีที่แล้ว

    30:27
    I think the Quoter contract can get the reserves and give the prices.

  • @juanmosqueda2210
    @juanmosqueda2210 6 หลายเดือนก่อน

    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.

  • @diiialee7012
    @diiialee7012 ปีที่แล้ว

    Do you prefer email? Or nah? Also is your patreon still accessible and you still use it.

  • @Codewriter5482
    @Codewriter5482 ปีที่แล้ว

    sir how to add faucet in goerli link token and usdc

  • @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...

  • @douglasduarte360
    @douglasduarte360 8 หลายเดือนก่อน

    And how about Uniswap Swap Router address SEPOLIA ? I Can't find

  • @user-hl6hv3qu9c
    @user-hl6hv3qu9c ปีที่แล้ว

    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

  • @basitkhan3853
    @basitkhan3853 ปีที่แล้ว

    Good content

  • @stepchild5453
    @stepchild5453 ปีที่แล้ว

    So I just need to import the github link to remix? That's gona run the universal router?

  • @xheikhfazi5481
    @xheikhfazi5481 ปีที่แล้ว

    Great Content learning lots of stuff....

  • @vinayakshukla2653
    @vinayakshukla2653 ปีที่แล้ว

    thanksAloT very usefull

  • @Arjun147gtk
    @Arjun147gtk 3 หลายเดือนก่อน

    7:58 VS code implementation

  • @ashishjanghel9340
    @ashishjanghel9340 ปีที่แล้ว

    I am facing issue on your flashloan tutorial while running on mainnet polygon....can you please help

  • @feff232
    @feff232 ปีที่แล้ว

    This is absolutely 10million dollar knowledge and all it gets is 57 comments. Hilarious. Thanks man

  • @shankarmettur1551
    @shankarmettur1551 ปีที่แล้ว

    I will create token new contract but I can not swap to another contract how to posible than liqudity pool make

  • @ramonmarino9396
    @ramonmarino9396 ปีที่แล้ว

    Is it possible to do all this directly from etherscan?

  • @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  ปีที่แล้ว +3

      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 ปีที่แล้ว +1

      @@BlockExplorerMedia im thinking of a multisig wallet as a practice for myself not sure if it will fit for the audience :D

    • @BlockExplorerMedia
      @BlockExplorerMedia  ปีที่แล้ว +1

      No I think that would be a good one. Let me see what I can do.

    • @milanis7a
      @milanis7a ปีที่แล้ว +1

      @@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

  • @nocareit
    @nocareit ปีที่แล้ว

    Hi, this code work for pancakeswap?

  • @TheGaneshshow
    @TheGaneshshow ปีที่แล้ว

    hello sir,
    3.08 seconds,
    why you will get 4 lp shares or 12 pool tokens?
    Thank you sir.

    • @BlockExplorerMedia
      @BlockExplorerMedia  ปีที่แล้ว +1

      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 ปีที่แล้ว +1

      @@BlockExplorerMedia Thank you sir very much!
      Sir, Please do a complete video on hardhat Testing.

    • @BlockExplorerMedia
      @BlockExplorerMedia  ปีที่แล้ว +1

      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?

  • @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

  • @user-we6ri4gi9y
    @user-we6ri4gi9y 4 หลายเดือนก่อน

    Smart contrat in The video différent in your repo😂

  • @diiialee7012
    @diiialee7012 ปีที่แล้ว

    How can I reach you sir?

  • @TheGaneshshow
    @TheGaneshshow ปีที่แล้ว

    Hello sir,
    poolFee = 3000,
    what is 3000 here?
    Thank you.

    • @BlockExplorerMedia
      @BlockExplorerMedia  ปีที่แล้ว +1

      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 ปีที่แล้ว +2

      @@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  ปีที่แล้ว +1

      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  ปีที่แล้ว +1

      Anytime!

    • @TheGaneshshow
      @TheGaneshshow ปีที่แล้ว

      @@BlockExplorerMedia Hello sir,
      I want to talk to you one on one,
      Please reply sir.
      Thank you.

    • @BlockExplorerMedia
      @BlockExplorerMedia  ปีที่แล้ว +1

      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 ปีที่แล้ว +2

      @@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.