Skip to content

Commit

Permalink
Deploy Mantle to testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-riley committed Nov 8, 2023
1 parent 0a89e23 commit fc5c2ec
Show file tree
Hide file tree
Showing 10 changed files with 180 additions and 94 deletions.
16 changes: 16 additions & 0 deletions ethereum/.env.mantle.testnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Mantle testnet env
# Rename to .env to use with truffle migrations

# Wormhole Core Migrations
INIT_SIGNERS=["0x13947Bd48b18E53fdAeEe77F3473391aC727C638"]
INIT_CHAIN_ID=35
INIT_GOV_CHAIN_ID=0x1
INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
INIT_EVM_CHAIN_ID=5001

# Bridge Migrations
BRIDGE_INIT_CHAIN_ID=35
BRIDGE_INIT_GOV_CHAIN_ID=0x1
BRIDGE_INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
BRIDGE_INIT_WETH=0xEa12Be2389c2254bAaD383c6eD1fa1e15202b52A
BRIDGE_INIT_FINALITY=1
9 changes: 9 additions & 0 deletions ethereum/truffle-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,15 @@ module.exports = {
},
network_id: 534351,
},
mantle_testnet: {
provider: () => {
return new HDWalletProvider(
process.env.MNEMONIC,
"https://rpc.testnet.mantle.xyz"
);
},
network_id: 5001,
},
rootstock: {
provider: () => {
return new HDWalletProvider(
Expand Down
1 change: 1 addition & 0 deletions node/cmd/guardiand/adminnodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func runListNodes(cmd *cobra.Command, args []string) {
{"Base", vaa.ChainIDBase},
{"Sei", vaa.ChainIDSei},
{"Scroll", vaa.ChainIDScroll},
{"Mantle", vaa.ChainIDMantle},
{"Wormchain", vaa.ChainIDWormchain},
{"Sepolia", vaa.ChainIDSepolia},
}
Expand Down
23 changes: 23 additions & 0 deletions node/cmd/guardiand/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ var (
scrollRPC *string
scrollContract *string

mantleRPC *string
mantleContract *string

sepoliaRPC *string
sepoliaContract *string

Expand Down Expand Up @@ -343,6 +346,9 @@ func init() {
scrollRPC = NodeCmd.Flags().String("scrollRPC", "", "Scroll RPC URL")
scrollContract = NodeCmd.Flags().String("scrollContract", "", "Scroll contract address")

mantleRPC = NodeCmd.Flags().String("mantleRPC", "", "Mantle RPC URL")
mantleContract = NodeCmd.Flags().String("mantleContract", "", "Mantle contract address")

baseRPC = NodeCmd.Flags().String("baseRPC", "", "Base RPC URL")
baseContract = NodeCmd.Flags().String("baseContract", "", "Base contract address")

Expand Down Expand Up @@ -496,6 +502,7 @@ func runNode(cmd *cobra.Command, args []string) {
*baseContract = unsafeDevModeEvmContractAddress(*baseContract)
*sepoliaContract = unsafeDevModeEvmContractAddress(*sepoliaContract)
*scrollContract = unsafeDevModeEvmContractAddress(*scrollContract)
*mantleContract = unsafeDevModeEvmContractAddress(*mantleContract)
}

// Verify flags
Expand Down Expand Up @@ -638,6 +645,10 @@ func runNode(cmd *cobra.Command, args []string) {
logger.Fatal("Both --scrollContract and --scrollRPC must be set together or both unset")
}

if (*mantleRPC == "") != (*mantleContract == "") {
logger.Fatal("Both --mantleContract and --mantleRPC must be set together or both unset")
}

if *gatewayWS != "" {
if *gatewayLCD == "" || *gatewayContract == "" {
logger.Fatal("If --gatewayWS is specified, then --gatewayLCD and --gatewayContract must be specified")
Expand Down Expand Up @@ -863,6 +874,7 @@ func runNode(cmd *cobra.Command, args []string) {
rpcMap["ibcWS"] = *ibcWS
rpcMap["karuraRPC"] = *karuraRPC
rpcMap["klaytnRPC"] = *klaytnRPC
rpcMap["mantleRPC"] = *mantleRPC
rpcMap["moonbeamRPC"] = *moonbeamRPC
rpcMap["nearRPC"] = *nearRPC
rpcMap["neonRPC"] = *neonRPC
Expand Down Expand Up @@ -1222,6 +1234,17 @@ func runNode(cmd *cobra.Command, args []string) {
watcherConfigs = append(watcherConfigs, wc)
}

if shouldStart(mantleRPC) {
wc := &evm.WatcherConfig{
NetworkID: "mantle",
ChainID: vaa.ChainIDMantle,
Rpc: *mantleRPC,
Contract: *mantleContract,
}

watcherConfigs = append(watcherConfigs, wc)
}

if shouldStart(terraWS) {
wc := &cosmwasm.WatcherConfig{
NetworkID: "terra",
Expand Down
192 changes: 98 additions & 94 deletions node/pkg/proto/publicrpc/v1/publicrpc.pb.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions proto/publicrpc/v1/publicrpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ enum ChainID {
CHAIN_ID_SEI = 32;
// CHAIN_ID_ROOTSTOCK = 33;
CHAIN_ID_SCROLL = 34;
CHAIN_ID_MANTLE = 35;
CHAIN_ID_SEPOLIA = 10002;
}

Expand Down
18 changes: 18 additions & 0 deletions sdk/js/src/utils/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const CHAINS = {
sei: 32,
rootstock: 33,
scroll: 34,
mantle: 35,
wormchain: 3104,
cosmoshub: 4000,
evmos: 4001,
Expand Down Expand Up @@ -67,6 +68,7 @@ export const EVMChainNames = [
"base",
"rootstock",
"scroll",
"mantle",
"sepolia",
] as const;
export type EVMChainName = typeof EVMChainNames[number];
Expand Down Expand Up @@ -281,6 +283,11 @@ const MAINNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
mantle: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
wormchain: {
core: "wormhole1ufs3tlq4umljk0qfe8k5ya0x6hpavn897u2cnf9k0en9jr7qarqqaqfk2j",
token_bridge:
Expand Down Expand Up @@ -487,6 +494,11 @@ const TESTNET = {
token_bridge: "0x22427d90B7dA3fA4642F7025A854c7254E4e45BF",
nft_bridge: "0x47B9a1406BEe29a3001BFEB7e45aE45fFFB40c18",
},
mantle: {
core: "0x6b9C8671cdDC8dEab9c719bB87cBd3e782bA6a35",
token_bridge: "0xC7A204bDBFe983FCD8d8E61D02b475D4073fF97e",
nft_bridge: "0x23908A62110e21C04F3A4e011d24F901F911744A",
},
wormchain: {
core: "wormhole16jzpxp0e8550c9aht6q9svcux30vtyyyyxv5w2l2djjra46580wsazcjwp",
token_bridge:
Expand Down Expand Up @@ -690,6 +702,11 @@ const DEVNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
mantle: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
wormchain: {
core: "wormhole17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgshdnj3k",
token_bridge:
Expand Down Expand Up @@ -794,6 +811,7 @@ export const CHAIN_ID_BASE = CHAINS["base"];
export const CHAIN_ID_SEI = CHAINS["sei"];
export const CHAIN_ID_ROOTSTOCK = CHAINS["rootstock"];
export const CHAIN_ID_SCROLL = CHAINS["scroll"];
export const CHAIN_ID_MANTLE = CHAINS["mantle"];
export const CHAIN_ID_WORMCHAIN = CHAINS["wormchain"];
export const CHAIN_ID_GATEWAY = CHAIN_ID_WORMCHAIN;
export const CHAIN_ID_COSMOSHUB = CHAINS["cosmoshub"];
Expand Down
5 changes: 5 additions & 0 deletions sdk/rust/core/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub enum Chain {
Sei,
Rootstock,
Scroll,
Mantle,
Wormchain,
Sepolia,

Expand Down Expand Up @@ -87,6 +88,7 @@ impl From<u16> for Chain {
32 => Chain::Sei,
33 => Chain::Rootstock,
34 => Chain::Scroll,
35 => Chain::Mantle,
3104 => Chain::Wormchain,
10002 => Chain::Sepolia,
c => Chain::Unknown(c),
Expand Down Expand Up @@ -130,6 +132,7 @@ impl From<Chain> for u16 {
Chain::Sei => 32,
Chain::Rootstock => 33,
Chain::Scroll => 34,
Chain::Mantle => 35,
Chain::Wormchain => 3104,
Chain::Sepolia => 10002,
Chain::Unknown(c) => c,
Expand Down Expand Up @@ -173,6 +176,7 @@ impl fmt::Display for Chain {
Self::Sei => f.write_str("Sei"),
Self::Rootstock => f.write_str("Rootstock"),
Self::Scroll => f.write_str("Scroll"),
Self::Mantle => f.write_str("Mantle"),
Self::Sepolia => f.write_str("Sepolia"),
Self::Wormchain => f.write_str("Wormchain"),
Self::Unknown(v) => write!(f, "Unknown({v})"),
Expand Down Expand Up @@ -222,6 +226,7 @@ impl FromStr for Chain {
"Sei" | "sei" | "SEI" => Ok(Chain::Sei),
"Rootstock" | "rootstock" | "ROOTSTOCK" => Ok(Chain::Rootstock),
"Scroll" | "scroll" | "SCROLL" => Ok(Chain::Scroll),
"Mantle" | "mantle" | "MANTLE" => Ok(Chain::Mantle),
"Sepolia" | "sepolia" | "SEPOLIA" => Ok(Chain::Sepolia),
"Wormchain" | "wormchain" | "WORMCHAIN" => Ok(Chain::Wormchain),
_ => {
Expand Down
2 changes: 2 additions & 0 deletions sdk/testnet_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var knownTestnetTokenbridgeEmitters = map[vaa.ChainID]string{
vaa.ChainIDKlaytn: "000000000000000000000000c7a13be098720840dea132d860fdfa030884b09a",
vaa.ChainIDCelo: "00000000000000000000000005ca6037ec51f8b712ed2e6fa72219feae74e153",
vaa.ChainIDNear: "c2c0b6ecbbe9ecf91b2b7999f0264018ba68126c2e83bf413f59f712f3a1df55",
vaa.ChainIDMantle: "000000000000000000000000C7A204bDBFe983FCD8d8E61D02b475D4073fF97e",
vaa.ChainIDMoonbeam: "000000000000000000000000bc976d4b9d57e57c3ca52e1fd136c45ff7955a96",
vaa.ChainIDArbitrum: "00000000000000000000000023908A62110e21C04F3A4e011d24F901F911744A",
vaa.ChainIDOptimism: "000000000000000000000000C7A204bDBFe983FCD8d8E61D02b475D4073fF97e",
Expand Down Expand Up @@ -54,6 +55,7 @@ var knownTestnetNFTBridgeEmitters = map[vaa.ChainID]string{
vaa.ChainIDAcala: "00000000000000000000000096f1335e0acab3cfd9899b30b2374e25a2148a6e",
vaa.ChainIDKlaytn: "00000000000000000000000094c994fc51c13101062958b567e743f1a04432de",
vaa.ChainIDCelo: "000000000000000000000000acd8190f647a31e56a656748bc30f69259f245db",
vaa.ChainIDMantle: "00000000000000000000000023908A62110e21C04F3A4e011d24F901F911744A",
vaa.ChainIDMoonbeam: "00000000000000000000000098a0f4b96972b32fcb3bd03caeb66a44a6ab9edb",
vaa.ChainIDArbitrum: "000000000000000000000000Ee3dB83916Ccdc3593b734F7F2d16D630F39F1D0",
vaa.ChainIDOptimism: "00000000000000000000000023908A62110e21C04F3A4e011d24F901F911744A",
Expand Down
7 changes: 7 additions & 0 deletions sdk/vaa/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ func (c ChainID) String() string {
return "sei"
case ChainIDScroll:
return "scroll"
case ChainIDMantle:
return "mantle"
case ChainIDSepolia:
return "sepolia"
default:
Expand Down Expand Up @@ -285,6 +287,8 @@ func ChainIDFromString(s string) (ChainID, error) {
return ChainIDSei, nil
case "scroll":
return ChainIDScroll, nil
case "mantle":
return ChainIDMantle, nil
case "sepolia":
return ChainIDSepolia, nil
default:
Expand Down Expand Up @@ -323,6 +327,7 @@ func GetAllNetworkIDs() []ChainID {
ChainIDBase,
ChainIDSei,
ChainIDScroll,
ChainIDMantle,
ChainIDWormchain,
ChainIDSepolia,
}
Expand Down Expand Up @@ -388,6 +393,8 @@ const (
ChainIDSei ChainID = 32
// ChainIDScroll is the ChainID of Scroll
ChainIDScroll ChainID = 34
// ChainIDMantle is the ChainID of Mantle
ChainIDMantle ChainID = 35
//ChainIDWormchain is the ChainID of Wormchain
ChainIDWormchain ChainID = 3104
// ChainIDSepolia is the ChainID of Sepolia
Expand Down

0 comments on commit fc5c2ec

Please sign in to comment.