From 4ae986a7378baa0765a4646467d1abf33ce0699a Mon Sep 17 00:00:00 2001 From: Giovanni Sanchez <108043524+sisyphusSmiling@users.noreply.github.com> Date: Fri, 2 Aug 2024 17:01:20 -0600 Subject: [PATCH 1/2] add emulator support to deployment script --- flow.json | 52 ++++++++++++++++++++++++++++++---------------------- main.go | 2 +- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/flow.json b/flow.json index ba45258e..41af50b0 100644 --- a/flow.json +++ b/flow.json @@ -4,7 +4,7 @@ "source": "./cadence/contracts/utils/ArrayUtils.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -23,7 +23,7 @@ "source": "./cadence/contracts/bridge/interfaces/CrossVMNFT.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -33,7 +33,7 @@ "source": "./cadence/contracts/bridge/interfaces/CrossVMToken.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -71,7 +71,7 @@ "source": "./cadence/contracts/bridge/FlowEVMBridge.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -81,7 +81,7 @@ "source": "./cadence/contracts/bridge/FlowEVMBridgeAccessor.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -91,7 +91,7 @@ "source": "./cadence/contracts/bridge/FlowEVMBridgeConfig.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -101,7 +101,7 @@ "source": "./cadence/contracts/bridge/interfaces/FlowEVMBridgeHandlerInterfaces.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -111,7 +111,7 @@ "source": "./cadence/contracts/bridge/FlowEVMBridgeHandlers.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -121,7 +121,7 @@ "source": "./cadence/contracts/bridge/FlowEVMBridgeNFTEscrow.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -131,7 +131,7 @@ "source": "./cadence/contracts/bridge/FlowEVMBridgeTemplates.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -141,7 +141,7 @@ "source": "./cadence/contracts/bridge/FlowEVMBridgeTokenEscrow.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -151,7 +151,7 @@ "source": "./cadence/contracts/bridge/FlowEVMBridgeUtils.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -204,7 +204,7 @@ "source": "./cadence/contracts/bridge/interfaces/IBridgePermissions.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -214,7 +214,7 @@ "source": "./cadence/contracts/bridge/interfaces/ICrossVM.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -224,7 +224,7 @@ "source": "./cadence/contracts/bridge/interfaces/IEVMBridgeNFTMinter.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -234,7 +234,7 @@ "source": "./cadence/contracts/bridge/interfaces/IEVMBridgeTokenMinter.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -244,7 +244,7 @@ "source": "./cadence/contracts/bridge/interfaces/IFlowEVMNFTBridge.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -254,7 +254,7 @@ "source": "./cadence/contracts/bridge/interfaces/IFlowEVMTokenBridge.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -286,7 +286,7 @@ "source": "./cadence/contracts/utils/ScopedFTProviders.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -296,7 +296,7 @@ "source": "./cadence/contracts/utils/Serialize.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -306,7 +306,7 @@ "source": "./cadence/contracts/utils/SerializeMetadata.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -316,7 +316,7 @@ "source": "./cadence/contracts/utils/StringUtils.cdc", "aliases": { "crescendo": "dfc20aee650fcbdf", - "emulator": "179b6b1cb6755e31", + "emulator": "f8d6e0586b0a20c7", "previewnet": "7792cfb75d8dfdd8", "testing": "0000000000000007", "testnet": "dfc20aee650fcbdf" @@ -367,10 +367,18 @@ "address": "f8d6e0586b0a20c7", "key": "fe809cc837ddcd7e761a482721c050aae43657448db859f4eb8fc421e9609938" }, + "emulator-service-account": { + "address": "f8d6e0586b0a20c7", + "key": "fe809cc837ddcd7e761a482721c050aae43657448db859f4eb8fc421e9609938" + }, "emulator-flow": { "address": "0ae53cb6e3f42a79", "key": "c1e4c9d9dca9e4d5e9b0b5a9a8e8b9c5d6f4a8b9c5d6f4a8b9c5d6f4a8b9c5d6" }, + "emulator-flow-evm-bridge": { + "address": "f8d6e0586b0a20c7", + "key": "fe809cc837ddcd7e761a482721c050aae43657448db859f4eb8fc421e9609938" + }, "previewnet-flow-evm-bridge": { "address": "7792cfb75d8dfdd8", "key": { diff --git a/main.go b/main.go index 2687c0eb..4f87317d 100644 --- a/main.go +++ b/main.go @@ -24,7 +24,7 @@ import ( // Overflow prefixes signer names with the current network - e.g. "crescendo-flow-evm-bridge" // Ensure accounts in flow.json are named accordingly -var networks = []string{"previewnet", "crescendo", "testnet", "mainnet"} +var networks = []string{"crescendo", "emulator", "mainnet", "previewnet", "testnet"} // Pulled from flow.json deployments. Specified here as some contracts have init arg values that // are emitted in transaction events and cannot be hardcoded in the deployment config section From 04b9d86d824cd4738ff766c9ffc36b849c110271 Mon Sep 17 00:00:00 2001 From: Giovanni Sanchez <108043524+sisyphusSmiling@users.noreply.github.com> Date: Fri, 2 Aug 2024 17:26:13 -0600 Subject: [PATCH 2/2] add emulator init instructions to README --- README.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/README.md b/README.md index bbafb90b..03ce24a4 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,54 @@ execute** - the value of `allowsBridging()` is irrelevant and assets can move be For an in-depth look at the high-level architecture of the bridge, see [FLIP #237](https://github.com/onflow/flips/blob/main/application/20231222-evm-vm-bridge.md) +## Local Development + +The contracts in this repo are not yet included in the Flow emulator. For local development against the bridge, follow +the steps below to stand up a local Flow emulator instance and deploy the bridge contracts: + +### Prerequisites + +- Install Flow CLI on your machine. For instructions, see the [Flow CLI documentation](https://developers.flow.com/tools/flow-cli/install). +- Download and install Go. For instructions, see the [Go documentation](https://go.dev/doc/install). + +Ensure both are installed with: + +```sh +flow-c1 version +``` + +and go with: + +```sh +go version +``` + +### Start your local emulator + +Start the Flow emulator with the following command: + +```sh +flow-c1 emulator +``` + +### Run the deployment script + +In a separate terminal window, run the deployment script to deploy the bridge contracts to your local emulator: + +```sh +go run main.go +``` + +If all is successful, you should see a long flow of event and transaction logs in your terminal with a final line resulting in: + +```sh +SETUP COMPLETE! Bridge is now unpaused and ready for use. +``` + +### Interact with the bridge + +You're now ready to interact with the bridge! + ### Additional Resources For the current state of Flow EVM across various task paths, see the following resources: