tipstream-reputation
SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5TSource Code
;; tipstream-reputation
;; Reputation scoring
(define-data-var total-reps uint u0)
(define-map reputations uint {
creator: principal,
value: uint,
at-block: uint
})
(define-public (add-rep (points uint))
(let
(
(id (var-get total-reps))
)
(map-set reputations id {
creator: tx-sender,
value: points,
at-block: block-height
})
(var-set total-reps (+ id u1))
(ok id)
)
)
(define-read-only (get-entry (id uint))
(map-get? reputations id)
)
(define-read-only (get-total)
(ok (var-get total-reps))
)
Functions (3)
| Function | Access | Args |
|---|---|---|
| add-rep | public | points: uint |
| get-entry | read-only | id: uint |
| get-total | read-only |