Safe Haskell | None |
---|---|
Language | Haskell2010 |
Module, containing function to interpret Michelson instructions against given context and input stack.
Synopsis
- data ContractEnv = ContractEnv {}
- data InterpreterState = InterpreterState {}
- data MichelsonFailed where
- MichelsonFailedWith :: (Typeable t, SingI t) => Value t -> MichelsonFailed
- MichelsonArithError :: (Typeable n, Typeable m) => ArithError (CValue n) (CValue m) -> MichelsonFailed
- MichelsonGasExhaustion :: MichelsonFailed
- MichelsonFailedTestAssert :: Text -> MichelsonFailed
- MichelsonAmbigousEpRef :: EpName -> EpAddress -> MichelsonFailed
- newtype RemainingSteps = RemainingSteps Word64
- data SomeItStack where
- SomeItStack :: ExtInstr inp -> Rec Value inp -> SomeItStack
- type EvalOp a = ExceptT MichelsonFailed (ReaderT ContractEnv (State InterpreterState)) a
- newtype MorleyLogs = MorleyLogs {
- unMorleyLogs :: [Text]
- noMorleyLogs :: MorleyLogs
- interpret :: Contract cp st -> EntryPointCallT cp arg -> Value arg -> Value st -> ContractEnv -> ContractReturn st
- interpretInstr :: ContractEnv -> Instr inp out -> Rec Value inp -> Either MichelsonFailed (Rec Value out)
- type ContractReturn st = (Either MichelsonFailed ([Operation], Value st), InterpreterState)
- handleContractReturn :: StorageScope st => ContractReturn st -> Either InterpretError InterpretResult
- interpretUntyped :: Contract -> Value -> Value -> ContractEnv -> Either InterpretError InterpretResult
- data InterpretError
- data InterpretResult where
- InterpretResult :: StorageScope st => {..} -> InterpretResult
- runInstr :: Instr inp out -> Rec Value inp -> EvalOp (Rec Value out)
- runInstrNoGas :: forall a b. Instr a b -> Rec Value a -> EvalOp (Rec Value b)
- runUnpack :: forall t. UnpackedValScope t => ByteString -> Either UnpackError (Value t)
Documentation
data ContractEnv Source #
Environment for contract execution.
ContractEnv | |
|
data InterpreterState Source #
Instances
Show InterpreterState Source # | |
Defined in Michelson.Interpret showsPrec :: Int -> InterpreterState -> ShowS # show :: InterpreterState -> String # showList :: [InterpreterState] -> ShowS # |
data MichelsonFailed where Source #
Represents `[FAILED]` state of a Michelson program. Contains
value that was on top of the stack when FAILWITH
was called.
MichelsonFailedWith :: (Typeable t, SingI t) => Value t -> MichelsonFailed | |
MichelsonArithError :: (Typeable n, Typeable m) => ArithError (CValue n) (CValue m) -> MichelsonFailed | |
MichelsonGasExhaustion :: MichelsonFailed | |
MichelsonFailedTestAssert :: Text -> MichelsonFailed | |
MichelsonAmbigousEpRef :: EpName -> EpAddress -> MichelsonFailed |
Instances
Eq MichelsonFailed Source # | |
Defined in Michelson.Interpret (==) :: MichelsonFailed -> MichelsonFailed -> Bool # (/=) :: MichelsonFailed -> MichelsonFailed -> Bool # | |
Show MichelsonFailed Source # | |
Defined in Michelson.Interpret showsPrec :: Int -> MichelsonFailed -> ShowS # show :: MichelsonFailed -> String # showList :: [MichelsonFailed] -> ShowS # | |
Buildable MichelsonFailed Source # | |
Defined in Michelson.Interpret build :: MichelsonFailed -> Builder # |
newtype RemainingSteps Source #
Instances
data SomeItStack where Source #
SomeItStack :: ExtInstr inp -> Rec Value inp -> SomeItStack |
type EvalOp a = ExceptT MichelsonFailed (ReaderT ContractEnv (State InterpreterState)) a Source #
newtype MorleyLogs Source #
Morley interpreter state
MorleyLogs | |
|
Instances
Eq MorleyLogs Source # | |
Defined in Michelson.Interpret (==) :: MorleyLogs -> MorleyLogs -> Bool # (/=) :: MorleyLogs -> MorleyLogs -> Bool # | |
Show MorleyLogs Source # | |
Defined in Michelson.Interpret showsPrec :: Int -> MorleyLogs -> ShowS # show :: MorleyLogs -> String # showList :: [MorleyLogs] -> ShowS # | |
Default MorleyLogs Source # | |
Defined in Michelson.Interpret def :: MorleyLogs # | |
Buildable MorleyLogs Source # | |
Defined in Michelson.Interpret build :: MorleyLogs -> Builder # |
interpret :: Contract cp st -> EntryPointCallT cp arg -> Value arg -> Value st -> ContractEnv -> ContractReturn st Source #
interpretInstr :: ContractEnv -> Instr inp out -> Rec Value inp -> Either MichelsonFailed (Rec Value out) Source #
Interpret an instruction in vacuum, putting no extra contraints on its execution.
Mostly for testing purposes.
type ContractReturn st = (Either MichelsonFailed ([Operation], Value st), InterpreterState) Source #
handleContractReturn :: StorageScope st => ContractReturn st -> Either InterpretError InterpretResult Source #
interpretUntyped :: Contract -> Value -> Value -> ContractEnv -> Either InterpretError InterpretResult Source #
Interpret a contract without performing any side effects. This function uses untyped representation of contract, parameter and storage. Mostly used for testing.
data InterpretError Source #
RuntimeFailure (MichelsonFailed, MorleyLogs) | |
IllTypedContract TCError | |
IllTypedParam TCError | |
IllTypedStorage TCError | |
UnexpectedParamType TCTypeError | |
UnexpectedStorageType TCTypeError |
Instances
data InterpretResult where Source #
InterpretResult | |
|
Instances
Show InterpretResult Source # | |
Defined in Michelson.Interpret showsPrec :: Int -> InterpretResult -> ShowS # show :: InterpretResult -> String # showList :: [InterpretResult] -> ShowS # |
runInstr :: Instr inp out -> Rec Value inp -> EvalOp (Rec Value out) Source #
Function to change amount of remaining steps stored in State monad
runUnpack :: forall t. UnpackedValScope t => ByteString -> Either UnpackError (Value t) Source #
Unpacks given raw data into a typed value.