Skip to content

Commit

Permalink
Moonbeam mainnet deploy (#1579)
Browse files Browse the repository at this point in the history
* Moonbeam mainnet deploy

* Add eth migrate command to just deploy bridges

* node: Added moonbeam emitter addresses and governor limits

Co-authored-by: Bruce Riley <[email protected]>
  • Loading branch information
kev1n-peters and bruce-riley authored Sep 12, 2022
1 parent 2ad0245 commit cda45a8
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 23 deletions.
11 changes: 9 additions & 2 deletions ethereum/.env.moonbeam.mainnet
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# Moonbeam mainnet read only env
# Moonbeam mainnet env
# Rename to .env to use with truffle migrations

# Wormhole Core Migrations
INIT_SIGNERS=["0x58CC3AE5C097b213cE3c81979e1B9f9570746AA5"]
INIT_CHAIN_ID=16
INIT_GOV_CHAIN_ID=0x1
INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
INIT_CHAIN_ID=1284
INIT_EVM_CHAIN_ID=1284

# Bridge Migrations
BRIDGE_INIT_CHAIN_ID=16
BRIDGE_INIT_GOV_CHAIN_ID=0x1
BRIDGE_INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
BRIDGE_INIT_WETH=0xAcc15dC74880C9944775448304B263D191c6077F
BRIDGE_INIT_FINALITY=1
1 change: 1 addition & 0 deletions ethereum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"deploy-bridge-implementation-only": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --f 6 --to 6",
"deploy-token-implementation-only": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --f 7 --to 7",
"deploy-read-only": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --f 1 --to 2",
"deploy-bridges-only": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --f 3 --to 4",
"deploy_weth9": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --f 9",
"deploy-batched-vaa-sender": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --f 10 --to 10",
"verify": "patch -u -f node_modules/truffle-plugin-verify/constants.js -i truffle-verify-constants.patch; truffle run verify $npm_config_module@$npm_config_contract_address --network $npm_config_network",
Expand Down
2 changes: 1 addition & 1 deletion node/cmd/guardiand/adminnodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ func runListNodes(cmd *cobra.Command, args []string) {
{"Near", vaa.ChainIDNear},
{"Terra2", vaa.ChainIDTerra2},
{"Pythnet", vaa.ChainIDPythNet},
{"Moonbeam", vaa.ChainIDMoonbeam},
}

if isTestnet {
networks = append(networks, network{"Ropsten", vaa.ChainIDEthereumRopsten})
networks = append(networks, network{"Moonbeam", vaa.ChainIDMoonbeam})
networks = append(networks, network{"Neon", vaa.ChainIDNeon})
networks = append(networks, network{"Injective", vaa.ChainIDInjective})
}
Expand Down
30 changes: 12 additions & 18 deletions node/cmd/guardiand/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,10 @@ func runNode(cmd *cobra.Command, args []string) {
readiness.RegisterComponent(common.ReadinessAcalaSyncing)
readiness.RegisterComponent(common.ReadinessKlaytnSyncing)
readiness.RegisterComponent(common.ReadinessCeloSyncing)
readiness.RegisterComponent(common.ReadinessMoonbeamSyncing)

if *testnetMode {
readiness.RegisterComponent(common.ReadinessEthRopstenSyncing)
readiness.RegisterComponent(common.ReadinessMoonbeamSyncing)
readiness.RegisterComponent(common.ReadinessNeonSyncing)
readiness.RegisterComponent(common.ReadinessInjectiveSyncing)
}
Expand Down Expand Up @@ -539,19 +539,19 @@ func runNode(cmd *cobra.Command, args []string) {
} else if *nearContract != "" {
logger.Fatal("If --nearContract is specified, then --nearRPC must be specified")
}
if *moonbeamRPC == "" {
logger.Fatal("Please specify --moonbeamRPC")
}
if *moonbeamContract == "" {
logger.Fatal("Please specify --moonbeamContract")
}
if *testnetMode {
if *ethRopstenRPC == "" {
logger.Fatal("Please specify --ethRopstenRPC")
}
if *ethRopstenContract == "" {
logger.Fatal("Please specify --ethRopstenContract")
}
if *moonbeamRPC == "" {
logger.Fatal("Please specify --moonbeamRPC")
}
if *moonbeamContract == "" {
logger.Fatal("Please specify --moonbeamContract")
}
if *neonRPC == "" {
logger.Fatal("Please specify --neonRPC")
}
Expand All @@ -574,12 +574,6 @@ func runNode(cmd *cobra.Command, args []string) {
if *ethRopstenContract != "" {
logger.Fatal("Please do not specify --ethRopstenContract in non-testnet mode")
}
if *moonbeamRPC != "" && !*unsafeDevMode {
logger.Fatal("Please do not specify --moonbeamRPC")
}
if *moonbeamContract != "" && !*unsafeDevMode {
logger.Fatal("Please do not specify --moonbeamContract")
}
if *neonRPC != "" && !*unsafeDevMode {
logger.Fatal("Please do not specify --neonRPC")
}
Expand Down Expand Up @@ -815,8 +809,8 @@ func runNode(cmd *cobra.Command, args []string) {
chainObsvReqC[vaa.ChainIDKlaytn] = make(chan *gossipv1.ObservationRequest)
chainObsvReqC[vaa.ChainIDCelo] = make(chan *gossipv1.ObservationRequest)
chainObsvReqC[vaa.ChainIDPythNet] = make(chan *gossipv1.ObservationRequest)
chainObsvReqC[vaa.ChainIDMoonbeam] = make(chan *gossipv1.ObservationRequest)
if *testnetMode {
chainObsvReqC[vaa.ChainIDMoonbeam] = make(chan *gossipv1.ObservationRequest)
chainObsvReqC[vaa.ChainIDNeon] = make(chan *gossipv1.ObservationRequest)
chainObsvReqC[vaa.ChainIDEthereumRopsten] = make(chan *gossipv1.ObservationRequest)
chainObsvReqC[vaa.ChainIDInjective] = make(chan *gossipv1.ObservationRequest)
Expand Down Expand Up @@ -983,16 +977,16 @@ func runNode(cmd *cobra.Command, args []string) {
ethereum.NewEthWatcher(*celoRPC, celoContractAddr, "celo", common.ReadinessCeloSyncing, vaa.ChainIDCelo, lockC, nil, 1, chainObsvReqC[vaa.ChainIDCelo], *unsafeDevMode).Run); err != nil {
return err
}
if err := supervisor.Run(ctx, "moonbeamwatch",
ethereum.NewEthWatcher(*moonbeamRPC, moonbeamContractAddr, "moonbeam", common.ReadinessMoonbeamSyncing, vaa.ChainIDMoonbeam, lockC, nil, 1, chainObsvReqC[vaa.ChainIDMoonbeam], *unsafeDevMode).Run); err != nil {
return err
}

if *testnetMode {
if err := supervisor.Run(ctx, "ethropstenwatch",
ethereum.NewEthWatcher(*ethRopstenRPC, ethRopstenContractAddr, "ethropsten", common.ReadinessEthRopstenSyncing, vaa.ChainIDEthereumRopsten, lockC, nil, 1, chainObsvReqC[vaa.ChainIDEthereumRopsten], *unsafeDevMode).Run); err != nil {
return err
}
if err := supervisor.Run(ctx, "moonbeamwatch",
ethereum.NewEthWatcher(*moonbeamRPC, moonbeamContractAddr, "moonbeam", common.ReadinessMoonbeamSyncing, vaa.ChainIDMoonbeam, lockC, nil, 1, chainObsvReqC[vaa.ChainIDMoonbeam], *unsafeDevMode).Run); err != nil {
return err
}
if err := supervisor.Run(ctx, "neonwatch",
ethereum.NewEthWatcher(*neonRPC, neonContractAddr, "neon", common.ReadinessNeonSyncing, vaa.ChainIDNeon, lockC, nil, 32, chainObsvReqC[vaa.ChainIDNeon], *unsafeDevMode).Run); err != nil {
return err
Expand Down
4 changes: 3 additions & 1 deletion node/hack/repair_eth/repair_eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ var etherscanAPIMap = map[vaa.ChainID]string{
vaa.ChainIDKarura: "https://blockscout.karura.network/api",
vaa.ChainIDAcala: "https://blockscout.acala.network/api",
// NOTE: Not sure what should be here for Klaytn, since they use: https://scope.klaytn.com/
vaa.ChainIDCelo: "https://celoscan.xyz/api",
vaa.ChainIDCelo: "https://celoscan.xyz/api",
vaa.ChainIDMoonbeam: "https://api-moonbeam.moonscan.io",
}

var coreContractMap = map[vaa.ChainID]string{
Expand All @@ -54,6 +55,7 @@ var coreContractMap = map[vaa.ChainID]string{
vaa.ChainIDAcala: strings.ToLower("0xa321448d90d4e5b0A732867c18eA198e75CAC48E"),
vaa.ChainIDKlaytn: strings.ToLower("0x0C21603c4f3a6387e241c0091A7EA39E43E90bb7"),
vaa.ChainIDCelo: strings.ToLower("0xa321448d90d4e5b0A732867c18eA198e75CAC48E"),
vaa.ChainIDMoonbeam: strings.ToLower("0xC8e2b0cD52Cf01b0Ce87d389Daa3d414d4cE29f3"),
}

var (
Expand Down
2 changes: 2 additions & 0 deletions node/pkg/common/mainnet_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ var knownTokenbridgeEmitters = map[vaa.ChainID]string{
vaa.ChainIDKlaytn: "0000000000000000000000005b08ac39EAED75c0439FC750d9FE7E1F9dD0193F",
vaa.ChainIDCelo: "000000000000000000000000796Dff6D74F3E27060B71255Fe517BFb23C93eed",
vaa.ChainIDNear: "148410499d3fcda4dcfd68a1ebfcdddda16ab28326448d4aae4d2f0465cdfcb7",
vaa.ChainIDMoonbeam: "000000000000000000000000B1731c586ca89a23809861c6103F0b96B3F57D92",
}

// KnownNFTBridgeEmitters is a list of well-known mainnet emitters for the NFT bridge.
Expand All @@ -129,6 +130,7 @@ var knownNFTBridgeEmitters = map[vaa.ChainID]string{
vaa.ChainIDAcala: "000000000000000000000000b91e3638F82A1fACb28690b37e3aAE45d2c33808",
vaa.ChainIDKlaytn: "0000000000000000000000003c3c561757BAa0b78c5C025CdEAa4ee24C1dFfEf",
vaa.ChainIDCelo: "000000000000000000000000A6A377d75ca5c9052c9a77ED1e865Cc25Bd97bf3",
vaa.ChainIDMoonbeam: "000000000000000000000000453cfBe096C0f8D763E8C5F24B441097d577bdE2",
}

func GetEmitterAddressForChain(chainID vaa.ChainID, emitterType EmitterType) (vaa.Address, error) {
Expand Down
1 change: 1 addition & 0 deletions node/pkg/governor/mainnet_chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ func chainList() []chainConfigEntry {
chainConfigEntry{emitterChainID: vaa.ChainIDCelo, dailyLimit: 5_000_000, bigTransactionSize: 500_000},
chainConfigEntry{emitterChainID: vaa.ChainIDNear, dailyLimit: 200_000, bigTransactionSize: 20_000},
chainConfigEntry{emitterChainID: vaa.ChainIDTerra2, dailyLimit: 500_000, bigTransactionSize: 50_000},
chainConfigEntry{emitterChainID: vaa.ChainIDMoonbeam, dailyLimit: 200_000, bigTransactionSize: 20_000},
}
}
1 change: 1 addition & 0 deletions node/pkg/governor/mainnet_tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ func tokenList() []tokenConfigEntry {
tokenConfigEntry{chain: 14, addr: "000000000000000000000000d8763cba276a3738e6de85b4b3bf5fded6d6ca73", symbol: "cEUR", coinGeckoId: "celo-euro", decimals: 8, price: 1.009}, // Addr: 0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73, Notional: 101465
tokenConfigEntry{chain: 15, addr: "0000000000000000000000000000000000000000000000000000000000000000", symbol: "NEAR", coinGeckoId: "near", decimals: 8, price: 4.330}, // *** manually added
tokenConfigEntry{chain: 15, addr: "67499b7b8f58eaeb3cd81aea1d1ce9f7f722fd7750ceb2bed13e255073c25e2a", symbol: "SWEAT", coinGeckoId: "sweatcoin", decimals: 8, price: 0.007}, // *** manually added
tokenConfigEntry{chain: 16, addr: "000000000000000000000000acc15dc74880c9944775448304b263d191c6077f", symbol: "GLMR", coinGeckoId: "moonbeam", decimals: 8, price: 0.58}, // *** manually added
tokenConfigEntry{chain: 18, addr: "01fa6c6fbc36d8c245b0a852a43eb5d644e8b4c477b27bfab9537c10945939da", symbol: "LUNA", coinGeckoId: "terra-luna-2", decimals: 6, price: 1.99}, // Addr: uluna, Notional: 1182
}
}
2 changes: 1 addition & 1 deletion node/pkg/governor/mainnet_tokens_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestTokenListSize(t *testing.T) {

/* Assuming that governed tokens will need to be updated every time
we regenerate it */
assert.Equal(t, 127, len(tokenConfigEntries))
assert.Equal(t, 128, len(tokenConfigEntries))
}

func TestTokenListFloor(t *testing.T) {
Expand Down

0 comments on commit cda45a8

Please sign in to comment.