Source Code

;; tipstream-content
;; Content registry

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

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

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

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

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

Functions (3)

FunctionAccessArgs
register-contentpubliccontent-type: uint
get-entryread-onlyid: uint
get-totalread-only