Add validation for withdrawal and refund delays in KeepWhatsRaised contract (OZ-15)#20
Conversation
mahabubAlahi
commented
Feb 23, 2026
- Introduced a new error to revert transactions when withdrawalDelay is less than refundDelay, ensuring claimFund can only be called after the refund window ends.
- Updated the configuration documentation to reflect this new requirement for withdrawal and refund delays.
…ntract - Introduced a new error to revert transactions when withdrawalDelay is less than refundDelay, ensuring claimFund can only be called after the refund window ends. - Updated the configuration documentation to reflect this new requirement for withdrawal and refund delays.
…or improved fund management
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a7e7e48ef
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (config.withdrawalDelay < config.refundDelay) { | ||
| revert KeepWhatsRaisedWithdrawalBeforeRefundEnd(config.withdrawalDelay, config.refundDelay); |
There was a problem hiding this comment.
Allow withdrawalDelay to be shorter than refundDelay
In the non-cancelled flow, withdraw() becomes a full-balance withdrawal as soon as block.timestamp > getDeadline() and remains callable until deadline + s_config.withdrawalDelay (src/treasuries/KeepWhatsRaised.sol, withdraw, lines 873-899), while claimRefund() stays open until deadline + s_config.refundDelay and reverts once s_availablePerToken has been drained (lines 977-990). This new check removes the only way to configure withdrawals to stop before refunds do, so every future deployment must keep final withdrawals open for the entire refund window, letting an approved owner/admin empty the treasury before backers finish refunding.
Useful? React with 👍 / 👎.