Source Code

;; pledge-wall -- public pledge board for good intentions
(define-data-var pledge-count uint u0)
(define-map pledges uint { author: principal, text: (string-ascii 100), category: (string-ascii 20), block: uint })
(define-public (make-pledge (text (string-ascii 100)) (category (string-ascii 20)))
  (let ((id (+ (var-get pledge-count) u1)))
    (var-set pledge-count id)
    (map-set pledges id { author: tx-sender, text: text, category: category, block: stacks-block-height }) (ok id)))
(define-read-only (get-pledge (id uint)) (map-get? pledges id))
(define-read-only (get-count) (var-get pledge-count))

Functions (3)

FunctionAccessArgs
make-pledgepublictext: (string-ascii 100
get-pledgeread-onlyid: uint
get-countread-only