From 993bc9bbe729435e633dca048453c78159dc4bc8 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 23 Aug 2024 16:58:14 +0800 Subject: [PATCH] 1 --- .../config/currencys/97/currency.json | 4 ++-- server/marketserver/constant/constant.go | 1 + server/marketserver/mt/Currency.go | 17 ++++++++++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/bin/marketserver/config/currencys/97/currency.json b/bin/marketserver/config/currencys/97/currency.json index 00ec2ea5..2cdb2bb2 100644 --- a/bin/marketserver/config/currencys/97/currency.json +++ b/bin/marketserver/config/currencys/97/currency.json @@ -2,11 +2,11 @@ { "currency_name": "USDC", "contract_name": "BEUSDC", - "currency_decimal": 6 + "currency_decimal": 18 }, { "currency_name": "USDT", "contract_name": "BEUSDT", - "currency_decimal": 6 + "currency_decimal": 18 } ] diff --git a/server/marketserver/constant/constant.go b/server/marketserver/constant/constant.go index dae7e836..1c2704ed 100644 --- a/server/marketserver/constant/constant.go +++ b/server/marketserver/constant/constant.go @@ -25,6 +25,7 @@ const ( RECHARGE_CURRENCY_MAX_EXCHANGE_RAET = 100 RECHARGE_CURRENCY_MAX_DECIMAL = 6 RECHARGE_CURRENCY_MAX_BUY_NUM = 9999 + BNB_RECHARGE_CURRENCY_MAX_DECIMAL = 18 ) const ( diff --git a/server/marketserver/mt/Currency.go b/server/marketserver/mt/Currency.go index 650dd1ec..bb2647e7 100644 --- a/server/marketserver/mt/Currency.go +++ b/server/marketserver/mt/Currency.go @@ -43,14 +43,21 @@ func (this *Currency) GetContract() *Contract { return this.contract } -func (this *Currency) check() { +func (this *Currency) check(netId int32) { if this.GetCurrencyDecimal() <= 0 { panic("Currency currency_decimal <= 0") return } - if this.GetCurrencyDecimal() != constant.RECHARGE_CURRENCY_MAX_DECIMAL { - panic("Currency exchange_rate > uplimit") - return + if netId == 56 || netId == 97 { + if this.GetCurrencyDecimal() != constant.BNB_RECHARGE_CURRENCY_MAX_DECIMAL { + panic("Currency exchange_rate > uplimit") + return + } + } else { + if this.GetCurrencyDecimal() != constant.RECHARGE_CURRENCY_MAX_DECIMAL { + panic("Currency exchange_rate > uplimit") + return + } } } @@ -109,7 +116,7 @@ func (this *CurrencyTable) Load() { for _, currencyCfg := range currencysCfg { p := new(Currency) p.init(currencyCfg.CurrencyName, currencyCfg.ContractName, currencyCfg.CurrencyDecimal) - p.check() + p.check(netId) currencysMeta := this.GetByNetId(netId) if currencysMeta == nil { currencysMeta = new(q5.ConcurrentMap[string, *Currency])