Skip to content

feat(contract): add fee distribution at settlement - #114

Merged
thlpkee20-wq merged 2 commits into
Chronopay-Org:mainfrom
Drock0:feature/sc-025
Apr 1, 2026
Merged

feat(contract): add fee distribution at settlement#114
thlpkee20-wq merged 2 commits into
Chronopay-Org:mainfrom
Drock0:feature/sc-025

Conversation

@Drock0

@Drock0 Drock0 commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

[SC-025] Add Fee Distribution At Settlement

Description

This PR resolves issue #25 by introducing a production-grade fee distribution logic during the redeem_time_token (settlement) process for the ChronoPayContract.

Closes #25

Changes Introduced

  • Enforced a protocol fee mapping FeeRateBps in DataKey to reliably source dynamic rates.
  • Addressed robust handling via a typed Error enum (InvalidFeeRate, CalculationOverflow).
  • Introduced configuration endpoints set_fee_rate and get_fee_rate bound under 10000 limit constraints (100%).
  • Implemented SettlementResult exposing clear tracking indices returning split bounds: professional_amount and protocol_fee.
  • Restructured redeem_time_token returning SettlementResult.

Testing Output

running 6 tests
test test::test_hello ... ok
test test::test_mint_and_redeem ... ok
test test::test_create_time_slot_auto_increments ... ok
test test::test_fee_distribution_splits ... ok
test test::test_negative_settlement_blocked - should panic ... ok
test test::test_invalid_fee_rate_bounded - should panic ... ok

test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

@Drock0

Drock0 commented Mar 29, 2026

Copy link
Copy Markdown
Contributor Author

@thlpkee20-wq please merge

@drips-wave

drips-wave Bot commented Mar 29, 2026

Copy link
Copy Markdown

@Drock0 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Drock0

Drock0 commented Mar 29, 2026

Copy link
Copy Markdown
Contributor Author

@thlpkee20-wq

@thlpkee20-wq
thlpkee20-wq merged commit c1783cd into Chronopay-Org:main Apr 1, 2026
0 of 3 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.

[SC-025] Add Fee Distribution At Settlement

2 participants