From 6f636da4eb6181492b665178e85eb9b58288c9ee Mon Sep 17 00:00:00 2001 From: Jerry Date: Fri, 13 Sep 2024 21:05:20 +0800 Subject: [PATCH 1/2] feat: update das-lib --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2c9be04..140f74f 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module das_register_server go 1.18 require ( - github.com/dotbitHQ/das-lib v1.2.1-0.20240912030217-046bcfda6ba4 + github.com/dotbitHQ/das-lib v1.2.1-0.20240913121048-5646fbd9ec80 github.com/ethereum/go-ethereum v1.10.26 github.com/fsnotify/fsnotify v1.5.4 github.com/getsentry/sentry-go v0.25.0 diff --git a/go.sum b/go.sum index 1961ad2..8cdd9fa 100644 --- a/go.sum +++ b/go.sum @@ -147,8 +147,8 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= -github.com/dotbitHQ/das-lib v1.2.1-0.20240912030217-046bcfda6ba4 h1:Iq5PJs3mHJE5wxoF+yuG0fNEPDI/RxD8EHhyeRicpp8= -github.com/dotbitHQ/das-lib v1.2.1-0.20240912030217-046bcfda6ba4/go.mod h1:WgHO3ZBtA0JY3l5N2gqssPxwvzoRYf4JKpQT6zyLH4s= +github.com/dotbitHQ/das-lib v1.2.1-0.20240913121048-5646fbd9ec80 h1:kaYTAe9E6WewHCRuwR1JyvhcS/WgSkGi8933hoN24XM= +github.com/dotbitHQ/das-lib v1.2.1-0.20240913121048-5646fbd9ec80/go.mod h1:WgHO3ZBtA0JY3l5N2gqssPxwvzoRYf4JKpQT6zyLH4s= github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/elazarl/goproxy v0.0.0-20221015165544-a0805db90819 h1:RIB4cRk+lBqKK3Oy0r2gRX4ui7tuhiZq2SuTtTCi0/0= From 3c54fb16fffcca603d2851b4a155bf4a59b0524d Mon Sep 17 00:00:00 2001 From: scorpiotzh <835598264@qq.com> Date: Sat, 14 Sep 2024 14:32:55 +0800 Subject: [PATCH 2/2] feat: update token info pol --- config/config.go | 4 +++- example/order_test.go | 2 +- http_server/handle/account_search.go | 2 +- notify/notify_order.go | 5 +++-- tables/t_das_order_info.go | 21 ++++++++++++--------- unipay/unipay.go | 2 +- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/config/config.go b/config/config.go index 54cecd8..3661cc1 100644 --- a/config/config.go +++ b/config/config.go @@ -150,7 +150,9 @@ func GetUnipayAddress(tokenId tables.PayTokenId) string { return Cfg.PayAddressMap["eth"] case tables.TokenIdBnb, tables.TokenIdBep20USDT: return Cfg.PayAddressMap["bsc"] - case tables.TokenIdMatic: + //case tables.TokenIdMatic: + // return Cfg.PayAddressMap["polygon"] + case tables.TokenIdPol: return Cfg.PayAddressMap["polygon"] case tables.TokenIdTrx, tables.TokenIdTrc20USDT: return Cfg.PayAddressMap["tron"] diff --git a/example/order_test.go b/example/order_test.go index df8ca6f..bff99a7 100644 --- a/example/order_test.go +++ b/example/order_test.go @@ -135,7 +135,7 @@ func TestOrderOrderChange(t *testing.T) { }, PayChainType: 0, PayAddress: "", - PayTokenId: tables.TokenIdMatic, + PayTokenId: tables.TokenIdPol, PayType: "", } diff --git a/http_server/handle/account_search.go b/http_server/handle/account_search.go index 99acf50..c7ba214 100644 --- a/http_server/handle/account_search.go +++ b/http_server/handle/account_search.go @@ -444,7 +444,7 @@ func (h *HttpHandle) checkAddressOrder(ctx context.Context, req *ReqAccountSearc switch order.PayTokenId { case tables.TokenIdDas, tables.TokenIdCkb, tables.TokenIdCkbInternal: chainType = common.ChainTypeCkb - case tables.TokenIdEth, tables.TokenIdBnb, tables.TokenIdMatic: + case tables.TokenIdEth, tables.TokenIdBnb, tables.TokenIdPol: //, tables.TokenIdMatic: chainType = common.ChainTypeEth case tables.TokenIdTrx: chainType = common.ChainTypeTron diff --git a/notify/notify_order.go b/notify/notify_order.go index 5cedb3c..6fbceef 100644 --- a/notify/notify_order.go +++ b/notify/notify_order.go @@ -29,9 +29,10 @@ func SendLarkOrderNotify(p *SendLarkOrderNotifyParam) { address := fmt.Sprintf("(%s)%s", p.ChainType.ToString(), p.Address) amount := p.Amount switch p.PayTokenId { - case tables.TokenIdBnb, tables.TokenIdEth, tables.TokenIdMatic: + case tables.TokenIdBnb, tables.TokenIdEth, tables.TokenIdPol: //, tables.TokenIdMatic: amount = amount.DivRound(decimal.New(1, 18), 18) - case tables.TokenIdCkb, tables.TokenIdDas, tables.TokenIdCkbInternal, tables.TokenIdPadgeInternal: + case tables.TokenIdCkb, tables.TokenIdDas, tables.TokenIdCkbInternal, + tables.TokenIdPadgeInternal, tables.TokenIdCkbCCC: amount = amount.DivRound(decimal.New(1, 8), 8) case tables.TokenIdTrx: amount = amount.DivRound(decimal.New(1, 6), 6) diff --git a/tables/t_das_order_info.go b/tables/t_das_order_info.go index 20004ce..91b5006 100644 --- a/tables/t_das_order_info.go +++ b/tables/t_das_order_info.go @@ -85,14 +85,15 @@ const ( type PayTokenId string const ( - TokenIdDas PayTokenId = "ckb_das" - TokenIdCkb PayTokenId = "ckb_ckb" - TokenIdCkbInternal PayTokenId = "ckb_internal" - TokenIdEth PayTokenId = "eth_eth" - TokenIdTrx PayTokenId = "tron_trx" - TokenIdWx PayTokenId = "wx_cny" - TokenIdBnb PayTokenId = "bsc_bnb" - TokenIdMatic PayTokenId = "polygon_matic" + TokenIdDas PayTokenId = "ckb_das" + TokenIdCkb PayTokenId = "ckb_ckb" + TokenIdCkbInternal PayTokenId = "ckb_internal" + TokenIdEth PayTokenId = "eth_eth" + TokenIdTrx PayTokenId = "tron_trx" + TokenIdWx PayTokenId = "wx_cny" + TokenIdBnb PayTokenId = "bsc_bnb" + //TokenIdMatic PayTokenId = "polygon_matic" + TokenIdPol PayTokenId = "polygon_pol" TokenCoupon PayTokenId = "coupon" TokenIdDoge PayTokenId = "doge_doge" TokenIdStripeUSD PayTokenId = "stripe_usd" @@ -118,7 +119,9 @@ func (p PayTokenId) ToChainString() string { return "tron" case TokenIdBnb: return "bsc" - case TokenIdMatic: + //case TokenIdMatic: + // return "polygon" + case TokenIdPol: return "polygon" case TokenIdDoge: return "doge" diff --git a/unipay/unipay.go b/unipay/unipay.go index 0221726..78f8da3 100644 --- a/unipay/unipay.go +++ b/unipay/unipay.go @@ -121,7 +121,7 @@ type ToolUniPay struct { func RoundAmount(amount decimal.Decimal, tokenId tables.PayTokenId) decimal.Decimal { switch tokenId { - case tables.TokenIdEth, tables.TokenIdBnb, tables.TokenIdMatic: + case tables.TokenIdEth, tables.TokenIdBnb, tables.TokenIdPol: //, tables.TokenIdMatic: dec := decimal.New(1, 8) amount = amount.Div(dec).Ceil().Mul(dec) case tables.TokenIdDas, tables.TokenIdCkb, tables.TokenIdCkbInternal, tables.TokenIdDoge, tables.TokenIdPadgeInternal: