1
This commit is contained in:
parent
321950a38a
commit
8ea2c287fe
@ -4,6 +4,7 @@ import (
|
||||
"q5"
|
||||
"f5"
|
||||
"fmt"
|
||||
"strings"
|
||||
"main/constant"
|
||||
)
|
||||
|
||||
@ -69,7 +70,21 @@ func (this *CurrencyTable) GetByNetId(netId int32) *q5.ConcurrentMap[string, *Cu
|
||||
}
|
||||
|
||||
func (this *CurrencyTable) GetByNetIdAddress(netId int32, currencyAddress string) *Currency {
|
||||
return nil
|
||||
currencysMeta := this.GetByNetId(netId)
|
||||
if currencysMeta == nil {
|
||||
return nil
|
||||
}
|
||||
var result *Currency
|
||||
currencyAddress = strings.ToLower(currencyAddress)
|
||||
currencysMeta.Range(
|
||||
func (key string, meta *Currency) bool {
|
||||
if meta.GetContract().GetAddress() == currencyAddress {
|
||||
result = meta
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
func (this *CurrencyTable) Load() {
|
||||
@ -101,7 +116,12 @@ func (this *CurrencyTable) Load() {
|
||||
p := new(Currency)
|
||||
p.init(currencyCfg.CurrencyName, currencyCfg.ExchangeRate, currencyCfg.CurrencyDecimal)
|
||||
p.check()
|
||||
//this.netIdHash.Store(netId, p)
|
||||
currencysMeta := this.GetByNetId(netId)
|
||||
if currencysMeta == nil {
|
||||
currencysMeta := new(q5.ConcurrentMap[string, *Currency])
|
||||
this.netIdHash.Store(netId, currencysMeta)
|
||||
}
|
||||
currencysMeta.Store(p.GetCurrencyName(), p)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user