Skip to content

Instantly share code, notes, and snippets.

@et4te
Last active August 6, 2018 02:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save et4te/4dea46b77c001423d6b9a6e275ab67f6 to your computer and use it in GitHub Desktop.
Save et4te/4dea46b77c001423d6b9a6e275ab67f6 to your computer and use it in GitHub Desktop.
Trusted Identity Contracts
[%%version 0.3]
(* Identity Domain *)
type storage =
{ version : string;
owner : address;
domain : (address, bool) map;
}
type action =
SetMember of address * bool
let%entry main (parameter : action) (storage : storage) =
match parameter with
SetMember (id, value) ->
if Current.source () = storage.owner then
let m = Map.add id value storage.domain in
( ([] : operation list), {
version = storage.version;
owner = storage.owner;
domain = m;
} )
else
Current.failwith (Current.source ())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment