interface icon indicating copy to clipboard operation
interface copied to clipboard

swap form frontend calculation error for ETH to any token.

Open kritik-sah opened this issue 2 years ago • 6 comments

[BUG] : when we click max button, I should get my exact balance in the input field(Actual Balance: 0.010), as you can see what am I getting (0.000174...) its happening only for ETH Screenshot 2024-01-29 015731 Screenshot 2024-01-29 015751

kritik-sah avatar Jan 28 '24 22:01 kritik-sah

I want to work on this, I already started and setup it up in my local env. This will be my first contribution to Uniswap

kritik-sah avatar Jan 28 '24 22:01 kritik-sah

This is not a bug I think, as you said it's only happening with ETH.

As ETH is the native currency, which is used to pay for gas fees. Uniswap Dapp just shows the amount after substracting the amount that needs to be in the wallet for the gas fees so that the transaction successfully goes through.

Other protocols do this as well, because the user doesn't know how much will be the gas cost.

Zartaj0 avatar Jan 30 '24 11:01 Zartaj0

Im having this same issue too. I'm trying to fork a swap on a test net, and this same thing happens.. works fine on the actualy network, but I get this issue with ETH on arbitrum

RedPillPhil avatar Feb 22 '24 07:02 RedPillPhil

Hey @RedPillPhil what is the exact issue, can you also share the screenshots?

Zartaj0 avatar Feb 22 '24 10:02 Zartaj0

Hey @RedPillPhil what is the exact issue, can you also share the screenshots?

Thanks for your response.

Actually, my issue is a bit different..

I click the "Max" button, and it just inputs 0. Despite having a balance showing that is above zero. Any time I try to make a swap involving ETH native token, it shows me an error "The transaction cannot succeed due to error: undefined. This is probably an issue with one of the tokens you are swapping." I can swap token for token just fine, but swapping involving ETH does not work. It does let me attempt to wrap eth if I swap for wrapped ETH.

This happens when I attempt to fork a swap on arbitrum, there must be something I am forgetting to change.

RedPillPhil avatar Feb 22 '24 13:02 RedPillPhil

https://swapfork.vercel.app/#/swap <--- I put together a live version here, so you can see the problem https://github.com/RedPillPhil/swapfork <---- repo is here

RedPillPhil avatar Feb 22 '24 15:02 RedPillPhil