Skip to content

Instantly share code, notes, and snippets.

@mightybyte
Created June 3, 2019 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mightybyte/f795fd59cb9d1a42fd09bff1d75c2c6c to your computer and use it in GitHub Desktop.
Save mightybyte/f795fd59cb9d1a42fd09bff1d75c2c6c to your computer and use it in GitHub Desktop.
Type error mentioned on Discord
; 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment