Skip to content

Commit e6935f6

Browse files
authored
Merge branch 'v0' into jord/v0-disabled-moet-ops
2 parents b983ea5 + dc344ca commit e6935f6

2 files changed

Lines changed: 118 additions & 8 deletions

File tree

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#test_fork(network: "mainnet", height: nil)
2+
3+
import Test
4+
5+
access(all) struct ContractSpec {
6+
access(all) let path: String
7+
access(all) let arguments: [AnyStruct]
8+
9+
init(
10+
path: String,
11+
arguments: [AnyStruct]
12+
) {
13+
self.path = path
14+
self.arguments = arguments
15+
}
16+
}
17+
18+
/// Extract contract name from path
19+
/// "../../contracts/FlowALPv0.cdc" -> "FlowALPv0"
20+
access(all) fun contractNameFromPath(path: String): String {
21+
// Split by "/"
22+
let parts = path.split(separator: "/")
23+
let file = parts[parts.length - 1]
24+
25+
// Remove ".cdc"
26+
let nameParts = file.split(separator: ".")
27+
return nameParts[0]
28+
}
29+
30+
access(all) fun deployAndExpectSuccess(_ contractSpec: ContractSpec) {
31+
let name = contractNameFromPath(path: contractSpec.path)
32+
33+
log("Deploying ".concat(name).concat("..."))
34+
35+
let err = Test.deployContract(
36+
name: name,
37+
path: contractSpec.path,
38+
arguments: contractSpec.arguments
39+
)
40+
41+
Test.expect(err, Test.beNil())
42+
Test.commitBlock()
43+
}
44+
45+
access(all) fun setup() {
46+
log("==== FlowActions Backward-Compatibility Redeploy Test ====")
47+
48+
let contractsSpecs: [ContractSpec] = [
49+
ContractSpec(
50+
path: "../../lib/FlowALPMath.cdc",
51+
arguments: []
52+
),
53+
ContractSpec(
54+
path: "../../contracts/MOET.cdc",
55+
arguments: [0.0]
56+
),
57+
ContractSpec(
58+
path: "../../contracts/FlowALPv0.cdc",
59+
arguments: []
60+
),
61+
ContractSpec(
62+
path: "../../contracts/FlowALPRebalancerv1.cdc",
63+
arguments: []
64+
),
65+
ContractSpec(
66+
path: "../../contracts/FlowALPRebalancerPaidv1.cdc",
67+
arguments: []
68+
),
69+
ContractSpec(
70+
path: "../../contracts/FlowALPSupervisorv1.cdc",
71+
arguments: []
72+
)
73+
]
74+
75+
for contractSpec in contractsSpecs {
76+
deployAndExpectSuccess(contractSpec)
77+
}
78+
79+
log("==== All FlowALP contracts redeployed successfully ====")
80+
}
81+
82+
access(all) fun testAllContractsRedeployedWithoutError() {
83+
log("All FlowALP contracts redeployed without error (verified in setup)")
84+
}

flow.json

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,31 +49,46 @@
4949
"FlowALPMath": {
5050
"source": "./cadence/lib/FlowALPMath.cdc",
5151
"aliases": {
52-
"testing": "0000000000000007"
52+
"mainnet": "6b00ff876c299c61",
53+
"mainnet-fork": "6b00ff876c299c61",
54+
"testing": "0000000000000007",
55+
"testnet": "426f0458ced60037"
5356
}
5457
},
5558
"FlowALPRebalancerPaidv1": {
5659
"source": "./cadence/contracts/FlowALPRebalancerPaidv1.cdc",
5760
"aliases": {
58-
"testing": "0000000000000007"
61+
"mainnet": "6b00ff876c299c61",
62+
"mainnet-fork": "6b00ff876c299c61",
63+
"testing": "0000000000000007",
64+
"testnet": "426f0458ced60037"
5965
}
6066
},
6167
"FlowALPRebalancerv1": {
6268
"source": "./cadence/contracts/FlowALPRebalancerv1.cdc",
6369
"aliases": {
64-
"testing": "0000000000000007"
70+
"mainnet": "6b00ff876c299c61",
71+
"mainnet-fork": "6b00ff876c299c61",
72+
"testing": "0000000000000007",
73+
"testnet": "426f0458ced60037"
6574
}
6675
},
6776
"FlowALPSupervisorv1": {
6877
"source": "./cadence/contracts/FlowALPSupervisorv1.cdc",
6978
"aliases": {
70-
"testing": "0000000000000007"
79+
"mainnet": "6b00ff876c299c61",
80+
"mainnet-fork": "6b00ff876c299c61",
81+
"testing": "0000000000000007",
82+
"testnet": "426f0458ced60037"
7183
}
7284
},
7385
"FlowALPv0": {
7486
"source": "./cadence/contracts/FlowALPv0.cdc",
7587
"aliases": {
76-
"testing": "0000000000000007"
88+
"mainnet": "6b00ff876c299c61",
89+
"mainnet-fork": "6b00ff876c299c61",
90+
"testing": "0000000000000007",
91+
"testnet": "426f0458ced60037"
7792
}
7893
},
7994
"FungibleTokenConnectors": {
@@ -89,6 +104,8 @@
89104
"MOET": {
90105
"source": "./cadence/contracts/MOET.cdc",
91106
"aliases": {
107+
"mainnet": "6b00ff876c299c61",
108+
"mainnet-fork": "6b00ff876c299c61",
92109
"testing": "0000000000000007"
93110
}
94111
},
@@ -364,7 +381,10 @@
364381
}
365382
]
366383
},
367-
"FlowALPv0"
384+
"FlowALPv0",
385+
"FlowALPRebalancerPaidv1",
386+
"FlowALPRebalancerv1",
387+
"FlowALPSupervisorv1"
368388
],
369389
"mainnet-fyv-deployer": [
370390
"MockDexSwapper",
@@ -383,7 +403,10 @@
383403
}
384404
]
385405
},
386-
"FlowALPv0"
406+
"FlowALPv0",
407+
"FlowALPRebalancerPaidv1",
408+
"FlowALPRebalancerv1",
409+
"FlowALPSupervisorv1"
387410
],
388411
"mainnet-fork-fyv-deployer": [
389412
"MockDexSwapper",
@@ -402,7 +425,10 @@
402425
}
403426
]
404427
},
405-
"FlowALPv0"
428+
"FlowALPv0",
429+
"FlowALPRebalancerPaidv1",
430+
"FlowALPRebalancerv1",
431+
"FlowALPSupervisorv1"
406432
],
407433
"testnet-fyv-deployer": [
408434
"MockDexSwapper",

0 commit comments

Comments
 (0)