Skip to content

Commit

Permalink
Add ton tokens support
Browse files Browse the repository at this point in the history
  • Loading branch information
tw-daniel committed Jul 16, 2024
1 parent e462dc7 commit eb2c598
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 136 deletions.
245 changes: 123 additions & 122 deletions coin/coins.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion coin/coins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@
name: TON
decimals: 9
blockchain: The Open Network
isTokenSupported: false
isTokenSupported: true

- id: 10001101
symbol: ZKEVM
Expand Down
5 changes: 4 additions & 1 deletion types/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ const (
TokenVersionV18 TokenVersion = 18
TokenVersionV19 TokenVersion = 19
TokenVersionV20 TokenVersion = 20
TokenVersionV21 TokenVersion = 21
TokenVersionUndefined TokenVersion = -1
)

Expand Down Expand Up @@ -408,7 +409,7 @@ func GetTokenVersion(tokenType string) (TokenVersion, error) {
return TokenVersionV10, nil
case RONIN, AURORA:
return TokenVersionV11, nil
case TON, POLYGONZKEVM, ZKSYNC, SUI:
case POLYGONZKEVM, ZKSYNC, SUI:
return TokenVersionV12, nil
case BASE, AKASH, AGORIC, AXELAR, JUNO, SEI, OPBNB:
return TokenVersionV13, nil
Expand All @@ -425,6 +426,8 @@ func GetTokenVersion(tokenType string) (TokenVersion, error) {
return TokenVersionV19, nil
case ZKLINKNOVA:
return TokenVersionV20, nil
case TON:
return TokenVersionV21, nil
case ERC721, ERC1155, EOS, NEP5, VET, ONTOLOGY, THETA, TOMO, POA, OASIS, ALGORAND, METER, EVMOS_ERC20,
KIP20, STRIDE, NEUTRON, FA2, CARDANO, NATIVEEVMOS, CRYPTOORG, COSMOS, OSMOSIS, STARGAZE:
return TokenVersionUndefined, nil
Expand Down
18 changes: 6 additions & 12 deletions types/token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,42 +548,30 @@ func TestGetTokenVersion(t *testing.T) {
TokenVersionV14,
nil,
},

{
"Ton token version",
args{t: string(TON)},
TokenVersionV12,
nil,
},

{
"Stride token version",
args{t: string(STRIDE)},
TokenVersionUndefined,
nil,
},

{
"Neutron token version",
args{t: string(NEUTRON)},
TokenVersionUndefined,
nil,
},

{
"Conflux eSpace token version",
args{t: string(CONFLUX)},
TokenVersionV14,
nil,
},

{
"Acala token version",
args{t: string(ACA)},
TokenVersionV14,
nil,
},

{
"NativeZeta token version",
args{t: string(ZETACHAIN)},
Expand Down Expand Up @@ -632,6 +620,12 @@ func TestGetTokenVersion(t *testing.T) {
TokenVersionV20,
nil,
},
{
"TON token version",
args{t: string(TON)},
TokenVersionV21,
nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit eb2c598

Please sign in to comment.