Source Code

;; Contract 7: Color Vote
(define-map votes (string-ascii 10) uint)

(define-public (vote-color (color (string-ascii 10)))
    (let ((current-votes (default-to u0 (map-get? votes color))))
        (ok (map-set votes color (+ current-votes u1)))
    )
)

(define-read-only (get-votes (color (string-ascii 10)))
    (ok (default-to u0 (map-get? votes color)))
)

Functions (2)

FunctionAccessArgs
vote-colorpubliccolor: (string-ascii 10
get-votesread-onlycolor: (string-ascii 10