Skip to content
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

add exception catch for amount exceeds decimals #89

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions views/transactions/Deposit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@
(e) => e.networkKey === eraNetwork.value.key || e.address === ETH_TOKEN.l1Address
);
return filterL1tokens;
// return Object.values(l1Tokens.value ?? []);

Check failure on line 474 in views/transactions/Deposit.vue

View workflow job for this annotation

GitHub Actions / Build

'ETH_TOKEN' is not defined
});
const availableBalances = computed<TokenAmount[]>(() => {
return balance.value ?? [];
Expand Down Expand Up @@ -640,10 +640,14 @@

const mergeLimitExceeds = computed(() => {
if (!selectedToken.value || !mergeTokenInfo.value || !amount.value) return false;
const amountVal = decimalToBigNumber(amount.value, selectedToken.value.decimals);
const exceeds = amountVal.add(mergeTokenInfo.value?.balance).gt(mergeTokenInfo.value?.depositLimit);
console.log("exceeds: ", exceeds);
return mergeSupported.value && isMerge.value && exceeds;
try {
const amountVal = decimalToBigNumber(amount.value, selectedToken.value.decimals);
const exceeds = amountVal.add(mergeTokenInfo.value?.balance).gt(mergeTokenInfo.value?.depositLimit);
console.log("exceeds: ", exceeds);
return mergeSupported.value && isMerge.value && exceeds;
} catch (e) { // may throw exception when amount exceeds decimals
return false;
}
});

const transaction = computed<
Expand Down
Loading