Expand description

Provides functionality around the transaction storage.

Transactional storage provides functionality to run an entire code block in a storage transaction. This means that either the entire changes to the storage are committed or everything is thrown away. This simplifies the writing of functionality that may bail at any point of operation. Otherwise you would need to first verify all storage accesses and then do the storage modifications.

with_transaction provides a way to run a given closure in a transactional context.


The maximum number of nested layers.
The key that is holds the current number of active layers.


Execute the supplied function, ensuring we are at least in one storage layer.
Check if the current call is within a transactional layer.
Execute the supplied function, adding a new storage layer.
Execute the supplied function in a new storage transaction.
Same as with_transaction but without a limit check on nested transactional layers.

Type Definitions

The type that is being used to store the current number of active layers.