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

feat(ZetaChain) Add support for ZetaEVM mainnet #3670

Merged
merged 17 commits into from
Jan 25, 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
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class CoinAddressDerivationTests {
FANTOM, CELO, CRONOSCHAIN, SMARTBITCOINCASH, KUCOINCOMMUNITYCHAIN, BOBA, METIS,
AURORA, EVMOS, MOONRIVER, MOONBEAM, KAVAEVM, KLAYTN, METER, OKXCHAIN, POLYGONZKEVM, SCROLL,
CONFLUXESPACE, ACALAEVM, OPBNB, NEON, BASE, LINEA, GREENFIELD, MANTLE, ZENEON, MANTAPACIFIC,
ZETAEVM,
-> assertEquals("0x8f348F300873Fd5DA36950B2aC75a26584584feE", address)

RONIN -> assertEquals("ronin:8f348F300873Fd5DA36950B2aC75a26584584feE", address)
Expand Down
1 change: 1 addition & 0 deletions docs/registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ This list is generated from [./registry.json](../registry.json)
| 19000118 | Sei | SEI | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/sei/info/logo.png" width="32" /> | <https://sei.io/> |
| 20000118 | Stargaze | STARS | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/stargaze/info/logo.png" width="32" /> | <https://www.stargaze.zone/> |
| 20000714 | BNB Smart Chain | BNB | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/smartchain/info/logo.png" width="32" /> | <https://www.binance.org/en/smartChain> |
| 20007000 | Zeta EVM | ZETA | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zetaevm/info/logo.png" width="32" /> | <https://www.zetachain.com/> |
| 20009001 | Native Evmos | EVMOS | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/nativeevmos/info/logo.png" width="32" /> | <https://evmos.org/> |
| 21000118 | Celestia | TIA | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/tia/info/logo.png" width="32" /> | <https://celestia.org/> |
| 30000118 | Juno | JUNO | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/juno/info/logo.png" width="32" /> | <https://www.junonetwork.io/> |
Expand Down
1 change: 1 addition & 0 deletions include/TrustWalletCore/TWCoinType.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ enum TWCoinType {
TWCoinTypeTia = 21000118,
TWCoinTypeMantaPacific = 169,
TWCoinTypeNativeZetaChain = 10007000,
TWCoinTypeZetaEVM = 20007000,
// end_of_tw_coin_type_marker_do_not_modify
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class CoinAddressDerivationTests {
Fantom, Celo, CronosChain, SmartBitcoinCash, KuCoinCommunityChain, Boba, Metis,
Aurora, Evmos, Moonriver, Moonbeam, KavaEvm, Klaytn, Meter, OKXChain, PolygonzkEVM, Scroll,
ConfluxeSpace, AcalaEVM, OpBNB, Neon, Base, Linea, Greenfield, Mantle, ZenEON, MantaPacific,
ZetaEVM,
-> "0x8f348F300873Fd5DA36950B2aC75a26584584feE"

Ronin -> "ronin:8f348F300873Fd5DA36950B2aC75a26584584feE"
Expand Down
28 changes: 28 additions & 0 deletions registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -4451,6 +4451,34 @@
"documentation": "https://www.zetachain.com/docs/"
}
},
{
"id": "zetaevm",
"name": "Zeta EVM",
"coinId": 20007000,
"symbol": "ZETA",
"decimals": 18,
"blockchain": "Ethereum",
"derivation": [
{
"path": "m/44'/60'/0'/0/0"
}
],
"curve": "secp256k1",
"publicKeyType": "secp256k1Extended",
"chainId": "7000",
"addressHasher": "keccak256",
"explorer": {
"url": "https://explorer.zetachain.com",
"txPath": "/evm/tx/",
"accountPath": "/address/",
"sampleTx": "0x04cb1201857de29af97b755e51c888454fb96c1f3bb3c1329bb94d5353d5c19e",
"sampleAccount": "0x85539A58F9c88DdDccBaBBfc660968323Fd1e167"
},
"info": {
"url": "https://www.zetachain.com/",
"documentation": "https://www.zetachain.com/docs/"
}
},
{
"id": "ton",
"name": "TON",
Expand Down
1 change: 1 addition & 0 deletions rust/tw_any_coin/tests/coin_address_derivation_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ fn test_coin_address_derivation() {
| CoinType::Mantle
| CoinType::ZenEON
| CoinType::MantaPacific
| CoinType::ZetaEVM
// end_of_evm_address_derivation_tests_marker_do_not_modify
=> "0xAc1ec44E4f0ca7D172B7803f6836De87Fb72b309",
CoinType::Bitcoin
Expand Down
3 changes: 2 additions & 1 deletion swift/Tests/CoinAddressDerivationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ class CoinAddressDerivationTests: XCTestCase {
.greenfield,
.mantle,
.zenEON,
.mantaPacific:
.mantaPacific,
.zetaEVM:
let expectedResult = "0x8f348F300873Fd5DA36950B2aC75a26584584feE"
assertCoinDerivation(coin, expectedResult, derivedAddress, address)
case .ronin:
Expand Down
35 changes: 35 additions & 0 deletions tests/chains/ZetaEVM/TWCoinTypeTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here MAY BE LOST.
// Generated one-time (codegen/bin/cointests)
//

#include "TestUtilities.h"
#include <TrustWalletCore/TWCoinTypeConfiguration.h>
#include <gtest/gtest.h>


TEST(TWZetaEVMCoinType, TWCoinType) {
const auto coin = TWCoinTypeZetaEVM;
const auto symbol = WRAPS(TWCoinTypeConfigurationGetSymbol(coin));
const auto id = WRAPS(TWCoinTypeConfigurationGetID(coin));
const auto name = WRAPS(TWCoinTypeConfigurationGetName(coin));
const auto chainId = WRAPS(TWCoinTypeChainId(coin));
const auto txId = WRAPS(TWStringCreateWithUTF8Bytes("0x04cb1201857de29af97b755e51c888454fb96c1f3bb3c1329bb94d5353d5c19e"));
const auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(coin, txId.get()));
const auto accId = WRAPS(TWStringCreateWithUTF8Bytes("0x85539A58F9c88DdDccBaBBfc660968323Fd1e167"));
const auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(coin, accId.get()));

assertStringsEqual(id, "zetaevm");
assertStringsEqual(name, "Zeta EVM");
assertStringsEqual(symbol, "ZETA");
ASSERT_EQ(TWCoinTypeConfigurationGetDecimals(coin), 18);
ASSERT_EQ(TWCoinTypeBlockchain(coin), TWBlockchainEthereum);
ASSERT_EQ(TWCoinTypeP2shPrefix(coin), 0x0);
ASSERT_EQ(TWCoinTypeStaticPrefix(coin), 0x0);
assertStringsEqual(chainId, "7000");
assertStringsEqual(txUrl, "https://explorer.zetachain.com/evm/tx/0x04cb1201857de29af97b755e51c888454fb96c1f3bb3c1329bb94d5353d5c19e");
assertStringsEqual(accUrl, "https://explorer.zetachain.com/address/0x85539A58F9c88DdDccBaBBfc660968323Fd1e167");
}
1 change: 1 addition & 0 deletions tests/common/CoinAddressDerivationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ TEST(Coin, DeriveAddress) {
case TWCoinTypeMantle:
case TWCoinTypeZenEON:
case TWCoinTypeMantaPacific:
case TWCoinTypeZetaEVM:
// end_of_evm_address_derivation_tests_marker_do_not_modify
EXPECT_EQ(address, "0x9d8A62f656a8d1615C1294fd71e9CFb3E4855A4F");
break;
Expand Down
Loading