References/constraints

In Universa Smart Contracts, references (sometimes called constraints) are a method to add extra custom verification logic to any roles.

One, and the original usage of that, is to refer to any roles in any other contracts, specified somehow (e.g. by the requirements on their fields). The syntax of the references, though, allows to add advanced logic rules (e.g. depending on the field values and how they correlate to each other).

Some examples of using the references (but their syntax is way wider than that):

  • The role in question must be taken from the attached contract, which must be in APPROVED state and have the specified Origin ID;
  • The role may be a regular SimpleRole (see roles for explanation), but is applicable only if the contract registration time is later than January 1, 2048;
  • The role may be a regular SimpleRole but is applicable only when some attached contract (in APPROVED state) has a data field enabled set to true.

For advanced details and references logic specification, see References article.