-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy path028_UpgradeARMsPauseScript.s.sol
More file actions
82 lines (70 loc) · 2.94 KB
/
Copy path028_UpgradeARMsPauseScript.s.sol
File metadata and controls
82 lines (70 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.36;
// Contracts
import {Proxy} from "contracts/Proxy.sol";
import {Mainnet} from "contracts/utils/Addresses.sol";
import {LidoARM} from "contracts/LidoARM.sol";
import {EthenaARM} from "contracts/EthenaARM.sol";
import {EtherFiARM} from "contracts/EtherFiARM.sol";
// Deployment
import {AbstractDeployScript} from "script/deploy/helpers/AbstractDeployScript.s.sol";
import {GovHelper, GovProposal} from "script/deploy/helpers/GovHelper.sol";
/// @notice Upgrades LidoARM, EtherFiARM, EthenaARM and OETH (Origin) ARM
/// to the new AbstractARM implementation that adds the pause mechanism
/// (pause/unpause + whenNotPaused on deposit/requestRedeem) and lets
/// the operator claim withdrawal requests on behalf of users.
contract $028_UpgradeARMsPauseScript is AbstractDeployScript("028_UpgradeARMsPauseScript") {
using GovHelper for GovProposal;
LidoARM public lidoARMImpl;
EtherFiARM public etherFiARMImpl;
EthenaARM public ethenaARMImpl;
function _execute() internal override {
uint256 claimDelay = 10 minutes;
// 1. LidoARM
lidoARMImpl = new LidoARM(
Mainnet.WETH,
claimDelay,
1e7, // minSharesToRedeem
1e18 // allocateThreshold
);
_recordDeployment("LIDO_ARM_IMPL", address(lidoARMImpl));
// 2. EtherFiARM
etherFiARMImpl = new EtherFiARM(
Mainnet.EETH,
Mainnet.WETH,
claimDelay,
1e7, // minSharesToRedeem
1e18 // allocateThreshold
);
_recordDeployment("ETHERFI_ARM_IMPL", address(etherFiARMImpl));
// 3. EthenaARM
ethenaARMImpl = new EthenaARM(
Mainnet.USDE,
claimDelay,
1e18, // minSharesToRedeem
100e18 // allocateThreshold
);
_recordDeployment("ETHENA_ARM_IMPL", address(ethenaARMImpl));
}
function _buildGovernanceProposal() internal override {
govProposal.setDescription("Upgrade LidoARM and EtherFiARM to add pause mechanism and operator claims");
govProposal.action(
resolver.resolve("LIDO_ARM"), "upgradeTo(address)", abi.encode(resolver.resolve("LIDO_ARM_IMPL"))
);
govProposal.action(
resolver.resolve("ETHER_FI_ARM"), "upgradeTo(address)", abi.encode(resolver.resolve("ETHERFI_ARM_IMPL"))
);
}
/// @notice EthenaARM is owned by the multisig directly, so we upgrade it
/// via a prank in fork simulation. On real deployment, the multisig will execute the upgrade.
function _fork() internal override {
// EthenaARM
Proxy ethenaProxy = Proxy(payable(resolver.resolve("ETHENA_ARM")));
address ethenaImpl = resolver.resolve("ETHENA_ARM_IMPL");
if (ethenaProxy.implementation() != ethenaImpl) {
vm.startPrank(ethenaProxy.owner());
ethenaProxy.upgradeTo(ethenaImpl);
vm.stopPrank();
}
}
}