Skip to content

feat: Implemented Configurable Fee Model (Per-Escrow & Token-Specific Fees) to close #93#130

Merged
Cedarich merged 4 commits intoStayLitCodes:mainfrom
Oluwaseyi89:feature/Configurable-Fee-Model-Per-Escrow-and-Token-Specific-Fees
Mar 3, 2026
Merged

feat: Implemented Configurable Fee Model (Per-Escrow & Token-Specific Fees) to close #93#130
Cedarich merged 4 commits intoStayLitCodes:mainfrom
Oluwaseyi89:feature/Configurable-Fee-Model-Per-Escrow-and-Token-Specific-Fees

Conversation

@Oluwaseyi89
Copy link
Contributor

Description

This PR introduces a configurable fee model that extends the current flat fee structure to support per-token and per-escrow fee overrides, providing greater flexibility for different assets and use cases.

Key Features

  • Maintains existing global fee as default
  • Added per-token fee overrides via token_fee_bps mapping
  • Added per-escrow fee overrides via escrow_fee_bps mapping
  • Clear precedence: escrow override → token override → global default
  • All fees bounded to [0, BPS_DENOMINATOR] with validation

New Admin Functions

  • set_token_fee(env, token_address, fee_bps) - configure token-specific fees
  • set_escrow_fee(env, escrow_id, fee_bps) - configure escrow-specific fees

Events

  • FeeUpdated(scope, key, old_fee, new_fee) emitted for all fee changes

Testing

  • ✅ Default global fee behavior
  • ✅ Token-level override only
  • ✅ Escrow-level override only
  • ✅ Combined precedence scenarios
  • ✅ Invalid fee rejections (>100%)
  • All existing tests remain passing

Closes #93

@Oluwaseyi89
Copy link
Contributor Author

@Cedarich please, review.

@Cedarich
Copy link
Contributor

Please check formatting errors

@Oluwaseyi89
Copy link
Contributor Author

Oluwaseyi89 commented Mar 2, 2026

@Cedarich merge conflicts resolved and fmt errors. Please, review. And I observe you people commited node_modules/

@Oluwaseyi89
Copy link
Contributor Author

@Cedarich please, review. Clippy errors resolved.

@Cedarich
Copy link
Contributor

Cedarich commented Mar 2, 2026

@Oluwaseyi89 Boss please fix failing test

@Oluwaseyi89
Copy link
Contributor Author

@Cedarich bugs causing panic fixed and all tests pass.

Copy link
Contributor

@Cedarich Cedarich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Cedarich Cedarich merged commit 02fa8b0 into StayLitCodes:main Mar 3, 2026
1 check 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.

Configurable Fee Model (Per-Escrow & Token-Specific Fees)

2 participants