diff --git a/README.md b/README.md index 03ce24a4..c1560643 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,10 @@ addresses: |Contracts|PreviewNet|Testnet|Mainnet| |---|---|---|---| |All Cadence Bridge contracts|`0x7792cfb75d8dfdd8`|`0xdfc20aee650fcbdf`|TBD| -|[`FlowEVMBridgeFactory.sol`](./solidity/src/FlowBridgeFactory.sol)|`0xb0885c08995a053d8dcadce1c66b2fb11e40b868`|TBD|TBD| -|[`FlowEVMBridgeDeploymentRegistry.sol`](./solidity/src/FlowEVMBridgeDeploymentRegistry.sol)|`0xfadbc0c156f6679d1ac9eb271d4e55dce7de8802`|TBD|TBD| -|[`FlowEVMBridgedERC20Deployer.sol`](./solidity/src/FlowEVMBridgedERC20Deployer.sol)|`0x9d5fe779e35d1f13abd875dd6c2b49f20e813054`|TBD|TBD| -|[`FlowEVMBridgedERC721Deployer.sol`](./solidity/src/FlowEVMBridgedERC721Deployer.sol)|`0x211f54ca1e325a3946ed67aeefcc6cc32b1e833d`|TBD|TBD| +|[`FlowEVMBridgeFactory.sol`](./solidity/src/FlowBridgeFactory.sol)|`0xb0885c08995a053d8dcadce1c66b2fb11e40b868`|`0xf8146b4aef631853f0eb98dbe28706d029e52c52`|TBD| +|[`FlowEVMBridgeDeploymentRegistry.sol`](./solidity/src/FlowEVMBridgeDeploymentRegistry.sol)|`0xfadbc0c156f6679d1ac9eb271d4e55dce7de8802`|`0x8781d15904d7e161f421400571dea24cc0db6938`|TBD| +|[`FlowEVMBridgedERC20Deployer.sol`](./solidity/src/FlowEVMBridgedERC20Deployer.sol)|`0x9d5fe779e35d1f13abd875dd6c2b49f20e813054`|`0x716c4ffae66e1105afd550a3f23775f010f2df7e`|TBD| +|[`FlowEVMBridgedERC721Deployer.sol`](./solidity/src/FlowEVMBridgedERC721Deployer.sol)|`0x211f54ca1e325a3946ed67aeefcc6cc32b1e833d`|`0xcfda0226e323cc250d21744512eb353f6024bfb2`|TBD| ## Interacting with the bridge diff --git a/cadence/scripts/utils/get_registry_address.cdc b/cadence/scripts/utils/get_registry_address.cdc new file mode 100644 index 00000000..687d0906 --- /dev/null +++ b/cadence/scripts/utils/get_registry_address.cdc @@ -0,0 +1,29 @@ +import "EVM" + +import "FlowEVMBridgeConfig" +import "FlowEVMBridgeUtils" + +access(all) +fun main(coaHost: Address): String { + let coa = getAuthAccount(coaHost) + .storage + .borrow(from: /storage/evm) + ?? panic("Could not borrow CadenceOwnedAccount from host=".concat(coaHost.toString())) + let res = coa.call( + to: FlowEVMBridgeUtils.getBridgeFactoryEVMAddress(), + data: EVM.encodeABIWithSignature("getRegistry()", []), + gasLimit: FlowEVMBridgeConfig.gasLimit, + value: EVM.Balance(attoflow: UInt(0)) + ) + + assert( + res.status == EVM.Status.successful, + message: "getRegistry call to FlowEVMBridgeFactory failed" + ) + + let decodedRes = EVM.decodeABI(types: [Type()], data: res.data) + + assert(decodedRes.length == 1, message: "Invalid response length") + + return (decodedRes[0] as! EVM.EVMAddress).toString() +} diff --git a/cadence/tests/scripts/create_empty_usdc_vault.cdc b/cadence/tests/scripts/create_empty_usdc_vault.cdc new file mode 100644 index 00000000..ff8a9f81 --- /dev/null +++ b/cadence/tests/scripts/create_empty_usdc_vault.cdc @@ -0,0 +1,8 @@ +import "USDCFlow" + +access(all) +fun main() { + let v <- USDCFlow.createEmptyVault(vaultType: Type<@USDCFlow.Vault>()) + log("Vault creation successful") + destroy v +} diff --git a/flow.json b/flow.json index 9350a296..79fe467c 100644 --- a/flow.json +++ b/flow.json @@ -15,8 +15,10 @@ "aliases": { "crescendo": "9a0766d93b6608b7", "emulator": "f8d6e0586b0a20c7", + "mainnet": "f233dcee88fe0abe", "previewnet": "b6763b4399a888c8", - "testing": "0000000000000001" + "testing": "0000000000000001", + "testnet": "9a0766d93b6608b7" } }, "CrossVMNFT": { @@ -44,8 +46,8 @@ "aliases": { "crescendo": "8c5303eaa26202d6", "emulator": "f8d6e0586b0a20c7", + "mainnet": "e467b9dd11fa00df", "previewnet": "b6763b4399a888c8", - "mainnet": "0xe467b9dd11fa00df", "testnet": "8c5303eaa26202d6" } }, @@ -325,10 +327,10 @@ "USDCFlow": { "source": "./cadence/contracts/handled-tokens/USDCFlow.cdc", "aliases": { - "crescendo": "4516677f8083d680", + "crescendo": "64adf39cbc354fcb", "emulator": "f8d6e0586b0a20c7", "testing": "0000000000000007", - "testnet": "4516677f8083d680" + "testnet": "64adf39cbc354fcb" } }, "ViewResolver": { @@ -356,8 +358,7 @@ "address": "dfc20aee650fcbdf", "key": { "type": "file", - "location": "./crescendo-flow-evm-bridge.pkey", - "index": 1 + "location": "./crescendo-flow-evm-bridge.pkey" } }, "crescendo-service-account": { @@ -366,18 +367,13 @@ "type": "file", "signatureAlgorithm": "ECDSA_secp256k1", "hashAlgorithm": "SHA2_256", - "location": "./crescendo-service-account.pkey", - "index": 2 + "location": "./crescendo-service-account.pkey" } }, "emulator-account": { "address": "f8d6e0586b0a20c7", "key": "fe809cc837ddcd7e761a482721c050aae43657448db859f4eb8fc421e9609938" }, - "emulator-service-account": { - "address": "f8d6e0586b0a20c7", - "key": "fe809cc837ddcd7e761a482721c050aae43657448db859f4eb8fc421e9609938" - }, "emulator-flow": { "address": "0ae53cb6e3f42a79", "key": "c1e4c9d9dca9e4d5e9b0b5a9a8e8b9c5d6f4a8b9c5d6f4a8b9c5d6f4a8b9c5d6" @@ -386,15 +382,9 @@ "address": "f8d6e0586b0a20c7", "key": "fe809cc837ddcd7e761a482721c050aae43657448db859f4eb8fc421e9609938" }, - "previewnet-service-account": { - "address": "b6763b4399a888c8", - "key": { - "type": "file", - "signatureAlgorithm": "ECDSA_secp256k1", - "hashAlgorithm": "SHA2_256", - "location": "./previewnet-service-account.pkey", - "index": 0 - } + "emulator-service-account": { + "address": "f8d6e0586b0a20c7", + "key": "fe809cc837ddcd7e761a482721c050aae43657448db859f4eb8fc421e9609938" }, "previewnet-flow-evm-bridge": { "address": "7792cfb75d8dfdd8", @@ -404,6 +394,15 @@ "resourceID": "projects/dl-flow-admin/locations/global/keyRings/flow-vm-bridge/cryptoKeys/flow-fvm-evm-bridge-previewnet/cryptoKeyVersions/1" } }, + "previewnet-service-account": { + "address": "b6763b4399a888c8", + "key": { + "type": "file", + "signatureAlgorithm": "ECDSA_secp256k1", + "hashAlgorithm": "SHA2_256", + "location": "./previewnet-service-account.pkey" + } + }, "testnet-flow-evm-bridge": { "address": "dfc20aee650fcbdf", "key": { @@ -418,8 +417,7 @@ "type": "file", "signatureAlgorithm": "ECDSA_secp256k1", "hashAlgorithm": "SHA2_256", - "location": "./testnet-service-account.pkey", - "index": 2 + "location": "./testnet-service-account.pkey" } } }, @@ -466,8 +464,8 @@ "name": "FlowEVMBridgeUtils", "args": [ { - "type": "String", - "value": "f23c8619603434f7f71659820193c8e491feb1d9" + "value": "f23c8619603434f7f71659820193c8e491feb1d9", + "type": "String" } ] }, diff --git a/main.go b/main.go index aa58e65f..f179b6d2 100644 --- a/main.go +++ b/main.go @@ -341,7 +341,7 @@ func main() { dir, "cadence/args/bridged-token-code-chunks-args-"+network+".json", ) - nftChunkPath := filepath.Join(dir, "cadence/args/bridged-token-code-chunks-args-"+network+".json") + nftChunkPath := filepath.Join(dir, "cadence/args/bridged-nft-code-chunks-args-"+network+".json") tokenChunks := getCodeChunksFromArgsJSON(tokenChunkPath) nftChunks := getCodeChunksFromArgsJSON(nftChunkPath) tokenChunkUpsert := o.Tx("bridge/admin/templates/upsert_contract_code_chunks",