Skip to content

Commit

Permalink
Merge pull request #89 from zkLinkProtocol/fix/page_error
Browse files Browse the repository at this point in the history
add exception catch for amount exceeds decimals
  • Loading branch information
zkLeonardo authored Apr 9, 2024
2 parents e7e0803 + 58097d5 commit 7360b5f
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 7360b5f

Please sign in to comment.