Skip to content

feat: surface and document per-asset fee configuration - #345

Merged
MaryammAli merged 1 commit into
BlockDash-Studios:mainfrom
Mkalbani:feat/surface-per-asset-fee-config
Jul 23, 2026
Merged

feat: surface and document per-asset fee configuration#345
MaryammAli merged 1 commit into
BlockDash-Studios:mainfrom
Mkalbani:feat/surface-per-asset-fee-config

Conversation

@Mkalbani

@Mkalbani Mkalbani commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

closes #333

Summary

This PR surfaces and fully documents the per-asset fee configuration that was previously declared in storage but not well-documented or easily discoverable.

Changes

📖 Documentation

  • README.md: Added comprehensive "Fee Configuration" section explaining:

    • Fee resolution priority (per-asset > oracle > global)
    • Global fee configuration with examples
    • Per-asset fee overrides and use cases
    • Arbiter splits (both legacy and explicit)
    • Collector rotation mechanism
    • Fee breakdown structure
  • FEE_CONFIGURATION_GUIDE.md (new): Detailed developer guide covering:

    • All fee configuration patterns with working examples
    • Common use cases (tiered fees, arbiter incentivization, multi-recipient splits, fee-free tokens)
    • FeeRatio validation rules
    • Comprehensive troubleshooting guide

🔧 Code Documentation

  • lib.rs: Enhanced docstrings for:

    • set_fee_config() - With priority order and examples
    • set_per_asset_fee() - With fee distribution options and error cases
    • get_per_asset_fee() - With query examples
  • admin.rs: Added comprehensive documentation for:

    • set_fee_config() - Fallback priority explanation
    • set_per_asset_fee() - Fee split options, validation, and errors

Problem Solved

Per-asset fee overrides were fully functional but:

  • ❌ Not documented at the README level
  • ❌ Complex split options unexplained
  • ❌ No usage examples or patterns
  • ❌ Discovery was difficult for new developers

Solution

Minimal: No code changes (implementation already correct)
Efficient: ~675 lines of documentation vs refactoring
Comprehensive: Multiple documentation levels for different audiences

Files Changed

  • README.md - Added fee configuration section
  • FEE_CONFIGURATION_GUIDE.md - New comprehensive guide
  • contracts/Folder/src/lib.rs - Enhanced entry point docs
  • contracts/Folder/src/admin.rs - Enhanced admin function docs

Key Features Now Documented

  1. ✅ Per-asset override priority
  2. ✅ Global fallback mechanism
  3. ✅ Oracle dynamic pricing integration
  4. ✅ Legacy arbiter_bps split
  5. ✅ Explicit FeeRatio splits with validation
  6. ✅ Collector rotation without disruption
  7. ✅ Fee breakdown structure
  8. ✅ Common patterns with code examples
  9. ✅ Troubleshooting guide

Type of Change

  • Bug fix
  • Documentation
  • New feature
  • Breaking change

Testing

Documentation quality review only (no code changes).


Fixes: Issue #305 (Fee Router v2 - per-asset overrides now fully documented)

- Add comprehensive fee configuration section to README.md explaining:
  * Fee resolution priority (per-asset > oracle > global)
  * Global fee configuration with examples
  * Per-asset fee overrides and use cases
  * Arbiter splits (both legacy and explicit FeeRatio)
  * Collector rotation mechanism
  * Fee breakdown structure

- Create FEE_CONFIGURATION_GUIDE.md with:
  * Detailed examples for all fee configuration patterns
  * Common use cases and patterns
  * Troubleshooting guide
  * FeeRatio validation rules

- Enhance inline documentation in lib.rs:
  * Add detailed docstrings for set_fee_config()
  * Expand set_per_asset_fee() with priority order, fee distribution, and examples
  * Add clear documentation for get_per_asset_fee()

- Enhance admin.rs documentation:
  * Document set_fee_config() with fallback priority
  * Document set_per_asset_fee() with fee split options and validation
  * Add comprehensive error cases

This fully surfaces the per-asset fee override functionality that was
previously declared in storage but not well-documented or easily discoverable.

Fixes: Issue BlockDash-Studios#305 (Fee Router v2 - per-asset overrides now fully documented)
@MaryammAli
MaryammAli merged commit 48115d8 into BlockDash-Studios:main Jul 23, 2026
2 checks passed
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.

add per-asset fee override support with contract-level tests

2 participants