wormchain: tokenbridge: Check for base denom in GetWrappedCoinMeta
The base denom for wrapped tokens is prefixed with "b". Check for this in GetWrappedCoinMeta so that we don't end up treating base denom tokens as native tokens.
This commit is contained in:
parent
a66b3ac28c
commit
a0c25dead2
|
@ -101,7 +101,7 @@ func GetWrappedCoinMeta(identifier string) (tokenChain uint16, tokenAddress [32]
|
||||||
if len(parts) != 3 {
|
if len(parts) != 3 {
|
||||||
return 0, [32]byte{}, false
|
return 0, [32]byte{}, false
|
||||||
}
|
}
|
||||||
if parts[0] != "wh" {
|
if parts[0] != "wh" && parts[0] != "bwh" {
|
||||||
return 0, [32]byte{}, false
|
return 0, [32]byte{}, false
|
||||||
}
|
}
|
||||||
if len(parts[1]) != 5 {
|
if len(parts[1]) != 5 {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package types
|
package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/hex"
|
||||||
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -87,6 +89,13 @@ func TestGetWrappedCoinMeta(t *testing.T) {
|
||||||
tokenAddress: [32]byte{},
|
tokenAddress: [32]byte{},
|
||||||
wrapped: false,
|
wrapped: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "base denom",
|
||||||
|
identifier: fmt.Sprintf("bwh/00008/%s", hex.EncodeToString(testToken[:])),
|
||||||
|
tokenChain: 8,
|
||||||
|
tokenAddress: testToken,
|
||||||
|
wrapped: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue