@inco/lightning 0.2.11 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/DeployUtils.sol +1 -69
- package/src/test/IncoTest.sol +1 -2
package/package.json
CHANGED
package/src/DeployUtils.sol
CHANGED
|
@@ -9,7 +9,6 @@ import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.s
|
|
|
9
9
|
import {CONTRACT_NAME, MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION} from "../src/version/IncoLightningConfig.sol";
|
|
10
10
|
import {console} from "forge-std/console.sol";
|
|
11
11
|
import {CreateXHelper} from "./CreateXHelper.sol";
|
|
12
|
-
import {IncoLightningPreview} from "@inco/lightning-preview/src/IncoLightningPreview.sol";
|
|
13
12
|
|
|
14
13
|
// can be set to 0x01 so the inco address can exist on only one chain, we want the same contract at the same address
|
|
15
14
|
// on all chains
|
|
@@ -61,23 +60,6 @@ contract DeployUtils is Script {
|
|
|
61
60
|
);
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
/// @dev deploys an CreateX proxy with an IncoLightning implementation
|
|
65
|
-
/// @param deployer MUST be the signer of the transaction
|
|
66
|
-
/// @param pepper a value used to avoid address collision on deploying the same contract twice with the same deployer
|
|
67
|
-
function deployIncoLightningUsingConfig(
|
|
68
|
-
address deployer,
|
|
69
|
-
string memory pepper,
|
|
70
|
-
bool includePreviewFeatures
|
|
71
|
-
) internal returns (IncoLightning proxy) {
|
|
72
|
-
return deployIncoLightningUsingConfig(
|
|
73
|
-
deployer,
|
|
74
|
-
pepper,
|
|
75
|
-
MINOR_VERSION,
|
|
76
|
-
PATCH_VERSION,
|
|
77
|
-
includePreviewFeatures
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
63
|
/// @dev Computes the address of the IncoLightning contract using CreateX based on the deployer and pepper
|
|
82
64
|
/// @param deployer MUST be the signer of the transaction
|
|
83
65
|
/// @param pepper a value used to avoid address collision on deploying the same contract twice with the same deployer
|
|
@@ -111,14 +93,12 @@ contract DeployUtils is Script {
|
|
|
111
93
|
/// @param pepper a value used to avoid address collision on deploying the same contract twice with the same deployer
|
|
112
94
|
/// @param minorVersionForSalt minor version of the contract to use in the salt
|
|
113
95
|
/// @param patchVersionForSalt patch version of the contract to use in the salt
|
|
114
|
-
/// @param includePreviewFeatures whether to include preview features in the contract
|
|
115
96
|
function deployIncoLightningUsingConfig(
|
|
116
97
|
address deployer,
|
|
117
98
|
string memory pepper,
|
|
118
99
|
// FIXME: on the next major version (new contract address and state) we should remove these from the salt altogether
|
|
119
100
|
uint8 minorVersionForSalt,
|
|
120
|
-
uint8 patchVersionForSalt
|
|
121
|
-
bool includePreviewFeatures
|
|
101
|
+
uint8 patchVersionForSalt
|
|
122
102
|
) internal returns (IncoLightning proxy) {
|
|
123
103
|
bytes32 salt = getSalt(
|
|
124
104
|
CONTRACT_NAME,
|
|
@@ -134,11 +114,6 @@ contract DeployUtils is Script {
|
|
|
134
114
|
vm.toString(salt)
|
|
135
115
|
);
|
|
136
116
|
IncoLightning implementation = new IncoLightning(salt);
|
|
137
|
-
if (includePreviewFeatures) {
|
|
138
|
-
IncoLightningPreview preview = new IncoLightningPreview(address(implementation));
|
|
139
|
-
// FIXME: This is hack, we ought to define an interface IIncoLightning here and use that instead
|
|
140
|
-
implementation = IncoLightning(address(preview));
|
|
141
|
-
}
|
|
142
117
|
proxy = IncoLightning(
|
|
143
118
|
deployProxy({
|
|
144
119
|
deployer: deployer,
|
|
@@ -149,49 +124,6 @@ contract DeployUtils is Script {
|
|
|
149
124
|
);
|
|
150
125
|
}
|
|
151
126
|
|
|
152
|
-
/// @dev Upgrades an existing IncoLightning contract whose major version is in IncoLightningConfig.sol but whose
|
|
153
|
-
/// minor and patch versions can be provided to this function in order to perform an upgrade
|
|
154
|
-
/// @param deployer MUST be the signer of the transaction
|
|
155
|
-
/// @param pepper a value used to avoid address collision on deploying the same contract twice with the same deployer
|
|
156
|
-
/// @param minorVersionForSalt minor version of the contract to use in the salt
|
|
157
|
-
/// @param patchVersionForSalt patch version of the contract to use in the salt
|
|
158
|
-
/// @param includePreviewFeatures whether to include preview features in the contract
|
|
159
|
-
function upgradeIncoLightningUsingConfig(
|
|
160
|
-
address deployer,
|
|
161
|
-
string memory pepper,
|
|
162
|
-
// FIXME: on the next major version (new contract address and state) we should remove these from the salt altogether
|
|
163
|
-
uint8 minorVersionForSalt,
|
|
164
|
-
uint8 patchVersionForSalt,
|
|
165
|
-
bool includePreviewFeatures
|
|
166
|
-
) internal returns (IncoLightning proxy) {
|
|
167
|
-
// Here we hack around the fact that we must use the same salt for an upgrade and currently the salt includes
|
|
168
|
-
// the minor and patch versions
|
|
169
|
-
bytes32 salt = getSalt(
|
|
170
|
-
CONTRACT_NAME,
|
|
171
|
-
MAJOR_VERSION,
|
|
172
|
-
minorVersionForSalt,
|
|
173
|
-
patchVersionForSalt,
|
|
174
|
-
deployer,
|
|
175
|
-
pepper
|
|
176
|
-
);
|
|
177
|
-
CreateXHelper createX = new CreateXHelper();
|
|
178
|
-
address proxyAddress = createX.computeCreate3DeployAddress({salt: salt});
|
|
179
|
-
console.log(
|
|
180
|
-
"Upgrading Inco with deployerAddress: %s, salt: %s, proxyAddress: %s",
|
|
181
|
-
vm.toString(deployer),
|
|
182
|
-
vm.toString(salt),
|
|
183
|
-
vm.toString(proxyAddress)
|
|
184
|
-
);
|
|
185
|
-
proxy = IncoLightning(proxyAddress);
|
|
186
|
-
|
|
187
|
-
IncoLightning newImplementation = new IncoLightning(salt);
|
|
188
|
-
if (includePreviewFeatures) {
|
|
189
|
-
newImplementation = IncoLightning(address(new IncoLightningPreview(address(newImplementation))));
|
|
190
|
-
}
|
|
191
|
-
new IncoLightning(salt);
|
|
192
|
-
proxy.upgradeToAndCall(address(newImplementation), "");
|
|
193
|
-
return proxy;
|
|
194
|
-
}
|
|
195
127
|
|
|
196
128
|
/// @notice deploys a ERC1967Proxy contract using CreateX (create3 pattern), gives the deployer the ownership of
|
|
197
129
|
/// the proxy
|
package/src/test/IncoTest.sol
CHANGED
|
@@ -30,8 +30,7 @@ contract IncoTest is MockOpHandler, DeployUtils {
|
|
|
30
30
|
// The highest precedent deployment
|
|
31
31
|
pepper: "testnet",
|
|
32
32
|
minorVersionForSalt: 1,
|
|
33
|
-
patchVersionForSalt: 29
|
|
34
|
-
includePreviewFeatures: false
|
|
33
|
+
patchVersionForSalt: 29
|
|
35
34
|
});
|
|
36
35
|
proxy.transferOwnership(owner);
|
|
37
36
|
vm.stopPrank();
|