;; Simple Storage Contract
;; 1. Define the Data Variable
;; This creates a persistent variable named 'store' that holds a uint (unsigned integer)
(define-data-var store uint u0)
;; 2. Public Function: Set Value
;; This allows any user to update the stored value.
(define-public (set-value (new-value uint))
(begin
;; Update the data variable
(var-set store new-value)
;; Return a success response
(ok true)
)
)
;; 3. Read-Only Function: Get Value
;; This retrieves the current value without costing gas/transaction fees.
(define-read-only (get-value)
(ok (var-get store))
)