Safe Haskell | None |
---|---|
Language | Haskell2010 |
Module, containing function to interpret Michelson instructions against given context and input stack.
Synopsis
- data ContractEnv = ContractEnv {
- ceNow :: !Timestamp
- ceMaxSteps :: !RemainingSteps
- ceBalance :: !Mutez
- ceContracts :: Map Address UntypedContract
- ceSelf :: !Address
- ceSource :: !Address
- ceSender :: !Address
- ceAmount :: !Mutez
- data InterpreterEnv s = InterpreterEnv {
- ieContractEnv :: ContractEnv
- ieItHandler :: (InstrExtT, SomeItStack) -> EvalOp s ()
- data InterpreterState s = InterpreterState {}
- data MichelsonFailed where
- newtype RemainingSteps = RemainingSteps Word64
- data SomeItStack where
- SomeItStack :: Typeable inp => Rec (Val Instr) inp -> SomeItStack
- type EvalOp s a = ExceptT MichelsonFailed (ReaderT (InterpreterEnv s) (State (InterpreterState s))) a
- interpret :: (ExtC, ToJSON ExpandedInstrExtU, Typeable cp, Typeable st) => Contract cp st -> Val Instr cp -> Val Instr st -> InterpreterEnv s -> s -> ContractReturn s st
- type ContractReturn s st = (Either MichelsonFailed ([Operation Instr], Val Instr st), InterpreterState s)
- interpretUntyped :: forall s. (ExtC, ToJSON ExpandedInstrExtU) => TcExtHandler -> UntypedContract -> UntypedValue -> UntypedValue -> InterpreterEnv s -> s -> Either (InterpretUntypedError s) (InterpretUntypedResult s)
- data InterpretUntypedError s
- data InterpretUntypedResult s where
- InterpretUntypedResult :: (Typeable st, SingI st) => {..} -> InterpretUntypedResult s
- runInstr :: (ExtC, ToJSON ExpandedInstrExtU, Typeable inp) => Instr inp out -> Rec (Val Instr) inp -> EvalOp state (Rec (Val Instr) out)
- runInstrNoGas :: forall a b state. (ExtC, ToJSON ExpandedInstrExtU, Typeable a) => Instr a b -> Rec (Val Instr) a -> EvalOp state (Rec (Val Instr) b)
Documentation
data ContractEnv Source #
Environment for contract execution.
ContractEnv | |
|
data InterpreterEnv s Source #
InterpreterEnv | |
|
data InterpreterState s Source #
Instances
Show s => Show (InterpreterState s) Source # | |
Defined in Michelson.Interpret showsPrec :: Int -> InterpreterState s -> ShowS # show :: InterpreterState s -> String # showList :: [InterpreterState s] -> 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 :: Val Instr t -> MichelsonFailed | |
MichelsonArithError :: ArithError (CVal n) (CVal m) -> MichelsonFailed | |
MichelsonGasExhaustion :: MichelsonFailed | |
MichelsonFailedOther :: Text -> MichelsonFailed |
Instances
Show MichelsonFailed Source # | |
Defined in Michelson.Interpret showsPrec :: Int -> MichelsonFailed -> ShowS # show :: MichelsonFailed -> String # showList :: [MichelsonFailed] -> ShowS # | |
ConversibleExt => Buildable MichelsonFailed Source # | |
Defined in Michelson.Interpret build :: MichelsonFailed -> Builder # |
newtype RemainingSteps Source #
Instances
data SomeItStack where Source #
SomeItStack :: Typeable inp => Rec (Val Instr) inp -> SomeItStack |
type EvalOp s a = ExceptT MichelsonFailed (ReaderT (InterpreterEnv s) (State (InterpreterState s))) a Source #
interpret :: (ExtC, ToJSON ExpandedInstrExtU, Typeable cp, Typeable st) => Contract cp st -> Val Instr cp -> Val Instr st -> InterpreterEnv s -> s -> ContractReturn s st Source #
type ContractReturn s st = (Either MichelsonFailed ([Operation Instr], Val Instr st), InterpreterState s) Source #
interpretUntyped :: forall s. (ExtC, ToJSON ExpandedInstrExtU) => TcExtHandler -> UntypedContract -> UntypedValue -> UntypedValue -> InterpreterEnv s -> s -> Either (InterpretUntypedError s) (InterpretUntypedResult s) Source #
Interpret a contract without performing any side effects.
data InterpretUntypedError s Source #
RuntimeFailure (MichelsonFailed, s) | |
IllTypedContract TCError | |
IllTypedParam TCError | |
IllTypedStorage TCError | |
UnexpectedParamType Text | |
UnexpectedStorageType Text |
Instances
data InterpretUntypedResult s where Source #
InterpretUntypedResult | |
|
Instances
Show s => Show (InterpretUntypedResult s) Source # | |
Defined in Michelson.Interpret showsPrec :: Int -> InterpretUntypedResult s -> ShowS # show :: InterpretUntypedResult s -> String # showList :: [InterpretUntypedResult s] -> ShowS # |