Skip to content

feat: implement recipient reward multiplier system (#880) - #906

Merged
Kingsman-99 merged 2 commits into
Stellar-split:mainfrom
jacobjacobb4242:feat/issue-880-recipient-reward-multiplier
Sep 30, 2026
Merged

Kingsman-99 merged 2 commits into
Stellar-split:mainfrom
jacobjacobb4242:feat/issue-880-recipient-reward-multiplier

Conversation

@jacobjacobb4242

Copy link
Copy Markdown

Issue #880 — Implement recipient reward multiplier system

Adds a new reward_multiplier_ext.rs module that lets an invoice creator attach
a per-recipient reward multiplier (in basis points) to control scaled payouts.

Core functionality

  • set_reward_multiplier(creator, invoice_id, recipient, multiplier_bps) — creator sets a multiplier in [1, 20 000] bps (1× – 2×) for a recipient while the invoice is Pending.
  • clear_reward_multiplier(creator, invoice_id, recipient) — resets to the default 1× (10 000 bps).
  • get_reward_multiplier(invoice_id, recipient) — returns current multiplier or 10 000 if unset.
  • get_all_multipliers(invoice_id) — enumerates every (recipient, multiplier_bps) pair on the invoice.
  • effective_multiplier is exposed as pub(crate) for use by the release path.

Events

Topic Data
(split, mul_set, invoice_id) (recipient, multiplier_bps)
(split, mul_clr, invoice_id) recipient

Storage

Local RewardMulKey enum in persistent storage:

  • Multiplier(invoice_id, recipient) — the bps value.
  • MultiplierRecipients(invoice_id) — enumeration list.

Tests

9 unit tests covering:

  • Set and read a multiplier
  • Default is 10 000
  • Clear resets to default
  • get_all_multipliers lists all entries
  • Non-creator cannot set
  • Zero multiplier rejected
  • Multiplier > 20 000 rejected
  • Unknown recipient rejected
  • Multiplier readable after partial payment

Files changed

File Change
contracts/split/src/reward_multiplier_ext.rs New
contracts/split/src/lib.rs Added mod reward_multiplier_ext;

Closes #880

Add reward_multiplier_ext.rs with set_reward_multiplier,
clear_reward_multiplier, get_reward_multiplier, and
get_all_multipliers entry points.

- Multipliers stored per (invoice_id, recipient) in persistent storage
- Range [1, 20_000] bps (max 2x); default 10_000 = 1x (no-op)
- Only invoice creator may set/clear while invoice is Pending
- Events: (split, mul_set, invoice_id) and (split, mul_clr, invoice_id)
- 9 unit tests covering happy paths and all guard conditions

Closes Stellar-split#880
@drips-wave

drips-wave Bot commented Sep 30, 2026

Copy link
Copy Markdown

@jacobjacobb4242 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

@Kingsman-99
Kingsman-99 merged commit 621ebcb into Stellar-split:main Sep 30, 2026
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.

Implement recipient reward multiplier system

2 participants