2016-09-08 21:13:10 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Copyright (c) 2014 - 2016. *)
|
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
(* Tezos Protocol Implementation - Low level Repr. of Operations *)
|
|
|
|
|
|
|
|
type operation = {
|
|
|
|
hash: Operation_hash.t ;
|
|
|
|
shell: Updater.shell_operation ;
|
|
|
|
contents: proto_operation ;
|
|
|
|
signature: Ed25519.signature option ;
|
|
|
|
}
|
|
|
|
|
|
|
|
and proto_operation =
|
|
|
|
| Anonymous_operations of anonymous_operation list
|
|
|
|
| Sourced_operations of sourced_operations
|
|
|
|
|
|
|
|
and anonymous_operation =
|
|
|
|
| Seed_nonce_revelation of {
|
|
|
|
level: Raw_level_repr.t ;
|
|
|
|
nonce: Seed_repr.nonce ;
|
|
|
|
}
|
|
|
|
|
|
|
|
and sourced_operations =
|
|
|
|
| Manager_operations of {
|
|
|
|
source: Contract_repr.contract ;
|
|
|
|
public_key: Ed25519.public_key option ;
|
|
|
|
fee: Tez_repr.tez ;
|
|
|
|
counter: counter ;
|
|
|
|
operations: manager_operation list ;
|
|
|
|
}
|
|
|
|
| Delegate_operations of {
|
|
|
|
source: Ed25519.public_key ;
|
|
|
|
operations: delegate_operation list ;
|
|
|
|
}
|
|
|
|
|
|
|
|
and manager_operation =
|
|
|
|
| Transaction of {
|
|
|
|
amount: Tez_repr.tez ;
|
|
|
|
parameters: Script_repr.expr option ;
|
|
|
|
destination: Contract_repr.contract ;
|
|
|
|
}
|
|
|
|
| Origination of {
|
2016-11-14 18:54:21 +04:00
|
|
|
manager: Ed25519.Public_key_hash.t ;
|
|
|
|
delegate: Ed25519.Public_key_hash.t option ;
|
2016-09-08 21:13:10 +04:00
|
|
|
script: Script_repr.t ;
|
|
|
|
spendable: bool ;
|
|
|
|
delegatable: bool ;
|
|
|
|
credit: Tez_repr.tez ;
|
|
|
|
}
|
|
|
|
| Issuance of {
|
2016-11-14 18:54:21 +04:00
|
|
|
asset: Asset_repr.t * Ed25519.Public_key_hash.t ;
|
2016-09-08 21:13:10 +04:00
|
|
|
amount: Tez_repr.tez ;
|
|
|
|
}
|
2016-11-14 18:54:21 +04:00
|
|
|
| Delegation of Ed25519.Public_key_hash.t option
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
and delegate_operation =
|
|
|
|
| Endorsement of {
|
|
|
|
block: Block_hash.t ;
|
|
|
|
slot: int ;
|
|
|
|
}
|
|
|
|
| Proposals of {
|
|
|
|
period: Voting_period_repr.t ;
|
|
|
|
proposals: Protocol_hash.t list ;
|
|
|
|
}
|
|
|
|
| Ballot of {
|
|
|
|
period: Voting_period_repr.t ;
|
|
|
|
proposal: Protocol_hash.t ;
|
|
|
|
ballot: Vote_repr.ballot ;
|
|
|
|
}
|
|
|
|
|
|
|
|
and counter = Int32.t
|
|
|
|
|
|
|
|
type error += Cannot_parse_operation
|
|
|
|
|
|
|
|
val parse:
|
|
|
|
Operation_hash.t -> Updater.raw_operation -> operation tzresult
|
|
|
|
|
|
|
|
val parse_proto:
|
|
|
|
MBytes.t ->
|
|
|
|
(proto_operation * Ed25519.signature option) tzresult Lwt.t
|
|
|
|
|
|
|
|
type error += Invalid_signature
|
|
|
|
val check_signature:
|
|
|
|
Ed25519.public_key -> operation -> unit tzresult Lwt.t
|
|
|
|
|
|
|
|
val forge: Updater.shell_operation -> proto_operation -> MBytes.t
|
|
|
|
|
|
|
|
val proto_operation_encoding:
|
|
|
|
proto_operation Data_encoding.t
|
|
|
|
|
|
|
|
val unsigned_operation_encoding:
|
|
|
|
(Updater.shell_operation * proto_operation) Data_encoding.t
|
|
|
|
|
|
|
|
val max_operation_data_length: int
|