Safe Haskell | None |
---|---|
Language | Haskell2010 |
Global blockchain state (emulated).
Synopsis
- data ContractState = forall cp st.(ParameterScope cp, StorageScope st) => ContractState {}
- data AddressState
- asBalance :: AddressState -> Mutez
- data GState = GState {}
- gsChainIdL :: Lens' GState ChainId
- gsAddressesL :: Lens' GState (Map Address AddressState)
- gsCounterL :: Lens' GState GlobalCounter
- genesisAddresses :: NonEmpty Address
- genesisKeyHashes :: NonEmpty KeyHash
- genesisAddress :: Address
- genesisAddress1 :: Address
- genesisAddress2 :: Address
- genesisAddress3 :: Address
- genesisAddress4 :: Address
- genesisAddress5 :: Address
- genesisAddress6 :: Address
- genesisKeyHash :: KeyHash
- genesisSecretKey :: SecretKey
- genesisSecrets :: NonEmpty SecretKey
- initGState :: GState
- readGState :: FilePath -> IO GState
- writeGState :: FilePath -> GState -> IO ()
- data GStateUpdate where
- GSAddAddress :: Address -> AddressState -> GStateUpdate
- GSSetStorageValue :: StorageScope st => Address -> Value st -> GStateUpdate
- GSSetBalance :: Address -> Mutez -> GStateUpdate
- GSIncrementCounter :: GStateUpdate
- data GStateUpdateError
- applyUpdate :: GStateUpdate -> GState -> Either GStateUpdateError GState
- applyUpdates :: [GStateUpdate] -> GState -> Either GStateUpdateError GState
- extractAllContracts :: GState -> TcOriginatedContracts
Auxiliary types
data ContractState Source #
State of a contract with code.
forall cp st.(ParameterScope cp, StorageScope st) => ContractState | |
Instances
Show ContractState Source # | |
Defined in Michelson.Runtime.GState showsPrec :: Int -> ContractState -> ShowS # show :: ContractState -> String # showList :: [ContractState] -> ShowS # | |
ToJSON ContractState Source # | |
Defined in Michelson.Runtime.GState toJSON :: ContractState -> Value # toEncoding :: ContractState -> Encoding # toJSONList :: [ContractState] -> Value # toEncodingList :: [ContractState] -> Encoding # | |
FromJSON ContractState Source # | |
Defined in Michelson.Runtime.GState parseJSON :: Value -> Parser ContractState # parseJSONList :: Value -> Parser [ContractState] # | |
Buildable ContractState Source # | |
Defined in Michelson.Runtime.GState build :: ContractState -> Builder # |
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 | |
|
genesisAddresses :: NonEmpty Address Source #
Initially these addresses have a lot of money.
genesisKeyHashes :: NonEmpty KeyHash Source #
KeyHash of genesis address.
genesisAddress :: Address Source #
One of genesis addresses.
More genesisAddresses which can be used in tests
genesisAddress1 :: Address Source #
More genesis addresses
We know size of genesisAddresses
, so it is safe to use !!
genesisAddress2 :: Address Source #
More genesis addresses
We know size of genesisAddresses
, so it is safe to use !!
genesisAddress3 :: Address Source #
More genesis addresses
We know size of genesisAddresses
, so it is safe to use !!
genesisKeyHash :: KeyHash Source #
One of genesis key hashes.
Genesis secret keys
genesisSecretKey :: SecretKey Source #
Secret key assotiated with genesisAddress
.
genesisSecrets :: NonEmpty SecretKey Source #
Secrets from which genesis addresses are derived from.
initGState :: GState Source #
Operations on GState
data GStateUpdate where Source #
Updates that can be applied to GState
.
GSAddAddress :: Address -> AddressState -> GStateUpdate | |
GSSetStorageValue :: StorageScope st => Address -> Value st -> GStateUpdate | |
GSSetBalance :: Address -> Mutez -> GStateUpdate | |
GSIncrementCounter :: GStateUpdate |
Instances
Show GStateUpdate Source # | |
Defined in Michelson.Runtime.GState showsPrec :: Int -> GStateUpdate -> ShowS # show :: GStateUpdate -> String # showList :: [GStateUpdate] -> ShowS # | |
Buildable GStateUpdate Source # | |
Defined in Michelson.Runtime.GState build :: GStateUpdate -> Builder # |
data GStateUpdateError Source #
GStateAddressExists Address | |
GStateUnknownAddress Address | |
GStateNotContract Address | |
GStateStorageNotMatch Address |
Instances
Show GStateUpdateError Source # | |
Defined in Michelson.Runtime.GState showsPrec :: Int -> GStateUpdateError -> ShowS # show :: GStateUpdateError -> String # showList :: [GStateUpdateError] -> ShowS # | |
Buildable GStateUpdateError Source # | |
Defined in Michelson.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
.
extractAllContracts :: GState -> TcOriginatedContracts Source #
Retrieve all contracts stored in GState