Skip to content
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
2 changes: 0 additions & 2 deletions lib/protocol/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { getMode } from "hardhat.helpers";
import { deployScratchProtocol, deployUpgrade, ether, findEventsWithInterfaces, impersonate, log } from "lib";

import { discover } from "./discover";
import { ensurePredepositGuaranteeUnpaused } from "./helpers";
import { provision } from "./provision";
import { ProtocolContext, ProtocolContextFlags, ProtocolSigners, Signer } from "./types";

Expand Down Expand Up @@ -88,7 +87,6 @@ export const getProtocolContext = async (skipV3Contracts: boolean = false): Prom
await provision(context);
} else {
await ensureVaultsShareLimit(context);
await ensurePredepositGuaranteeUnpaused(context);
}

return context;
Expand Down
5 changes: 5 additions & 0 deletions test/integration/vaults/disconnected.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
} from "lib";
import {
createVaultWithDashboard,
ensurePredepositGuaranteeUnpaused,
getProtocolContext,
getPubkeys,
mockProof,
Expand Down Expand Up @@ -273,6 +274,10 @@ describe("Integration: Actions with vault disconnected from hub", () => {
});

describe("Deposits", () => {
before(async () => {
await ensurePredepositGuaranteeUnpaused(ctx);
});

beforeEach(async () => {
await stakingVault.connect(owner).fund({ value: ether("2048") });
});
Expand Down
5 changes: 5 additions & 0 deletions test/integration/vaults/gate-seal-pause.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const IGateSeal_ABI = [
import { ether, generateValidator } from "lib";
import {
createVaultWithDashboard,
ensurePredepositGuaranteeUnpaused,
generatePredepositData,
getProtocolContext,
ProtocolContext,
Expand Down Expand Up @@ -122,6 +123,7 @@ describe("Integration: GateSeal pause functionality for VaultHub and PredepositG
});

it("GateSeal can pause PredepositGuarantee", async function () {
await ensurePredepositGuaranteeUnpaused(ctx);
if (ctx.isScratch) {
this.skip();
}
Expand Down Expand Up @@ -164,6 +166,7 @@ describe("Integration: GateSeal pause functionality for VaultHub and PredepositG
});

it("GateSeal can pause both VaultHub and PredepositGuarantee simultaneously", async function () {
await ensurePredepositGuaranteeUnpaused(ctx);
if (ctx.isScratch) {
this.skip();
}
Expand Down Expand Up @@ -215,6 +218,7 @@ describe("Integration: GateSeal pause functionality for VaultHub and PredepositG
});

it("Operations resume after RESUME_ROLE holder resumes the contracts", async function () {
await ensurePredepositGuaranteeUnpaused(ctx);
if (ctx.isScratch) {
this.skip();
}
Expand Down Expand Up @@ -277,6 +281,7 @@ describe("Integration: GateSeal pause functionality for VaultHub and PredepositG
});

it("Cannot seal when PredepositGuarantee is already paused", async function () {
await ensurePredepositGuaranteeUnpaused(ctx);
if (ctx.isScratch) {
this.skip();
}
Expand Down
3 changes: 3 additions & 0 deletions test/integration/vaults/pdg.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Dashboard, DepositContract, StakingVault } from "typechain-types";
import { ether, generateValidator, PDGPolicy, toGwei, toLittleEndian64 } from "lib";
import {
createVaultWithDashboard,
ensurePredepositGuaranteeUnpaused,
generatePredepositData,
getProtocolContext,
mockProof,
Expand Down Expand Up @@ -37,6 +38,8 @@ describe("Integration: Predeposit Guarantee core functionality", () => {

originalSnapshot = await Snapshot.take();

await ensurePredepositGuaranteeUnpaused(ctx);

await setupLidoForVaults(ctx);

[owner, nodeOperator, stranger] = await ethers.getSigners();
Expand Down
25 changes: 25 additions & 0 deletions test/integration/vaults/scenario/happy-path.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
import { TOTAL_BASIS_POINTS } from "lib/constants";
import {
calculateLockedValue,
ensurePredepositGuaranteeUnpaused,
getProtocolContext,
getReportTimeElapsed,
OracleReportParams,
Expand Down Expand Up @@ -76,6 +77,7 @@ describe("Scenario: Staking Vaults Happy Path", () => {
const { depositSecurityModule } = ctx.contracts;
depositContract = await depositSecurityModule.DEPOSIT_CONTRACT();

await ensurePredepositGuaranteeUnpaused(ctx);
await setupLidoForVaults(ctx);

// add ETH to NO for PDG deposit + gas
Expand Down Expand Up @@ -423,6 +425,29 @@ describe("Scenario: Staking Vaults Happy Path", () => {
expect(reportEvents.length).to.equal(1n);

expect(await vaultHub.locked(stakingVaultAddress)).to.equal(0);
expect(await vaultHub.isVaultConnected(stakingVaultAddress)).to.equal(false);
});

it("Should allow to transfer the StakingVault ownership to the owner", async () => {
const { vaultHub } = ctx.contracts;

await expect(dashboard.connect(owner).abandonDashboard(owner))
.to.emit(stakingVault, "OwnershipTransferred")
.withArgs(vaultHub, dashboard)
.to.emit(stakingVault, "OwnershipTransferStarted")
.withArgs(dashboard, owner);
expect(await stakingVault.pendingOwner()).to.equal(owner);

await expect(stakingVault.connect(owner).acceptOwnership())
.to.emit(stakingVault, "OwnershipTransferred")
.withArgs(dashboard, owner);
expect(await stakingVault.owner()).to.equal(owner);
});

it("Should allow to withdraw the deposit from the vault", async () => {
const withdrawTx = await stakingVault.connect(owner).withdraw(owner, VAULT_CONNECTION_DEPOSIT);
await expect(withdrawTx).to.emit(stakingVault, "EtherWithdrawn").withArgs(owner, VAULT_CONNECTION_DEPOSIT);
await expect(withdrawTx).changeEtherBalance(owner, VAULT_CONNECTION_DEPOSIT);
});

async function isSoleRoleMember(account: HardhatEthersSigner, role: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { TOTAL_BASIS_POINTS } from "lib/constants";
import { mEqual } from "lib/promise";
import {
createVaultProxyWithoutConnectingToVaultHub,
ensurePredepositGuaranteeUnpaused,
getProtocolContext,
getReportTimeElapsed,
ProtocolContext,
Expand Down Expand Up @@ -191,6 +192,7 @@ resetState(
agent = await ctx.getSigner("agent");

await setupLidoForVaults(ctx);
await ensurePredepositGuaranteeUnpaused(ctx);
await setBalance(nodeOperator.address, ether("100"));

slot = await predepositGuarantee.PIVOT_SLOT();
Expand Down
2 changes: 2 additions & 0 deletions test/integration/vaults/scenario/pdg-deposit.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
} from "lib";
import {
createVaultWithDashboard,
ensurePredepositGuaranteeUnpaused,
getProtocolContext,
mockProof,
ProtocolContext,
Expand Down Expand Up @@ -48,6 +49,7 @@ describe("Scenario: Predeposit Guarantee happy path and frontrunning", () => {

originalSnapshot = await Snapshot.take();

await ensurePredepositGuaranteeUnpaused(ctx);
await setupLidoForVaults(ctx);

[owner, nodeOperator, guarantor, depositor, stranger] = await ethers.getSigners();
Expand Down
Loading