Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harvest Action now collects if there is more than 0.5 execution rewards #2281

Merged
merged 1 commit into from
Oct 20, 2024
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
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"))
Comment on lines +70 to +71
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Could probably use gte but not a big deal

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, the line has to be drawn somewhere. Those amounts were arbitrary

) {
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
Loading