content-post
SP3CGHKW1Q0QXGW8WPG4JGRBQB2T5B7ZQE8QQ0GW2Source Code
;; Content Posts
(define-map posts uint {author: principal, content: (string-ascii 500), timestamp: uint})
(define-data-var post-id uint u0)
(define-public (publish-post (content (string-ascii 500)) (timestamp uint))
(let ((id (var-get post-id)))
(map-set posts id {author: tx-sender, content: content, timestamp: timestamp})
(var-set post-id (+ id u1))
(ok id)))
(define-read-only (get-post (id uint))
(map-get? posts id))
Functions (2)
| Function | Access | Args |
|---|---|---|
| publish-post | public | content: (string-ascii 500 |
| get-post | read-only | id: uint |