Summary
There is no on-chain incentive for users to bring new buyers to the platform. Adding an optional referrer: Option<Address> param to the buy function lets any wallet earn a portion of the protocol fee when someone they referred makes a purchase. The referrer's cut is taken from the protocol fee, so buyers pay nothing extra.
Scope
- Add
referrer: Option<Address> parameter to the buy function
- When a referrer is provided, split the protocol fee: e.g. 80% to protocol treasury, 20% to referrer (configurable bps stored in protocol config)
- Add
referral_fee_bps to protocol config, settable by admin, defaulting to 2000 (20% of protocol fee)
- Referrer cannot be the buyer themselves — revert with
InvalidReferrer if equal
- Emit
ReferralFeeEarned { creator_id, buyer, referrer, amount, ledger } event
- Add
get_referral_fee_bps() -> u32 view function
- When referrer is
None, full protocol fee goes to treasury as before
Acceptance Criteria
ETA: 24 hours
Coordinate on Telegram
Summary
There is no on-chain incentive for users to bring new buyers to the platform. Adding an optional
referrer: Option<Address>param to the buy function lets any wallet earn a portion of the protocol fee when someone they referred makes a purchase. The referrer's cut is taken from the protocol fee, so buyers pay nothing extra.Scope
referrer: Option<Address>parameter to the buy functionreferral_fee_bpsto protocol config, settable by admin, defaulting to 2000 (20% of protocol fee)InvalidReferrerif equalReferralFeeEarned { creator_id, buyer, referrer, amount, ledger }eventget_referral_fee_bps() -> u32view functionNone, full protocol fee goes to treasury as beforeAcceptance Criteria
InvalidReferrerReferralFeeEarnedevent emitted with correct fieldsreferral_fee_bpswithin a valid rangeETA: 24 hours
Coordinate on Telegram