revert(tokenization): restore additive (on-top) protocol fee#100
Merged
Conversation
This reverts commit e3d6247.
…ro fees The pre-#80 fee coverage in approved_transfers_test.go only transferred 100 ubadge, where 0.1% rounds down to 0 — so the protocol fee was effectively never exercised. This adds dedicated coverage against the restored additive method: payer charged amount+fee, recipient gets the full amount, fee lands in the community pool, multi-transfer per-denom aggregation, and rounds-to-zero. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Added a dedicated additive protocol-fee test suite ( Context: the pre-#80 fee coverage in
All pass under |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reverts PR #80 (
e3d62474, feat(tokenization): inclusive protocol fees (#0335)), restoring the original additive / on-top protocol fee method.About three weeks ago we converted the 0.1% protocol fee from additive to inclusive (deducted out of the transfer amount). This caused problems — most visibly, recipients/escrows received only 99.9% of the quoted amount, breaking 1:1 redeem math (e.g. prediction-market escrows came up short on full-balance redeems).
This restores the pre-#80 behavior:
amount + 0.1%; the recipient receives the full quoted amount.CalculateAndDistributeProtocolFeesand routed to the community pool.ProtocolFeeDenominatoris back to1000intransfer_utils.go; the inlinesendProtocolFeehelper and inclusive deduction inExecuteCoinTransfersare removed.inclusive_protocol_fees_test.go, added in feat(tokenization): inclusive protocol fees (#0335) #80) is removed; pre-feat(tokenization): inclusive protocol fees (#0335) #80 tests are restored.This is a clean
git revertof #80 with no conflicts.Relationship to PR #99
PR #99 (
chore/disable-protocol-fee-local) takes a different tack — it setsProtocolFeeDenominator = 0to disable the fee entirely (no protocol revenue) as a local/e2e workaround. This PR instead restores the original revenue-preserving additive method, which is the literal "old method" and also fixes the escrow shortfall (recipients get the full amount again). These two are mutually exclusive approaches to the same problem — picking this one supersedes #99.Test plan
go build -tags=test ./...passesgo test -tags=test ./x/tokenization/keeper/...passes (104s)🤖 Generated with Claude Code