Created
June 5, 2019 21:45
-
-
Save mightybyte/decaf13c4956f0a358c99e36a9bd4b9f to your computer and use it in GitHub Desktop.
Revisions
-
mightybyte created this gist
Jun 5, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ ;; ;; "Hello, world!" smart contract/module ;; ;; Define the module. (module hello-world MODULE_ADMIN "A smart contract to greet the world." ; no-op module admin for example purposes. ; in a real contract this could enforce a keyset, or ; tally votes, etc. (defcap MODULE_ADMIN () true) (defschema message-schema @doc "Message schema" @model [(invariant (!= msg ""))] msg:string) (deftable message:{message-schema}) (defun set-message ( m:string ) "Set the message that will be used next" (write message "0" {"msg": m}) ) (defun greet () "Do the hello-world dance" (with-default-read message "0" { "msg": "" } { "msg":= msg } (format "Hello {}!" [msg]))) ) (create-table message) (set-message "world") (greet)