Skip to content

Commit

Permalink
Register aptos coin (#83)
Browse files Browse the repository at this point in the history
* add aptos coin

* add aptos token

* add aptos explorer
  • Loading branch information
dimkouv authored Oct 18, 2022
1 parent 99c477f commit 352ae8c
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 3 deletions.
27 changes: 26 additions & 1 deletion coin/coins.go

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

9 changes: 8 additions & 1 deletion coin/coins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -621,4 +621,11 @@
handle: cryptoorg
name: CryptoOrg
decimals: 8
blockchain: Cosmos
blockchain: Cosmos

- id: 637
symbol: APTOS
handle: aptos
name: Aptos
decimals: 8
blockchain: Aptos
2 changes: 2 additions & 0 deletions coin/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ func GetCoinExploreURL(c Coin, tokenID, tokenType string) (string, error) {
return fmt.Sprintf("https://evm.evmos.org/address/%s", tokenID), nil
case OKC:
return fmt.Sprintf("https://www.oklink.com/en/okc/address/%s", tokenID), nil
case APTOS:
return "https://explorer.aptoslabs.com/", nil
}

return "", errors.New("no explorer for coin: " + c.Handle)
Expand Down
2 changes: 2 additions & 0 deletions types/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ func GetChainFromAssetType(assetType string) (coin.Coin, error) {
return coin.Evmos(), nil
case KIP20:
return coin.Okc(), nil
case APTOS:
return coin.Aptos(), nil
}

return coin.Coin{}, errors.New("unknown asset type: " + assetType)
Expand Down
7 changes: 6 additions & 1 deletion types/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const (
METER TokenType = "METER"
EVMOS_ERC20 TokenType = "EVMOS_ERC20"
KIP20 TokenType = "KIP20"
APTOS TokenType = "APTOS"
)

const (
Expand Down Expand Up @@ -146,6 +147,7 @@ func GetTokenTypes() []TokenType {
METER,
EVMOS_ERC20,
KIP20,
APTOS,
}
}

Expand Down Expand Up @@ -207,6 +209,8 @@ func GetTokenType(c uint, tokenID string) (string, bool) {
return string(EVMOS_ERC20), true
case coin.OKC:
return string(KIP20), true
case coin.APTOS:
return string(APTOS), true
default:
return "", false
}
Expand All @@ -230,7 +234,8 @@ func GetTokenVersion(tokenType string) (TokenVersion, error) {
WAN20,
GO20,
TT20,
WAVES:
WAVES,
APTOS:
return TokenVersionV0, nil
case TRC20:
return TokenVersionV1, nil
Expand Down
6 changes: 6 additions & 0 deletions types/token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ func TestGetTokenType(t *testing.T) {
want: string(ALGORAND),
wantBool: true,
},
{
name: "Aptos",
args: args{coin.APTOS, ""},
want: string(APTOS),
wantBool: true,
},
}

for _, tt := range tests {
Expand Down

0 comments on commit 352ae8c

Please sign in to comment.