Last active
July 1, 2022 20:04
-
-
Save cliffhall/90493dbed4c8e1e63be1d6509e22c3cf to your computer and use it in GitHub Desktop.
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 characters
//-------------------------------------------------------------------------------------------------------------------- | |
// 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