Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
24 changes: 14 additions & 10 deletions contracts/upgrade/V3Template.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ 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;

Expand Down Expand Up @@ -128,10 +123,11 @@ 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;
constructor(
V3AddressesParams memory _params,
uint256 _initialMaxExternalRatioBP
) V3Addresses(_params) {
INITIAL_MAX_EXTERNAL_RATIO_BP = _initialMaxExternalRatioBP;
contractsWithBurnerAllowances.push(WITHDRAWAL_QUEUE);
// NB: NOR and SIMPLE_DVT allowances are set to 0 in TW upgrade, so they are not migrated
Expand All @@ -141,7 +137,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 Expand Up @@ -208,6 +203,7 @@ contract V3Template is V3Addresses {
}

_assertProxyImplementation(IOssifiableProxy(LOCATOR), NEW_LOCATOR_IMPL);
_assertProxyImplementation(IOssifiableProxy(ACCOUNTING_ORACLE), NEW_ACCOUNTING_ORACLE_IMPL);

_assertContractVersion(IVersioned(LIDO), EXPECTED_FINAL_LIDO_VERSION);
_assertContractVersion(IVersioned(ACCOUNTING_ORACLE), EXPECTED_FINAL_ACCOUNTING_ORACLE_VERSION);
Expand Down Expand Up @@ -266,6 +262,7 @@ contract V3Template is V3Addresses {
_assertSingleOZRoleHolder(LAZY_ORACLE, LazyOracle(LAZY_ORACLE).UPDATE_SANITY_PARAMS_ROLE(), AGENT);

// AccountingOracle
_assertProxyAdmin(IOssifiableProxy(ACCOUNTING_ORACLE), AGENT);
_assertSingleOZRoleHolder(ACCOUNTING_ORACLE, DEFAULT_ADMIN_ROLE, AGENT);

// OracleReportSanityChecker
Expand Down Expand Up @@ -373,6 +370,14 @@ contract V3Template is V3Addresses {
revert IncorrectBurnerAllowance(contractsWithBurnerAllowances_[i], BURNER);
}
}

// NO and SimpleDVT new Burner allowances are to be zero the same as old Burner on pre upgrade state
if (ILidoWithFinalizeUpgrade(LIDO).allowance(NODE_OPERATORS_REGISTRY, BURNER) != 0) {
revert IncorrectBurnerAllowance(NODE_OPERATORS_REGISTRY, BURNER);
}
if (ILidoWithFinalizeUpgrade(LIDO).allowance(SIMPLE_DVT, BURNER) != 0) {
revert IncorrectBurnerAllowance(SIMPLE_DVT, BURNER);
}
}

function _assertProxyAdmin(IOssifiableProxy _proxy, address _admin) internal view {
Expand Down Expand Up @@ -465,7 +470,6 @@ contract V3Template is V3Addresses {
error IncorrectOZAccessControlRoleHolders(address contractAddress, bytes32 role);
error NonZeroRoleHolders(address contractAddress, bytes32 role);
error IncorrectAragonAppImplementation(address repo, address implementation);
error StartAndFinishMustBeInSameBlock();
error StartAndFinishMustBeInSameTx();
error StartAlreadyCalledInThisTx();
error Expired();
Expand Down
Loading