Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Morley.Michelson.Typed.Operation
Synopsis
- newtype OperationHash = OperationHash {}
- data OriginationOperation = forall cp st kind.(StorageScope st, ParameterScope cp, L1AddressKind kind) => OriginationOperation {
- ooOriginator :: KindedAddress kind
- ooDelegate :: Maybe KeyHash
- ooBalance :: Mutez
- ooStorage :: Value st
- ooContract :: Contract cp st
- ooCounter :: GlobalCounter
- ooAlias :: Maybe ContractAlias
- data TransferOperation = TransferOperation {}
- data SetDelegateOperation = SetDelegateOperation {}
- data EmitOperation = forall t.PackedValScope t => EmitOperation {
- eoSource :: ContractAddress
- eoEmit :: Emit Instr t
- mkContractAddress :: OperationHash -> GlobalCounter -> ContractAddress
- mkOriginationOperationHash :: OriginationOperation -> OperationHash
- mkTransferOperationHash :: ParameterScope t => KindedAddress kind -> Value t -> EpName -> Mutez -> OperationHash
- mkTransferTicketOperationHash :: TicketKey -> Natural -> Address -> EpName -> OperationHash
- mkDelegationOperationHash :: SetDelegateOperation -> OperationHash
Documentation
newtype OperationHash Source #
Constructors
OperationHash | |
Fields |
Instances
data OriginationOperation Source #
Data necessary to originate a contract.
Constructors
forall cp st kind.(StorageScope st, ParameterScope cp, L1AddressKind kind) => OriginationOperation | |
Fields
|
Instances
Show OriginationOperation Source # | |
Defined in Morley.Michelson.Typed.Operation Methods showsPrec :: Int -> OriginationOperation -> ShowS # show :: OriginationOperation -> String # showList :: [OriginationOperation] -> ShowS # | |
Buildable OriginationOperation Source # | Prettyprinter for
|
Defined in Morley.Michelson.Typed.Operation |
data TransferOperation Source #
Data necessary to send a transaction to given address which is assumed to be the address of an originated contract.
Constructors
TransferOperation | |
Fields
|
Instances
Show TransferOperation Source # | |
Defined in Morley.Michelson.Typed.Operation Methods showsPrec :: Int -> TransferOperation -> ShowS # show :: TransferOperation -> String # showList :: [TransferOperation] -> ShowS # | |
Buildable TransferOperation Source # | Prettyprinter for
|
Defined in Morley.Michelson.Typed.Operation |
data SetDelegateOperation Source #
Set contract's delegate
Constructors
SetDelegateOperation | |
Fields
|
Instances
Show SetDelegateOperation Source # | |
Defined in Morley.Michelson.Typed.Operation Methods showsPrec :: Int -> SetDelegateOperation -> ShowS # show :: SetDelegateOperation -> String # showList :: [SetDelegateOperation] -> ShowS # | |
Buildable SetDelegateOperation Source # | Prettyprinter for
|
Defined in Morley.Michelson.Typed.Operation |
data EmitOperation Source #
Constructors
forall t.PackedValScope t => EmitOperation | |
Fields
|
Instances
Show EmitOperation Source # | |
Defined in Morley.Michelson.Typed.Operation Methods showsPrec :: Int -> EmitOperation -> ShowS # show :: EmitOperation -> String # showList :: [EmitOperation] -> ShowS # | |
Buildable EmitOperation Source # | Prettyprinter for
|
Defined in Morley.Michelson.Typed.Operation |
mkContractAddress :: OperationHash -> GlobalCounter -> ContractAddress Source #
Compute address of a contract from its origination operation and global counter.
However, in real Tezos encoding of the operation is more than just OriginationOperation
.
There an Operation has several more meta-fields plus a big sum-type of all possible operations.
In other words, contract hash is calculated as the blake2b160 (20-byte) hash of origination operation hash + word64 global counter.
In Morley we do not yet support full encoding of Tezos Operations, therefore we choose to generate contract addresses in a simplified manner.
Namely, we encode OriginationOperation
as we can and concat it with the global counter.
Then we take blake2b160
hash of the resulting bytes and consider it to be the contract's
address.
mkOriginationOperationHash :: OriginationOperation -> OperationHash Source #
Construct OperationHash
for an OriginationOperation
.
mkTransferOperationHash :: ParameterScope t => KindedAddress kind -> Value t -> EpName -> Mutez -> OperationHash Source #
mkTransferTicketOperationHash :: TicketKey -> Natural -> Address -> EpName -> OperationHash Source #
mkDelegationOperationHash :: SetDelegateOperation -> OperationHash Source #
Construct OperationHash
for a SetDelegateOperation
.