Created
June 3, 2019 21:08
-
-
Save mightybyte/f795fd59cb9d1a42fd09bff1d75c2c6c to your computer and use it in GitHub Desktop.
Revisions
-
mightybyte created this gist
Jun 3, 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,32 @@ ; Simplified example of a token implementation. ; When I run `(typecheck "my-token")` I get the error: ; > Typecheck my-token: Unable to resolve all types (module my-token GOVERNANCE (defschema accounts-schema balance:integer guard:guard ) (deftable accounts-table:{accounts-schema}) (defcap GOVERNANCE () true ) (defcap NULL_GUARD () "Used as a placeholder when calling with-default-read." false ) (defun get-balance:integer (accountId:string) (with-default-read accounts-table accountId { "balance" : 0, "guard" : NULL_GUARD } { "balance" := balance } balance ) ) ) (create-table accounts-table)