Skip to content

Reference

tilttek/friend-challenges
TypeRole
FriendChallengesCreates challenges, moves them, settles their prizes and dispatches the events
ChallengeA challenge and its state machine; its record written and read back, checked
ChallengeDraftWhat a member asks for: identifier, title, prize, end, invitees, visibility, validation, terms, votes needed
ChallengeRulesThe site's bounds: shortest and longest challenge, review, largest prize
ChallengeStateOpen, Frozen, Won, Cancelled, Expired or Removed
VisibilityFriends or Open
ValidationCreator, Vote or Moderator
ProofA participant's proof: identifier, evidence, time, state, approvals and rejections
ProofStatePending, Accepted, Rejected or Removed
PrizeAn amount of a unit of points, never money
PrizeHoldThe points held for a prize: key, payer, amount, unit, from when and until when
PayoutPoints of a hold paid to a member
PseudonymWhat stands for an erased member: a reference of the kind erased, drawn for each challenge
ReportA member's report to the moderators: challenge, reporter, reason, time, proof, note
ReportReasonSpam, Harassment, Cheating, Unsafe, Inappropriate or Other
Contract\ChallengeStoreWhere the challenges are kept
Contract\PrizeEscrowWhere the prizes are held: reserve, confirm, cancel
Contract\FriendshipWho is a friend of whom
Contract\ModerationWhere reports go, and who moderates
Escrow\PointsPrizeEscrowThe prizes held in the ledger of tilttek/points
Escrow\InMemoryPrizeEscrowThe prizes and the members' points in memory
Store\InMemoryChallengeStoreThe challenges in memory, kept as records
Store\InMemoryFriendshipFriendships in memory
Store\InMemoryModerationModerators and reports in memory
Event\ChallengeCreated, MemberInvited, ParticipantJoined, ProofSubmitted, ProofDecided, ChallengeWon, ChallengeEnded, ChallengeFrozen, ChallengeUnfrozenSee Extension points

Instant, Check, Reader and ChallengeRecord are internal: the time in UTC, the checks of what the library takes, and the reading and checking of a record.

Exceptions

ExceptionThrown when
Exception\FriendChallengesExceptionThe interface of every exception of the library
Exception\InvalidChallengeA value the library refuses: an identifier, a title, terms, a prize, a draft outside the rules, a time, a record, a reference of the kind erased given by a caller
Exception\ChallengeRefusedA move the rules do not allow: an unknown challenge or proof, a member who may not, a state or a time past its limit, a limit reached, an identifier reused
Exception\ChallengeConflictAnother writer kept the challenge first, three times in a row; a challenge of the same identifier kept already
Exception\EscrowConflictAn escrow move that contradicts its hold: another hold under its key, payouts over its amount, a hold settled twice
Tilttek\Points\Exception\InsufficientPointsThe creator's points do not cover the prize

Nothing is kept and no point moves when one is thrown during a move, except an escrow failure after the move is kept, which settle() makes good. Each message says what was expected, as member:eve is not invited to the challenge "01JD3", which is between friends.