Simple non-trivial receive logic example
Only allow receiving tokens of non-zero quantity of the listed assets.
Constraints:
There is a created kudo ‘r’ in the same action s.t.:
r.owner = self.label.owner
(checking that the kudo is created for the person whose receive logic is currently being checked)r.kind() is in allowedKinds
. List of allowed kinds is hardcoded in the logic in this example. We can imagine that it is something like this:allowedKinds = [apple, orange, banana]
(the list contains specific kinds instead of letters)r.quantity > 0
The constraint is triggered for all receive logic resources (we only create ephemeral ones to trigger the logic by design, but we can just not check it since it doesn’t seem to allow any invalid behaviour)