Synthetixio / synthetix

Synthetix Solidity smart contracts
https://synthetix.io/
MIT License
1.2k stars 594 forks source link

[BUG] Exchanging whole balance tx reverting bug #244

Open k06a opened 4 years ago

k06a commented 4 years ago

https://etherscan.io/tx/0x37a4cec23fb67ac06a88f28a156aad1b002e053ccf2fccf58637d223087193bf

It seems you tried to burn more than you have after fees applied:

balance = 0x236b9d18d583ac
amount  = 0x2386f26fc10000

And subtraction balance.sub(amount) reverts. You should fix UI (frontend) to pass the proper amount to exchange method, in case of an amount close enough to balance

image image
jjgonecrypto commented 4 years ago

@clementbalestrat we should include this over on https://github.com/Synthetixio/synthetix-exchange. @hav-noms do you think it's worth adding a require check for this in Synthetix.exchange() for better user feedback? I know you're loathe to add more code to that bulky contract 🙄