Add reward notifier script - #44
Conversation
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on November 1. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| const mintRequestId = BigInt(nextId.toString()) - 1n; | ||
| console.log(` Mint Request ID: ${mintRequestId}`); | ||
|
|
||
| const executeAfter = new Date((Number(mintRequestReceipt.blockTimestamp) + mintDelaySeconds) * 1000); |
There was a problem hiding this comment.
Bug: Invalid date from missing blockTimestamp in receipts
The script attempts to read blockTimestamp directly from the transaction receipt. Ethers.js v5 transaction receipts do not include this property, only blockNumber. This causes the executeAfter date calculation to use an undefined value, resulting in an invalid date.
Additional Locations (1)
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Resolved conflicts in imports by keeping new imports from main and applying scopelint formatting. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When the current reward rate is above the desired rate, instead of exiting early, the script now calls notifyRewardAmount(0) directly to spread existing rewards over a new REWARD_DURATION period, effectively lowering the APR toward the target. Changes: - Add notifyRewardAmount to STAKER_ABI - Add RATE_TOLERANCE (0.01%) for rate comparison - Add logic to detect when rate is too high - Calculate and display projected new rate - Call notifyRewardAmount(0) directly (bypassing DelayMod) - Show before/after rates on success 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| console.log("scaledRewardRate", scaledRewardRate); | ||
| console.log("annualRewards", annualRewards); | ||
| const ratePercentage = (Number(annualRewards) / Number(totalEarningPower)) * 100; | ||
| console.log("ratePercentage", ratePercentage); |
There was a problem hiding this comment.
Debug logging statements left in production code
The calculateCurrentRatePercentage function contains debug-style console.log statements that output raw variable names and values (e.g., console.log("scaledRewardRate", scaledRewardRate)). These don't follow the formatting conventions used elsewhere in the file, which use emojis and formatted template strings. Since this function is called multiple times during script execution, these debug statements will clutter the output in production use.
Clarify that NotifyReward.ts is specifically for recovering from failed notify calls when ExecuteMints.ts successfully mints but fails to notify the staker contract. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove unused DEPLOYER_PRIVATE_KEY and ZK_TOKEN_ADDRESS. Keep only variables actually used: ZKSYNC_RPC_URL, ZKSTAKER_ADDRESS, DELAY_MOD_ADDRESS, and Turnkey configuration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The older v2.x SDK used deprecated activity types that are no longer supported by Turnkey's API. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Coverage after merging add-reward-notifier-script into main will be
Coverage Report
|
|||||||||||||||||||
Note
Introduces a complete reward minting workflow with delay support and recovery tooling.
RequestMint.tsto compute target APR and submit delayed mint requests toZkMinterDelayV1forZkStakerExecuteMints.tsto scanDelayModfor ready requests, executeexecuteMint, and callstaker.notifyRewardAmount, with dry-run modeNotifyReward.tsdisaster-recovery script to manually callnotifyRewardAmountif notify fails post-mintscript/rewards/README.md(usage, cron patterns, recovery steps) and.env.templatefor RPC/contract/Turnkey configWritten by Cursor Bugbot for commit bc1f215. This will update automatically on new commits. Configure here.