tipstream-follows
SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5TSource Code
;; tipstream-follows
;; Follow system
(define-data-var total-follows uint u0)
(define-map follows uint {
creator: principal,
value: uint,
at-block: uint
})
(define-public (follow-user (target-id uint))
(let
(
(id (var-get total-follows))
)
(map-set follows id {
creator: tx-sender,
value: target-id,
at-block: block-height
})
(var-set total-follows (+ id u1))
(ok id)
)
)
(define-read-only (get-entry (id uint))
(map-get? follows id)
)
(define-read-only (get-total)
(ok (var-get total-follows))
)
Functions (3)
| Function | Access | Args |
|---|---|---|
| follow-user | public | target-id: uint |
| get-entry | read-only | id: uint |
| get-total | read-only |