Skip to content

Commit

Permalink
Merge branch 'develop' into segue/htlc
Browse files Browse the repository at this point in the history
  • Loading branch information
Haifeng Xi authored Sep 6, 2019
2 parents c5dc6c9 + ff83f29 commit ac81de5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 9 additions & 1 deletion app/v1/auth/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func (am AccountKeeper) InitTotalSupply(ctx sdk.Context) {
tsMap := make(map[string]sdk.Coin)
am.IterateAccounts(ctx, func(account Account) (stop bool) {
for _, coin := range account.GetCoins() {
if sdk.IrisAtto == coin.Denom || sdk.Iris == coin.Denom {
if sdk.IrisAtto == coin.Denom || sdk.Iris == coin.Denom || strings.HasPrefix(coin.Denom, sdk.FormatUniABSPrefix) {
continue
}
totalSupply, ok := tsMap[coin.Denom]
Expand All @@ -360,7 +360,15 @@ func (am AccountKeeper) InitTotalSupply(ctx sdk.Context) {
}
return false
})

// Defense against empty token's keyId
var coins sdk.Coins
for _, coin := range tsMap {
coins = append(coins, coin)
}

coins = coins.Sort()
for _, coin := range coins {
am.SetTotalSupply(ctx, coin)
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/v2/coinswap/internal/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var (
)

const (
FormatUniABSPrefix = "uni:"
FormatUniABSPrefix = sdk.FormatUniABSPrefix
FormatUniId = FormatUniABSPrefix + "%s"
)

Expand Down
2 changes: 2 additions & 0 deletions types/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"strings"
)

const FormatUniABSPrefix = "uni:"

// ConvertIdToTokenKeyId return the store key suffix of a token
func ConvertIdToTokenKeyId(tokenId string) (key string, err error) {
var reToken = `[A-Za-z0-9\.]{3,17}`
Expand Down

0 comments on commit ac81de5

Please sign in to comment.