Skip to content

Commit

Permalink
Added fixAccounting and pauseStaking HH tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
naddison36 committed Jun 3, 2024
1 parent 6b31de6 commit 41f9414
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
34 changes: 34 additions & 0 deletions contracts/tasks/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ const {
doAccounting,
resetStakeETHTally,
setStakeETHThreshold,
fixAccounting,
pauseStaking,
} = require("./validator");
const { resolveContract } = require("../utils/resolvers");
const { harvestAndSwap } = require("./harvest");
Expand Down Expand Up @@ -1135,6 +1137,38 @@ task("setStakeETHThreshold").setAction(async (_, __, runSuper) => {
return runSuper();
});

subtask("fixAccounting", "Fix the accounting of the Native Staking Strategy.")
.addOptionalParam(
"validators",
"The number of validators to adjust up or down (negative)",
0,
types.int
)
.addOptionalParam(
"rewards",
"The number of consensus rewards to adjust up or down (negative) in ether",
0,
types.float
)
.addOptionalParam(
"ether",
"amount of ether that gets wrapped into WETH and sent to the Vault",
0,
types.float
)
.setAction(fixAccounting);
task("fixAccounting").setAction(async (_, __, runSuper) => {
return runSuper();
});

subtask(
"pauseStaking",
"Pause the staking of the Native Staking Strategy"
).setAction(pauseStaking);
task("pauseStaking").setAction(async (_, __, runSuper) => {
return runSuper();
});

// Defender
subtask(
"setActionVars",
Expand Down
30 changes: 30 additions & 0 deletions contracts/tasks/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,34 @@ async function setStakeETHThreshold({ amount }) {
await logTxDetails(tx, "setStakeETHThreshold");
}

async function fixAccounting({ validators, rewards, ether }) {
const signer = await getSigner();

const strategy = await resolveContract(
"NativeStakingSSVStrategyProxy",
"NativeStakingSSVStrategy"
);

log(`About to fix accounting`);
const tx = await strategy
.connect(signer)
.manuallyFixAccounting(validators, rewards, ether);
await logTxDetails(tx, "manuallyFixAccounting");
}

async function pauseStaking() {
const signer = await getSigner();

const strategy = await resolveContract(
"NativeStakingSSVStrategyProxy",
"NativeStakingSSVStrategy"
);

log(`About to pause the Native Staking Strategy`);
const tx = await strategy.connect(signer).pause();
await logTxDetails(tx, "pause");
}

module.exports = {
validatorOperationsConfig,
registerValidators,
Expand All @@ -847,4 +875,6 @@ module.exports = {
doAccounting,
resetStakeETHTally,
setStakeETHThreshold,
fixAccounting,
pauseStaking,
};

0 comments on commit 41f9414

Please sign in to comment.