OptimizerV3Push3 is an equivalence-proof contract with only isBullMarket(). It cannot serve as an ERC1967Proxy implementation because it has no initialize() or getLiquidityParams(). The CI bootstrap was failing because the proxy deployment reverted when calling initialize() on the Push3 implementation. Switch deploy scripts to Optimizer.sol (the base UUPS contract) which has the full interface required by ERC1967Proxy and LiquidityManager. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
50 lines
2 KiB
Solidity
50 lines
2 KiB
Solidity
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
pragma solidity ^0.8.19;
|
|
|
|
import "../src/Optimizer.sol";
|
|
import { UUPSUpgradeable } from "@openzeppelin/proxy/utils/UUPSUpgradeable.sol";
|
|
import "forge-std/Script.sol";
|
|
|
|
/**
|
|
* @title UpgradeOptimizer
|
|
* @notice Upgrades an existing Optimizer UUPS proxy to OptimizerV3 implementation.
|
|
* @dev Usage:
|
|
* OPTIMIZER_PROXY=0x... forge script script/UpgradeOptimizer.sol \
|
|
* --rpc-url <RPC_URL> --broadcast
|
|
*
|
|
* The caller must be the proxy admin (the address that called initialize()).
|
|
*/
|
|
contract UpgradeOptimizer is Script {
|
|
function run() public {
|
|
address proxyAddress = vm.envAddress("OPTIMIZER_PROXY");
|
|
require(proxyAddress != address(0), "OPTIMIZER_PROXY env var required");
|
|
|
|
string memory seedPhrase = vm.readFile(".secret");
|
|
uint256 privateKey = vm.deriveKey(seedPhrase, 0);
|
|
vm.startBroadcast(privateKey);
|
|
address sender = vm.addr(privateKey);
|
|
|
|
console.log("\n=== Optimizer UUPS Upgrade ===");
|
|
console.log("Proxy address:", proxyAddress);
|
|
console.log("Admin (sender):", sender);
|
|
|
|
// Deploy new Optimizer implementation
|
|
Optimizer newImpl = new Optimizer();
|
|
console.log("New Optimizer implementation:", address(newImpl));
|
|
|
|
// Upgrade proxy to new implementation (no reinitialize needed — storage layout compatible)
|
|
UUPSUpgradeable(proxyAddress).upgradeTo(address(newImpl));
|
|
console.log("Proxy upgraded to Optimizer");
|
|
|
|
// Verify upgrade by calling getLiquidityParams through the proxy
|
|
Optimizer upgraded = Optimizer(proxyAddress);
|
|
(uint256 ci, uint256 as_, uint24 aw, uint256 dd) = upgraded.getLiquidityParams();
|
|
console.log("\n=== Post-Upgrade Verification ===");
|
|
console.log("capitalInefficiency:", ci);
|
|
console.log("anchorShare:", as_);
|
|
console.log("anchorWidth:", uint256(aw));
|
|
console.log("discoveryDepth:", dd);
|
|
|
|
vm.stopBroadcast();
|
|
}
|
|
}
|