0

I am working on a project in which I am converting ETH -> DAI and then DAI -> ETH. Since the market is bearish right now, so when I am selling 1 Eth for DAI it's giving me 1573.0360852806744 DAI , but when I re-sell the 1573.0360852806744 DAI for ETH it's giving me 0.998939449793482496 ETH. Why so? It should provide me with same value of ETH I have converted earlier ( 1 ETH ).

If I make the API call in postman and do the same above procedure, I got back the same amount of ETH for which I have converted the DAI. Why so difference in postman request and in my javascript code.

I am using axios to make the request.

1 Answer 1

0

Well if you are swapping with DEXs such as uniswap then they have there fee on it (which is 0.3%) when user swap token for other. Well probably guess this is the thing.

If not could you please specify which DEXs you use and which testnet.

11
  • I am using 0x protocol api . It doesn't allow me to select exchanges, it's just give me best price for the swap. I am using it on Goerli testnet. If you know about any good DEXs fo swap back & forth tokens, please let me know Aug 23, 2022 at 12:34
  • ok, well i have also worked on same stuff, i have used uniswap in which i directly interact with contract to swap token, but your charges way less than my. then there is no need. And i look into your 0x protocol and fees are pretty less link.
    – DereK
    Aug 23, 2022 at 13:55
  • But your doubt is solved @RishabhRaghwendra or not ??
    – DereK
    Aug 23, 2022 at 13:59
  • I think it's issue with DAI/ETH pair because there is no such issue with DAI/LINK pair Aug 23, 2022 at 19:38
  • 1
    Are you getting the same out back when you are swapping back of DAI/LINK pair
    – DereK
    Aug 24, 2022 at 5:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.