Uniswap Tutorial for Developers (Solidity & Javascript)

Поделиться
HTML-код
  • Опубликовано: 31 янв 2025

Комментарии • 235

  • @MaxPicAxe
    @MaxPicAxe 4 года назад +8

    I love the way you have no choice but to use interfaces like this in solidity. It forces better programming, better architecture.

  • @leanlabiano
    @leanlabiano 3 года назад +7

    - 0:55 how to uniswap work
    - 5:55 interact with uniswap using sdk
    - 20:00 infura

  • @MaxPicAxe
    @MaxPicAxe 4 года назад +3

    This video covers all the basics you need to start writing a dapp! Thanks!

  • @voyagerquant3479
    @voyagerquant3479 3 года назад

    Dude, You are a fantastic engineer. Thank you so much for the work you're doing. It's extremely helpful!.

  • @anhmt90
    @anhmt90 3 года назад +5

    Thank you, Julian. Another great video. I'm just asking myself how people could easily manipulate the market price on-chain as you mentioned at 33:00? Could you please point me to some references to read more about this? Thanks.

    • @hassanahmed2781
      @hassanahmed2781 3 года назад

      chainlink oracle

    • @viciouskinid
      @viciouskinid 3 года назад

      I second that, it would be great to better understand this

    • @juhaklee5944
      @juhaklee5944 2 года назад

      can somebody explain this plz

  • @zachhijazi6898
    @zachhijazi6898 4 года назад +3

    This is awesome! Exactly what I was looking for - keep up the good work!

  • @NS-ee2wn
    @NS-ee2wn 3 года назад +1

    AMAZING!!! By far one of the best tutorials regarding uniswap and solidity coding. Can you please make a video using getReserves etc and constructing a pair price from 2 tokens addresses?
    Thank you,

  • @AnthonyTrimble
    @AnthonyTrimble 3 года назад +2

    This video really helped me. I would love to see the more verbose way of making pairs.

  • @AkshayPatel0095
    @AkshayPatel0095 4 года назад +6

    Suggestion:
    Instead of copying abi there is a cleaner way. I did in my react project using:
    1. Run:
    `npm install @uniswap/v2-periphery`
    2. import the json in the javascript file:
    `import UniswapV2Router02 from '@uniswap/v2-periphery/build/UniswapV2Router02.json';
    `
    3. Access the abi:
    ` const abi: AbiItem | AbiItem[] = UniswapV2Router02['abi'] as AbiItem | AbiItem[];
    `
    4. get contract object:
    ` const uniswapRouter = new web3.eth.Contract(abi, UniSwapV2_Router02_Address);
    `

    • @EatTheBlocks
      @EatTheBlocks  4 года назад +1

      that works too :)

    • @MovieZest
      @MovieZest 4 года назад

      @@EatTheBlocks Great Tutorial. Thank you. I am unable to understand how to pass gasPrice value. Here the default you gave was 20e9 which is 20 Gwei. But, how to I convert 200 Gwei to this similar value to 20e9 ? Actually what are these 20e9 representation of the values? Can you please point me to right direction on this? Thank you.

    • @ahsannawaz4180
      @ahsannawaz4180 4 года назад

      Is there any library which provide ABI of any contract runtime in node js?
      I'm facing issue to approve token node js . acn you provide info on that?

    • @aniquehashmani1781
      @aniquehashmani1781 4 года назад

      sir how can i contact you?

    • @vanxxxx2387
      @vanxxxx2387 3 года назад

      For all those stuck at the 'INVALID_ARGUMENTS portion, this is a better solution!

  • @MsMicroSound
    @MsMicroSound 4 года назад

    Thank you so much! Your tutorials really help me with getting started with solidity! Nice cap btw :)

  • @kshitijpandey9376
    @kshitijpandey9376 2 года назад

    Great Video😃Learned a lot.

  • @sebidelamata9307
    @sebidelamata9307 Год назад

    Very well explained thank you!

  • @Street.Credit
    @Street.Credit 2 года назад

    Built this today. Cool tutorial for sure my guy. Very advanced stuff made fairly simple

  • @gerhardsteenkamp562
    @gerhardsteenkamp562 4 года назад +1

    Exactly what i was looking for, thank you sir 🙏

  • @gregbrown6104
    @gregbrown6104 2 года назад

    Perfect video! Thank you very much for the explanation & code

  • @rayoseldev819
    @rayoseldev819 3 года назад

    Hello,
    I have a question about Why have we use uniswap in our contract tokens?
    What is the adventatge about not use that?
    Because I can do liquduity in pancakeswap for example.
    Thanks

  • @randomplan9537
    @randomplan9537 3 года назад

    Hi Julian, love your channel.
    Q: are you able to show to clone Geth and modify the Gas function to be lower?

  • @zerle4623
    @zerle4623 3 года назад

    Thank you so much! Thank you so much! Thank you so much! Thank you so much! Thank you so much!

  • @juanmanuelespina4540
    @juanmanuelespina4540 2 года назад

    Great! So, is it safer to do it through uniswap SDK or is it better through an smart contract??

  • @Chuppe_g
    @Chuppe_g Год назад +1

    Wsp bro I'm trying to integrate the interface on my swapliquify function but it's not working sits giving an error on my contract any way I can use to resolve this issue 🙏🙏🙏

  • @facundofarall7716
    @facundofarall7716 3 года назад

    Great video! Really helpful! Question, why do you add 15 zeros after the 100 ETH when creating the TokenAmount.

    • @grizzlyintent6597
      @grizzlyintent6597 3 года назад +1

      the input value is in WEI, and not ETHER. so 1000000000000000 wei is equal to 1 ETH.

  • @yogeshbhanushali8572
    @yogeshbhanushali8572 4 года назад +2

    Bro awesome tutotial please make video with flash loan and arbaitage it will be very helpful

    • @EatTheBlocks
      @EatTheBlocks  4 года назад +1

      Thanks man:)
      I have a full playlist about Flashloan:
      ruclips.net/p/PLbbtODcOYIoEMz-XatfkcFMsEwMmYShwk
      And a course about Flashloan arbitrage:
      eattheblocks-pro.teachable.com

  • @DEVANSHU23
    @DEVANSHU23 3 года назад

    we also need one approve to transfer balance from msg.sender to smart contract dont we.

  • @easonhuang4031
    @easonhuang4031 3 года назад +1

    is uniswap/sdk also work for pancakswap?

  • @evan.rianto
    @evan.rianto 2 года назад

    Dont you need to approve first before calling transferFrom function ?

  • @andreaspeer6711
    @andreaspeer6711 3 года назад

    Hello, thanks for this great tutorial. Unfortunately i can't find a link to the presented code... Isn't it in your Github repo?

  •  4 года назад +1

    Great content, as always!

  • @user-if8tb9ks9n
    @user-if8tb9ks9n 4 года назад +1

    Can you interact with multiple block chains?

  • @rjlacanlaled9419
    @rjlacanlaled9419 3 года назад

    do you have a pancakeswap version of this?

  • @franksdrivingschool
    @franksdrivingschool 2 года назад

    How on earth did you acquire so much knowledge?

  • @vtech256
    @vtech256 4 года назад +1

    Thanks for this guide.

  • @vanxxxx2387
    @vanxxxx2387 3 года назад

    I have a question! I used the RINKEBY test network (chain id =4 ) for both Uniswap and my Infura. But I dont see any transaction occuring in my Metamask. How do I test the program?

  • @Rishi440
    @Rishi440 3 года назад

    Awesome tutorial!
    Quick question.
    How can someone create a route for a token pair that does not exist programatically?

  • @prashantkachhawaha3707
    @prashantkachhawaha3707 2 года назад

    How to convert some % off selling fee and send to a wallet as dev fee...like if some one try to sell on defi exchange my token 5% cut as a fee and convert to WETH and send to a particular add.

  • @uztrtrwhu3678
    @uztrtrwhu3678 3 года назад

    hey do you know how to attract liquidity providers except a vampire attack (what sushiswap did) to attract liquidity providers

  • @rjlacanlaled9419
    @rjlacanlaled9419 3 года назад

    how does poocoin find out before executing a transaction what the slippage tolerance will be?

  • @arthurss7280
    @arthurss7280 Год назад

    I really like the Uniswap tutorial, it helped me a lot, I'm trying to use USDT to swap to others cryptos and encountered some problems,do you have any course for similar stuff?or anyone could help with this,if so, i can willing to pay for it

  • @andersmelin4085
    @andersmelin4085 3 года назад

    Great video. Thanx.
    Now a lazy question:
    Is there a max slippage like in the Uniswap app (49%) or is it possible to set it at any percentage?

    • @EatTheBlocks
      @EatTheBlocks  3 года назад +1

      You specify this is the min/max token you are willing to receive in the swap functions

    • @andersmelin4085
      @andersmelin4085 3 года назад

      @@EatTheBlocks Yep, but is there a max limit do you know?

  • @priime-xr9852
    @priime-xr9852 3 года назад

    At the min 4:03 you said that me as trader i can send WETH to the pair contract in exchange for DAI. I tried to send a small amount of WETH from my metamask to the pair contract and i lose my WETH. I did not became any DAI back on my wallet. Can you explain if it is a way to swap (trade) WETH for another token without using the Uniswap UI. Better to say is there a way to trade in backend of uniswap? Thank you!

  • @unforgivenyasuo9082
    @unforgivenyasuo9082 3 года назад

    what is font family in your IDE ?

  • @vrajakd
    @vrajakd 4 года назад

    Nice tutorial. Thank you!
    Is it possible to pass also gas Limit value and how?
    The same question about nonce - whether it is possible to assign a nonce number or send tx with the same number (to cancel the tx).

    • @EatTheBlocks
      @EatTheBlocks  4 года назад +1

      Yes its possible, by customizing the tx object. The syntax is different depending on whether you are using Web3 or Ethers. You have to look at the doc of these projects for specific syntax.

  • @ahsannawaz4180
    @ahsannawaz4180 4 года назад

    TO swap back in node how to approve token for uniswap? Kindly, provide info on that as well.

  • @andrepadez
    @andrepadez 4 года назад +2

    awesome tutorial, i want to use it from javascript

  • @zackmcclary2427
    @zackmcclary2427 3 года назад

    Is there a reason tokens don't use the "exclusive fee" model? Meaning the token sender will send the (transaction amount + fees) and the recipient just gets the transaction amount?

  • @jessicaperry40
    @jessicaperry40 3 года назад

    is that terminal node?

  • @Legend01231
    @Legend01231 3 года назад +2

    Error: invalid BigNumber value
    How can I solve this? This happened from the contract part.

    • @jiml581
      @jiml581 3 года назад +2

      Did you solve it? I have the same issue

    • @no1inparticulr
      @no1inparticulr 3 года назад +1

      @@jiml581 same here, let us know if you found a fix

  • @vivekkhudaniya9275
    @vivekkhudaniya9275 3 года назад

    how to add liquidity from add liquidity function can anybody help with that it's showing out of gas limit while doing that

  • @corediscovery8837
    @corediscovery8837 4 года назад

    How would you approach / what would the code be for a payable function interaction like swapExactETHForTokens?

  • @CoversTavo
    @CoversTavo 2 года назад

    In the solidity code, Do you ever import Uniswap and OpenZeppelin files in any moment? Because I only see that you call IUniswap and IERC20 but without importing any file. This is ok?

  • @calvinthong6292
    @calvinthong6292 4 года назад

    Thanks for the great tutorial. What if I want to change it to token to token? For example, DAI->BAT. Then am i specifying path[0] = DAI and pair[1] = BAT?

  • @antonwinter630
    @antonwinter630 4 года назад

    great tutorial. could you explain all the zero's on the tokenamount? is it in wei or something?

    • @EatTheBlocks
      @EatTheBlocks  4 года назад

      I dont have this tutorial fresh in my mind, but tokens like ETH have decimals.
      ETH have 18 decimals. And most token have 18 decimals too, with some exceptions like USDC (6 decimals).

    • @awnihussein6590
      @awnihussein6590 4 года назад

      ​@@EatTheBlocks const trade = new Trade(route, new TokenAmount(weth, '100000000000000000'), TradeType.EXACT_INPUT);
      you used 18 digits total, which means this 0.1 Eth. Yet you said 100 Eth in the video. Can you please confirm it is 0.1 eth and not 100 eth? thanks.

    • @dixon2233
      @dixon2233 4 года назад

      @@EatTheBlocks im not able to pass a value greater than 100 in TokenAmount. it says invalid Big number. any ideas?

    • @droidsage7240
      @droidsage7240 4 года назад

      Yeah because ETH is represented in denomination of WEI which have 18 zero's

  • @ParadoxDecoded
    @ParadoxDecoded 4 года назад +1

    Did you make an error when you call the contract function? Shouldn't it be swapExactETHForTokens() not 'send'?

    • @sabbir883
      @sabbir883 4 года назад

      It should be swap. Probably typo.

    • @sylvainverdat7135
      @sylvainverdat7135 3 года назад

      @@sabbir883 is it swapExactETHForTokens() , isn'it ? I think it is not sendExactETHForTokens. Someone to confirm ?

  • @emanuelkent
    @emanuelkent 4 года назад

    Hi Julian, great video! I have one question ... how to test the Solidity program? I have already tested some smart contracts using Truffle and Ganache, but they were simple local project. In this case how could I test it without spending real ETH?
    Thanks a lot : )

    • @EatTheBlocks
      @EatTheBlocks  4 года назад

      Checkout this video:
      ruclips.net/video/b2VInFwZmNw/видео.html

    • @emanuelkent
      @emanuelkent 4 года назад

      @@EatTheBlocks thanks for signaling this! I went through it very quickly and it only talks about how to write tests for code that can run on a local blockchain. I was referring to testing the code above which requires interaction with Uniswap, that is how to run it on test nets. So this is not exactly what I was looking for. Thanks anyway!

    • @sagarprince27sCH
      @sagarprince27sCH 4 года назад

      @@emanuelkent were u able to do this ? Let me know

  • @Glow0110
    @Glow0110 2 года назад

    One huge part that I am confused about - how do you use these interfaces without having to import those other smart contracts?! Actually, I am very confused about these Interfaces and how you are using them within your functions.

  • @paradroidMusic
    @paradroidMusic 4 года назад +1

    real nice bro - TY !!

  • @arturo3511
    @arturo3511 3 года назад

    can you make a video on how to create your own ethereum node?

  • @sabbir883
    @sabbir883 4 года назад +3

    I keep getting this error. I did exact copy of your javascript code with my private key.
    (node:3550) UnhandledPromiseRejectionWarning: Error: resolver or addr is not configured for ENS name (argument="name", value="", code=INVALID_ARGUMENT, version=contracts/5.0.5)

    • @BlackFearOpsOne
      @BlackFearOpsOne 4 года назад

      Hello, I have this error too. Did you found a solution ?

    • @elxanito123
      @elxanito123 4 года назад

      having same error. did u find a solution?

    • @BlackFearOpsOne
      @BlackFearOpsOne 4 года назад

      @@elxanito123 Not yet...

    • @elxanito123
      @elxanito123 4 года назад

      @EatTheBlocks we would appreciate your help! :) stuck on this problem unfortunately

    • @elxanito123
      @elxanito123 4 года назад

      @@BlackFearOpsOne Please inform me if u do find. will do the same

  • @567BTHTY
    @567BTHTY 4 года назад

    14:04 , I think it needs to be 18 zeros, am I right? I am currently experimenting to compare my execution price with uniswap interface on the website. The numbers are only correct when i use 18 zeros.

    • @EatTheBlocks
      @EatTheBlocks  4 года назад +1

      I don't remember how much I wanted to specify. We need 18 zeros for 1 WETH. So add even more zeros if you want 10, 100 WETH or more.

    • @567BTHTY
      @567BTHTY 4 года назад

      @@EatTheBlocks ah ok that makes it clear thanks

    • @567BTHTY
      @567BTHTY 4 года назад

      I have an additional question. I have seen that there are a number of front run bots and they seem to work with a contract on the ethereum network and call that contract whenever they want to execute a front run trade. Could you know why they would use an onchain-contract that they published themselves to execute trades rather than using node.js. Is this necessary?

    • @kttalkZ
      @kttalkZ 4 года назад

      @@567BTHTY hey I also want to know, is there a way to front run, this has become the painpoint

    • @567BTHTY
      @567BTHTY 4 года назад

      @@kttalkZ I have done some research. The front run trade bots use a on chain contract to interact with to prevent their front run trades from being front run again by other bots.

  • @sagarprince27sCH
    @sagarprince27sCH 4 года назад +1

    Was anyone able to use code to do fast buy ?

  • @HighFrecuency1
    @HighFrecuency1 3 года назад

    Hello brother, I need to make a token with automatic burning in each transaction, do you know how I could do it?

  • @pintalubaf
    @pintalubaf 4 года назад

    @EatTheBlocks hey man, thank you so much for this tutorial, is very helpful. How APYs in staking pools or farming pools are calculated? I'm very curious about that

    • @EatTheBlocks
      @EatTheBlocks  4 года назад +1

      It depends on the staking mechanism.
      Let's stay you earn some reward tokens RT for staking some other tokens, ST
      They take the current price of the reward token, calculate how much you get per block with your current stake, and convert this per block profit in the unit of the staking token (ST). They they annualize this amount, assuming the price of the reward token will stay the same (it will not of course, this is just a theoritical APY).

    • @uztrtrwhu3678
      @uztrtrwhu3678 3 года назад

      @@EatTheBlocks hey do you know how to attract liquidity providers except a vampire attack (what sushiswap did) to attract liquidity providers

  • @facundofarall7716
    @facundofarall7716 3 года назад

    Error: Invariant failed: CHAIN_ID how can i solve this?
    at invariant (/path/node_modules/tiny-invariant/dist/tiny-invariant.cjs.js:14:11)
    at Function.fetchPairData (/path/node_modules/@uniswap/sdk/dist/sdk.cjs.development.js:1556:79)
    at init (/path/index.js:13:40)

    • @TomTom-ns9tc
      @TomTom-ns9tc 2 года назад

      I get the same error, did you figure out how to solve it?

  • @hugoamorim5301
    @hugoamorim5301 4 года назад +1

    Very Good

  • @dciriva5369
    @dciriva5369 3 года назад

    How can I change gas Limit ?

  • @meagamontana
    @meagamontana 4 года назад

    Thank you for the update.

  • @paulo.calazans
    @paulo.calazans 3 года назад

    Hello, you know how to inform how I can create a platform similar to a Tron clone or ethereum, there is a tutorial or video explaining how to create this type of eco system

  • @arturo3511
    @arturo3511 3 года назад

    can you make uniswap tutorial but with uniswap V3

  • @rudreshsolanki5028
    @rudreshsolanki5028 3 года назад

    Very Cool, thanks

  • @T1ger8oi
    @T1ger8oi 3 года назад

    I just launched a bep20 token and it seems like the smart contract is accumulating tokens with each transactions. It’s got something to do with auto liquidity. Will the tokens be stuck inside the contract? Will the amount keeps growing?...

  • @MantisRight
    @MantisRight 3 года назад

    how to calculate price in js with multihops?

  • @FreakxUA
    @FreakxUA 4 года назад

    Ok if I route someToken with WETH it's ok. But I cant route between two different tokens. I get an error.
    And how to make a transaction if an exchange needs a path for example 3 or more tokens from A to B.

  • @ashwanisingh2417
    @ashwanisingh2417 3 года назад

    Really helpful video

  • @sstrangee99
    @sstrangee99 3 года назад

    Pure gold!

  • @sesto-dev
    @sesto-dev 3 года назад

    Please release a video for V3 SDK, documentation is no help.

    • @EatTheBlocks
      @EatTheBlocks  3 года назад

      There is a live training on Uniswap V3 in the EatTheBlocks academy

  • @raunaquepatra3966
    @raunaquepatra3966 3 года назад

    where does the requests go? I mean which/what server is responding to the requests? who is hosting the servers.

    • @EatTheBlocks
      @EatTheBlocks  3 года назад

      Uniswap is a smart contract, there is no server, it's on the blockchain

    • @raunaquepatra3966
      @raunaquepatra3966 3 года назад

      @@EatTheBlocks Yes I know, but the smart contracts only swap tokens right(that is execute the transactiona) ? But how the sdk is proving the prices?
      You can tell the smart contracts are not being executed as the action of getting the prices, transaction costs etc is not requiring any gas fees.
      My understanding was executing any smart contract requires gas fees. Correct me If I am wrong.

    • @tehmhithorphehardhekheyhe9760
      @tehmhithorphehardhekheyhe9760 2 года назад

      @@raunaquepatra3966
      Not all transactions require gas fees ... ... ... you can read BlockChain data without creating an entire transaction .... as long as you're not changing blockchain state.

  • @granthoffman6900
    @granthoffman6900 3 года назад

    Thanks for the tutorial. but it would be a lot more useful to show us how to debug the remix version...

  • @Dufftata
    @Dufftata 4 года назад

    can I link the script with an ethers API Key Token?

  • @blazecrypto4431
    @blazecrypto4431 4 года назад

    Unable to trade with "Fail with error 'UniswapV2Router: INVALID_PATH". Any idea how to fix?

  • @UK_60
    @UK_60 4 года назад +1

    Hello Julian, nice work...watched a couple of your livestreams. Say I'm at another academy and progressed through it a fair bit but I am no where near launching my own project...actually that is the stage I am at right now. Do you have a bulletin board in your academy where I can post my queries? I am keen to start a 'travelhealth' utility token for a network of healthcare providers in Egypt. I seek to target UK and european clients looking for discount but high quality healthcare and tourism and the token would be used amongst the providers. I would likely register in Malta as technically Egypt is crypto hostile. I myself am a dental surgeon seeking licensure in Egypt with an active license in California, USA. I seek to be the bridge consultant especially for larger cases such as full mouth reconstruction and facial plastic surgeries. While I have taken C++, Solidity and advanced Ethereum programming courses...I know my limit and it is best for me to partner with another to get this project rolling. Your thought?

    • @EatTheBlocks
      @EatTheBlocks  4 года назад

      Hi John,
      Nice project!
      I dont know much about travel, health in Egypt, but I can certainly help you on the technical side.
      We do have a forum but that's mostly for students of my courses:
      forum.eattheblocks.com
      If you need some customized help, you can book me for a 1h private session here:
      eattheblocks-pro.teachable.com/p/private-coaching
      I can help you translate your business needs into a technical architecture, and make you save time, and feel confident that you are going in the right direction.
      Cheers,
      Julien

    • @explorethe_web
      @explorethe_web 3 года назад

      hope your project is running now!!

  • @cryptoadler3419
    @cryptoadler3419 3 года назад

    nice content thx !

  • @seemab9546
    @seemab9546 4 года назад

    Hi man, thank you for you efforts for providing such a good knowledge, ( Please can you tell me how I can get Uniswap Api Key ) So I can use this in my website for displaying data from uniswap, such as trade history, prices and top coins etc. I am unable to find api key from uniswap. I will appreciate alot any kind of help. Thanks.

    • @EatTheBlocks
      @EatTheBlocks  4 года назад

      I am not aware of an API key for using the Uniswap API. You can use it without API key.

  • @shubhangidargarh1678
    @shubhangidargarh1678 2 года назад

    running this code in remix with injected web3-Metamask. Contract deployed to Rinkeby. But when calling swapTokenForETH, given amountIn - 1. But facing this error: Uni::transferFrom: transfer amount exceeds spender allowance". Can you please help me with it.

    • @shubhangidargarh1678
      @shubhangidargarh1678 2 года назад

      Can anyone help me with this? It would be greatly appreciated.

  • @ersayboyar
    @ersayboyar 4 года назад

    Thank you but ı have a problem
    TypeError: uniswap.sendExactETHForTokens is not a function what is wrong

    • @sylvainverdat7135
      @sylvainverdat7135 3 года назад

      @Jackson Aguasme too , I think he made a mistake. It should be swapExactForTokens()

  • @giorgiu9915
    @giorgiu9915 4 года назад

    Getting this when trying to swap UNI for ETH (part 2 solidity)
    "Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
    execution reverted: UniswapV2Router: EXPIRED { "originalError": { "code": 3, "data": "0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000018556e69737761705632526f757465723a20455850495245440000000000000000", "message": "execution reverted: UniswapV2Router: EXPIRED" } }"
    Any suggestions? Thanks

    • @MaxPicAxe
      @MaxPicAxe 4 года назад

      Your probably not sending enough gas fee in your transaction and therefore no miner will accept it.

    • @giorgiu9915
      @giorgiu9915 4 года назад

      @@MaxPicAxe Thanks for your reply, the reason was the desktop time, so it was reverted because of timestamp and it worked after taking that part to solidity))

  • @bunchaart6600
    @bunchaart6600 3 года назад

    Hi Julian. I am trying to use the code for pancakeswap, but I got this error: .. unsupported getDefaultProvider network (operation="getDefaultProvider", network={"chainId":56,"name":"unknown"}.. Could you help me to solve it ?

    • @julianfrost4827
      @julianfrost4827 3 года назад

      You need to be connected to Binance Smart Chain.

  • @spritemoney
    @spritemoney 4 года назад

    How did you know that Ethers package was missing? What made you suspect that?

    • @EatTheBlocks
      @EatTheBlocks  4 года назад +2

      When I tried to install Uniswap SDK I think it mentioned some sub-package of ethers was missing.. that gave me a hint

  • @ongNguyen-vj5xw
    @ongNguyen-vj5xw 4 года назад +1

    I have got this error: "UnhandledPromiseRejectionWarning: Error: invalid BigNumber value"
    Please help me.

    • @shisha4060
      @shisha4060 4 года назад +3

      Got the same problem too. Line const tx = await uniswap.swapETHForExactTokens

    • @王先生-f6c
      @王先生-f6c 4 года назад +1

      You have to change the value to Hex format.

    • @ongNguyen-vj5xw
      @ongNguyen-vj5xw 4 года назад +1

      @@王先生-f6c Which value? Here is my code that got error:
      const tx = await uniswap.swapExactETHForTokens(
      amountOutMin,
      path,
      to,
      deadline,
      {value,gasPrice: 20000000000}
      );
      Thank you so much.

    • @王先生-f6c
      @王先生-f6c 4 года назад +5

      @@ongNguyen-vj5xw Try this. const amountOutMin = toHex(trade.minimumAmountOut(slippageToLerance)); const value = toHex(trade.inputAmount); function toHex(currencyAmount) {
      return `0x${currencyAmount.raw.toString(16)}`
      }

    • @ongNguyen-vj5xw
      @ongNguyen-vj5xw 4 года назад +1

      @@王先生-f6c Thanks. It worked like a charm. But I got the error "Error: processing response error".
      Maybe it was caused by Infura. Could you please send me the full code that work. I'm newbie and I find it difficult to identify the error :(

  • @kttalkZ
    @kttalkZ 4 года назад

    did you upload the node js code in your github? can't find it ;) Thanks

    • @EatTheBlocks
      @EatTheBlocks  4 года назад +3

      github.com/jklepatch/eattheblocks/tree/master/screencast/217-uniswap-v2
      in javascript folder

    • @kttalkZ
      @kttalkZ 4 года назад

      @@EatTheBlocks are you available on twitter or telegram, I want to add a uniswap watcher to this?

  • @ahsannawaz4180
    @ahsannawaz4180 4 года назад

    This video is so good. If i want to send 0.01 eth then i will do const trade = new Trade(route, new TokenAmount(weth, '0.001000000000000000000'), TradeType.EXACT_INPUT). ?

  • @tipsoffficial3664
    @tipsoffficial3664 3 года назад

    Your video is quite nice.It will better if you can...give us code...in the description

    • @EatTheBlocks
      @EatTheBlocks  3 года назад

      You can checkout the github repo of eattheblocks, the code of the youtube videos is in the `screencast` folder.

  • @misael-empreendedordofutur2574
    @misael-empreendedordofutur2574 4 года назад

    I would like to learn solidity with you. I have zero experience in computer language.

    • @EatTheBlocks
      @EatTheBlocks  4 года назад +1

      Hi Misael. You can start with this free series on Solidity:
      ruclips.net/video/CHLgAgWoUvo/видео.html
      Then the next step, if you are committed to find a Blockchain job, is to take my course:
      eattheblocks.com/6-figure-blockchain-developer/

    • @Blazejkrzak
      @Blazejkrzak 4 года назад +1

      Try to learn go, rust, python or js(typescript) at first, then go to solidity.

  • @yurifernandes8608
    @yurifernandes8608 3 года назад

    i trying at pancakeswap-sdk and returning this error, can you please help me?
    (node:14348) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '
    call' of null at Contract.
    node_modules\@ether
    sproject\contracts\lib\index.js:316:63)

  • @JoshDrentlaw
    @JoshDrentlaw 3 года назад

    Has anyone been able to get the reverse (swapExactTokenForETH) to work?

    • @JoshDrentlaw
      @JoshDrentlaw 3 года назад

      @EatTheBlócks thanks for the reply. I did end up figuring out my issue. I wasn't approving the transaction, so it was failing.

  • @consciousmines451
    @consciousmines451 3 года назад

    Hey there, we are looking for a fluent Solidity engineer to help us with one of our projects. Do you do any development privately? What is the best email to get in touch for business inquiries? If you can't if you know any other engineers that could help that would be great!

  • @elxanito123
    @elxanito123 4 года назад +1

    Hi! Thanks for a cool tutorial. i did exact same thing but i get an error:
    UnhandledPromiseRejectionWarning: Error: resolver or addr is not configured for ENS name (argument="name", value="", code=INVALID_ARGUMENT, version=contracts/5.0.5)

  • @dixon2233
    @dixon2233 4 года назад

    i keep getting this error --> Error: invalid hexlify value (argument="value", value=[-1004487074,773], code=INVALID_ARGUMENT, version=bytes/5.0.5). happens even when i hexlify it or convert it to hex

    • @awnihussein6590
      @awnihussein6590 4 года назад

      Did you solve this?

    • @dixon2233
      @dixon2233 4 года назад

      @@awnihussein6590 no, however i made progress. passing in a value as a string (that is

    • @awnihussein6590
      @awnihussein6590 4 года назад

      @@dixon2233 I get this error when passing private key

    • @awnihussein6590
      @awnihussein6590 4 года назад

      @@dixon2233 I just scrolled through other questions in this video and they have an answer that I will try

    • @dixon2233
      @dixon2233 4 года назад

      @@awnihussein6590 Please post solution here or on stack overflow. Much appreciated

  • @awnihussein6590
    @awnihussein6590 4 года назад

    Where is the user wallet specified?

    • @vrajakd
      @vrajakd 4 года назад

      Hi! Did you find it? Where?

    • @awnihussein6590
      @awnihussein6590 4 года назад +1

      @@vrajakd I think in the wallet object. The all caps PRIVATE_KEY is a place holder not a constant

  • @pashmak119
    @pashmak119 3 года назад

    hi this is not working please add a real swap transaction

  • @Legend01231
    @Legend01231 3 года назад

    How cain i do this on BSC?

    • @EatTheBlocks
      @EatTheBlocks  3 года назад

      Check out Pancakeswap, it's a clone of Uniswap.

  • @ruman_life
    @ruman_life 4 года назад

    Is this the same as forking?

    • @EatTheBlocks
      @EatTheBlocks  4 года назад +1

      no its different, this is for using the Uniswap protocol, not a fork.