pub struct ReferralRegistry { /* private fields */ }Expand description
Tracks referral relationships and bounty payouts
Implementations§
Source§impl ReferralRegistry
impl ReferralRegistry
pub fn new() -> Self
Sourcepub fn register_referral(
&mut self,
referrer_agent: &str,
referred_user: &str,
timestamp: u64,
) -> Result<(), String>
pub fn register_referral( &mut self, referrer_agent: &str, referred_user: &str, timestamp: u64, ) -> Result<(), String>
Register a new referral (called when user joins via agent invite)
Sourcepub fn update_credential_tier(
&mut self,
referred_user: &str,
credential_tier: u8,
) -> bool
pub fn update_credential_tier( &mut self, referred_user: &str, credential_tier: u8, ) -> bool
Update the referred user’s credential tier (called on credential verification)
Sourcepub fn get_referrer(&self, user: &str) -> Option<&str>
pub fn get_referrer(&self, user: &str) -> Option<&str>
Check if a user was referred and by whom
Sourcepub fn is_bounty_eligible(&self, referred_user: &str) -> bool
pub fn is_bounty_eligible(&self, referred_user: &str) -> bool
Check if bounty is eligible (has Tier 1+ credential and not yet paid)
Sourcepub fn mark_bounty_paid(
&mut self,
referred_user: &str,
bounty_amount: u32,
timestamp: u64,
) -> bool
pub fn mark_bounty_paid( &mut self, referred_user: &str, bounty_amount: u32, timestamp: u64, ) -> bool
Mark bounty as paid and record the amount
Sourcepub fn get_agent_bounties(&self, agent_pubkey: &str) -> u32
pub fn get_agent_bounties(&self, agent_pubkey: &str) -> u32
Get total bounties earned by an agent
Sourcepub fn get_agent_referrals(&self, agent_pubkey: &str) -> Vec<&ReferralRecord>
pub fn get_agent_referrals(&self, agent_pubkey: &str) -> Vec<&ReferralRecord>
Get all referrals made by an agent
Trait Implementations§
Source§impl Debug for ReferralRegistry
impl Debug for ReferralRegistry
Source§impl Default for ReferralRegistry
impl Default for ReferralRegistry
Source§fn default() -> ReferralRegistry
fn default() -> ReferralRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ReferralRegistry
impl RefUnwindSafe for ReferralRegistry
impl Send for ReferralRegistry
impl Sync for ReferralRegistry
impl Unpin for ReferralRegistry
impl UnsafeUnpin for ReferralRegistry
impl UnwindSafe for ReferralRegistry
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.