Skip to content

Commit

Permalink
feat: update VaultHub constructor to accept StETH address directly
Browse files Browse the repository at this point in the history
  • Loading branch information
DiRaiks committed Mar 2, 2025
1 parent 01450ad commit 7a8ef28
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 10 deletions.
4 changes: 2 additions & 2 deletions contracts/0.8.25/vaults/VaultHub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ contract VaultHub is PausableUntilWithRoles {
/// @param _accounting Accounting contract
/// @param _connectedVaultsLimit Maximum number of vaults that can be connected simultaneously
/// @param _relativeShareLimitBP Maximum share limit relative to TVL in basis points
constructor(ILidoLocator _locator, address _accounting, uint256 _connectedVaultsLimit, uint256 _relativeShareLimitBP) {
constructor(ILidoLocator _locator, IStETH _stETH, address _accounting, uint256 _connectedVaultsLimit, uint256 _relativeShareLimitBP) {
if (_connectedVaultsLimit == 0) revert ZeroArgument("_connectedVaultsLimit");
if (_relativeShareLimitBP == 0) revert ZeroArgument("_relativeShareLimitBP");
if (_relativeShareLimitBP > TOTAL_BASIS_POINTS) revert RelativeShareLimitBPTooHigh(_relativeShareLimitBP, TOTAL_BASIS_POINTS);

LIDO_LOCATOR = _locator;
STETH = IStETH(_locator.lido());
STETH = _stETH;
ACCOUNTING = _accounting;
CONNECTED_VAULTS_LIMIT = _connectedVaultsLimit;
RELATIVE_SHARE_LIMIT_BP = _relativeShareLimitBP;
Expand Down
25 changes: 18 additions & 7 deletions scripts/scratch/steps/0090-deploy-non-aragon-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,17 @@ export async function main() {
]);

// Deploy DummyEmptyContract
const locatorAddress = state[Sk.lidoLocator].proxy.address;
const dummyContract = await deployWithoutProxy(Sk.dummyEmptyContract, "DummyEmptyContract", deployer);

// Deploy LidoLocator with dummy implementation
const locator = await deployBehindOssifiableProxy(
Sk.lidoLocator,
"DummyEmptyContract",
proxyContractsOwner,
deployer,
[],
dummyContract.address,
);

// Deploy EIP712StETH
await deployWithoutProxy(Sk.eip712StETH, "EIP712StETH", deployer, [lidoAddress]);
Expand Down Expand Up @@ -130,12 +140,13 @@ export async function main() {

// Deploy Accounting
const accounting = await deployBehindOssifiableProxy(Sk.accounting, "Accounting", proxyContractsOwner, deployer, [
locatorAddress,
locator.address,
lidoAddress,
]);

const vaultHub = await deployBehindOssifiableProxy(Sk.vaultHub, "VaultHub", proxyContractsOwner, deployer, [
locatorAddress,
locator.address,
lidoAddress,
accounting.address,
vaultHubParams.connectedVaultsLimit,
vaultHubParams.relativeShareLimitBP,
Expand All @@ -147,7 +158,7 @@ export async function main() {
"AccountingOracle",
proxyContractsOwner,
deployer,
[locatorAddress, legacyOracleAddress, Number(chainSpec.secondsPerSlot), Number(chainSpec.genesisTime)],
[locator.address, legacyOracleAddress, Number(chainSpec.secondsPerSlot), Number(chainSpec.genesisTime)],
);

// Deploy HashConsensus for AccountingOracle
Expand All @@ -167,7 +178,7 @@ export async function main() {
"ValidatorsExitBusOracle",
proxyContractsOwner,
deployer,
[chainSpec.secondsPerSlot, chainSpec.genesisTime, locatorAddress],
[chainSpec.secondsPerSlot, chainSpec.genesisTime, locator.address],
);

// Deploy HashConsensus for ValidatorsExitBusOracle
Expand All @@ -184,7 +195,7 @@ export async function main() {
// Deploy Burner
const burner = await deployWithoutProxy(Sk.burner, "Burner", deployer, [
admin,
locatorAddress,
locator.address,
lidoAddress,
burnerParams.totalCoverSharesBurnt,
burnerParams.totalNonCoverSharesBurnt,
Expand All @@ -210,5 +221,5 @@ export async function main() {
wstETH.address,
vaultHub.address,
];
await updateProxyImplementation(Sk.lidoLocator, "LidoLocator", locatorAddress, proxyContractsOwner, [locatorConfig]);
await updateProxyImplementation(Sk.lidoLocator, "LidoLocator", locator.address, proxyContractsOwner, [locatorConfig]);
}
1 change: 1 addition & 0 deletions test/0.8.25/vaults/vaultFactory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ describe("VaultFactory.sol", () => {
// Accounting
vaultHubImpl = await ethers.deployContract("VaultHub", [
locator,
steth,
ZeroAddress,
VAULTS_CONNECTED_VAULTS_LIMIT,
VAULTS_RELATIVE_SHARE_LIMIT_BP,
Expand Down
1 change: 1 addition & 0 deletions test/0.8.25/vaults/vaultHub.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe("VaultHub.sol", () => {
// VaultHub
vaultHubImpl = await ethers.deployContract("VaultHub", [
locator,
steth,
ZeroAddress,
VAULTS_CONNECTED_VAULTS_LIMIT,
VAULTS_RELATIVE_SHARE_LIMIT_BP,
Expand Down
4 changes: 3 additions & 1 deletion test/0.8.25/vaults/vaulthub/contracts/VaultHub__Harness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ pragma solidity ^0.8.0;

import {VaultHub} from "contracts/0.8.25/vaults/VaultHub.sol";
import {ILidoLocator} from "contracts/common/interfaces/ILidoLocator.sol";
import {ILido as IStETH} from "contracts/0.8.25/interfaces/ILido.sol";

contract VaultHub__Harness is VaultHub {
constructor(
address _locator,
address _stETH,
uint256 _connectedVaultsLimit,
uint256 _relativeShareLimitBP
) VaultHub(ILidoLocator(_locator), address(0), _connectedVaultsLimit, _relativeShareLimitBP) {}
) VaultHub(ILidoLocator(_locator), IStETH(_stETH), address(0), _connectedVaultsLimit, _relativeShareLimitBP) {}

function mock__calculateVaultsRebase(
uint256 _postTotalShares,
Expand Down
1 change: 1 addition & 0 deletions test/0.8.25/vaults/vaulthub/vaulthub.forceExit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ describe("VaultHub.sol:forceExit", () => {

const vaultHubImpl = await ethers.deployContract("VaultHub__Harness", [
locator,
steth,
VAULTS_CONNECTED_VAULTS_LIMIT,
VAULTS_RELATIVE_SHARE_LIMIT_BP,
]);
Expand Down
1 change: 1 addition & 0 deletions test/0.8.25/vaults/vaulthub/vaulthub.hub.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ describe("VaultHub.sol:hub", () => {

const vaultHubImpl = await ethers.deployContract("VaultHub", [
locator,
lido,
ZeroAddress,
VAULTS_CONNECTED_VAULTS_LIMIT,
VAULTS_RELATIVE_SHARE_LIMIT_BP,
Expand Down
1 change: 1 addition & 0 deletions test/0.8.25/vaults/vaulthub/vaulthub.pausable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe("VaultHub.sol:pausableUntil", () => {

const vaultHubImpl = await ethers.deployContract("VaultHub", [
locator,
steth,
ZeroAddress,
VAULTS_CONNECTED_VAULTS_LIMIT,
VAULTS_RELATIVE_SHARE_LIMIT_BP,
Expand Down

0 comments on commit 7a8ef28

Please sign in to comment.