Skip to content

Commit

Permalink
Merge pull request #120 from onflow/post-crescendo-updates
Browse files Browse the repository at this point in the history
Post-Crescendo updates
  • Loading branch information
sisyphusSmiling authored Sep 10, 2024
2 parents 7d4a2ff + 66629f2 commit 8c83149
Show file tree
Hide file tree
Showing 22 changed files with 226 additions and 3,084 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/cadence_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ jobs:
- name: Install Flow CLI
run: sh -ci "$(curl -fsSL https://raw.githubusercontent.com/onflow/flow-cli/master/install.sh)"
- name: Flow CLI Version
run: flow-c1 version
run: flow version
- name: Update PATH
run: echo "/root/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: flow deps install
- name: Run tests
run: sh local/run_cadence_tests.sh
- name: Upload coverage reports to Codecov
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ local.flow.json

# Local
.DS_Store
.vscode/
.vscode/
imports/
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,26 @@

# Flow EVM Bridge

This repo contains contracts enabling bridging of fungible & non-fungible tokens between Cadence and EVM.
This repo contains contracts enabling bridging of fungible & non-fungible tokens between Cadence and EVM on Flow.

## Deployments

PreviewNet is currently the only EVM-enabled network on Flow. The bridge in this repo are deployed to the following
addresses:
The bridge contracts in this repo are deployed to the following addresses:

