;; alcove-cache-44
(define-map votes { voter: principal } { choice: uint, weight: uint })
(define-data-var factor-count uint u0)
(define-data-var quorum uint u11)
(define-data-var voting-open bool true)
(define-public (cast-vote (choice uint) (weight uint))
(if (var-get voting-open)
(begin
(map-set votes { voter: tx-sender } { choice: choice, weight: weight })
(var-set factor-count (+ (var-get factor-count) u1))
(ok true))
(err u1)))
(define-public (close-voting)
(begin
(var-set voting-open false)
(ok true)))
(define-read-only (get-vote (who principal))
(ok (map-get? votes { voter: who })))
(define-read-only (get-vote-count)
(ok (var-get factor-count)))
(define-read-only (is-open)
(ok (var-get voting-open)))