Skip to content

Commit

Permalink
update denom validation regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed Nov 17, 2023
1 parent e3ec745 commit 942bb8e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/params/app_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,9 @@ func init() {
if AccountAddressPrefix != Name {
log.Fatal("AccountAddresPrefix must equal Name")
}

sdk.SetCoinDenomRegex(func() string {
// allow "ux" token. Default regexp requires denom to be at least 3 characters long.
return `[a-zA-Z][a-zA-Z0-9/:._-]{1,127}`
})
}
17 changes: 17 additions & 0 deletions app/params/app_settings_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package params

import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/assert"
)

func TestDenoms(t *testing.T) {
assert := assert.New(t)

assert.NoError(sdk.ValidateDenom(BondDenom))
assert.NoError(sdk.ValidateDenom(BaseExtraDenom))
assert.NoError(sdk.ValidateDenom(DisplayDenom))
assert.NoError(sdk.ValidateDenom(LegacyDisplayDenom))
}
1 change: 1 addition & 0 deletions app/params/prefix.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
)

// AccountAddressPrefix defines the Umee network's Bech32 address prefix.
// NOTE: this must not be changed.
const AccountAddressPrefix = "umee"

// Account specific Bech32 prefixes.
Expand Down

0 comments on commit 942bb8e

Please sign in to comment.