Statuses

Once you have defined the state, you need to show the different statuses that the state can be in. You do this by having a copy of the State for each status.

The properties shown in each status box may differ. This allows you to highlight the properties which are salient for that status even though they are actually a view of the same underlying class which must implement the union of all properties on the diagram.

In this example the participants remain consistent in all statuses but this will not always be the case.

To prevent an explosion of complexity, CDL mandates the following rules:

  • The Primary state type is defined as the state type in the Smart Contract which has a status field.
  • There can only be one Primary state type per smart contract, although there can be multiple smart contracts operating and interacting in a single transaction each of which have their own Primary state type.
  • Other state types in this smart contract cannot have a status field.
  • A transaction’s inputs can only contain primary states with a single status.
  • A transaction’s outputs can only contain primary states with a single status, although this can be different from the input status.