1
This commit is contained in:
parent
4a846b2b0f
commit
f9387d345f
@ -144,7 +144,7 @@ const (
|
||||
|
||||
const (
|
||||
ETH_NET_ID = 1
|
||||
IMTB_NET_ID = 13371
|
||||
IMTBL_NET_ID = 13371
|
||||
ARB_NET_ID = 42161
|
||||
BNB_NET_ID = 56
|
||||
)
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"main/constant"
|
||||
"q5"
|
||||
"jccommon"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@ -139,9 +140,79 @@ func (this *CurrencyTable) PostInit1() {
|
||||
if contractMeta == nil {
|
||||
panic(fmt.Sprintf("currency contract not found"))
|
||||
}
|
||||
this.verifyCurrencyAddress(netId, currencyMeta.GetContractName(), contractMeta.GetAddress())
|
||||
currencyMeta.contract = contractMeta
|
||||
return true
|
||||
})
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
func (this *CurrencyTable) verifyCurrencyAddress(netId int32, name string, address string) {
|
||||
switch netId {
|
||||
case jccommon.ETH_NET_ID:
|
||||
{
|
||||
if name == "BEUSDC" {
|
||||
if (strings.ToLower(address) != strings.ToLower(jccommon.ETH_USDC_ADDRESS)) {
|
||||
panic(fmt.Sprintf("verifyCurrencyAddress error net:%d name:%s address:%s",
|
||||
netId, name, address))
|
||||
}
|
||||
} else if name == "BEUSDT" {
|
||||
if (strings.ToLower(address) != strings.ToLower(jccommon.ETH_USDT_ADDRESS)) {
|
||||
panic(fmt.Sprintf("verifyCurrencyAddress error net:%d name:%s address:%s",
|
||||
netId, name, address))
|
||||
}
|
||||
} else {
|
||||
panic(fmt.Sprintf("verifyCurrencyAddress error net:%d name:%s address:%s",
|
||||
netId, name, address))
|
||||
}
|
||||
}
|
||||
case jccommon.IMTBL_NET_ID:
|
||||
{
|
||||
if name == "BEUSDC" {
|
||||
if (strings.ToLower(address) != strings.ToLower(jccommon.IMTBL_USDC_ADDRESS)) {
|
||||
panic(fmt.Sprintf("verifyCurrencyAddress error net:%d name:%s address:%s",
|
||||
netId, name, address))
|
||||
}
|
||||
} else {
|
||||
panic(fmt.Sprintf("verifyCurrencyAddress error net:%d name:%s address:%s",
|
||||
netId, name, address))
|
||||
}
|
||||
}
|
||||
case jccommon.ARB_NET_ID:
|
||||
{
|
||||
if name == "BEUSDC" {
|
||||
if (strings.ToLower(address) != strings.ToLower(jccommon.ARB_USDC_ADDRESS)) {
|
||||
panic(fmt.Sprintf("verifyCurrencyAddress error net:%d name:%s address:%s",
|
||||
netId, name, address))
|
||||
}
|
||||
} else if name == "BEUSDT" {
|
||||
if (strings.ToLower(address) != strings.ToLower(jccommon.ARB_USDT_ADDRESS)) {
|
||||
panic(fmt.Sprintf("verifyCurrencyAddress error net:%d name:%s address:%s",
|
||||
netId, name, address))
|
||||
}
|
||||
} else {
|
||||
panic(fmt.Sprintf("verifyCurrencyAddress error net:%d name:%s address:%s",
|
||||
netId, name, address))
|
||||
}
|
||||
}
|
||||
case jccommon.BNB_NET_ID:
|
||||
{
|
||||
if name == "BEUSDC" {
|
||||
if (strings.ToLower(address) != strings.ToLower(jccommon.BNB_USDC_ADDRESS)) {
|
||||
panic(fmt.Sprintf("verifyCurrencyAddress error net:%d name:%s address:%s",
|
||||
netId, name, address))
|
||||
}
|
||||
} else if name == "BEUSDT" {
|
||||
if (strings.ToLower(address) != strings.ToLower(jccommon.BNB_USDT_ADDRESS)) {
|
||||
panic(fmt.Sprintf("verifyCurrencyAddress error net:%d name:%s address:%s",
|
||||
netId, name, address))
|
||||
}
|
||||
} else {
|
||||
panic(fmt.Sprintf("verifyCurrencyAddress error net:%d name:%s address:%s",
|
||||
netId, name, address))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user