voting-system
SP9J1MR94CRTZ7476R8MWZ53W073GVKZ7VX63SZKSource Code
;; Voting System
(define-map votes {vote-id: uint} {creator: principal, title: (string-ascii 100), yes-count: uint, no-count: uint, status: (string-ascii 20)})
(define-public (create-vote (vote-id uint) (title (string-ascii 100)) (status (string-ascii 20)))
(begin (map-set votes {vote-id: vote-id} {creator: tx-sender, title: title, yes-count: u0, no-count: u0, status: status}) (ok true)))
(define-read-only (get-vote (vote-id uint))
(map-get? votes {vote-id: vote-id}))
Functions (2)
| Function | Access | Args |
|---|---|---|
| create-vote | public | vote-id: uint, title: (string-ascii 100 |
| get-vote | read-only | vote-id: uint |