pub struct ReputationEngine {
pub user_pubkey: String,
pub layer_scores: HashMap<CaptureLayer, ReputationDimension>,
pub account_created: u64,
pub total_attestations: u64,
/* private fields */
}Expand description
Main reputation engine
Fields§
§user_pubkey: StringUser public key (Solana address)
layer_scores: HashMap<CaptureLayer, ReputationDimension>Score for each capture layer
account_created: u64Account creation timestamp
total_attestations: u64Total attestations processed
Implementations§
Source§impl ReputationEngine
impl ReputationEngine
Sourcepub fn process_attestation<A: Attestation>(&mut self, attestation: &A)
pub fn process_attestation<A: Attestation>(&mut self, attestation: &A)
Process an attestation from any capture layer
Sourcepub fn calculate_trust_score(&mut self) -> TrustScore
pub fn calculate_trust_score(&mut self) -> TrustScore
Calculate composite trust score
Sourcepub fn verify_threshold(
&mut self,
threshold_name: &str,
commitment: &str,
) -> Option<bool>
pub fn verify_threshold( &mut self, threshold_name: &str, commitment: &str, ) -> Option<bool>
Verify a threshold proof (external parties can check without seeing score)
Sourcepub fn can_coordinate_swarm(&mut self) -> bool
pub fn can_coordinate_swarm(&mut self) -> bool
Check if user can coordinate sub-agents (Layer 22 gate)
Sourcepub fn qualifies_for_collateral(&mut self) -> bool
pub fn qualifies_for_collateral(&mut self) -> bool
Check if user qualifies for reputation collateral (Layer 21)
Sourcepub fn collateral_discount_bps(&mut self) -> u16
pub fn collateral_discount_bps(&mut self) -> u16
Get collateral discount rate in basis points
Sourcepub fn max_sub_agents(&mut self) -> u8
pub fn max_sub_agents(&mut self) -> u8
Get maximum sub-agents this user can hire
Source§impl ReputationEngine
impl ReputationEngine
Sourcepub fn to_api_response(&mut self) -> ReputationResponse
pub fn to_api_response(&mut self) -> ReputationResponse
Generate API response
Source§impl ReputationEngine
Extension trait for ReputationEngine to load from Supabase
impl ReputationEngine
Extension trait for ReputationEngine to load from Supabase
Sourcepub async fn load_from_supabase(
&mut self,
client: &SupabaseClient,
) -> Result<usize, String>
pub async fn load_from_supabase( &mut self, client: &SupabaseClient, ) -> Result<usize, String>
Load attestations from Supabase and process them
Sourcepub async fn from_supabase(
user_pubkey: String,
client: &SupabaseClient,
) -> Result<Self, String>
pub async fn from_supabase( user_pubkey: String, client: &SupabaseClient, ) -> Result<Self, String>
Create engine and load from Supabase in one step
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReputationEngine
impl RefUnwindSafe for ReputationEngine
impl Send for ReputationEngine
impl Sync for ReputationEngine
impl Unpin for ReputationEngine
impl UnsafeUnpin for ReputationEngine
impl UnwindSafe for ReputationEngine
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.