Skip to content

Commit

Permalink
Validation changes (#149)
Browse files Browse the repository at this point in the history
* validation changes

* validation changes

* change name

* change name

* change name
  • Loading branch information
defisaur authored Dec 6, 2023
1 parent bbcf57f commit 10a3fd8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion coin/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func GetCoinExploreURL(c Coin, tokenID, tokenType string) (string, error) {
case SOLANA:
return fmt.Sprintf("https://solscan.io/token/%s", tokenID), nil
case TOMOCHAIN:
return fmt.Sprintf("https://scan.tomochain.com/address/%s", tokenID), nil
return fmt.Sprintf("https://tomoscan.io/token/%s", tokenID), nil
case KAVA:
return "https://www.mintscan.io/kava", nil
case ONTOLOGY:
Expand Down Expand Up @@ -157,6 +157,10 @@ func GetCoinExploreURL(c Coin, tokenID, tokenType string) (string, error) {
return fmt.Sprintf("https://cexplorer.io/asset/%s", tokenID), nil
case NEON:
return fmt.Sprintf("https://neonscan.org/token/%s", tokenID), nil
case MANTLE:
return fmt.Sprintf("https://explorer.mantle.xyz/address/%s", tokenID), nil
case LINEA:
return fmt.Sprintf("https://explorer.linea.build/token/%s", tokenID), 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 @@ -157,6 +157,8 @@ func GetChainFromAssetType(assetType string) (coin.Coin, error) {
return coin.Linea(), nil
case STARGAZE:
return coin.Stargaze(), nil
case MANTLE:
return coin.Mantle(), nil
}

return coin.Coin{}, errors.New("unknown asset type: " + assetType)
Expand Down
8 changes: 7 additions & 1 deletion types/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const (
IOTEXEVM TokenType = "XRC20"
OPBNB TokenType = "OPBNB"
LINEA TokenType = "LINEA"
MANTLE TokenType = "MANTLE"
)

const (
Expand Down Expand Up @@ -215,6 +216,7 @@ func GetTokenTypes() []TokenType {
OPBNB,
LINEA,
ACALAEVM,
MANTLE,
}
}

Expand Down Expand Up @@ -318,6 +320,8 @@ func GetTokenType(c uint, tokenID string) (string, bool) {
return string(CARDANO), true
case coin.NEON:
return string(NEON), true
case coin.MANTLE:
return string(MANTLE), true
default:
return "", false
}
Expand Down Expand Up @@ -371,7 +375,7 @@ func GetTokenVersion(tokenType string) (TokenVersion, error) {
case KAVAEVM, BOBA, METIS, NEON, LINEA, ACA, ACALAEVM, CONFLUX, IOTEXEVM, KLAYTN, MOONRIVER, MOONBEAM:
return TokenVersionV14, nil
case BRC20, ERC721, ERC1155, EOS, NEP5, VET, ONTOLOGY, THETA, TOMO, POA, OASIS, ALGORAND, METER, EVMOS_ERC20,
KIP20, STRIDE, NEUTRON, FA2, CARDANO, NATIVEINJECTIVE, NATIVEEVMOS, CRYPTOORG, COSMOS, OSMOSIS, STARGAZE:
KIP20, STRIDE, NEUTRON, FA2, CARDANO, NATIVEINJECTIVE, NATIVEEVMOS, CRYPTOORG, COSMOS, OSMOSIS, STARGAZE, MANTLE:
return TokenVersionUndefined, nil
default:
// This should not happen, as it is guarded by TestGetTokenVersionImplementEverySupportedTokenTypes
Expand Down Expand Up @@ -477,6 +481,8 @@ func GetEthereumTokenTypeByIndex(coinIndex uint) (TokenType, error) {
tokenType = OPBNB
case coin.LINEA:
tokenType = LINEA
case coin.MANTLE:
tokenType = MANTLE
}

if tokenType == "" {
Expand Down

0 comments on commit 10a3fd8

Please sign in to comment.