Trust

Address: [-------------]

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░█████╗░██╗░░░░░░█████╗░░██████╗██╗░░██╗░█████╗░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░██╔══██╗██║░░░░░██╔══██╗██╔════╝██║░██╔╝██╔══██╗░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░███████║██║░░░░░███████║╚█████╗░█████═╝░███████║░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░██╔══██║██║░░░░░██╔══██║░╚═══██╗██╔═██╗░██╔══██║░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░██║░░██║███████╗██║░░██║██████╔╝██║░╚██╗██║░░██║░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═════╝░╚═╝░░╚═╝╚═╝░░╚═╝░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░ ░░░░
░░░░ ▀█▀ █▀█ █░█ █▀ ▀█▀    ░░░░
░░░░ ░█░ █▀▄ █▄█ ▄█ ░█░  ░░░░
░░░░ ░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

IDL

type UserReputation =
record {
noOfInteractions: float64;
reputation: Reputation;
};
type UserP = principal;
type Trustworthy = bool;
type Trust =
service {
addInteraction: (UserP, float64) -> (InteractionId);
deployToAlaska: () -> ();
getGlobalAverageReputation: () -> (GlobalAvgReputation);
getInteraction: (InteractionId) -> (opt Interaction);
getReputation: (principal) -> (UserReputation);
isTrustworthy: (principal) -> (Trustworthy);
whoami: () -> (principal);
};
type Reputation = float64;
type InteractionId = nat;
type Interaction =
record {
by: UserP;
satisfaction: float64;
to: UserP;
};
type GlobalAvgReputation = float64;
service : (text) -> Trust

Getters

getGlobalAverageReputation

Returns Global Average Reputation amoung users.
@returns T.GlobalAvgReputation
@parameters ()

getReputation

Returns Reputation of a user.
@returns T.UserReputation
@parameters (p: Principal)

isTrustworthy

Returns Trustworthiness of a user.
@returns T.Trustworthy
@parameters (p: Principal)

getInteraction

Returns an indexed Interaction for Reputation.
@returns ?T.Interaction
@parameters (id: T.InteractionId)

Setters

addInteraction

Add an Interaction for Reputation.
@returns (to: T.UserP, satisfaction: Float)
@parameters T.InteractionId