diff --git a/bun.lockb b/bun.lockb index 1417aac..ea7b5d1 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 7b2744f..2fc505b 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "url": "https://github.com/AngleProtocol/merkl-contracts/issues" }, "devDependencies": { - "@angleprotocol/sdk": "2.34.7", + "@angleprotocol/sdk": "2.35.0", "@openzeppelin/contracts": "^4.9.0", "@openzeppelin/contracts-upgradeable": "4.9.0", "prettier": "^2.0.0", diff --git a/scripts/DistributionCreator.s.sol b/scripts/DistributionCreator.s.sol index 5b17e78..55100a3 100644 --- a/scripts/DistributionCreator.s.sol +++ b/scripts/DistributionCreator.s.sol @@ -523,7 +523,7 @@ contract SignAndCreateCampaign is DistributionCreatorScript { } contract UpgradeAndBuildUpgradeToPayload is DistributionCreatorScript { - function run() external { + function run() external broadcast { uint256 chainId = block.chainid; address distributionCreator = readAddress(chainId, "Merkl.DistributionCreator"); @@ -534,7 +534,7 @@ contract UpgradeAndBuildUpgradeToPayload is DistributionCreatorScript { distributionCreatorImpl ); - try this.externalReadAddress(chainId, "Merkl.AngleLabs") returns (address safe) { + try this.externalReadAddress(chainId, "AngleLabs") returns (address safe) { _serializeJson( chainId, distributionCreator, // target address (the proxy) diff --git a/scripts/Distributor.s.sol b/scripts/Distributor.s.sol index d72aa32..2f21738 100644 --- a/scripts/Distributor.s.sol +++ b/scripts/Distributor.s.sol @@ -5,6 +5,7 @@ import { console } from "forge-std/console.sol"; import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { JsonReader } from "@utils/JsonReader.sol"; +import { ITransparentUpgradeableProxy } from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import { BaseScript } from "./utils/Base.s.sol"; import { Distributor, MerkleTree } from "../contracts/Distributor.sol"; @@ -295,3 +296,30 @@ contract Claim is DistributorScript { console.log("Claimed rewards for", users.length, "users"); } } + +contract BuildUpgradeToPayload is DistributorScript { + function run() external broadcast { + uint256 chainId = block.chainid; + address distributor = readAddress(chainId, "Merkl.Distributor"); + + address distributorImpl = address(new Distributor()); + + bytes memory payload = abi.encodeWithSelector(ITransparentUpgradeableProxy.upgradeTo.selector, distributorImpl); + + try this.externalReadAddress(chainId, "AngleLabs") returns (address safe) { + _serializeJson( + chainId, + distributor, // target address (the proxy) + 0, // value + payload, // direct upgrade call + Operation.Call, // standard call (not delegate) + hex"", // signature + safe // safe address + ); + } catch {} + } + + function externalReadAddress(uint256 chainId, string memory key) external view returns (address) { + return readAddress(chainId, key); + } +}