Move Coding Patterns
This section introduces various Move coding patterns designed to address specific logic challenges you may encounter while developing packages for the IOTA blockchain.
Capabilities
The capability pattern allows for the authorization of actions on an object.
Witness and Transferable Witness
A witness and a transferable witness are types with the drop
ability
that proves its owner was present during a privileged operation.
For example, having access to a one-time witness (OTW)
for a module demonstrates that the code is being executed at the time the module was first published.
Hot Potato
The hot potato pattern refers to a struct that lacks capabilities, meaning it can only be packed and unpacked within its defining module.
ID Pointer
Objects can reference each other by using their IDs as pointers.
For example,
a capability that controls access to another object might store that object's ID
to perform authorization checks.