Skip to content

Commit 98990a4

Browse files
committed
fix proposal
1 parent 497f519 commit 98990a4

File tree

1 file changed

+24
-53
lines changed

1 file changed

+24
-53
lines changed

proposals/mips/mip-x35/x35.sol

Lines changed: 24 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ import {ProxyAdmin} from "@openzeppelin-contracts/contracts/proxy/transparent/Pr
1717
import {validateProxy} from "@proposals/utils/ProxyUtils.sol";
1818

1919
// this proposal should
20-
// 1. deploy the new ChainlinkOEVWrapper and ChainlinkOEVMorphoWrapper contracts
21-
// 2. upgrade existing ChainlinkOracleProxy contracts for all markets => test that storage can still be accessed
20+
// 1. deploy new non-upgradeable ChainlinkOEVWrapper contracts for core markets
21+
// 2. upgrade existing ChainlinkOEVMorphoWrapper proxy contracts for Morpho markets => test that storage can still be accessed
2222
// 3. call setFeed on the ChainlinkOracle for all markets, to point to the new ChainlinkOEVWrapper contracts
2323
contract x35 is HybridProposal, Configs, Networks {
2424
string public constant override name = "MIP-X35";
2525

26-
string public constant IMPLEMENTATION_NAME = "CHAINLINK_OEV_WRAPPER_IMPL";
2726
string public constant MORPHO_IMPLEMENTATION_NAME =
2827
"CHAINLINK_OEV_MORPHO_WRAPPER_IMPL";
2928

@@ -152,7 +151,7 @@ contract x35 is HybridProposal, Configs, Networks {
152151
}
153152
}
154153

155-
/// @dev deploy implementation contract (if not already deployed) and deploy proxies for all core markets
154+
/// @dev deploy direct instances (non-upgradeable) for all core markets
156155
function _deployCoreWrappers(Addresses addresses) internal {
157156
OracleConfig[] memory oracleConfigs = getOracleConfigurations(
158157
block.chainid
@@ -164,72 +163,32 @@ contract x35 is HybridProposal, Configs, Networks {
164163

165164
vm.startBroadcast();
166165

167-
// Deploy or get the implementation contract
168-
ChainlinkOEVWrapper impl;
169-
if (!addresses.isAddressSet(IMPLEMENTATION_NAME)) {
170-
impl = new ChainlinkOEVWrapper();
171-
addresses.addAddress(IMPLEMENTATION_NAME, address(impl));
172-
} else {
173-
impl = ChainlinkOEVWrapper(
174-
addresses.getAddress(IMPLEMENTATION_NAME)
175-
);
176-
}
177-
178166
for (uint256 i = 0; i < oracleConfigs.length; i++) {
179167
OracleConfig memory config = oracleConfigs[i];
180168

181169
string memory wrapperName = string(
182170
abi.encodePacked(config.oracleName, "_OEV_WRAPPER")
183171
);
184172

185-
// Initialize proxy
186-
address proxyAdmin;
187-
if (!addresses.isAddressSet("CHAINLINK_ORACLE_PROXY_ADMIN")) {
188-
ProxyAdmin _proxyAdmin = new ProxyAdmin();
189-
addresses.addAddress(
190-
"CHAINLINK_ORACLE_PROXY_ADMIN",
191-
address(_proxyAdmin)
192-
);
193-
proxyAdmin = address(_proxyAdmin);
194-
} else {
195-
proxyAdmin = addresses.getAddress(
196-
"CHAINLINK_ORACLE_PROXY_ADMIN"
197-
);
198-
}
199-
address owner = addresses.getAddress("TEMPORAL_GOVERNOR");
200-
201-
// TODO: who should be the fee recipient?
202-
address feeRecipient = addresses.isAddressSet(
203-
"OEV_WRAPPER_FEE_RECIPIENT"
204-
)
205-
? addresses.getAddress("OEV_WRAPPER_FEE_RECIPIENT")
206-
: owner;
207-
208-
bytes memory initData = abi.encodeWithSelector(
209-
ChainlinkOEVWrapper.initialize.selector,
173+
ChainlinkOEVWrapper wrapper = new ChainlinkOEVWrapper(
210174
addresses.getAddress(config.oracleName),
211-
owner,
212-
feeRecipient,
175+
addresses.getAddress("TEMPORAL_GOVERNOR"),
176+
addresses.getAddress("OEV_WRAPPER_FEE_RECIPIENT"),
177+
addresses.getAddress("CHAINLINK_ORACLE"),
213178
FEE_MULTIPLIER,
214179
MAX_ROUND_DELAY,
215180
MAX_DECREMENTS
216181
);
217182

218-
TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(
219-
address(impl),
220-
proxyAdmin,
221-
initData
222-
);
223-
224-
// Set existing proxy to deprecated and add new proxy
183+
// Set existing wrapper to deprecated and add new wrapper
225184
if (addresses.isAddressSet(wrapperName)) {
226185
addresses.addAddress(
227186
string(abi.encodePacked(wrapperName, "_DEPRECATED")),
228187
addresses.getAddress(wrapperName)
229188
);
230-
addresses.changeAddress(wrapperName, address(proxy), true);
189+
addresses.changeAddress(wrapperName, address(wrapper), true);
231190
} else {
232-
addresses.addAddress(wrapperName, address(proxy));
191+
addresses.addAddress(wrapperName, address(wrapper));
233192
}
234193
}
235194

@@ -242,12 +201,24 @@ contract x35 is HybridProposal, Configs, Networks {
242201
return;
243202
}
244203

204+
vm.startBroadcast();
205+
206+
// Ensure proxy admin exists for Morpho wrapper upgrades
207+
if (!addresses.isAddressSet("CHAINLINK_ORACLE_PROXY_ADMIN")) {
208+
ProxyAdmin proxyAdmin = new ProxyAdmin();
209+
addresses.addAddress(
210+
"CHAINLINK_ORACLE_PROXY_ADMIN",
211+
address(proxyAdmin)
212+
);
213+
}
214+
215+
// Deploy Morpho implementation if needed
245216
if (!addresses.isAddressSet(MORPHO_IMPLEMENTATION_NAME)) {
246-
vm.startBroadcast();
247217
ChainlinkOEVMorphoWrapper impl = new ChainlinkOEVMorphoWrapper();
248218
addresses.addAddress(MORPHO_IMPLEMENTATION_NAME, address(impl));
249-
vm.stopBroadcast();
250219
}
220+
221+
vm.stopBroadcast();
251222
}
252223

253224
// FIX: test the contructor setting

0 commit comments

Comments
 (0)