Source Code

(define-map hack-count principal uint)
(define-data-var total-hacks uint u0)

(define-public (hack-node)
  (begin
    (map-set hack-count tx-sender
      (+ (default-to u0 (map-get? hack-count tx-sender)) u1))
    (var-set total-hacks (+ (var-get total-hacks) u1))
    (ok true)))

(define-read-only (get-hack-count (who principal))
  (default-to u0 (map-get? hack-count who)))

(define-read-only (get-total-hacks)
  (var-get total-hacks))

Functions (3)

FunctionAccessArgs
hack-nodepublic
get-hack-countread-onlywho: principal
get-total-hacksread-only