Skip to content

Commit

Permalink
Harvest Action now collects if there is > 0.5 execution rewards (#2281)
Browse files Browse the repository at this point in the history
  • Loading branch information
naddison36 authored Oct 20, 2024
1 parent db2f3fa commit 7a65810
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
21 changes: 17 additions & 4 deletions contracts/scripts/defender-actions/harvest.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,33 @@ const harvest = async (
signer,
stratDesc
) => {
const nativeStakingStrategy1 = new ethers.Contract(
const nativeStakingStrategy = new ethers.Contract(
nativeStakingProxyAddress,
nativeStakingStrategyAbi,
signer
);
const consensusRewards = await nativeStakingStrategy1.consensusRewards();
const consensusRewards = await nativeStakingStrategy.consensusRewards();
log(`Consensus rewards for ${stratDesc}: ${formatUnits(consensusRewards)}`);
if (consensusRewards.gt(parseEther("1"))) {

const feeAccumulatorAddress =
await nativeStakingStrategy.FEE_ACCUMULATOR_ADDRESS();
const executionRewards = await signer.provider.getBalance(
feeAccumulatorAddress
);
log(`Execution rewards for ${stratDesc}: ${formatUnits(executionRewards)}`);

if (
consensusRewards.gt(parseEther("1")) ||
executionRewards.gt(parseEther("0.5"))
) {
const tx1 = await harvester
.connect(signer)
.harvestAndSwap(nativeStakingProxyAddress);
await logTxDetails(tx1, `${stratDesc} harvestAndSwap`);
} else {
log(`Skipping ${stratDesc} harvestAndSwap due to low consensus rewards`);
log(
`Skipping ${stratDesc} harvestAndSwap due to low consensus and execution rewards`
);
}
};

Expand Down
2 changes: 2 additions & 0 deletions contracts/utils/addresses.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ addresses.mainnet.beaconChainDepositContract =
// Native Staking Strategy
addresses.mainnet.NativeStakingSSVStrategyProxy =
"0x34eDb2ee25751eE67F68A45813B22811687C0238";
addresses.mainnet.NativeStakingSSVStrategy2Proxy =
"0x4685dB8bF2Df743c861d71E6cFb5347222992076";

// Defender relayer
addresses.mainnet.validatorRegistrator =
Expand Down

0 comments on commit 7a65810

Please sign in to comment.