feat: custom fees pallet with protocol and community fee layers#70
Open
feat: custom fees pallet with protocol and community fee layers#70
Conversation
Configurable protocol and community fees on asset transfers.
CallInspector trait detects pallet-assets transfers; ChargeCommunityFees extension charges fees in prepare phase.
Rename pallet, directory, package, and ChargeCommunityFees → ChargeFees. Internal storage names (ProtocolFees, CommunityFees) unchanged.
- FeeConfig::calculate now accepts optional min_balance parameter; non-zero fees below it are rounded up to avoid dust - Percentage fees use mul_ceil (round up) instead of mul_floor - calculate_fees takes the asset ID to look up minimum_balance - Extrinsic weights now include proper read/write DB accounting instead of placeholder values - Extension weight increased to reflect actual work - Added tests: rounding to min_balance, percentage rounding up, zero stays zero, fixed fee rounding
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
Custom fees pallet (
fc-pallet-fees) that lets protocol governance and communities configure fees on asset transfers.AdminOrigin, applied to all transfersCommunityOrigin, applied when sender belongs to a communityFixed,Percentage(Permill),PercentageClamped(with min/max bounds)mul_ceil) and clamped to asset'sminimum_balanceto avoid dustWithFees<T>adapter: wrapsfungibles::Mutateto charge fees transparently ontransfercallsChargeFees<T>transaction extension: charges fees on directpallet-assetscalls detected byCallInspectorTest plan
🤖 Generated with Claude Code