From b95aaba699e9a075d45926431d0db1baa69132ac Mon Sep 17 00:00:00 2001 From: Alex <12097569+nialexsan@users.noreply.github.com> Date: Wed, 25 Mar 2026 10:20:14 -0400 Subject: [PATCH 1/2] deployment specs and back compat tests --- .../tests/fork/backcompat_redeploy_test.cdc | 84 +++++++++++++++++++ flow.json | 22 ++++- 2 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 cadence/tests/fork/backcompat_redeploy_test.cdc diff --git a/cadence/tests/fork/backcompat_redeploy_test.cdc b/cadence/tests/fork/backcompat_redeploy_test.cdc new file mode 100644 index 00000000..ad233881 --- /dev/null +++ b/cadence/tests/fork/backcompat_redeploy_test.cdc @@ -0,0 +1,84 @@ +#test_fork(network: "mainnet", height: nil) + +import Test + +access(all) struct ContractSpec { + access(all) let path: String + access(all) let arguments: [AnyStruct] + + init( + path: String, + arguments: [AnyStruct] + ) { + self.path = path + self.arguments = arguments + } +} + +/// Extract contract name from path +/// "../../contracts/FlowALPv0.cdc" -> "FlowALPv0" +access(all) fun contractNameFromPath(path: String): String { + // Split by "/" + let parts = path.split(separator: "/") + let file = parts[parts.length - 1] + + // Remove ".cdc" + let nameParts = file.split(separator: ".") + return nameParts[0] +} + +access(all) fun deployAndExpectSuccess(_ contractSpec: ContractSpec) { + let name = contractNameFromPath(path: contractSpec.path) + + log("Deploying ".concat(name).concat("...")) + + let err = Test.deployContract( + name: name, + path: contractSpec.path, + arguments: contractSpec.arguments + ) + + Test.expect(err, Test.beNil()) + Test.commitBlock() +} + +access(all) fun setup() { + log("==== FlowActions Backward-Compatibility Redeploy Test ====") + + let contractsSpecs: [ContractSpec] = [ + ContractSpec( + path: "../../lib/FlowALPMath.cdc", + arguments: [] + ), + ContractSpec( + path: "../../contracts/MOET.cdc", + arguments: [0.0] + ), + ContractSpec( + path: "../../contracts/FlowALPv0.cdc", + arguments: [] + ), + ContractSpec( + path: "../../contracts/FlowALPRebalancerv1.cdc", + arguments: [] + ), + ContractSpec( + path: "../../contracts/FlowALPRebalancerPaidv1.cdc", + arguments: [] + ), + ContractSpec( + path: "../../contracts/FlowALPSupervisorv1.cdc", + arguments: [] + ) + ] + + for contractSpec in contractsSpecs { + deployAndExpectSuccess(contractSpec) + } + + log("==== All FlowALP contracts redeployed successfully ====") +} + +access(all) fun testAllContractsRedeployedWithoutError() { + log("All FlowALP contracts redeployed without error (verified in setup)") +} diff --git a/flow.json b/flow.json index 7d8baff7..db0b3491 100644 --- a/flow.json +++ b/flow.json @@ -49,30 +49,40 @@ "FlowALPMath": { "source": "./cadence/lib/FlowALPMath.cdc", "aliases": { + "mainnet": "6b00ff876c299c61", + "mainnet-fork": "6b00ff876c299c61", "testing": "0000000000000007" } }, "FlowALPRebalancerPaidv1": { "source": "./cadence/contracts/FlowALPRebalancerPaidv1.cdc", "aliases": { + "mainnet": "6b00ff876c299c61", + "mainnet-fork": "6b00ff876c299c61", "testing": "0000000000000007" } }, "FlowALPRebalancerv1": { "source": "./cadence/contracts/FlowALPRebalancerv1.cdc", "aliases": { + "mainnet": "6b00ff876c299c61", + "mainnet-fork": "6b00ff876c299c61", "testing": "0000000000000007" } }, "FlowALPSupervisorv1": { "source": "./cadence/contracts/FlowALPSupervisorv1.cdc", "aliases": { + "mainnet": "6b00ff876c299c61", + "mainnet-fork": "6b00ff876c299c61", "testing": "0000000000000007" } }, "FlowALPv0": { "source": "./cadence/contracts/FlowALPv0.cdc", "aliases": { + "mainnet": "6b00ff876c299c61", + "mainnet-fork": "6b00ff876c299c61", "testing": "0000000000000007" } }, @@ -89,6 +99,8 @@ "MOET": { "source": "./cadence/contracts/MOET.cdc", "aliases": { + "mainnet": "6b00ff876c299c61", + "mainnet-fork": "6b00ff876c299c61", "testing": "0000000000000007" } }, @@ -364,7 +376,10 @@ } ] }, - "FlowALPv0" + "FlowALPv0", + "FlowALPRebalancerPaidv1", + "FlowALPRebalancerv1", + "FlowALPSupervisorv1" ], "mainnet-fyv-deployer": [ "MockDexSwapper", @@ -383,7 +398,10 @@ } ] }, - "FlowALPv0" + "FlowALPv0", + "FlowALPRebalancerPaidv1", + "FlowALPRebalancerv1", + "FlowALPSupervisorv1" ], "mainnet-fork-fyv-deployer": [ "MockDexSwapper", From 93d06d2743916ba8ad2318d6f5ea463decfbe0fb Mon Sep 17 00:00:00 2001 From: Alex <12097569+nialexsan@users.noreply.github.com> Date: Wed, 25 Mar 2026 13:47:20 -0400 Subject: [PATCH 2/2] testnet deployment --- flow.json | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/flow.json b/flow.json index db0b3491..03a71424 100644 --- a/flow.json +++ b/flow.json @@ -51,7 +51,8 @@ "aliases": { "mainnet": "6b00ff876c299c61", "mainnet-fork": "6b00ff876c299c61", - "testing": "0000000000000007" + "testing": "0000000000000007", + "testnet": "426f0458ced60037" } }, "FlowALPRebalancerPaidv1": { @@ -59,7 +60,8 @@ "aliases": { "mainnet": "6b00ff876c299c61", "mainnet-fork": "6b00ff876c299c61", - "testing": "0000000000000007" + "testing": "0000000000000007", + "testnet": "426f0458ced60037" } }, "FlowALPRebalancerv1": { @@ -67,7 +69,8 @@ "aliases": { "mainnet": "6b00ff876c299c61", "mainnet-fork": "6b00ff876c299c61", - "testing": "0000000000000007" + "testing": "0000000000000007", + "testnet": "426f0458ced60037" } }, "FlowALPSupervisorv1": { @@ -75,7 +78,8 @@ "aliases": { "mainnet": "6b00ff876c299c61", "mainnet-fork": "6b00ff876c299c61", - "testing": "0000000000000007" + "testing": "0000000000000007", + "testnet": "426f0458ced60037" } }, "FlowALPv0": { @@ -83,7 +87,8 @@ "aliases": { "mainnet": "6b00ff876c299c61", "mainnet-fork": "6b00ff876c299c61", - "testing": "0000000000000007" + "testing": "0000000000000007", + "testnet": "426f0458ced60037" } }, "FungibleTokenConnectors": { @@ -420,7 +425,10 @@ } ] }, - "FlowALPv0" + "FlowALPv0", + "FlowALPRebalancerPaidv1", + "FlowALPRebalancerv1", + "FlowALPSupervisorv1" ], "testnet-fyv-deployer": [ "MockDexSwapper",