Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/Trigger with state exampleForum ↗

Trigger with state example

App Development1 posts189 viewsLast activity Mar 2022
HU
huwOP
Mar 2022

I’d like to see an examples of how a trigger can be written which does not use () as the state type. So far I can’t find any in the documentation. I have a trigger which needs to see whenever a new contract for a particular template is created. My thinking was to store a set of contract IDs in the state: my updateState function can insert the new contract IDs whenever a CreatedEvent occurs. Then I realized it would simpler to use () for my state and do a linear scan of all active contracts inside my rule function - using query. However this seems quite wasteful having to do a linear time operation on every call of rule.

← Back to Discussions