Skip to content

Commit

Permalink
add exception catch for amount exceeds decimals
Browse files Browse the repository at this point in the history
  • Loading branch information
MickWang committed Apr 9, 2024
1 parent e7e0803 commit 58097d5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions views/transactions/Deposit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -640,10 +640,14 @@ const mergeSupported = computed(() => {
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

0 comments on commit 58097d5

Please sign in to comment.