morley-1.16.1: Developer tools for the Michelson Language
Safe HaskellNone
LanguageHaskell2010

Morley.Michelson.Runtime.GState

Description

Global blockchain state (emulated).

Synopsis

Auxiliary types

data ContractState Source #

State of a contract with code.

Constructors

forall cp st.(ParameterScope cp, StorageScope st) => ContractState 

Fields

data AddressState Source #

State of an arbitrary address.

Constructors

ASSimple Mutez

For contracts without code we store only its balance.

ASContract ContractState

For contracts with code we store more state represented by ContractState.

Instances

Instances details
Show AddressState Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

Generic AddressState Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

Associated Types

type Rep AddressState :: Type -> Type #

ToJSON AddressState Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

FromJSON AddressState Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

Buildable AddressState Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

type Rep AddressState Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

type Rep AddressState = D1 ('MetaData "AddressState" "Morley.Michelson.Runtime.GState" "morley-1.16.1-inplace" 'False) (C1 ('MetaCons "ASSimple" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Mutez)) :+: C1 ('MetaCons "ASContract" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ContractState)))

asBalance :: AddressState -> Mutez Source #

Extract balance from AddressState.

newtype VotingPowers Source #

Distribution of voting power among the contracts.

Voting power reflects the ability of bakers to accept, deny or pass new proposals for protocol updates. I.e. each baker has its vote weight.

This datatype definition may change in future, so its internals are not exported.

vpPick :: KeyHash -> VotingPowers -> Natural Source #

Get voting power of the given address.

vpTotal :: VotingPowers -> Natural Source #

Get total voting power.

mkVotingPowers :: [(KeyHash, Natural)] -> VotingPowers Source #

Create voting power distribution.

If some key is encountered multiple times, voting power will be summed up.

mkVotingPowersFromMap :: Map KeyHash Natural -> VotingPowers Source #

Create voting power distribution from map.

dummyVotingPowers :: VotingPowers Source #

Dummy VotingPowers. We give all the voting power to two genesis addreses as the addresses holding lot of money. Only two addresses are involved for simplicity.

newtype BigMapCounter Source #

All big_maps stored in a chain have a globally unique ID.

We use this counter to keep track of how many big_maps have been created so far, and to generate new IDs whenever a new big_map is created.

Constructors

BigMapCounter 

Instances

Instances details
Eq BigMapCounter Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

Num BigMapCounter Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

Show BigMapCounter Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

Generic BigMapCounter Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

Associated Types

type Rep BigMapCounter :: Type -> Type #

ToJSON BigMapCounter Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

FromJSON BigMapCounter Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

NFData BigMapCounter Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

Methods

rnf :: BigMapCounter -> () #

Buildable BigMapCounter Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

type Rep BigMapCounter Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

type Rep BigMapCounter = D1 ('MetaData "BigMapCounter" "Morley.Michelson.Runtime.GState" "morley-1.16.1-inplace" 'True) (C1 ('MetaCons "BigMapCounter" 'PrefixI 'True) (S1 ('MetaSel ('Just "_bigMapCounter") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural)))

GState

data GState Source #

Persistent data passed to Morley contracts which can be updated as result of contract execution.

Constructors

GState 

Fields

Instances

Instances details
Show GState Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

ToJSON GState Source # 
Instance details

Defined in Morley.Michelson.Runtime.GState

FromJSON GState Source # 
Instance details

Defined in Morley.Michelson.Runtime.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 #

Initial GState. It's supposed to be used if no GState is provided. It puts plenty of money on each genesis address.

readGState :: FilePath -> IO GState Source #

Read GState from a file.

writeGState :: FilePath -> GState -> IO () Source #

Write GState to a file.

Operations on GState

extractAllContracts :: GState -> TcOriginatedContracts Source #

Retrieve all contracts stored in GState