|Contracts|Testnet|Mainnet|
|---|---|---|
|All Cadence Bridge contracts|[`0xdfc20aee650fcbdf`](https://contractbrowser.com/account/0xdfc20aee650fcbdf/contracts)|[`0x1e4aa0b87d10b141`](https://contractbrowser.com/account/0x1e4aa0b87d10b141/contracts)|
|[`FlowEVMBridgeFactory.sol`](./solidity/src/FlowBridgeFactory.sol)|`0xf8146b4aef631853f0eb98dbe28706d029e52c52`|TBD|
|[`FlowEVMBridgeDeploymentRegistry.sol`](./solidity/src/FlowEVMBridgeDeploymentRegistry.sol)|`0x8781d15904d7e161f421400571dea24cc0db6938`|TBD|
|[`FlowEVMBridgedERC20Deployer.sol`](./solidity/src/FlowEVMBridgedERC20Deployer.sol)|`0x716c4ffae66e1105afd550a3f23775f010f2df7e`|TBD|
|[`FlowEVMBridgedERC721Deployer.sol`](./solidity/src/FlowEVMBridgedERC721Deployer.sol)|`0xcfda0226e323cc250d21744512eb353f6024bfb2`|TBD|
|[`FlowEVMBridgeFactory.sol`](./solidity/src/FlowBridgeFactory.sol)|[`0xf8146b4aef631853f0eb98dbe28706d029e52c52`](https://evm-testnet.flowscan.io/address/0xF8146B4aEF631853F0eB98DBE28706d029e52c52)|[`0x1c6dea788ee774cf15bcd3d7a07ede892ef0be40`](https://evm.flowscan.io/address/0x1C6dEa788Ee774CF15bCd3d7A07ede892ef0bE40)|
|[`FlowEVMBridgeDeploymentRegistry.sol`](./solidity/src/FlowEVMBridgeDeploymentRegistry.sol)|[`0x8781d15904d7e161f421400571dea24cc0db6938`](https://evm-testnet.flowscan.io/address/0x8781d15904d7e161f421400571dea24cc0db6938)|[`0x8fdec2058535a2cb25c2f8cec65e8e0d0691f7b0`](https://evm.flowscan.io/address/0x8FDEc2058535A2Cb25C2f8ceC65e8e0D0691f7B0)|
|[`FlowEVMBridgedERC20Deployer.sol`](./solidity/src/FlowEVMBridgedERC20Deployer.sol)|[`0x4d45CaD104A71D19991DE3489ddC5C7B284cf263`](https://evm-testnet.flowscan.io/address/0x4d45CaD104A71D19991DE3489ddC5C7B284cf263)|[`0x49631Eac7e67c417D036a4d114AD9359c93491e7`](https://evm.flowscan.io/address/0x49631Eac7e67c417D036a4d114AD9359c93491e7)|
|[`FlowEVMBridgedERC721Deployer.sol`](./solidity/src/FlowEVMBridgedERC721Deployer.sol)|[`0x1B852d242F9c4C4E9Bb91115276f659D1D1f7c56`](https://evm-testnet.flowscan.io/address/0x1B852d242F9c4C4E9Bb91115276f659D1D1f7c56)|[`0xe7c2B80a9de81340AE375B3a53940E9aeEAd79Df`](https://evm.flowscan.io/address/0xe7c2B80a9de81340AE375B3a53940E9aeEAd79Df)|

And below are the bridge escrow's EVM addresses. These addresses are [`CadenceOwnedAccount`s (COA)](https://developers.flow.com/evm/cadence/interacting-with-coa#coa-interface) and they are stored stored in the same Flow account as you'll find the Cadence contracts (see above).

|Network|Address|
|---|---|
|Testnet|[`0x0000000000000000000000023f946ffbc8829bfd`](https://evm-testnet.flowscan.io/address/0x0000000000000000000000023f946FFbc8829BFD)|
|Mainnet|[`0x00000000000000000000000249250a5c27ecab3b`](https://evm.flowscan.io/address/0x00000000000000000000000249250a5C27Ecab3B)|

## Interacting with the bridge

Expand Down Expand Up @@ -197,7 +203,7 @@ the steps below to stand up a local Flow emulator instance and deploy the bridge
Ensure both are installed with:

```sh
flow-c1 version
flow version
```

and go with:
Expand All @@ -211,7 +217,7 @@ go version
Start the Flow emulator with the following command:

```sh
flow-c1 emulator
flow emulator
```

### Run the deployment script
Expand Down
2 changes: 1 addition & 1 deletion cadence/args/bridged-token-code-chunks-args-emulator.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"value": [
{
"type": "String",
"value": "696d706f7274204e6f6e46756e6769626c65546f6b656e2066726f6d203078663864366530353836623061323063370a696d706f7274204d6574616461746156696577732066726f6d203078663864366530353836623061323063370a696d706f72742046756e6769626c65546f6b656e4d6574616461746156696577732066726f6d203078663864366530353836623061323063370a696d706f727420566965775265736f6c7665722066726f6d203078663864366530353836623061323063370a696d706f72742046756e6769626c65546f6b656e2066726f6d203078656538323835366266323065326161360a696d706f727420466c6f77546f6b656e2066726f6d203078306165353363623665336634326137390a0a696d706f72742045564d2066726f6d203078663864366530353836623061323063370a0a696d706f7274204943726f7373564d2066726f6d203078663864366530353836623061323063370a696d706f7274204943726f7373564d41737365742066726f6d203078663864366530353836623061323063370a696d706f7274204945564d427269646765546f6b656e4d696e7465722066726f6d203078663864366530353836623061323063370a696d706f727420466c6f7745564d427269646765546f6b656e457363726f772066726f6d203078663864366530353836623061323063370a696d706f727420466c6f7745564d427269646765436f6e6669672066726f6d203078663864366530353836623061323063370a696d706f727420466c6f7745564d4272696467655574696c732066726f6d203078663864366530353836623061323063370a696d706f727420466c6f7745564d4272696467652066726f6d203078663864366530353836623061323063370a696d706f72742043726f7373564d546f6b656e2066726f6d203078663864366530353836623061323063370a696d706f727420466c6f7745564d4272696467655265736f6c7665722066726f6d203078663864366530353836623061323063370a0a2f2f2f205468697320636f6e747261637420697320612074656d706c617465207573656420627920466c6f7745564d42726964676520746f20646566696e652045564d2d6e61746976652066756e6769626c6520746f6b656e7320627269646765642066726f6d20466c6f772045564d20746f200a2f2f2f20436164656e63652e2055706f6e206465706c6f796d656e74206f66207468697320636f6e74726163742c2074686520636f6e7472616374206e616d65206973206465726976656420617320612066756e6374696f6e206f6620746865206173736574207479706520286865726520616e200a2f2f2f2045524332302920616e642074686520636f6e747261637427732045564d20616464726573732e20546865206465726976656420636f6e7472616374206e616d65206973207468656e206a6f696e65642077697468207468697320636f6e7472616374277320636f64652c0a2f2f2f207072657061726564206173206368756e6b7320696e20466c6f7745564d42726964676554656d706c61746573206265666f7265206265696e67206465706c6f79656420746f2074686520466c6f772045564d20427269646765206163636f756e742e0a2f2f2f0a2f2f2f204f6e206272696467696e672c20746865204552433230206973207472616e7366657272656420746f2074686520627269646765277320436164656e63654f776e65644163636f756e742045564d206164647265737320616e6420746f6b656e7320617265206d696e7465642066726f6d0a2f2f2f207468697320636f6e747261637420746f20746865206272696467696e672063616c6c65722e204f6e2072657475726e20746f20466c6f772045564d2c2074686520726576657273652070726f6365737320697320666f6c6c6f776564202d2074686520746f6b656e206973206275726e65640a2f2f2f20696e207468697320636f6e747261637420616e6420746865204552433230206973207472616e7366657272656420746f2074686520646566696e656420726563697069656e742e20496e2074686973207761792c2074686520436164656e6365205661756c74206163747320617320610a2f2f2f20726570726573656e746174696f6e206f6620626f7468207468652045564d20746f6b656e7320616e642074687573206f776e6572736869702072696768747320746f2069742075706f6e206272696467696e67206261636b20746f20466c6f772045564d2e0a2f2f2f0a2f2f2f20546f20627269646765206265747765656e20564d732c20612063616c6c65722063616e20656974686572207573652074686520696e74657266616365206578706f736564206f6e20436164656e63654f776e65644163636f756e74206f722075736520466c6f7745564d4272696467650a2f2f2f207075626c696320636f6e7472616374206d6574686f64732e0a2f2f2f0a61636365737328616c6c2920636f6e747261637420"
"value": "696d706f7274204e6f6e46756e6769626c65546f6b656e2066726f6d203078663864366530353836623061323063370a696d706f7274204d6574616461746156696577732066726f6d203078663864366530353836623061323063370a696d706f72742046756e6769626c65546f6b656e4d6574616461746156696577732066726f6d203078656538323835366266323065326161360a696d706f727420566965775265736f6c7665722066726f6d203078663864366530353836623061323063370a696d706f72742046756e6769626c65546f6b656e2066726f6d203078656538323835366266323065326161360a696d706f727420466c6f77546f6b656e2066726f6d203078306165353363623665336634326137390a0a696d706f72742045564d2066726f6d203078663864366530353836623061323063370a0a696d706f7274204943726f7373564d2066726f6d203078663864366530353836623061323063370a696d706f7274204943726f7373564d41737365742066726f6d203078663864366530353836623061323063370a696d706f7274204945564d427269646765546f6b656e4d696e7465722066726f6d203078663864366530353836623061323063370a696d706f727420466c6f7745564d427269646765546f6b656e457363726f772066726f6d203078663864366530353836623061323063370a696d706f727420466c6f7745564d427269646765436f6e6669672066726f6d203078663864366530353836623061323063370a696d706f727420466c6f7745564d4272696467655574696c732066726f6d203078663864366530353836623061323063370a696d706f727420466c6f7745564d4272696467652066726f6d203078663864366530353836623061323063370a696d706f72742043726f7373564d546f6b656e2066726f6d203078663864366530353836623061323063370a696d706f727420466c6f7745564d4272696467655265736f6c7665722066726f6d203078663864366530353836623061323063370a0a2f2f2f205468697320636f6e747261637420697320612074656d706c617465207573656420627920466c6f7745564d42726964676520746f20646566696e652045564d2d6e61746976652066756e6769626c6520746f6b656e7320627269646765642066726f6d20466c6f772045564d20746f200a2f2f2f20436164656e63652e2055706f6e206465706c6f796d656e74206f66207468697320636f6e74726163742c2074686520636f6e7472616374206e616d65206973206465726976656420617320612066756e6374696f6e206f6620746865206173736574207479706520286865726520616e200a2f2f2f2045524332302920616e642074686520636f6e747261637427732045564d20616464726573732e20546865206465726976656420636f6e7472616374206e616d65206973207468656e206a6f696e65642077697468207468697320636f6e7472616374277320636f64652c0a2f2f2f207072657061726564206173206368756e6b7320696e20466c6f7745564d42726964676554656d706c61746573206265666f7265206265696e67206465706c6f79656420746f2074686520466c6f772045564d20427269646765206163636f756e742e0a2f2f2f0a2f2f2f204f6e206272696467696e672c20746865204552433230206973207472616e7366657272656420746f2074686520627269646765277320436164656e63654f776e65644163636f756e742045564d206164647265737320616e6420746f6b656e7320617265206d696e7465642066726f6d0a2f2f2f207468697320636f6e747261637420746f20746865206272696467696e672063616c6c65722e204f6e2072657475726e20746f20466c6f772045564d2c2074686520726576657273652070726f6365737320697320666f6c6c6f776564202d2074686520746f6b656e206973206275726e65640a2f2f2f20696e207468697320636f6e747261637420616e6420746865204552433230206973207472616e7366657272656420746f2074686520646566696e656420726563697069656e742e20496e2074686973207761792c2074686520436164656e6365205661756c74206163747320617320610a2f2f2f20726570726573656e746174696f6e206f6620626f7468207468652045564d20746f6b656e7320616e642074687573206f776e6572736869702072696768747320746f2069742075706f6e206272696467696e67206261636b20746f20466c6f772045564d2e0a2f2f2f0a2f2f2f20546f20627269646765206265747765656e20564d732c20612063616c6c65722063616e20656974686572207573652074686520696e74657266616365206578706f736564206f6e20436164656e63654f776e65644163636f756e74206f722075736520466c6f7745564d4272696467650a2f2f2f207075626c696320636f6e7472616374206d6574686f64732e0a2f2f2f0a61636365737328616c6c2920636f6e747261637420"
},
{
"type": "String",
Expand Down
2 changes: 1 addition & 1 deletion cadence/args/set-bridged-ft-display-view-args-mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"type": "String",
"value": "A.631e88ae7f1d7c20.MetadataViews.HTTPFile"
"value": "A.1d7e57aa55817448.MetadataViews.HTTPFile"
},
{
"type": "Optional",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
{
"type": "String",
"value": "A.1d7e57aa55817448.MetadataViews.HTTPFile"
"value": "A.631e88ae7f1d7c20.MetadataViews.HTTPFile"
},
{
"type": "Optional",
Expand Down
5 changes: 4 additions & 1 deletion cadence/contracts/bridge/interfaces/IFlowEVMNFTBridge.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ access(all) contract interface IFlowEVMNFTBridge {
evmID: CrossVMNFT.getEVMID(from: &token as &{NonFungibleToken.NFT}) ?? UInt256(token.id),
to: to.toString(),
evmContractAddress: self.getAssociatedEVMAddress(with: token.getType())?.toString()
?? panic("Could not find EVM Contract address associated with provided NFT"),
?? panic(
"Could not find EVM Contract address associated with provided NFT identifier="
.concat(token.getType().identifier)
),
bridgeAddress: self.account.address
)
}
Expand Down
5 changes: 4 additions & 1 deletion cadence/contracts/bridge/interfaces/IFlowEVMTokenBridge.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ access(all) contract interface IFlowEVMTokenBridge {
bridgedUUID: vault.uuid,
to: to.toString(),
evmContractAddress: self.getAssociatedEVMAddress(with: vault.getType())?.toString()
?? panic("Could not find EVM Contract address associated with provided NFT"),
?? panic(
"Could not find EVM Contract address associated with provided Token identifier="
.concat(vault.getType().identifier)
),
bridgeAddress: self.account.address
)
}
Expand Down
44 changes: 0 additions & 44 deletions cadence/contracts/standards/Burner.cdc

This file was deleted.

Loading

0 comments on commit 8c83149

Please sign in to comment.