Skip to content

Commit

Permalink
feat(bouncebit): Add support for BounceBit EVM (#3807)
Browse files Browse the repository at this point in the history
  • Loading branch information
satoshiotomakan authored Apr 19, 2024
1 parent 51917c0 commit cd212c9
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +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, MERLIN, LIGHTLINK, BLAST,
ZETAEVM, MERLIN, LIGHTLINK, BLAST, BOUNCEBIT,
-> 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 @@ -91,6 +91,7 @@ This list is generated from [./registry.json](../registry.json)
| 4200 | Merlin | BTC | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/merlin/info/logo.png" width="32" /> | <https://merlinchain.io> |
| 5000 | Mantle | MNT | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/mantle/info/logo.png" width="32" /> | <https://www.mantle.xyz> |
| 5600 | BNB Greenfield | BNB | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/greenfield/info/logo.png" width="32" /> | <https://greenfield.bnbchain.org> |
| 6001 | BounceBit | BB | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bouncebit/info/logo.png" width="32" /> | <https://bouncebit.io> |
| 6060 | GoChain | GO | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/gochain/info/logo.png" width="32" /> | <https://gochain.io> |
| 7332 | Zen EON | ZEN | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zeneon/info/logo.png" width="32" /> | <https://eon.horizen.io> |
| 8453 | Base | ETH | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/base/info/logo.png" width="32" /> | <https://base.mirror.xyz/> |
Expand Down
1 change: 1 addition & 0 deletions include/TrustWalletCore/TWCoinType.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ enum TWCoinType {
TWCoinTypeMerlin = 4200,
TWCoinTypeLightlink = 1890,
TWCoinTypeBlast = 81457,
TWCoinTypeBounceBit = 6001,
// end_of_tw_coin_type_marker_do_not_modify
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +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, Merlin, Lightlink, Blast,
ZetaEVM, Merlin, Lightlink, Blast, BounceBit,
-> "0x8f348F300873Fd5DA36950B2aC75a26584584feE"

Ronin -> "ronin:8f348F300873Fd5DA36950B2aC75a26584584feE"
Expand Down
30 changes: 30 additions & 0 deletions registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -4719,5 +4719,35 @@
"rpc": "https://rpc.blast.io",
"documentation": "https://docs.blast.io"
}
},
{
"id": "bouncebit",
"name": "BounceBit",
"coinId": 6001,
"symbol": "BB",
"decimals": 18,
"blockchain": "Ethereum",
"derivation": [
{
"path": "m/44'/60'/0'/0/0"
}
],
"curve": "secp256k1",
"publicKeyType": "secp256k1Extended",
"chainId": "6001",
"addressHasher": "keccak256",
"explorer": {
"url": "https://bbscan.io",
"txPath": "/tx/",
"accountPath": "/address/",
"sampleTx": "0x52558f4143d058d942e3b73414090266ae3ffce1fe8c25fe86896e2c8e5ef932",
"sampleAccount": "0xf4aa7349a9ccca4609943955b5ddc7bd9278c223"
},
"info": {
"url": "https://bouncebit.io",
"source": "https://github.com/BounceBit-Labs",
"rpc": "https://fullnode-mainnet.bouncebitapi.com",
"documentation": "https://docs.bouncebit.io"
}
}
]
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 @@ -89,6 +89,7 @@ fn test_coin_address_derivation() {
| CoinType::Merlin
| CoinType::Lightlink
| CoinType::Blast
| CoinType::BounceBit
// 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 @@ -117,7 +117,8 @@ class CoinAddressDerivationTests: XCTestCase {
.zetaEVM,
.merlin,
.lightlink,
.blast:
.blast,
.bounceBit:
let expectedResult = "0x8f348F300873Fd5DA36950B2aC75a26584584feE"
assertCoinDerivation(coin, expectedResult, derivedAddress, address)
case .ronin:
Expand Down
29 changes: 29 additions & 0 deletions tests/chains/BounceBit/TWCoinTypeTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.

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

TEST(TWBounceBitCoinType, TWCoinType) {
const auto coin = TWCoinTypeBounceBit;
const auto symbol = WRAPS(TWCoinTypeConfigurationGetSymbol(coin));
const auto id = WRAPS(TWCoinTypeConfigurationGetID(coin));
const auto name = WRAPS(TWCoinTypeConfigurationGetName(coin));
const auto txId = WRAPS(TWStringCreateWithUTF8Bytes("0x52558f4143d058d942e3b73414090266ae3ffce1fe8c25fe86896e2c8e5ef932"));
const auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(coin, txId.get()));
const auto accId = WRAPS(TWStringCreateWithUTF8Bytes("0xf4aa7349a9ccca4609943955b5ddc7bd9278c223"));
const auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(coin, accId.get()));

assertStringsEqual(id, "bouncebit");
assertStringsEqual(name, "BounceBit");
assertStringsEqual(symbol, "BB");
ASSERT_EQ(TWCoinTypeConfigurationGetDecimals(coin), 18);
ASSERT_EQ(TWCoinTypeBlockchain(coin), TWBlockchainEthereum);
ASSERT_EQ(TWCoinTypeP2pkhPrefix(coin), 0);
ASSERT_EQ(TWCoinTypeP2shPrefix(coin), 0);
ASSERT_EQ(TWCoinTypeStaticPrefix(coin), 0);
assertStringsEqual(txUrl, "https://bbscan.io/tx/0x52558f4143d058d942e3b73414090266ae3ffce1fe8c25fe86896e2c8e5ef932");
assertStringsEqual(accUrl, "https://bbscan.io/address/0xf4aa7349a9ccca4609943955b5ddc7bd9278c223");
}
1 change: 1 addition & 0 deletions tests/common/CoinAddressDerivationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ TEST(Coin, DeriveAddress) {
case TWCoinTypeMerlin:
case TWCoinTypeLightlink:
case TWCoinTypeBlast:
case TWCoinTypeBounceBit:
// end_of_evm_address_derivation_tests_marker_do_not_modify
EXPECT_EQ(address, "0x9d8A62f656a8d1615C1294fd71e9CFb3E4855A4F");
break;
Expand Down

0 comments on commit cd212c9

Please sign in to comment.