Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to zkLink Nova #173

Merged
merged 4 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading