Problem
Referral reward distribution has no standardised on-chain calculation. Reward splits are computed ad hoc on the backend, making them unauditable and gameable.
Proposed Solution
Create contracts/cntr/referral_reward.rs implementing pub fn calculate_referral_split(total_reward_stroops: i128, referrer_percent: u32) -> Result<(i128, i128), &'static str>. Returns (referrer_amount, referee_amount) where referrer_amount + referee_amount == total_reward_stroops always (any remainder from integer division goes to the referrer). All implementation must live inside contracts/cntr/.
Acceptance Criteria
Problem
Referral reward distribution has no standardised on-chain calculation. Reward splits are computed ad hoc on the backend, making them unauditable and gameable.
Proposed Solution
Create
contracts/cntr/referral_reward.rsimplementingpub fn calculate_referral_split(total_reward_stroops: i128, referrer_percent: u32) -> Result<(i128, i128), &'static str>. Returns(referrer_amount, referee_amount)wherereferrer_amount + referee_amount == total_reward_stroopsalways (any remainder from integer division goes to the referrer). All implementation must live insidecontracts/cntr/.Acceptance Criteria
contracts/cntr/referral_reward.rsErr("Referrer percent cannot exceed 100")forreferrer_percent > 100referrer_amount + referee_amountalways equalstotal_reward_stroopsexactlyreferrer_amountcargo test