Skip to content

Instantly share code, notes, and snippets.

@cliffhall
Last active July 1, 2022 20:04
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 cliffhall/90493dbed4c8e1e63be1d6509e22c3cf to your computer and use it in GitHub Desktop.
Save cliffhall/90493dbed4c8e1e63be1d6509e22c3cf to your computer and use it in GitHub Desktop.
//--------------------------------------------------------------------------------------------------------------------
// Machine definitions
//
// Plain JS object with the following properties:
//
// name - machine name. begin with letter, no spaces, a-z, A-Z, 0-9, and _
// initialStateId - keccak256 hash of initial state name
// uri - off-chain URI of metadata describing the machine
// states - an array of plain objects representing State entities
//
// Note: operator property of Machine guardLogic property of State are omitted,
// and will be populated at deployment
//
// See: Machine https://docs.fismo.xyz/domain/Machine.html
// State https://docs.fismo.xyz/domain/State.html
//--------------------------------------------------------------------------------------------------------------------
// LOCKABLE DOOR MACHINE
exports.LockableDoorMachine = {
"name": "LockableDoor",
"initialStateId": nameToId("Closed"),
"uri": "ipfs://bafkreidesmqwxqjsrc7i2ef7odriel6ovm5ifriybpfh53tyecfd52ow5y",
"states": [
{
"name": "Closed",
"enterGuarded": false,
"exitGuarded": false,
"transitions": [
{
"action": "Open",
"targetStateName": "Opened",
},
{
"action": "Lock",
"targetStateName": "Locked",
}
]
},
{
"name": "Locked",
"enterGuarded": false,
"exitGuarded": true,
"transitions": [
{
"action": "Unlock",
"targetStateName": "Closed",
},
]
},
{
"name": "Opened",
"enterGuarded": false,
"exitGuarded": false,
"transitions": [
{
"action": "Close",
"targetStateName": "Closed"
}
]
},
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment