Label: complexity: high
Points: 200
Description
Ecosystem growth depends on creators bringing other creators. This issue adds an optional referrer: Option<Address> field to create_invoice() stored on-chain, and a get_referral_count() view function counting how many invoices a given address has referred — enabling off-chain referral reward programs.
Technical Context
Involves types.rs (add referrer: Option<Address>) and lib.rs. After saving the invoice, if referrer is Some, increment persistent key ("ref_count", referrer) by 1. Add get_referral_count(env, referrer: Address) -> u64 returning stored count or 0.
Acceptance Criteria
Label: complexity: high
Points: 200
Description
Ecosystem growth depends on creators bringing other creators. This issue adds an optional
referrer: Option<Address>field tocreate_invoice()stored on-chain, and aget_referral_count()view function counting how many invoices a given address has referred — enabling off-chain referral reward programs.Technical Context
Involves
types.rs(addreferrer: Option<Address>) andlib.rs. After saving the invoice, ifreferrerisSome, increment persistent key("ref_count", referrer)by 1. Addget_referral_count(env, referrer: Address) -> u64returning stored count or 0.Acceptance Criteria
create_invoice()accepts optionalreferreraddressget_referral_count()returns correct count for address with multiple referrals0for address with no referralsreferrer = Noneproduces identical behaviour to current implementationcargo clippypasses with zero warnings