Alpha: use 'dft' field for boolean flag

This simplifies the binary encoding without changing the semantics of
the JSON objects.
This commit is contained in:
Grégoire Henry 2018-05-31 17:41:45 +02:00 committed by Benjamin Canou
parent ce79dc5383
commit b7ca0a1e1e

View File

@ -240,8 +240,8 @@ module Encoding = struct
(obj6
(req "managerPubkey" Signature.Public_key_hash.encoding)
(req "balance" Tez_repr.encoding)
(opt "spendable" bool)
(opt "delegatable" bool)
(dft "spendable" bool true)
(dft "delegatable" bool true)
(opt "delegate" Signature.Public_key_hash.encoding)
(opt "script" Script_repr.encoding)) ;
select =
@ -256,14 +256,10 @@ module Encoding = struct
(* the hash is only used internally
when originating from smart
contracts, don't serialize it *) } ->
(manager, credit, Some spendable,
Some delegatable, delegate, script)) ;
(manager, credit, spendable,
delegatable, delegate, script)) ;
inj =
(fun (manager, credit, spendable, delegatable, delegate, script) ->
let delegatable =
match delegatable with None -> true | Some b -> b in
let spendable =
match spendable with None -> true | Some b -> b in
Origination
{manager ; credit ; spendable ; delegatable ;
delegate ; script ; preorigination = None })