-
Notifications
You must be signed in to change notification settings - Fork 306
feat(pulse): add maximum deposit limit for permanent subscriptions #2675
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
feat(pulse): add maximum deposit limit for permanent subscriptions #2675
Conversation
Co-Authored-By: Tejas Badadare <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: Tejas Badadare <[email protected]>
| SubscriptionParams storage params = _state.subscriptionParams[ | ||
| subscriptionId | ||
| ]; | ||
| SubscriptionStatus storage status = _state.subscriptionStatuses[ | ||
| subscriptionId | ||
| ]; | ||
|
|
||
| // Check deposit limit for permanent subscriptions | ||
| if ( | ||
| params.isPermanent && | ||
| status.balanceInWei + msg.value > MAX_DEPOSIT_LIMIT | ||
| ) { | ||
| revert MaxDepositLimitExceeded(); | ||
| } | ||
|
|
||
| status.balanceInWei += msg.value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check should be on the incoming deposit, not on the balance
Co-Authored-By: Tejas Badadare <[email protected]>
2ee0169 to
422dca8
Compare
| subscriptionId | ||
| ]; | ||
|
|
||
| if (!status.isActive) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be if (!params.isActive)
Co-Authored-By: Tejas Badadare <[email protected]>
Co-Authored-By: Tejas Badadare <[email protected]>
|
Closing due to inactivity for more than 7 days. |
Add Maximum Deposit Limit for Permanent Subscriptions
This PR implements a maximum deposit limit for permanent subscriptions in the Pulse contract to mitigate the risk of accidental over-deposits.
Changes
MAX_DEPOSIT_LIMITconstant inSchedulerState.solset to 100 ETHMaxDepositLimitExceedederror inSchedulerErrors.solcreateSubscriptioninScheduler.solto check deposit limit for permanent subscriptionsaddFundsinScheduler.solto check deposit limit for permanent subscriptionsPulseScheduler.t.solto verify deposit limit functionalityTesting
All tests have been run and pass successfully, including new tests for the deposit limit functionality.
Link to Devin run
https://app.devin.ai/sessions/feae11c6c0db4a739a42be4fe136f996
Requested by
Tejas Badadare ([email protected])