mirror of
https://github.com/Xahau/xahau.js.git
synced 2026-04-29 15:37:50 +00:00
refactor MAX_TRADING_FEE to be in one place
This commit is contained in:
@@ -3,7 +3,7 @@ import { Amount } from '../common'
|
||||
|
||||
import { BaseTransaction, isAmount, validateBaseTransaction } from './common'
|
||||
|
||||
const MAX_TRADING_FEE = 65000
|
||||
export const AMM_MAX_TRADING_FEE = 65000
|
||||
|
||||
/**
|
||||
* AMMInstanceCreate is used to create AccountRoot and the corresponding
|
||||
@@ -68,9 +68,9 @@ export function validateAMMInstanceCreate(tx: Record<string, unknown>): void {
|
||||
throw new ValidationError('AMMInstanceCreate: TradingFee must be a number')
|
||||
}
|
||||
|
||||
if (tx.TradingFee > MAX_TRADING_FEE) {
|
||||
if (tx.TradingFee > AMM_MAX_TRADING_FEE) {
|
||||
throw new ValidationError(
|
||||
`AMMInstanceCreate: TradingFee must not be greater than ${MAX_TRADING_FEE}`,
|
||||
`AMMInstanceCreate: TradingFee must not be greater than ${AMM_MAX_TRADING_FEE}`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { ValidationError } from '../../errors'
|
||||
|
||||
import { AMM_MAX_TRADING_FEE } from './AMMInstanceCreate'
|
||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||
|
||||
const MAX_TRADING_FEE = 65000
|
||||
|
||||
/**
|
||||
* AMMVote is used for submitting a vote for the trading fee of an AMM Instance.
|
||||
*
|
||||
@@ -52,9 +51,9 @@ export function validateAMMVote(tx: Record<string, unknown>): void {
|
||||
throw new ValidationError('AMMVote: FeeVal must be a number')
|
||||
}
|
||||
|
||||
if (tx.FeeVal > MAX_TRADING_FEE) {
|
||||
if (tx.FeeVal > AMM_MAX_TRADING_FEE) {
|
||||
throw new ValidationError(
|
||||
`AMMVote: FeeVal must not be greater than ${MAX_TRADING_FEE}`,
|
||||
`AMMVote: FeeVal must not be greater than ${AMM_MAX_TRADING_FEE}`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user