Skip to content

feat: upgrade on forking #978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 87 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
42c64b6
feat: untangle Sanity Checker and Locator deployment
arwer13 Mar 7, 2025
3673df4
feat: untangle Delegation deployment and Locator upgrade
arwer13 Mar 8, 2025
ac5e23b
fix: integration tests are now runnable on fork after upgrade
arwer13 Mar 9, 2025
969dcf5
fix: upgrade initialization in Lido and AccountingOracle
arwer13 Mar 10, 2025
9f00310
feat: initial version of upgrade on forking (with template)
arwer13 Mar 10, 2025
9a18b10
fix: ci scratch integration tests (provisioning)
arwer13 Mar 11, 2025
c3840d5
feat: restore CI integration test
arwer13 Mar 11, 2025
2fa8d9a
fix: ci mainnet integration test
arwer13 Mar 11, 2025
ba9417a
feat: move burner burnt shares initialization to upgrade template
arwer13 Mar 11, 2025
ef7c242
fix: burner scratch deployment
arwer13 Mar 11, 2025
43814a5
feat: add Burner migration with stETH in Lido.finalizeUpgrade_v3
arwer13 Mar 14, 2025
67c7d88
fix: add workaround to fix forking forks (e.g. hardhat forking hardhat)
arwer13 Mar 14, 2025
23877f5
fix: ci but setting no chainId on hardhat-node
arwer13 Mar 14, 2025
ed61031
Merge 'feat/vaults' (pdg) into 'feat/ugprade-on-forking'
arwer13 Mar 14, 2025
d1bf561
feat(upgrade): separate mocking aragon voting into yarn command
arwer13 Mar 14, 2025
be49584
fix(tests): update burner migration unit tests
arwer13 Mar 17, 2025
7554864
feat(upgrade): little improvements here and there
arwer13 Mar 17, 2025
a3685a5
fix(upgrade): remove failed unnecessary test and uncomment checks
arwer13 Mar 18, 2025
863a3c0
feat(scratch): save aragon app repo addresses on scratch deploy
arwer13 Mar 18, 2025
df4508d
feat(upgrade): more burner allowance migration + more template checks
arwer13 Mar 19, 2025
8f21f92
feat(upgrade): remove upgrade template from coverage report
arwer13 Mar 19, 2025
896bd55
Merge branch 'feat/vaults' into feat/upgrade-on-forking
arwer13 Mar 20, 2025
1167c03
feat(upgrade): remove WithdrawalVault upgrade from upgrade
arwer13 Mar 20, 2025
47fb019
chore: update .vscode settings.json cSpell.words
arwer13 Mar 20, 2025
57074e0
chore: update .gitignore to include vscode snippets
arwer13 Mar 24, 2025
bf8c893
Merge feat/vaults into feat/upgrade-on-forking
arwer13 Mar 26, 2025
1d0144a
fix: a few integration tests on forking update
arwer13 Mar 26, 2025
d1a589c
Merge branch 'feat/vaults' into feat/upgrade-on-forking
arwer13 Mar 26, 2025
af8044e
Merge 'feat/vaults' into 'feat/upgrade-on-forking'
arwer13 Apr 4, 2025
11da9d7
Merge 'feat/vaults' into 'feat/upgrade-on-forking'
arwer13 Apr 9, 2025
6509f6b
fix: upgrade deployment and tests
arwer13 Apr 9, 2025
93ae002
fix: eip7002 mock storage issue
arwer13 Apr 10, 2025
9f89d64
fix: vault-creation.integration test for upgrade mode
arwer13 Apr 10, 2025
a114a94
chore: remove .vscode from repo
arwer13 Apr 10, 2025
8381da4
feat(upgrade): retrieve more contracts from other contracts (code rev…
arwer13 Apr 14, 2025
4c6773d
Merge 'feat/vaults' into 'feat/upgrade-on-forking'
arwer13 Apr 14, 2025
32ea160
Merge branch 'feat/vaults' into feat/upgrade-on-forking
arwer13 Apr 17, 2025
db30967
Merge branch 'feat/vaults' into feat/upgrade-on-forking
arwer13 Apr 18, 2025
381f529
feat(upgrade): revoke old Burner's REQUEST_BURN_SHARES_ROLE
arwer13 Apr 20, 2025
250c32d
Merge 'feat/vaults' into 'feat/upgrade-on-forking'
arwer13 Apr 20, 2025
35a3e50
feat: set Error.stackTraceLimit to 30 (the default was 10)
arwer13 Apr 20, 2025
a997641
feat(upgrade): refactor UpgradeTemplateV3
arwer13 Apr 20, 2025
3935209
refactor(upgrade): move UpgradeTemplateV3 file
arwer13 Apr 20, 2025
11f3a90
feat(upgrade): remove template non-single block upgrade hack
arwer13 Apr 21, 2025
cd6e6ad
fix(upgrade): operatorGrid address discovery
arwer13 Apr 21, 2025
97f0c21
Merge branch 'feat/vaults' into 'feat/upgrade-on-forking'
arwer13 Apr 21, 2025
8c56e92
refactor(upgrade): refactor upgrade template
arwer13 Apr 21, 2025
b82d387
Merge 'feat/vaults' into 'feat/upgrade-on-forking'
arwer13 Apr 22, 2025
890dcd9
fix(upgrade): disable other staking modules when staking via utils
arwer13 Apr 23, 2025
b541196
Merge 'feat/vaults' into 'feat/upgrade-on-forking'
arwer13 Apr 23, 2025
342163a
feat: code review + fix single block transactions issue
arwer13 Apr 23, 2025
b7959b2
feat: mvp of upgrade template tests + gh workflow + code review
arwer13 Apr 23, 2025
1676148
feat: skip extra full items, half-fix and refactoring
arwer13 May 2, 2025
0044853
Merge 'feat/vaults' into 'feat/upgrade-on-forking'
arwer13 May 2, 2025
7ca3ae1
fix: vaults/{connected,disconnected}.integration.ts test
arwer13 May 2, 2025
30a9065
fix: core/happy-path.integration Should rebase correctly WQ burn
arwer13 May 2, 2025
e1b07f6
feat: update AO consensus version as it changed on mainnet
arwer13 May 4, 2025
d18e077
fix: withdrawal-happy-path.integration for upgrade
arwer13 May 4, 2025
6472692
refactor(upgrade): restructure immutables in upgrade template
arwer13 May 6, 2025
07ad3c2
feat(upgrade): add mvp of onchain voting script generation
arwer13 May 7, 2025
2ec2a00
Merge branch 'feat/vaults' into feat/upgrade-on-forking
arwer13 May 7, 2025
515b809
Merge branch 'feat/vaults' into feat/upgrade-on-forking
arwer13 May 7, 2025
c9428c3
Merge branch 'feat/vaults' into feat/upgrade-on-forking
arwer13 May 12, 2025
d8a46b4
feat: fix a few integration tests
arwer13 May 12, 2025
7ea6f7c
Merge 'feat/vaults' into 'feat/upgrade-on-forking'
arwer13 May 12, 2025
ee8c52d
feat(upgrade): fix a few tests
arwer13 May 13, 2025
f4019c7
fix(upgrade): tricky fix of test accounts having weird bytecode
arwer13 May 13, 2025
0eae15d
fix(upgrade): fix a test and a bit of refactoring
arwer13 May 13, 2025
5a66af9
feat(upgrade): fix AO extra data full items test
arwer13 May 15, 2025
bb82e3f
Merge branch 'feat/vaults' into feat/upgrade-on-forking
arwer13 May 15, 2025
fd8584d
fix: typecheck error
arwer13 May 15, 2025
88c951d
feat(upgrade): code review
arwer13 May 21, 2025
8086d57
feat(upgrade): move V3Addresses to V3Template
arwer13 May 22, 2025
159bb13
feat(upgrade): remove immutable roles from upgrade template
arwer13 May 22, 2025
f9bbcc2
fix(upgrade): upgrade-template-v3 test
arwer13 May 22, 2025
cc5c8d1
feat(upgrade): code review
arwer13 May 23, 2025
35a0d7d
Merge 'feat/vaults' into 'feat/upgrade-on-forking'
arwer13 May 23, 2025
7942841
feat(upgrade): refactor addresses order in V3Addresses
arwer13 May 26, 2025
730b21e
Merge 'feat/vaults' into 'feat/upgrade-on-forking'
arwer13 May 28, 2025
ad94d17
feat(upgrade): code review
arwer13 May 29, 2025
5a1ce00
feat(upgrade): fix setNodeOperatorFeeBP integration test
arwer13 May 29, 2025
990a53d
feat(upgrade): fix template tests
arwer13 May 29, 2025
9882e1c
Update contracts/upgrade/V3Template.sol
TheDZhon May 30, 2025
818253d
Update contracts/upgrade/V3Template.sol
TheDZhon May 30, 2025
7b9aec1
Merge branch 'feat/vaults' into feat/upgrade-on-forking
arwer13 May 30, 2025
82867dd
fix: formatting
arwer13 May 30, 2025
5aa4ea8
fix: linter
arwer13 May 30, 2025
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
7 changes: 2 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ LOCAL_WITHDRAWAL_VAULT_ADDRESS=
LOCAL_STAKING_VAULT_FACTORY_ADDRESS=
LOCAL_STAKING_VAULT_BEACON_ADDRESS=

# RPC URL for a separate, non Hardhat Network node (Anvil, Infura, Alchemy, etc.)
MAINNET_RPC_URL=http://localhost:8545

# RPC URL for Hardhat Network forking, required for running tests on mainnet fork with tracing (Infura, Alchemy, etc.)
# RPC URL for Hardhat Network forking, required for running tests on fork with tracing (Infura, Alchemy, etc.)
# https://hardhat.org/hardhat-network/docs/guides/forking-other-networks#forking-other-networks
FORK_RPC_URL=https://eth.drpc.org
RPC_URL=https://eth.drpc.org

# https://docs.lido.fi/deployed-contracts
MAINNET_LOCATOR_ADDRESS=0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb
Expand Down
43 changes: 31 additions & 12 deletions .github/workflows/tests-integration-mainnet.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
name: Integration Tests
name: Integration Tests On Upgrade
# For local testing of this scenario use ./scripts/dao-upgrade-and-test-on-fork.sh

on: workflow_dispatch

# TODO: uncomment
#on:
# push:
# schedule:
# - cron: "0 10 */2 * *"
on: [push]

jobs:
test_hardhat_integration_fork:
Expand All @@ -18,9 +13,10 @@ jobs:
hardhat-node:
image: ghcr.io/lidofinance/hardhat-node:2.24.0
ports:
- 8545:8545
- 8555:8545
env:
ETH_RPC_URL: "${{ secrets.ETH_RPC_URL }}"
DONT_SET_CHAIN_ID: true
HARDFORK: "prague"

steps:
Expand All @@ -29,10 +25,33 @@ jobs:
- name: Common setup
uses: ./.github/workflows/setup

- name: Set env
run: cp .env.example .env
- name: Prepare network state file
run: cp deployed-mainnet.json deployed-mainnet-upgrade.json

- name: Deploy upgrade
run: yarn upgrade:deploy
env:
RPC_URL: http://localhost:8555
DEPLOYER: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" # first acc of default mnemonic "test test ..."
GAS_PRIORITY_FEE: 1
GAS_MAX_FEE: 100
NETWORK_STATE_FILE: deployed-mainnet-upgrade.json
UPGRADE_PARAMETERS_FILE: upgrade-parameters-mainnet.json

- name: Mock Aragon voting
run: yarn upgrade:mock-voting
env:
RPC_URL: http://localhost:8555
NETWORK_STATE_FILE: deployed-mainnet-upgrade.json

- name: Workaround for not updated state error when forking a fork
run: yarn hardhat --network local run --no-compile scripts/utils/mine.ts
env:
RPC_URL: http://localhost:8555

- name: Run integration tests
run: yarn test:integration:fork:mainnet
run: yarn test:integration
env:
LOG_LEVEL: debug
RPC_URL: http://localhost:8555
NETWORK_STATE_FILE: deployed-mainnet-upgrade.json
24 changes: 24 additions & 0 deletions .github/workflows/tests-integration-upgrade-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Integration Test For Upgrade Template

on: [push]

jobs:
test_hardhat_integration_fork_template:
name: Hardhat / Upgrade Template
runs-on: ubuntu-latest
timeout-minutes: 120

steps:
- uses: actions/checkout@v4

- name: Common setup
uses: ./.github/workflows/setup

- name: Prepare network state file
run: cp deployed-mainnet.json deployed-mainnet-upgrade.json

- name: Run Upgrade Template Integration Tests
run: yarn test:integration:upgrade-template
env:
RPC_URL: "${{ secrets.ETH_RPC_URL }}"
UPGRADE_PARAMETERS_FILE: upgrade-parameters-mainnet.json
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ deployed-local.json
deployed-local-devnet.json
deployed-hardhat.json
deployed-local-devnet.json
deployed-mainnet-upgrade.json

# MacOS
.DS_Store
48 changes: 32 additions & 16 deletions contracts/0.4.24/Lido.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import {StETHPermit} from "./StETHPermit.sol";

import {Versioned} from "./utils/Versioned.sol";


interface IBurnerMigration {
function migrate(address _oldBurner) external;
}

interface IStakingRouter {
function deposit(uint256 _depositsCount, uint256 _stakingModuleId, bytes _depositCalldata) external payable;

Expand All @@ -29,10 +34,7 @@ interface IStakingRouter {

function getWithdrawalCredentials() external view returns (bytes32);

function getStakingFeeAggregateDistributionE4Precision()
external
view
returns (uint16 modulesFee, uint16 treasuryFee);
function getStakingFeeAggregateDistributionE4Precision() external view returns (uint16 modulesFee, uint16 treasuryFee);
}

interface IWithdrawalQueue {
Expand Down Expand Up @@ -210,31 +212,45 @@ contract Lido is Versioned, StETHPermit, AragonApp {
emit LidoLocatorSet(_lidoLocator);
_initializeEIP712StETH(_eip712StETH);

// set infinite allowance for burner from withdrawal queue
// to burn finalized requests' shares
_approve(ILidoLocator(_lidoLocator).withdrawalQueue(), ILidoLocator(_lidoLocator).burner(), INFINITE_ALLOWANCE);
_setContractVersion(3);

_initialize_v3();
_approve(getLidoLocator().withdrawalQueue(), getLidoLocator().burner(), INFINITE_ALLOWANCE);
initialized();
}

/**
* @notice A function to finalize upgrade to v3 (from v2). Can be called only once
*
* For more details see https://github.com/lidofinance/lido-improvement-proposals/blob/develop/LIPS/lip-10.md
* @param _oldBurner The address of the old Burner contract to migrate from
* @param _contractsWithBurnerAllowances Contracts that have allowances for the old burner to be migrated
*/
function finalizeUpgrade_v3() external {
function finalizeUpgrade_v3(address _oldBurner, address[] _contractsWithBurnerAllowances) external {
require(hasInitialized(), "NOT_INITIALIZED");
_checkContractVersion(2);
require(_oldBurner != address(0), "OLD_BURNER_ADDRESS_ZERO");
address burner = getLidoLocator().burner();
require(_oldBurner != burner, "OLD_BURNER_SAME_AS_NEW");

_initialize_v3();
}

/**
* initializer for the Lido version "3"
*/
function _initialize_v3() internal {
_setContractVersion(3);

// migrate burner stETH balance
uint256 oldBurnerShares = _sharesOf(_oldBurner);
if (oldBurnerShares > 0) {
uint256 oldBurnerBalance = getPooledEthByShares(oldBurnerShares);
_transferShares(_oldBurner, burner, oldBurnerShares);
_emitTransferEvents(_oldBurner, burner, oldBurnerBalance, oldBurnerShares);
}

// initialize new burner with state from the old burner
IBurnerMigration(burner).migrate(_oldBurner);

// migrating allowances
for (uint256 i = 0; i < _contractsWithBurnerAllowances.length; i++) {
uint256 oldAllowance = allowance(_contractsWithBurnerAllowances[i], _oldBurner);
_approve(_contractsWithBurnerAllowances[i], _oldBurner, 0);
_approve(_contractsWithBurnerAllowances[i], burner, oldAllowance);
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/0.4.24/StETH.sol
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ contract StETH is IERC20, Pausable {
*
* @dev This value changes when `approve` or `transferFrom` is called.
*/
function allowance(address _owner, address _spender) external view returns (uint256) {
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowances[_owner][_spender];
}

Expand Down
42 changes: 22 additions & 20 deletions contracts/0.4.24/template/LidoTemplate.sol
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
// SPDX-FileCopyrightText: 2020 Lido <[email protected]>
// SPDX-FileCopyrightText: 2025 Lido <[email protected]>

// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.4.24;

import "@aragon/os/contracts/factory/APMRegistryFactory.sol";
import "@aragon/os/contracts/acl/ACL.sol";
import "@aragon/os/contracts/apm/Repo.sol";
import "@aragon/os/contracts/apm/APMRegistry.sol";
import "@aragon/os/contracts/ens/ENSSubdomainRegistrar.sol";
import "@aragon/os/contracts/kernel/Kernel.sol";
import "@aragon/os/contracts/lib/ens/ENS.sol";
import "@aragon/os/contracts/lib/ens/PublicResolver.sol";
import "@aragon/os/contracts/factory/DAOFactory.sol";
import "@aragon/os/contracts/common/IsContract.sol";
import {APMRegistryFactory} from "@aragon/os/contracts/factory/APMRegistryFactory.sol";
import {ACL} from "@aragon/os/contracts/acl/ACL.sol";
import {Repo} from "@aragon/os/contracts/apm/Repo.sol";
import {APMRegistry} from "@aragon/os/contracts/apm/APMRegistry.sol";
import {ENSSubdomainRegistrar} from "@aragon/os/contracts/ens/ENSSubdomainRegistrar.sol";
import {Kernel} from "@aragon/os/contracts/kernel/Kernel.sol";
import {ENS} from "@aragon/os/contracts/lib/ens/ENS.sol";
import {PublicResolver} from "@aragon/os/contracts/lib/ens/PublicResolver.sol";
import {DAOFactory} from "@aragon/os/contracts/factory/DAOFactory.sol";
import {IsContract} from "@aragon/os/contracts/common/IsContract.sol";
import {MiniMeToken, MiniMeTokenFactory} from "@aragon/minime/contracts/MiniMeToken.sol";
import {EVMScriptRegistry } from "@aragon/os/contracts/evmscript/EVMScriptRegistry.sol";

import "@aragon/apps-agent/contracts/Agent.sol";
import "@aragon/apps-vault/contracts/Vault.sol";

import "@aragon/apps-lido/apps/voting/contracts/Voting.sol";
import {Agent} from "@aragon/apps-agent/contracts/Agent.sol";
import {Vault} from "@aragon/apps-vault/contracts/Vault.sol";

import "@aragon/apps-finance/contracts/Finance.sol";
import "@aragon/apps-lido/apps/token-manager/contracts/TokenManager.sol";
import {Voting} from "@aragon/apps-lido/apps/voting/contracts/Voting.sol";
import {Finance} from "@aragon/apps-finance/contracts/Finance.sol";
import {TokenManager} from "@aragon/apps-lido/apps/token-manager/contracts/TokenManager.sol";

import "@aragon/id/contracts/IFIFSResolvingRegistrar.sol";
import {IFIFSResolvingRegistrar} from "@aragon/id/contracts/IFIFSResolvingRegistrar.sol";

import "../Lido.sol";
import "../nos/NodeOperatorsRegistry.sol";
import {Lido} from "../Lido.sol";
import {NodeOperatorsRegistry} from "../nos/NodeOperatorsRegistry.sol";

contract LidoTemplate is IsContract {
// Configuration errors
Expand Down Expand Up @@ -119,7 +121,7 @@ contract LidoTemplate is IsContract {
APMRegistryFactory private apmRegistryFactory;

DeployState private deployState;
APMRepos private apmRepos;
APMRepos public apmRepos;

event TmplAPMDeployed(address apm);
event TmplReposCreated();
Expand Down
5 changes: 4 additions & 1 deletion contracts/0.8.25/interfaces/ILido.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ pragma solidity 0.8.25;

import {IERC20} from "@openzeppelin/contracts-v5.2/token/ERC20/IERC20.sol";
import {IERC20Permit} from "@openzeppelin/contracts-v5.2/token/ERC20/extensions/IERC20Permit.sol";
import {IVersioned} from "contracts/common/interfaces/IVersioned.sol";

interface ILido is IERC20, IERC20Permit, IVersioned {
function sharesOf(address) external view returns (uint256);

interface ILido is IERC20, IERC20Permit {
function getSharesByPooledEth(uint256) external view returns (uint256);

function getPooledEthByShares(uint256) external view returns (uint256);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 Lido <[email protected]>
// SPDX-FileCopyrightText: 2025 Lido <[email protected]>
// SPDX-License-Identifier: GPL-3.0

// See contracts/COMPILERS.md
Expand Down
38 changes: 26 additions & 12 deletions contracts/0.8.9/Burner.sol
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should be a proxy?

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 Lido <[email protected]>
// SPDX-FileCopyrightText: 2025 Lido <[email protected]>
// SPDX-License-Identifier: GPL-3.0

/* See contracts/COMPILERS.md */
Expand Down Expand Up @@ -58,12 +58,14 @@ contract Burner is IBurner, AccessControlEnumerable {
using SafeERC20 for IERC20;

error AppAuthFailed();
error MigrationNotAllowedOrAlreadyMigrated();
error DirectETHTransfer();
error ZeroRecoveryAmount();
error StETHRecoveryWrongFunc();
error ZeroBurnAmount();
error BurnAmountExceedsActual(uint256 requestedAmount, uint256 actualAmount);
error ZeroAddress(string field);
error OnlyLidoCanMigrate();

bytes32 public constant REQUEST_BURN_MY_STETH_ROLE = keccak256("REQUEST_BURN_MY_STETH_ROLE");
bytes32 public constant REQUEST_BURN_SHARES_ROLE = keccak256("REQUEST_BURN_SHARES_ROLE");
Expand All @@ -74,6 +76,8 @@ contract Burner is IBurner, AccessControlEnumerable {
uint256 private totalCoverSharesBurnt;
uint256 private totalNonCoverSharesBurnt;

bool public isMigrationAllowed;

ILidoLocator public immutable LOCATOR;
ILido public immutable LIDO;

Expand Down Expand Up @@ -116,16 +120,9 @@ contract Burner is IBurner, AccessControlEnumerable {
* @param _admin the Lido DAO Aragon agent contract address
* @param _locator the Lido locator address
* @param _stETH stETH token address
* @param _totalCoverSharesBurnt Shares burnt counter init value (cover case)
* @param _totalNonCoverSharesBurnt Shares burnt counter init value (non-cover case)
* @param _isMigrationAllowed whether migration is allowed initially
*/
constructor(
address _admin,
address _locator,
address _stETH,
uint256 _totalCoverSharesBurnt,
uint256 _totalNonCoverSharesBurnt
) {
constructor(address _admin, address _locator, address _stETH, bool _isMigrationAllowed) {
if (_admin == address(0)) revert ZeroAddress("_admin");
if (_locator == address(0)) revert ZeroAddress("_locator");
if (_stETH == address(0)) revert ZeroAddress("_stETH");
Expand All @@ -135,9 +132,26 @@ contract Burner is IBurner, AccessControlEnumerable {

LOCATOR = ILidoLocator(_locator);
LIDO = ILido(_stETH);
isMigrationAllowed = _isMigrationAllowed;
}

totalCoverSharesBurnt = _totalCoverSharesBurnt;
totalNonCoverSharesBurnt = _totalNonCoverSharesBurnt;
/**
* @param _oldBurner The address of the old Burner contract
* @dev Can be called only by Lido contract. Migrates state from the old Burner. Can be run only once.
* Cannot be run if migration is disabled upon deployment.
*/
function migrate(address _oldBurner) external {
if (msg.sender != address(LIDO)) revert OnlyLidoCanMigrate();
if (_oldBurner == address(0)) revert ZeroAddress("_oldBurner");
if (!isMigrationAllowed) revert MigrationNotAllowedOrAlreadyMigrated();
isMigrationAllowed = false;

IBurner oldBurner = IBurner(_oldBurner);
totalCoverSharesBurnt = oldBurner.getCoverSharesBurnt();
totalNonCoverSharesBurnt = oldBurner.getNonCoverSharesBurnt();
(uint256 coverShares, uint256 nonCoverShares) = oldBurner.getSharesRequestedToBurn();
coverSharesBurnRequested = coverShares;
nonCoverSharesBurnRequested = nonCoverShares;
}

/**
Expand Down
11 changes: 7 additions & 4 deletions contracts/0.8.9/sanity_checks/OracleReportSanityChecker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: GPL-3.0

/* See contracts/COMPILERS.md */
pragma solidity 0.8.9;

Check warning on line 5 in contracts/0.8.9/sanity_checks/OracleReportSanityChecker.sol

View workflow job for this annotation

GitHub Actions / Solhint

Found more than One contract per file. 3 contracts found!

import {SafeCast} from "@openzeppelin/contracts-v4.4/utils/math/SafeCast.sol";

Expand Down Expand Up @@ -170,20 +170,23 @@
ISecondOpinionOracle public secondOpinionOracle;

/// @param _lidoLocator address of the LidoLocator instance
/// @param _accountingOracle address of the AccountingOracle instance
/// @param _accounting address of the Accounting instance
/// @param _admin address to grant DEFAULT_ADMIN_ROLE of the AccessControl contract
/// @param _limitsList initial values to be set for the limits list
constructor(
address _lidoLocator,
address _accountingOracle,
address _accounting,
address _admin,
LimitsList memory _limitsList
) {
if (_admin == address(0)) revert AdminCannotBeZero();
LIDO_LOCATOR = ILidoLocator(_lidoLocator);

address accountingOracle = LIDO_LOCATOR.accountingOracle();
GENESIS_TIME = IBaseOracle(accountingOracle).GENESIS_TIME();
SECONDS_PER_SLOT = IBaseOracle(accountingOracle).SECONDS_PER_SLOT();
ACCOUNTING_ADDRESS = LIDO_LOCATOR.accounting();
GENESIS_TIME = IBaseOracle(_accountingOracle).GENESIS_TIME();
SECONDS_PER_SLOT = IBaseOracle(_accountingOracle).SECONDS_PER_SLOT();
ACCOUNTING_ADDRESS = _accounting;

_updateLimits(_limitsList);

Expand Down
Loading
Loading