Skip to content

Commit

Permalink
feat: add wstETH to locator
Browse files Browse the repository at this point in the history
  • Loading branch information
tamtamchik committed Dec 10, 2024
1 parent fb2aa93 commit 2c31ba1
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 0 deletions.
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
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
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

0 comments on commit 2c31ba1

Please sign in to comment.