Conversation
This reverts commit b2c09ec.
Cover the three key behaviors when Config.forwardTipsImmediately is true: - claimTip() reverts with KeepWhatsRaisedTipsAlreadyForwarded - Permit2 pledge forwards tip to platform admin at pledge time - Admin setFeeAndPledge splits pledge vs tip accounting correctly Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
test(foundry): add forwardTipsImmediately unit tests
…e/refunds, add reason param and tests
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 92ae3d44ce
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: afbffc5183
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d7a480c63
ℹ️ 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".
…es, drop getTotalTipClaimed to stay under bytecode limit
…or bytecode limit
…ed treasuries (#84) * feat(KeepWhatsRaised): redirect all fees to platform admin on cancelled treasuries * test(KeepWhatsRaised): redirect all fees to platform admin on cancelled treasuries
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb4fc73653
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5682b11821
ℹ️ 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".
| via_ir = true | ||
| optimizer = true | ||
| optimizer_runs = 200 | ||
| optimizer_runs = 1 |
There was a problem hiding this comment.
Restore optimizer runs for production profile
Changing optimizer_runs from 200 to 1 in the default Foundry profile materially shifts optimization toward deployment cost and away from runtime execution, which can significantly increase gas usage for all user-facing contract calls and produce different bytecode than prior audited/deployed expectations. Unless this is intentionally scoped to a separate local/test profile, this default change is a performance regression for production builds.
Useful? React with 👍 / 👎.
Summary
KeepWhatsRaisedadds void pledge (ops/admin unwind without burning the NFT), optional forward tips on pledge, separate void accounting vs refunds, and on cancellation, route all disbursed fee balances indisburseFeesto the platform admin. Unit tests cover the new behavior end-to-end.Void pledge
voidPledge(tokenId)—PLATFORM_HASHplatform admin only. For chargebacks / lost disputes: unwinds that pledge’s current on-chain position; receipt NFT is not burned (unlikeclaimRefund, which burns and pays the backer).s_tokenIdToPledgeToken[tokenId] != 0. Fails withKeepWhatsRaisedVoidPledgeNotFoundif already cleared or never valid (covers tip-only the same way as principal pledges)._clearPledgeLedger(shared withclaimRefund) decrements current raised and clears per-pledge state. Voided principal is tracked ins_tokenVoidedAmountsand exposed viagetVoidedAmount().getLifetimeRaisedAmount()stays a monotonic “ever raised”;getRefundedAmount()is lifetime − current raised − voided so voids are not double-counted as refunds.s_availablePerToken, (b) imputed protocol + platform fee components of this pledge, only from the shared fee buckets if this pledge is newer than the lastdisburseFeesboundary:tokenId > s_lastFeeDisbursedPledgeTokenId[pledgeToken](otherwise no fee-bucket draw — avoids clawing from pooled, post-disburseFeesstate). (c) Unclaimed pooled tip, only while!s_tipClaimed, froms_tipPerToken, capped by the pledge’s tip. Everything is clamped so the call never underflows, including late voids (after withdraw,disburseFees,claimTippaths, orclaimFund).disburseFees,s_lastFeeDisbursedPledgeTokenId[token]is set tos_lastMintedPledgeTokenId; that is the “fee snapshot” the void path uses.s_tipClaimedPerTokenrecords what the platform already received (forwarding +claimTip); it is not decremented. Forwarded or already-claimed money is not pulled back; only what’s still represented as reclaimable in the right pools is in play.Optional tip forwarding (
forwardTipsImmediately)setFeeAndPledgewhen the “source is already the platform” — do not take the full pledge+tip twice from that side). Pooled accrual tos_tipPerToken[pledgeToken]is the off path.claimTipreverts withKeepWhatsRaisedTipsAlreadyForwarded.TipForwardedand **s_tipClaimedPerToken+= tip` on the forward path.getTipClaimedPerToken(address)— total tips the platform is counted as having received for that token. When tips were pooled and thenclaimTipruns, transferred amounts are also added tos_tipClaimedPerToken.disburseFeeswhen cancelledclaimFund— i.e. treasury and/or campaign in cancellation): all accumulated protocol and platform fee balances in that disbursal for each token are sent to the platform admin;FeesDisbursedreflects “all in the platform line” for the protocol share in that case. Callable so fees are not stuck; each call still updates the fee boundary that voidPledge uses (see above).Tests
Unit coverage for access, full/partial/zero platform recovery,
disburseFeesordering vs void, post-withdraw and post-claimFund, cancelled camp, both tip modes, refund vs void, and multi-pledge / multi-token cases; config defaults where the new flag is set.