articles-v1
SP3ZGVF03P0G2F798147EBKTYQ7GVD1BG34PMH2AGSource Code
;; Articles
(define-map articles uint {author: principal, title: (string-ascii 100), published: bool})
(define-data-var article-id uint u0)
(define-public (create-article (title (string-ascii 100)))
(let ((id (var-get article-id)))
(map-set articles id {author: tx-sender, title: title, published: false})
(var-set article-id (+ id u1))
(ok id)))
(define-read-only (get-article (id uint))
(map-get? articles id))
Functions (2)
| Function | Access | Args |
|---|---|---|
| create-article | public | title: (string-ascii 100 |
| get-article | read-only | id: uint |