Skip to content

Commit

Permalink
Add support to zkLink Nova (#173)
Browse files Browse the repository at this point in the history
* Add support to zkLink Nova

* Add support to zkLink Nova

* fix test

* Fix symbol
  • Loading branch information
danielmbirochi authored Jun 14, 2024
1 parent dd4f543 commit e462dc7
Show file tree
Hide file tree
Showing 7 changed files with 189 additions and 119 deletions.
264 changes: 145 additions & 119 deletions coin/coins.go

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

8 changes: 8 additions & 0 deletions coin/coins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1053,3 +1053,11 @@
decimals: 18
blockchain: Ethereum
isTokenSupported: false

- id: 810180
symbol: ETH
handle: zklinknova
name: zkLink Nova
decimals: 18
blockchain: Ethereum
isTokenSupported: true
2 changes: 2 additions & 0 deletions coin/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ func GetCoinExploreURL(c Coin, tokenID, tokenType string) (string, error) {
return fmt.Sprintf("https://blastscan.io/token/%s", tokenID), nil
case SCROLL:
return fmt.Sprintf("https://scrollscan.com/token/%s", tokenID), nil
case ZKLINKNOVA:
return fmt.Sprintf("https://explorer.zklink.io/address/%s", tokenID), nil
}

return "", errors.New("no explorer for coin: " + c.Handle)
Expand Down
11 changes: 11 additions & 0 deletions coin/models_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,16 @@ func TestGetCoinExploreURL(t *testing.T) {
want: "https://scrollscan.com/token/0xf55bec9cafdbe8730f096aa55dad6d22d44099df",
wantErr: false,
},
{
name: "Test zkLink Nova - Dai",
args: args{
addr: "0xF573fA04A73d5AC442F3DEa8741317fEaA3cDeab",
tokenType: "ZKLINKNOVA",
chain: Zklinknova(),
},
want: "https://explorer.zklink.io/address/0xF573fA04A73d5AC442F3DEa8741317fEaA3cDeab",
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down Expand Up @@ -479,6 +489,7 @@ var evmCoinsTestSet = map[uint]struct{}{
BLAST: {},
SCROLL: {},
BOUNCEBIT: {},
ZKLINKNOVA: {},
}

// TestEvmCoinsList This test will automatically fail when new EVM chain is added to coins.yml
Expand Down
2 changes: 2 additions & 0 deletions types/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ func GetChainFromAssetType(assetType string) (coin.Coin, error) {
return coin.Internet_computer(), nil
case BOUNCEBIT:
return coin.Bouncebit(), nil
case ZKLINKNOVA:
return coin.Zklinknova(), nil
}

return coin.Coin{}, errors.New("unknown asset type: " + assetType)
Expand Down
Loading

0 comments on commit e462dc7

Please sign in to comment.