Module common_strategies
Expand description
This module contains the common asset ops strategies.
Structs§
- Admin
- The
Admin
strategy is both inspect and update strategy allows getting and setting the admin of an asset. - Bytes
- The
Bytes
strategy represents raw state bytes. It is both an inspect and update strategy. - CanCreate
- The
CanCreate
strategy represents the ability to create an asset. It is both an inspect and update strategy. - CanDestroy
- The
CanDestroy
strategy represents the ability to destroy an asset. It is both an inspect and update strategy. - CanUpdate
- The
CanUpdate
strategy represents the ability to update the state of an asset. It is both an inspect and update strategy. - Check
Origin - The
CheckOrigin
is a strategy that accepts a runtime origin and theInner
strategy. - Check
State - The
CheckState
is a strategy that accepts anInspect
value and theInner
strategy. - Config
Value - Represents the value of an InspectStrategy to be used as a configuration value in the WithConfig strategy.
- Derive
AndReport Id - The
DeriveAndReportId
is an ID assignment approach intended to be used in"create" strategies
. - Derive
Strategy Then Create - This adapter allows one to derive a CreateStrategy value from the ID derivation parameters from the DeriveAndReportId.
- NoParams
- The NoParams represents the simplest state-mutating strategy, which doesn’t require any parameters to perform the operation.
- Owner
- The
Owner
strategy is both inspect and update strategy allows getting and setting the owner of an asset. - With
Config - The
WithConfig
is a create and restore strategy. It facilitates setting the asset’s properties that can be later inspected via the corresponding inspect strategies. The provided asset’s properties are considered its config. Every inspect strategy can be used to create a config value. - Witness
- The
Witness
strategy is an inspect strategy, which gets the specifiedWitnessData
from the asset.
Traits§
- AsCan
Update - This trait converts the given UpdateStrategy into the corresponding CanUpdate strategy representing the ability to update the asset using the provided strategy.
- Config
Value Marker - This trait marks a config value to be used in the WithConfig strategy. It is used to make compiler error messages clearer if invalid type is supplied into the WithConfig.
- With
Config Value - This trait converts the given InspectStrategy into the config value to be used in the WithConfig strategy.
Type Aliases§
- AutoId
- The
AutoId
is an ID assignment approach intended to be used in"create" strategies
. - Change
Owner From - The operation implementation must check
if the given account owns the asset and only then perform the owner update to the one supplied
to the
Update::update
function. - IfOwned
By - The operation implementation must check if the given account owns the asset and act according to the inner strategy.
- Predefined
Id - The
PredefinedId
is an ID assignment approach intended to be used in"create" strategies
. - With
Witness - The operation implementation must check if the given witness represents the correct state of the asset. If so, the operation must act according to the inner strategy.