Skip to content
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

feat: Update LidoLocator with wstETH contract address #863

Closed
wants to merge 7 commits into from
Closed
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
10 changes: 7 additions & 3 deletions contracts/0.8.9/LidoLocator.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// SPDX-FileCopyrightText: 2023 Lido <[email protected]>
// SPDX-License-Identifier: GPL-3.0

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

// solhint-disable immutable-vars-naming

import {ILidoLocator} from "../common/interfaces/ILidoLocator.sol";

/**
Expand All @@ -28,6 +29,7 @@ contract LidoLocator is ILidoLocator {
address withdrawalQueue;
address withdrawalVault;
address oracleDaemonConfig;
address wstEth;
}

error ZeroAddress();
Expand All @@ -46,6 +48,7 @@ contract LidoLocator is ILidoLocator {
address public immutable withdrawalQueue;
address public immutable withdrawalVault;
address public immutable oracleDaemonConfig;
address public immutable wstEth;

/**
* @notice declare service locations
Expand All @@ -67,9 +70,10 @@ contract LidoLocator is ILidoLocator {
withdrawalQueue = _assertNonZero(_config.withdrawalQueue);
withdrawalVault = _assertNonZero(_config.withdrawalVault);
oracleDaemonConfig = _assertNonZero(_config.oracleDaemonConfig);
wstEth = _assertNonZero(_config.wstEth);
}

function coreComponents() external view returns(
function coreComponents() external view returns (
address,
address,
address,
Expand All @@ -87,7 +91,7 @@ contract LidoLocator is ILidoLocator {
);
}

function oracleReportComponentsForLido() external view returns(
function oracleReportComponentsForLido() external view returns (
address,
address,
address,
Expand Down
41 changes: 24 additions & 17 deletions contracts/common/interfaces/ILidoLocator.sol
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@
// SPDX-FileCopyrightText: 2023 Lido <[email protected]>
// SPDX-License-Identifier: GPL-3.0

// See contracts/COMPILERS.md
// solhint-disable-next-line
pragma solidity >=0.4.24 <0.9.0;

interface ILidoLocator {
function accountingOracle() external view returns(address);
function depositSecurityModule() external view returns(address);
function elRewardsVault() external view returns(address);
function legacyOracle() external view returns(address);
function lido() external view returns(address);
function oracleReportSanityChecker() external view returns(address);
function burner() external view returns(address);
function stakingRouter() external view returns(address);
function treasury() external view returns(address);
function validatorsExitBusOracle() external view returns(address);
function withdrawalQueue() external view returns(address);
function withdrawalVault() external view returns(address);
function postTokenRebaseReceiver() external view returns(address);
function oracleDaemonConfig() external view returns(address);
function coreComponents() external view returns(

function accountingOracle() external view returns (address);
function depositSecurityModule() external view returns (address);
function elRewardsVault() external view returns (address);
function legacyOracle() external view returns (address);
function lido() external view returns (address);
function oracleReportSanityChecker() external view returns (address);
function burner() external view returns (address);
function stakingRouter() external view returns (address);
function treasury() external view returns (address);
function validatorsExitBusOracle() external view returns (address);
function withdrawalQueue() external view returns (address);
function withdrawalVault() external view returns (address);
function postTokenRebaseReceiver() external view returns (address);
function oracleDaemonConfig() external view returns (address);
function wstEth() external view returns (address);

/// @dev Returns a batch of core components addresses at once.
/// It's just a more gas-efficient way of calling several public getters at once.
function coreComponents() external view returns (
address elRewardsVault,
address oracleReportSanityChecker,
address stakingRouter,
address treasury,
address withdrawalQueue,
address withdrawalVault
);
function oracleReportComponentsForLido() external view returns(

/// @dev Returns a batch of addresses that is used specifically during oracle report handling in the Lido contract.
/// It's just a more gas-efficient way of calling several public getters at once.
function oracleReportComponentsForLido() external view returns (
address accountingOracle,
address elRewardsVault,
address oracleReportSanityChecker,
Expand Down
1 change: 1 addition & 0 deletions lib/protocol/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const defaultEnv = {
withdrawalQueue: "WITHDRAWAL_QUEUE_ADDRESS",
withdrawalVault: "WITHDRAWAL_VAULT_ADDRESS",
oracleDaemonConfig: "ORACLE_DAEMON_CONFIG_ADDRESS",
wstEth: "WST_ETH_ADDRESS",
// aragon contracts
kernel: "ARAGON_KERNEL_ADDRESS",
acl: "ARAGON_ACL_ADDRESS",
Expand Down
4 changes: 4 additions & 0 deletions lib/protocol/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
ValidatorsExitBusOracle,
WithdrawalQueueERC721,
WithdrawalVault,
WstETH,
} from "typechain-types";

export type ProtocolNetworkItems = {
Expand All @@ -41,6 +42,7 @@ export type ProtocolNetworkItems = {
withdrawalQueue: string;
withdrawalVault: string;
oracleDaemonConfig: string;
wstEth: string;
// aragon contracts
kernel: string;
acl: string;
Expand All @@ -65,6 +67,7 @@ export interface ContractTypes {
WithdrawalQueueERC721: WithdrawalQueueERC721;
WithdrawalVault: WithdrawalVault;
OracleDaemonConfig: OracleDaemonConfig;
WstETH: WstETH;
Kernel: Kernel;
ACL: ACL;
HashConsensus: HashConsensus;
Expand Down Expand Up @@ -93,6 +96,7 @@ export type CoreContracts = {
withdrawalQueue: LoadedContract<WithdrawalQueueERC721>;
withdrawalVault: LoadedContract<WithdrawalVault>;
oracleDaemonConfig: LoadedContract<OracleDaemonConfig>;
wstEth: LoadedContract<WstETH>;
};

export type AragonContracts = {
Expand Down
1 change: 1 addition & 0 deletions scripts/scratch/steps/09-deploy-non-aragon-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ async function main() {
withdrawalQueueERC721.address,
withdrawalVaultAddress,
oracleDaemonConfig.address,
wstETH.address,
];
await updateProxyImplementation(Sk.lidoLocator, "LidoLocator", locator.address, proxyContractsOwner, [locatorConfig]);

Expand Down
3 changes: 3 additions & 0 deletions scripts/upgrade/deploy-locator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const VIEW_NAMES_AND_CTOR_ARGS = [
"withdrawalQueue",
"withdrawalVault",
"oracleDaemonConfig",
"wstEth",
];

/////////////// GLOBAL VARIABLES ///////////////
Expand Down Expand Up @@ -52,12 +53,14 @@ async function main() {
const newOrCurrent = async (name: string) => {
return await getNewFromEnvOrCurrent(name, locator);
};

const ctorArgs = await Promise.all(VIEW_NAMES_AND_CTOR_ARGS.map(newOrCurrent));

if (Object.keys(g_newAddresses).length === 0) {
log(`No new addresses specified: exiting doing nothing`);
process.exit(0);
}

log.splitter();
for (const name in g_newAddresses) {
log(`(!) "${name}" new address: ${g_newAddresses[name]}`);
Expand Down
3 changes: 3 additions & 0 deletions test/0.8.9/contracts/LidoLocator__MockMutable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ contract LidoLocator__MockMutable {
address withdrawalQueue;
address withdrawalVault;
address oracleDaemonConfig;
address wstEth;
}

error ZeroAddress();
Expand All @@ -37,6 +38,7 @@ contract LidoLocator__MockMutable {
address public immutable withdrawalQueue;
address public immutable withdrawalVault;
address public immutable oracleDaemonConfig;
address public immutable wstEth;

/**
* @notice declare service locations
Expand All @@ -58,6 +60,7 @@ contract LidoLocator__MockMutable {
withdrawalQueue = _assertNonZero(_config.withdrawalQueue);
withdrawalVault = _assertNonZero(_config.withdrawalVault);
oracleDaemonConfig = _assertNonZero(_config.oracleDaemonConfig);
wstEth = _assertNonZero(_config.wstEth);
}

function coreComponents() external view returns (address, address, address, address, address, address) {
Expand Down
1 change: 1 addition & 0 deletions test/0.8.9/lidoLocator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const services = [
"withdrawalQueue",
"withdrawalVault",
"oracleDaemonConfig",
"wstEth",
] as const;

type Service = ArrayToUnion<typeof services>;
Expand Down
2 changes: 2 additions & 0 deletions test/deploy/locator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ async function deployDummyLocator(config?: Partial<LidoLocator.ConfigStruct>, de
validatorsExitBusOracle: certainAddress("dummy-locator:validatorsExitBusOracle"),
withdrawalQueue: certainAddress("dummy-locator:withdrawalQueue"),
withdrawalVault: certainAddress("dummy-locator:withdrawalVault"),
wstEth: certainAddress("dummy-locator:wstEth"),
...config,
});

Expand Down Expand Up @@ -102,6 +103,7 @@ async function getLocatorConfig(locatorAddress: string) {
"withdrawalQueue",
"withdrawalVault",
"oracleDaemonConfig",
"wstEth",
] as Partial<keyof LidoLocator.ConfigStruct>[];

const configPromises = addresses.map((name) => locator[name]());
Expand Down
Loading