Skip to content

Commit

Permalink
moved more logic into native staking fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
naddison36 committed Apr 29, 2024
1 parent 51e1748 commit 8bf8f7d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
14 changes: 12 additions & 2 deletions contracts/test/_fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -1551,14 +1551,24 @@ async function nativeStakingSSVStrategyFixture() {
});

if (isFork) {
const { oethVault, weth, nativeStakingSSVStrategy, timelock } = fixture;
const { oethVault, weth, nativeStakingSSVStrategy, ssv, timelock } =
fixture;
await oethVault
.connect(timelock)
.setAssetDefaultStrategy(weth.address, nativeStakingSSVStrategy.address);

fixture.validatorRegistrator = await ethers.provider.getSigner(
// The Defender Relayer
fixture.validatorRegistrator = await impersonateAndFund(
addresses.mainnet.validatorRegistrator
);

// Fund some SSV to the native staking strategy
const ssvWhale = await impersonateAndFund(
"0xf977814e90da44bfa03b6295a0616a897441acec" // Binance 8
);
await ssv
.connect(ssvWhale)
.transfer(nativeStakingSSVStrategy.address, oethUnits("100"));
} else {
const { governorAddr } = await getNamedAccounts();
const { oethVault, weth, nativeStakingSSVStrategy } = fixture;
Expand Down
16 changes: 1 addition & 15 deletions contracts/test/strategies/nativeSsvStaking.fork-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,6 @@ describe("ForkTest: Native SSV Staking Strategy", function () {
"0x0d12c28849771f3f946d8d705a1f73683d97add9edaec5e6b30650cc03bc57d5",
};

beforeEach(async () => {
const { nativeStakingSSVStrategy, ssv } = fixture;
// Add some ETH to the Defender Relayer account
// TODO this can be removed once the account is funded on mainnet
await impersonateAndFund(addresses.mainnet.validatorRegistrator, 1);

// Fund some SSV to the native staking strategy
const ssvWhale = await impersonateAndFund(
"0xf977814e90da44bfa03b6295a0616a897441acec" // Binance 8
);
await ssv
.connect(ssvWhale)
.transfer(nativeStakingSSVStrategy.address, oethUnits("100"));
});

it("Should register and staked 32 ETH by validator registrator", async () => {
const { weth, domen, nativeStakingSSVStrategy, validatorRegistrator } =
fixture;
Expand All @@ -149,6 +134,7 @@ describe("ForkTest: Native SSV Staking Strategy", function () {
chainId: 1,
ssvNetwork: addresses.mainnet.SSVNetwork,
});
// const cluster = ["0", "0", "0", true, "0"];
const stakeAmount = oethUnits("32");

// Register a new validator with the SSV Network
Expand Down
8 changes: 6 additions & 2 deletions contracts/utils/ssv.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const { logTxDetails } = require("../utils/txLogger");
const { parseUnits, formatUnits } = require("ethers/lib/utils");
const { ClusterScanner, NonceScanner } = require("ssv-scanner");
const { SSVKeys, KeyShares, KeySharesItem } = require("ssv-keys");
const path = require("path");
const fsp = require("fs").promises;

const { isForkWithLocalNode } = require("../test/helpers");
const { logTxDetails } = require("../utils/txLogger");

const log = require("../utils/logger")("utils:ssv");

const depositSSV = async (options) => {
Expand Down Expand Up @@ -126,7 +128,9 @@ const getClusterInfo = async ({
}) => {
const ssvNetworkName = chainId === 1 ? "MAINNET" : "HOLESKY";
log(`SSV network: ${ssvNetworkName}`);
const providerUrl = process.env.PROVIDER_URL;
const providerUrl = isForkWithLocalNode
? "http://localhost:8545/"
: process.env.PROVIDER_URL;
log(`Provider URL: ${providerUrl}`);

const params = {
Expand Down

0 comments on commit 8bf8f7d

Please sign in to comment.