Skip to content

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

Conversation

devin-ai-integration[bot]
Copy link
Contributor

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

  • Added a MAX_DEPOSIT_LIMIT constant in SchedulerState.sol set to 100 ETH
  • Added a MaxDepositLimitExceeded error in SchedulerErrors.sol
  • Modified createSubscription in Scheduler.sol to check deposit limit for permanent subscriptions
  • Modified addFunds in Scheduler.sol to check deposit limit for permanent subscriptions
  • Added tests in PulseScheduler.t.sol to verify deposit limit functionality

Testing

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 (tejas@dourolabs.xyz)

Co-Authored-By: Tejas Badadare <tejas@dourolabs.xyz>
Copy link

vercel bot commented May 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 12, 2025 7:21pm
component-library ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 12, 2025 7:21pm
entropy-debugger ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 12, 2025 7:21pm
entropy-explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 12, 2025 7:21pm
insights ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 12, 2025 7:21pm
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 12, 2025 7:21pm
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 12, 2025 7:21pm

Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Co-Authored-By: Tejas Badadare <tejas@dourolabs.xyz>
Comment on lines 531 to 546
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;
Copy link
Contributor

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 <tejas@dourolabs.xyz>
subscriptionId
];

if (!status.isActive) {
Copy link
Contributor

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 <tejas@dourolabs.xyz>
Co-Authored-By: Tejas Badadare <tejas@dourolabs.xyz>
Copy link
Contributor Author

Closing due to inactivity for more than 7 days.

@tejasbadadare tejasbadadare merged commit ff58d77 into main May 27, 2025
14 checks passed
@tejasbadadare tejasbadadare deleted the devin/1747072255-add-max-deposit-limit-for-permanent-subscriptions branch May 27, 2025 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants