Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions frontend/src/hooks/ramp/useRampValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,21 @@ function validateOnramp(
trackEvent: (event: TrackableEvent) => void;
},
): string | null {
const maxAmountUnits = multiplyByPowerOfTen(Big(fromToken.maxWithdrawalAmountRaw), -fromToken.decimals);
const minAmountUnits = multiplyByPowerOfTen(Big(fromToken.minWithdrawalAmountRaw), -fromToken.decimals);

if (inputAmount && maxAmountUnits.lt(inputAmount)) {
trackEvent({
event: 'form_error',
error_message: 'more_than_maximum_withdrawal',
input_amount: inputAmount ? inputAmount.toString() : '0',
});
return t('pages.swap.error.moreThanMaximumWithdrawal.buy', {
maxAmountUnits: stringifyBigWithSignificantDecimals(maxAmountUnits, 2),
assetSymbol: fromToken.fiat.symbol,
});
}

if (inputAmount && !inputAmount.eq(0) && minAmountUnits.gt(inputAmount)) {
trackEvent({
event: 'form_error',
Expand Down
2 changes: 1 addition & 1 deletion shared/src/tokens/moonbeam/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const moonbeamTokenConfig: Partial<Record<FiatToken, MoonbeamTokenDetails
polygonErc20Address: '0xe6a537a407488807f0bbeb0038b79004f19dddfb',
moonbeamErc20Address: '0xfeb25f3fddad13f82c4d6dbc1481516f62236429',
minWithdrawalAmountRaw: '3000000000000000000', // 3 BRL.
maxWithdrawalAmountRaw: '10000000000000000000000', // 10,000 BRL. Maximum value for a KYC level 1 user.
maxWithdrawalAmountRaw: '150000000000000000000000', // 150,000 BRL. We put this as an artificial limit to avoid too high amounts.
offrampFeesBasisPoints: 0,
offrampFeesFixedComponent: 0.75, // 0.75 BRL
onrampFeesBasisPoints: 0,
Expand Down
Loading