Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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 #
Instances
data OriginationOperation Source #
Data necessary to originate a contract.
forall cp st kind.(StorageScope st, ParameterScope cp, L1AddressKind kind) => OriginationOperation | |
|
Instances
Show OriginationOperation Source # | |
Defined in Morley.Michelson.Typed.Operation showsPrec :: Int -> OriginationOperation -> ShowS # show :: OriginationOperation -> String # showList :: [OriginationOperation] -> ShowS # | |
Buildable OriginationOperation Source # | Prettyprinter for
|
Defined in Morley.Michelson.Typed.Operation build :: OriginationOperation -> Doc buildList :: [OriginationOperation] -> Doc |
data TransferOperation Source #
Data necessary to send a transaction to given address which is assumed to be the address of an originated contract.
Instances
Show TransferOperation Source # | |
Defined in Morley.Michelson.Typed.Operation showsPrec :: Int -> TransferOperation -> ShowS # show :: TransferOperation -> String # showList :: [TransferOperation] -> ShowS # | |
Buildable TransferOperation Source # | Prettyprinter for
|
Defined in Morley.Michelson.Typed.Operation build :: TransferOperation -> Doc buildList :: [TransferOperation] -> Doc |
data SetDelegateOperation Source #
Set contract's delegate
SetDelegateOperation | |
|
Instances
Show SetDelegateOperation Source # | |
Defined in Morley.Michelson.Typed.Operation showsPrec :: Int -> SetDelegateOperation -> ShowS # show :: SetDelegateOperation -> String # showList :: [SetDelegateOperation] -> ShowS # | |
Buildable SetDelegateOperation Source # | Prettyprinter for
|
Defined in Morley.Michelson.Typed.Operation build :: SetDelegateOperation -> Doc buildList :: [SetDelegateOperation] -> Doc |
data EmitOperation Source #
forall t.PackedValScope t => EmitOperation | |
|
Instances
Show EmitOperation Source # | |
Defined in Morley.Michelson.Typed.Operation showsPrec :: Int -> EmitOperation -> ShowS # show :: EmitOperation -> String # showList :: [EmitOperation] -> ShowS # | |
Buildable EmitOperation Source # | Prettyprinter for
|
Defined in Morley.Michelson.Typed.Operation build :: EmitOperation -> Doc buildList :: [EmitOperation] -> Doc |
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
.