Skip to content

Commit 2172b5f

Browse files
committed
feat: replace old facets with new ones
1 parent 722eec7 commit 2172b5f

File tree

4 files changed

+209
-21
lines changed

4 files changed

+209
-21
lines changed

simulations/vip-xxx/bscmainnet.ts

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,21 @@ forking(52815412, async () => {
8282
it("market facet function selectors should be updated for new facet address", async () => {
8383
const newMarketFacetFunctionSelectors = ["0x3d98a1e5", "0xcab4f84c"];
8484

85-
expect(await unitroller.facetFunctionSelectors(NEW_MARKET_FACET)).to.deep.equal(newMarketFacetFunctionSelectors);
86-
expect(await unitroller.facetFunctionSelectors(OLD_MARKET_FACET)).to.deep.equal(marketFacetFunctionSelectors);
85+
const expectSelectors = [...marketFacetFunctionSelectors, ...newMarketFacetFunctionSelectors].sort();
86+
const updatedSelectors = [...(await unitroller.facetFunctionSelectors(NEW_MARKET_FACET))].sort();
87+
88+
expect(updatedSelectors).to.deep.equal(expectSelectors);
89+
expect(await unitroller.facetFunctionSelectors(OLD_MARKET_FACET)).to.deep.equal([]);
8790
});
8891

8992
it("policy facet function selectors should be updated for new facet address", async () => {
9093
const newPolicyFacetFunctionSelectors = ["0x528a174c"];
9194

92-
expect(await unitroller.facetFunctionSelectors(NEW_POLICY_FACET)).to.deep.equal(newPolicyFacetFunctionSelectors);
93-
expect(await unitroller.facetFunctionSelectors(OLD_POLICY_FACET)).to.deep.equal(policyFacetFunctionSelectors);
95+
const expectSelectors = [...policyFacetFunctionSelectors, ...newPolicyFacetFunctionSelectors].sort();
96+
const updatedSelectors = [...(await unitroller.facetFunctionSelectors(NEW_POLICY_FACET))].sort();
97+
98+
expect(updatedSelectors).to.deep.equal(expectSelectors);
99+
expect(await unitroller.facetFunctionSelectors(OLD_POLICY_FACET)).to.deep.equal([]);
94100
});
95101

96102
it("setter facet function selectors should be updated for new facet address", async () => {
@@ -106,8 +112,11 @@ forking(52815412, async () => {
106112
"0x530e784f",
107113
];
108114

109-
expect(await unitroller.facetFunctionSelectors(NEW_SETTER_FACET)).to.deep.equal(newSetterFacetFunctionSelectors);
110-
expect(await unitroller.facetFunctionSelectors(OLD_SETTER_FACET)).to.deep.equal(setterFacetFuntionSelectors);
115+
const expectSelectors = [...setterFacetFuntionSelectors, ...newSetterFacetFunctionSelectors].sort();
116+
const updatedSelectors = [...(await unitroller.facetFunctionSelectors(NEW_SETTER_FACET))].sort();
117+
118+
expect(updatedSelectors).to.deep.equal(expectSelectors);
119+
expect(await unitroller.facetFunctionSelectors(OLD_SETTER_FACET)).to.deep.equal([]);
111120
});
112121

113122
it("reward facet function selectors should not be changed", async () => {
@@ -117,10 +126,14 @@ forking(52815412, async () => {
117126
});
118127

119128
it("unitroller should contain the new and old facet addresses", async () => {
120-
expect(await unitroller.facetAddresses()).to.include(NEW_SETTER_FACET, OLD_SETTER_FACET);
121-
expect(await unitroller.facetAddresses()).to.include(NEW_POLICY_FACET, OLD_POLICY_FACET);
122-
expect(await unitroller.facetAddresses()).to.include(NEW_MARKET_FACET, OLD_MARKET_FACET);
129+
expect(await unitroller.facetAddresses()).to.include(NEW_SETTER_FACET);
130+
expect(await unitroller.facetAddresses()).to.include(NEW_POLICY_FACET);
131+
expect(await unitroller.facetAddresses()).to.include(NEW_MARKET_FACET);
123132
expect(await unitroller.facetAddresses()).to.include(UNCHANGED_REWARD_FACET);
133+
134+
expect(await unitroller.facetAddresses()).to.not.include(OLD_SETTER_FACET);
135+
expect(await unitroller.facetAddresses()).to.not.include(OLD_POLICY_FACET);
136+
expect(await unitroller.facetAddresses()).to.not.include(OLD_MARKET_FACET);
124137
});
125138
});
126139
});

simulations/vip-xxx/bsctestnet-addendum.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,21 @@ forking(56931937, async () => {
8282
it("market facet function selectors should be updated for new facet address", async () => {
8383
const newMarketFacetFunctionSelectors = ["0x3d98a1e5", "0xcab4f84c"];
8484

85-
expect(await unitroller.facetFunctionSelectors(NEW_MARKET_FACET)).to.deep.equal(newMarketFacetFunctionSelectors);
86-
expect(await unitroller.facetFunctionSelectors(OLD_MARKET_FACET)).to.deep.equal(marketFacetFunctionSelectors);
85+
const expectSelectors = [...marketFacetFunctionSelectors, ...newMarketFacetFunctionSelectors].sort();
86+
const updatedSelectors = [...(await unitroller.facetFunctionSelectors(NEW_MARKET_FACET))].sort();
87+
88+
expect(updatedSelectors).to.deep.equal(expectSelectors);
89+
expect(await unitroller.facetFunctionSelectors(OLD_MARKET_FACET)).to.deep.equal([]);
8790
});
8891

8992
it("policy facet function selectors should be updated for new facet address", async () => {
9093
const newPolicyFacetFunctionSelectors = ["0x528a174c"];
9194

92-
expect(await unitroller.facetFunctionSelectors(NEW_POLICY_FACET)).to.deep.equal(newPolicyFacetFunctionSelectors);
93-
expect(await unitroller.facetFunctionSelectors(OLD_POLICY_FACET)).to.deep.equal(policyFacetFunctionSelectors);
95+
const expectSelectors = [...policyFacetFunctionSelectors, ...newPolicyFacetFunctionSelectors].sort();
96+
const updatedSelectors = [...(await unitroller.facetFunctionSelectors(NEW_POLICY_FACET))].sort();
97+
98+
expect(updatedSelectors).to.deep.equal(expectSelectors);
99+
expect(await unitroller.facetFunctionSelectors(OLD_POLICY_FACET)).to.deep.equal([]);
94100
});
95101

96102
it("setter facet function selectors should be updated for new facet address", async () => {
@@ -106,8 +112,11 @@ forking(56931937, async () => {
106112
"0x530e784f",
107113
];
108114

109-
expect(await unitroller.facetFunctionSelectors(NEW_SETTER_FACET)).to.deep.equal(newSetterFacetFunctionSelectors);
110-
expect(await unitroller.facetFunctionSelectors(OLD_SETTER_FACET)).to.deep.equal(setterFacetFuntionSelectors);
115+
const expectSelectors = [...setterFacetFuntionSelectors, ...newSetterFacetFunctionSelectors].sort();
116+
const updatedSelectors = [...(await unitroller.facetFunctionSelectors(NEW_SETTER_FACET))].sort();
117+
118+
expect(updatedSelectors).to.deep.equal(expectSelectors);
119+
expect(await unitroller.facetFunctionSelectors(OLD_SETTER_FACET)).to.deep.equal([]);
111120
});
112121

113122
it("reward facet function selectors should not be changed", async () => {

simulations/vip-xxx/utils/cur-params-bscmainnet.json

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,90 @@
11
{
22
"cutParams": [
3-
["0x94573965fbCCAC5cD4558208A8cCB3F18E71B7Db", 0, ["0x3d98a1e5", "0xcab4f84c"]],
4-
["0x5bb2Dfe996629E558Cd5BDBfC4c0eC7367BB96E9", 0, ["0x528a174c"]],
3+
[
4+
"0x94573965fbCCAC5cD4558208A8cCB3F18E71B7Db",
5+
1,
6+
[
7+
"0xa76b3fda",
8+
"0x929fe9a1",
9+
"0xc2998238",
10+
"0xede4edd0",
11+
"0xb0772d0b",
12+
"0xabfceffc",
13+
"0x007e3dd2",
14+
"0xc488847b",
15+
"0xa78dc775",
16+
"0x0686dab6",
17+
"0xddbf54fd",
18+
"0xc5b4db55"
19+
]
20+
],
21+
[
22+
"0x94573965fbCCAC5cD4558208A8cCB3F18E71B7Db",
23+
0,
24+
[
25+
"0x3d98a1e5",
26+
"0xcab4f84c"
27+
]
28+
],
29+
[
30+
"0x5bb2Dfe996629E558Cd5BDBfC4c0eC7367BB96E9",
31+
1,
32+
[
33+
"0xead1a8a0",
34+
"0xda3d454c",
35+
"0x5c778605",
36+
"0x5ec88c79",
37+
"0x4e79238f",
38+
"0x5fc7e71e",
39+
"0x47ef3b3b",
40+
"0x4ef4c3e1",
41+
"0x41c728b9",
42+
"0xeabe7d91",
43+
"0x51dff989",
44+
"0x24008a62",
45+
"0x1ededc91",
46+
"0xd02f7351",
47+
"0x6d35bf91",
48+
"0xbdcdc258",
49+
"0x6a56947e"
50+
]
51+
],
52+
[
53+
"0x5bb2Dfe996629E558Cd5BDBfC4c0eC7367BB96E9",
54+
0,
55+
[
56+
"0x528a174c"
57+
]
58+
],
59+
[
60+
"0x9D1fdD581Bd6E638A7b98ac5567248A0c4E88f64",
61+
1,
62+
[
63+
"0xf519fc30",
64+
"0x2b5d790c",
65+
"0x317b0b77",
66+
"0xe4028eee",
67+
"0x9bf34cbb",
68+
"0x522c656b",
69+
"0x17db2163",
70+
"0x4fd42e17",
71+
"0xbb857450",
72+
"0x607ef6c1",
73+
"0x51a485e4",
74+
"0x5f5af1aa",
75+
"0x55ee1fe1",
76+
"0x9460c8b5",
77+
"0x2a6a6065",
78+
"0xd24febad",
79+
"0x9cfdd9e6",
80+
"0x2ec04124",
81+
"0x4e0853db",
82+
"0x6662c7c9",
83+
"0x919a3736",
84+
"0x4ef233fc",
85+
"0xfd51a3ad"
86+
]
87+
],
588
[
689
"0x9D1fdD581Bd6E638A7b98ac5567248A0c4E88f64",
790
0,
@@ -18,4 +101,4 @@
18101
]
19102
]
20103
]
21-
}
104+
}

simulations/vip-xxx/utils/cur-params-bsctestnet.json

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,90 @@
11
{
22
"cutParams": [
3-
["0x377c2E7CE08B4cc7033EDF678EE1224A290075Fd", 0, ["0x3d98a1e5", "0xcab4f84c"]],
4-
["0x671B787AEDB6769972f081C6ee4978146F7D92E6", 0, ["0x528a174c"]],
3+
[
4+
"0x377c2E7CE08B4cc7033EDF678EE1224A290075Fd",
5+
1,
6+
[
7+
"0xa76b3fda",
8+
"0x929fe9a1",
9+
"0xc2998238",
10+
"0xede4edd0",
11+
"0xb0772d0b",
12+
"0xabfceffc",
13+
"0x007e3dd2",
14+
"0xc488847b",
15+
"0xa78dc775",
16+
"0x0686dab6",
17+
"0xddbf54fd",
18+
"0xc5b4db55"
19+
]
20+
],
21+
[
22+
"0x377c2E7CE08B4cc7033EDF678EE1224A290075Fd",
23+
0,
24+
[
25+
"0x3d98a1e5",
26+
"0xcab4f84c"
27+
]
28+
],
29+
[
30+
"0x671B787AEDB6769972f081C6ee4978146F7D92E6",
31+
1,
32+
[
33+
"0xead1a8a0",
34+
"0xda3d454c",
35+
"0x5c778605",
36+
"0x5ec88c79",
37+
"0x4e79238f",
38+
"0x5fc7e71e",
39+
"0x47ef3b3b",
40+
"0x4ef4c3e1",
41+
"0x41c728b9",
42+
"0xeabe7d91",
43+
"0x51dff989",
44+
"0x24008a62",
45+
"0x1ededc91",
46+
"0xd02f7351",
47+
"0x6d35bf91",
48+
"0xbdcdc258",
49+
"0x6a56947e"
50+
]
51+
],
52+
[
53+
"0x671B787AEDB6769972f081C6ee4978146F7D92E6",
54+
0,
55+
[
56+
"0x528a174c"
57+
]
58+
],
59+
[
60+
"0xb619F7ce96c0a6E3F0b44e993f663522F79f294A",
61+
1,
62+
[
63+
"0xf519fc30",
64+
"0x2b5d790c",
65+
"0x317b0b77",
66+
"0xe4028eee",
67+
"0x9bf34cbb",
68+
"0x522c656b",
69+
"0x17db2163",
70+
"0x4fd42e17",
71+
"0xbb857450",
72+
"0x607ef6c1",
73+
"0x51a485e4",
74+
"0x5f5af1aa",
75+
"0x55ee1fe1",
76+
"0x9460c8b5",
77+
"0x2a6a6065",
78+
"0xd24febad",
79+
"0x9cfdd9e6",
80+
"0x2ec04124",
81+
"0x4e0853db",
82+
"0x6662c7c9",
83+
"0x919a3736",
84+
"0x4ef233fc",
85+
"0xfd51a3ad"
86+
]
87+
],
588
[
689
"0xb619F7ce96c0a6E3F0b44e993f663522F79f294A",
790
0,
@@ -18,4 +101,4 @@
18101
]
19102
]
20103
]
21-
}
104+
}

0 commit comments

Comments
 (0)