lorentz-0.1.0: EDSL for the Michelson Language

Safe HaskellNone
LanguageHaskell2010

Lorentz.UStore.Haskell

Description

Conversion between UStore in Haskell and Michelson representation.

Synopsis

Documentation

type UStoreContent = [(ByteString, ByteString)] Source #

UStore content represented as key-value pairs.

class (Generic template, GUStoreConversible (Rep template)) => UStoreConversible template Source #

Given template can be converted to UStore value.

Instances
(Generic template, GUStoreConversible (Rep template)) => UStoreConversible template Source # 
Instance details

Defined in Lorentz.UStore.Haskell

mkUStore :: UStoreConversible template => template -> UStore template Source #

Make UStore from separate big_maps and fields.

ustoreDecompose :: forall template. UStoreConversible template => UStore template -> Either Text (UStoreContent, template) Source #

Decompose UStore into separate big_maps and fields.

Since this function needs to UNPACK content of UStore to actual keys and values, you have to provide UnpackEnv.

Along with resulting value, you get a list of UStore entries which were not recognized as belonging to any submap or field according to UStore's template - this should be empty unless UStore invariants were violated.

ustoreDecomposeFull :: forall template. UStoreConversible template => UStore template -> Either Text template Source #

Like ustoreDecompose, but requires all entries from UStore to be recognized.

fillUStore :: UStoreConversible template => template -> UStoreMigration () template Source #

Make migration script which initializes UStore from scratch.

migrateFillUStore :: (UStoreConversible template, allFieldsExp ~ AllUStoreFieldsF template, newDiff ~ FillingNewDiff template diff, newTouched ~ FillingNewTouched template touched, PatternMatchL newDiff, PatternMatchL newTouched) => template -> Lambda (MUStore oldTempl newTempl diff touched) (MUStore oldTempl newTempl newDiff newTouched) Source #

Fill UStore with entries from the given template as part of simple migration.

Sometimes you already have some fields initialized and fillUStore does not suit, then in case if your UStore template is a nested structure you can use sub-templates to initialize the corresponding parts of UStore.

For batched migrations see fillUStoreMigrationBlock.

fillUStoreMigrationBlock :: (UStoreConversible template, allFieldsExp ~ AllUStoreFieldsF template, newDiff ~ FillingNewDiff template diff, newTouched ~ FillingNewTouched template touched, PatternMatchL newDiff, PatternMatchL newTouched) => template -> MigrationBlocks oldTempl newTempl diff touched newDiff newTouched Source #

Version of migrateFillUStore for batched migrations.

Each field write will be placed to a separate batch.