Safe Haskell | None |
---|---|
Language | Haskell2010 |
Global blockchain state (emulated).
Synopsis
- data ContractState = ContractState {
- csBalance :: !Mutez
- csStorage :: !UntypedValue
- csContract :: !UntypedContract
- data AddressState
- asBalance :: AddressState -> Mutez
- data GState = GState {}
- genesisAddress :: Address
- genesisAddressText :: Text
- genesisKeyHash :: KeyHash
- initGState :: GState
- readGState :: FilePath -> IO GState
- writeGState :: FilePath -> GState -> IO ()
- data GStateUpdate
- data GStateUpdateError
- applyUpdate :: GStateUpdate -> GState -> Either GStateUpdateError GState
- applyUpdates :: [GStateUpdate] -> GState -> Either GStateUpdateError GState
Auxiliary types
data ContractState Source #
State of a contract with code.
ContractState | |
|
Instances
data AddressState Source #
State of an arbitrary address.
ASSimple !Mutez | For contracts without code we store only its balance. |
ASContract !ContractState | For contracts with code we store more state represented by
|
Instances
asBalance :: AddressState -> Mutez Source #
Extract balance from AddressState
.
GState
Persistent data passed to Morley contracts which can be updated as result of contract execution.
GState | |
|
genesisAddress :: Address Source #
Initially this address has a lot of money.
genesisAddressText :: Text Source #
Initially this address has a lot of money.
genesisKeyHash :: KeyHash Source #
KeyHash of genesis address.
initGState :: GState Source #
Operations on GState
data GStateUpdate Source #
Updates that can be applied to GState
.
GSAddAddress !Address !AddressState | |
GSSetStorageValue !Address !UntypedValue | |
GSSetBalance !Address !Mutez |
Instances
Eq GStateUpdate Source # | |
Defined in Morley.Runtime.GState (==) :: GStateUpdate -> GStateUpdate -> Bool # (/=) :: GStateUpdate -> GStateUpdate -> Bool # | |
Show GStateUpdate Source # | |
Defined in Morley.Runtime.GState showsPrec :: Int -> GStateUpdate -> ShowS # show :: GStateUpdate -> String # showList :: [GStateUpdate] -> ShowS # | |
Buildable GStateUpdate Source # | |
Defined in Morley.Runtime.GState build :: GStateUpdate -> Builder # |
data GStateUpdateError Source #
Instances
Show GStateUpdateError Source # | |
Defined in Morley.Runtime.GState showsPrec :: Int -> GStateUpdateError -> ShowS # show :: GStateUpdateError -> String # showList :: [GStateUpdateError] -> ShowS # | |
Buildable GStateUpdateError Source # | |
Defined in Morley.Runtime.GState build :: GStateUpdateError -> Builder # |
applyUpdate :: GStateUpdate -> GState -> Either GStateUpdateError GState Source #
Apply GStateUpdate
to GState
.
applyUpdates :: [GStateUpdate] -> GState -> Either GStateUpdateError GState Source #
Apply a list of GStateUpdate
s to GState
.