Source Code

;; tipstream-challenges
;; Tipping challenges

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

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

(define-public (create-challenge (reward-type uint))
  (let
    (
      (id (var-get total-challenges))
    )
    (map-set challenges id {
      creator: tx-sender,
      value: reward-type,
      at-block: block-height
    })
    (var-set total-challenges (+ id u1))
    (ok id)
  )
)

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

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

Functions (3)

FunctionAccessArgs
create-challengepublicreward-type: uint
get-entryread-onlyid: uint
get-totalread-only