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: add wstETH to locator #898

Merged
merged 2 commits into from
Dec 16, 2024
Merged
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 contracts/0.8.9/LidoLocator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ contract LidoLocator is ILidoLocator {
address withdrawalVault;
address oracleDaemonConfig;
address accounting;
address wstETH;
}

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

/**
* @notice declare service locations
Expand All @@ -70,6 +72,7 @@ contract LidoLocator is ILidoLocator {
withdrawalVault = _assertNonZero(_config.withdrawalVault);
oracleDaemonConfig = _assertNonZero(_config.oracleDaemonConfig);
accounting = _assertNonZero(_config.accounting);
wstETH = _assertNonZero(_config.wstETH);
}

function coreComponents() external view returns(
Expand Down
7 changes: 7 additions & 0 deletions contracts/common/interfaces/ILidoLocator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ interface ILidoLocator {
function postTokenRebaseReceiver() external view returns(address);
function oracleDaemonConfig() external view returns(address);
function accounting() external view returns (address);
function wstETH() external view returns (address);

/// @notice Returns core Lido protocol component addresses in a single call
/// @dev This function provides a gas-efficient way to fetch multiple component addresses in a single call
function coreComponents() external view returns(
address elRewardsVault,
address oracleReportSanityChecker,
Expand All @@ -29,6 +33,9 @@ interface ILidoLocator {
address withdrawalQueue,
address withdrawalVault
);

/// @notice Returns addresses of components involved in processing oracle reports in the Lido contract
/// @dev This function provides a gas-efficient way to fetch multiple component addresses in a single call
function oracleReportComponents() external view returns(
address accountingOracle,
address oracleReportSanityChecker,
Expand Down
2 changes: 2 additions & 0 deletions globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ declare namespace NodeJS {
LOCAL_KERNEL_ADDRESS?: string;
LOCAL_LEGACY_ORACLE_ADDRESS?: string;
LOCAL_LIDO_ADDRESS?: string;
LOCAL_WSTETH_ADDRESS?: string;
LOCAL_NOR_ADDRESS?: string;
LOCAL_ORACLE_DAEMON_CONFIG_ADDRESS?: string;
LOCAL_ORACLE_REPORT_SANITY_CHECKER_ADDRESS?: string;
Expand All @@ -64,6 +65,7 @@ declare namespace NodeJS {
MAINNET_KERNEL_ADDRESS?: string;
MAINNET_LEGACY_ORACLE_ADDRESS?: string;
MAINNET_LIDO_ADDRESS?: string;
MAINNET_WSTETH_ADDRESS?: string;
MAINNET_NOR_ADDRESS?: string;
MAINNET_ORACLE_DAEMON_CONFIG_ADDRESS?: string;
MAINNET_ORACLE_REPORT_SANITY_CHECKER_ADDRESS?: string;
Expand Down
1 change: 1 addition & 0 deletions lib/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ async function getLocatorConfig(locatorAddress: string) {
"withdrawalVault",
"oracleDaemonConfig",
"accounting",
"wstETH",
] as (keyof LidoLocator.ConfigStruct)[];

const configPromises = addresses.map((name) => locator[name]());
Expand Down
1 change: 1 addition & 0 deletions lib/protocol/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const defaultEnv = {
withdrawalQueue: "WITHDRAWAL_QUEUE_ADDRESS",
withdrawalVault: "WITHDRAWAL_VAULT_ADDRESS",
oracleDaemonConfig: "ORACLE_DAEMON_CONFIG_ADDRESS",
wstETH: "WSTETH_ADDRESS",
// aragon contracts
kernel: "ARAGON_KERNEL_ADDRESS",
acl: "ARAGON_ACL_ADDRESS",
Expand Down
1 change: 1 addition & 0 deletions scripts/scratch/steps/0090-deploy-non-aragon-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export async function main() {
withdrawalVaultAddress,
oracleDaemonConfig.address,
accounting.address,
wstETH.address,
];
await updateProxyImplementation(Sk.lidoLocator, "LidoLocator", locator.address, proxyContractsOwner, [locatorConfig]);
}
3 changes: 3 additions & 0 deletions test/0.8.9/contracts/LidoLocator__MockForSanityChecker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ contract LidoLocator__MockForSanityChecker is ILidoLocator {
address postTokenRebaseReceiver;
address oracleDaemonConfig;
address accounting;
address wstETH;
}

address public immutable lido;
Expand All @@ -40,6 +41,7 @@ contract LidoLocator__MockForSanityChecker is ILidoLocator {
address public immutable postTokenRebaseReceiver;
address public immutable oracleDaemonConfig;
address public immutable accounting;
address public immutable wstETH;

constructor (
ContractAddresses memory addresses
Expand All @@ -59,6 +61,7 @@ contract LidoLocator__MockForSanityChecker is ILidoLocator {
postTokenRebaseReceiver = addresses.postTokenRebaseReceiver;
oracleDaemonConfig = addresses.oracleDaemonConfig;
accounting = addresses.accounting;
wstETH = addresses.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 = [
"withdrawalVault",
"oracleDaemonConfig",
"accounting",
"wstETH",
] as const;

type Service = ArrayToUnion<typeof services>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ describe("OracleReportSanityChecker.sol:negative-rebase", () => {
postTokenRebaseReceiver: deployer.address,
oracleDaemonConfig: deployer.address,
accounting: await accounting.getAddress(),
wstETH: deployer.address,
},
]);

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

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

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