Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "foundry/lib/forge-std"]
path = foundry/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "foundry/lib/dual-governance"]
path = foundry/lib/dual-governance
url = https://github.com/lidofinance/dual-governance
26 changes: 24 additions & 2 deletions contracts/upgrade/V3Addresses.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ contract V3Addresses {
address etfForceValidatorExitsInVaultHub;
address etfSetLiabilitySharesTargetInVaultHub;
address etfSocializeBadDebtInVaultHub;

// Treasury transfer parameters
address finance;
address maticToken;
address lolMultisig;
uint256 maticAmountWeiForTransfer;
string transferReference;

// TRP related parameters
address easyTrackTrpRegistry;
}

string public constant CURATED_MODULE_NAME = "curated-onchain-v1";
Expand Down Expand Up @@ -124,9 +134,7 @@ contract V3Addresses {
//

address public immutable EASY_TRACK;

address public immutable EVM_SCRIPT_EXECUTOR;

address public immutable VAULTS_ADAPTER;

// ETF = EasyTrack Factory
Expand Down Expand Up @@ -159,6 +167,13 @@ contract V3Addresses {
address public immutable CSM_ACCOUNTING;
address public immutable ORACLE_DAEMON_CONFIG;

address public immutable FINANCE;
address public immutable MATIC_TOKEN;
address public immutable LOL_MULTISIG;
uint256 public immutable MATIC_AMOUNT_WEI_FOR_TRANSFER;
string public TRANSFER_REFERENCE;
address public immutable EASY_TRACK_TRP_REGISTRY;

constructor(
V3AddressesParams memory params
) {
Expand Down Expand Up @@ -202,6 +217,13 @@ contract V3Addresses {
ETF_UPDATE_VAULTS_FEES_IN_OPERATOR_GRID = params.etfUpdateVaultsFeesInOperatorGrid;
ETF_FORCE_VALIDATOR_EXITS_IN_VAULT_HUB = params.etfForceValidatorExitsInVaultHub;

FINANCE = params.finance;
MATIC_TOKEN = params.maticToken;
LOL_MULTISIG = params.lolMultisig;
MATIC_AMOUNT_WEI_FOR_TRANSFER = params.maticAmountWeiForTransfer;
TRANSFER_REFERENCE = params.transferReference;
EASY_TRACK_TRP_REGISTRY = params.easyTrackTrpRegistry;

//
// Discovered via other contracts
//
Expand Down
38 changes: 29 additions & 9 deletions contracts/upgrade/V3Template.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,22 @@ contract V3Template is V3Addresses {

bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

// Timestamp since which startUpgrade()
// This behavior is introduced to disarm the template if the upgrade voting creation or enactment
// didn't happen in proper time period
uint256 public immutable EXPIRE_SINCE_INCLUSIVE;

// Initial value of upgradeBlockNumber storage variable
uint256 public constant UPGRADE_NOT_STARTED = 0;

uint256 public constant INFINITE_ALLOWANCE = type(uint256).max;

//
// Structs
//

struct TimeConstraintsParams {
uint256 disabledBefore; // Upgrade disabled before this Unix timestamp
uint256 disabledAfter; // Upgrade disabled after this Unix timestamp
uint256 enabledDaySpanStart; // Daily time window start (seconds since midnight UTC)
uint256 enabledDaySpanEnd; // Daily time window end (seconds since midnight UTC)
}

//
// Structured storage
//
Expand All @@ -117,6 +123,14 @@ contract V3Template is V3Addresses {
address[] public contractsWithBurnerAllowances;
uint256 public immutable INITIAL_MAX_EXTERNAL_RATIO_BP;

//
// Upgrade time constraints
//
uint256 public immutable DISABLED_BEFORE;
uint256 public immutable DISABLED_AFTER;
uint256 public immutable ENABLED_DAY_SPAN_START;
uint256 public immutable ENABLED_DAY_SPAN_END;

//
// Slots for transient storage
//
Expand All @@ -128,11 +142,18 @@ contract V3Template is V3Addresses {


/// @param _params Params required to initialize the addresses contract
/// @param _expireSinceInclusive Unix timestamp after which upgrade actions revert
/// @param _initialMaxExternalRatioBP Initial maximum external ratio in basis points
constructor(V3AddressesParams memory _params, uint256 _expireSinceInclusive, uint256 _initialMaxExternalRatioBP) V3Addresses(_params) {
EXPIRE_SINCE_INCLUSIVE = _expireSinceInclusive;
/// @param _timeConstraintsParams Time constraints for the upgrade window
constructor(
V3AddressesParams memory _params,
uint256 _initialMaxExternalRatioBP,
TimeConstraintsParams memory _timeConstraintsParams
) V3Addresses(_params) {
INITIAL_MAX_EXTERNAL_RATIO_BP = _initialMaxExternalRatioBP;
DISABLED_BEFORE = _timeConstraintsParams.disabledBefore;
DISABLED_AFTER = _timeConstraintsParams.disabledAfter;
ENABLED_DAY_SPAN_START = _timeConstraintsParams.enabledDaySpanStart;
ENABLED_DAY_SPAN_END = _timeConstraintsParams.enabledDaySpanEnd;
contractsWithBurnerAllowances.push(WITHDRAWAL_QUEUE);
// NB: NOR and SIMPLE_DVT allowances are set to 0 in TW upgrade, so they are not migrated
contractsWithBurnerAllowances.push(CSM_ACCOUNTING);
Expand All @@ -141,7 +162,6 @@ contract V3Template is V3Addresses {
/// @notice Must be called before LidoLocator is upgraded
function startUpgrade() external {
if (msg.sender != AGENT) revert OnlyAgentCanUpgrade();
if (block.timestamp >= EXPIRE_SINCE_INCLUSIVE) revert Expired();
if (isUpgradeFinished) revert UpgradeAlreadyFinished();
if (_isStartCalledInThisTx()) revert StartAlreadyCalledInThisTx();
if (upgradeBlockNumber != UPGRADE_NOT_STARTED) revert UpgradeAlreadyStarted();
Expand Down
Loading
Loading