-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enforce minimum amount for Evm token transfers #293
enforce minimum amount for Evm token transfers #293
Conversation
46937e6
to
1ca6879
Compare
@SamantaCasal you could test it here https://testnet.portal-bridge-ui.pages.dev/3fe5de76dc/ |
src/components/Transfer/Source.tsx
Outdated
@@ -260,6 +267,8 @@ function Source() { | |||
value={amount} | |||
onChange={handleAmountChange} | |||
disabled={isTransferDisabled || shouldLockFields} | |||
error={isBelowMinimum} | |||
helperText={isBelowMinimum ? "Amount is below minimum" : ""} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the error message could be more helpful? “Amount sent is too small. The amount must be equal or greater than X.” Or something like that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pushed an updated version with this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep in mind, only 6 decimal places are shown in the dropdown to select tokens, then the balance is displayed 0.000000 |
Ok! ❗ Fail wEth in Avalanche |
f3ff95f
to
f12c1cf
Compare
* Enforce minimum amount for evm token transfers * code review observations * fix decimals to the max supported for evm chains if the decimals are higher * [skip ci] - run prettier * code review observations * [skip ci] - cosmetic changes * disable next button if the amount is below minimum * [skip ci] - bump version
For token transfers from Evm the maximum decimal supported at this moment is 8 decimals, which lends to a minimum amount of 0.00000001 to be possible to transfer, below that the Token Bridge contract rounds to zero. To avoid a lack of funds now the UI prevents users to input amounts below that amount.
see: https://github.com/wormhole-foundation/wormhole/blob/96682bdbeb7c87bfa110eade0554b3d8cbf788d2/ethereum/contracts/bridge/Bridge.sol#L259