Source Code

;; tipstream-bounties
;; Bounty system

(define-data-var total-bounties uint u0)

(define-map bounties uint {
  creator: principal,
  value: uint,
  at-block: uint
})

(define-public (post-bounty (reward-level uint))
  (let
    (
      (id (var-get total-bounties))
    )
    (map-set bounties id {
      creator: tx-sender,
      value: reward-level,
      at-block: block-height
    })
    (var-set total-bounties (+ id u1))
    (ok id)
  )
)

(define-read-only (get-entry (id uint))
  (map-get? bounties id)
)

(define-read-only (get-total)
  (ok (var-get total-bounties))
)

Functions (3)

FunctionAccessArgs
post-bountypublicreward-level: uint
get-entryread-onlyid: uint
get-totalread-only