Alpha: fix typo s/token_per_rolls/tokens_per_roll
This commit is contained in:
parent
bdf6a5e564
commit
55ad294595
@ -277,7 +277,7 @@ module Constants : sig
|
||||
val proof_of_work_threshold: context -> int64
|
||||
val dictator_pubkey: context -> Ed25519.Public_key.t
|
||||
val max_operation_data_length: context -> int
|
||||
val token_per_rolls: context -> Tez.t
|
||||
val tokens_per_roll: context -> Tez.t
|
||||
val michelson_maximum_type_size: context -> int
|
||||
|
||||
end
|
||||
|
@ -60,7 +60,7 @@ type constants = {
|
||||
bootstrap_keys: Ed25519.Public_key.t list ;
|
||||
dictator_pubkey: Ed25519.Public_key.t ;
|
||||
max_operation_data_length: int ;
|
||||
token_per_rolls: Tez_repr.t ;
|
||||
tokens_per_roll: Tez_repr.t ;
|
||||
michelson_maximum_type_size: int;
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ let default = {
|
||||
"4d5373455738070434f214826d301a1c206780d7f789fcbf94c2149b2e0718cc" ;
|
||||
max_operation_data_length =
|
||||
16 * 1024 ; (* 16kB *)
|
||||
token_per_rolls =
|
||||
tokens_per_roll =
|
||||
Tez_repr.(mul_exn one 10_000) ;
|
||||
michelson_maximum_type_size = 1000 ;
|
||||
}
|
||||
@ -151,9 +151,9 @@ let constants_encoding =
|
||||
and max_operation_data_length =
|
||||
opt Compare.Int.(=)
|
||||
default.max_operation_data_length c.max_operation_data_length
|
||||
and token_per_rolls =
|
||||
and tokens_per_roll =
|
||||
opt Tez_repr.(=)
|
||||
default.token_per_rolls c.token_per_rolls
|
||||
default.tokens_per_roll c.tokens_per_roll
|
||||
and michelson_maximum_type_size =
|
||||
opt Compare.Int.(=)
|
||||
default.michelson_maximum_type_size c.michelson_maximum_type_size
|
||||
@ -171,7 +171,7 @@ let constants_encoding =
|
||||
bootstrap_keys,
|
||||
dictator_pubkey,
|
||||
max_operation_data_length,
|
||||
token_per_rolls,
|
||||
tokens_per_roll,
|
||||
michelson_maximum_type_size)), ()) )
|
||||
(fun ((( preserved_cycles,
|
||||
blocks_per_cycle,
|
||||
@ -186,7 +186,7 @@ let constants_encoding =
|
||||
bootstrap_keys,
|
||||
dictator_pubkey,
|
||||
max_operation_data_length,
|
||||
token_per_rolls,
|
||||
tokens_per_roll,
|
||||
michelson_maximum_type_size)), ()) ->
|
||||
{ preserved_cycles =
|
||||
unopt default.preserved_cycles preserved_cycles ;
|
||||
@ -215,8 +215,8 @@ let constants_encoding =
|
||||
unopt default.dictator_pubkey dictator_pubkey ;
|
||||
max_operation_data_length =
|
||||
unopt default.max_operation_data_length max_operation_data_length ;
|
||||
token_per_rolls =
|
||||
unopt default.token_per_rolls token_per_rolls ;
|
||||
tokens_per_roll =
|
||||
unopt default.tokens_per_roll tokens_per_roll ;
|
||||
michelson_maximum_type_size =
|
||||
unopt default.michelson_maximum_type_size michelson_maximum_type_size ;
|
||||
} )
|
||||
@ -238,7 +238,7 @@ let constants_encoding =
|
||||
(opt "bootstrap_keys" (list Ed25519.Public_key.encoding))
|
||||
(opt "dictator_pubkey" Ed25519.Public_key.encoding)
|
||||
(opt "max_operation_data_length" int31)
|
||||
(opt "token_per_rolls" Tez_repr.encoding)
|
||||
(opt "tokens_per_roll" Tez_repr.encoding)
|
||||
(opt "michelson_maximum_type_size" uint16)
|
||||
))
|
||||
unit)
|
||||
|
@ -43,9 +43,9 @@ let dictator_pubkey c =
|
||||
let max_operation_data_length c =
|
||||
let constants = Raw_context.constants c in
|
||||
constants.max_operation_data_length
|
||||
let token_per_rolls c =
|
||||
let tokens_per_roll c =
|
||||
let constants = Raw_context.constants c in
|
||||
constants.token_per_rolls
|
||||
constants.tokens_per_roll
|
||||
let michelson_maximum_type_size c =
|
||||
let constants = Raw_context.constants c in
|
||||
constants.michelson_maximum_type_size
|
||||
|
@ -148,16 +148,16 @@ module Delegate = struct
|
||||
return (roll, c)
|
||||
|
||||
let consume_roll_change c delegate =
|
||||
let token_per_rolls = Constants_storage.token_per_rolls c in
|
||||
let tokens_per_roll = Constants_storage.tokens_per_roll c in
|
||||
Storage.Roll.Delegate_change.get c delegate >>=? fun change ->
|
||||
trace Consume_roll_change
|
||||
(Lwt.return Tez_repr.(change -? token_per_rolls)) >>=? fun new_change ->
|
||||
(Lwt.return Tez_repr.(change -? tokens_per_roll)) >>=? fun new_change ->
|
||||
Storage.Roll.Delegate_change.set c delegate new_change
|
||||
|
||||
let recover_roll_change c delegate =
|
||||
let token_per_rolls = Constants_storage.token_per_rolls c in
|
||||
let tokens_per_roll = Constants_storage.tokens_per_roll c in
|
||||
Storage.Roll.Delegate_change.get c delegate >>=? fun change ->
|
||||
Lwt.return Tez_repr.(change +? token_per_rolls) >>=? fun new_change ->
|
||||
Lwt.return Tez_repr.(change +? tokens_per_roll) >>=? fun new_change ->
|
||||
Storage.Roll.Delegate_change.set c delegate new_change
|
||||
|
||||
let pop_roll_from_delegate c delegate =
|
||||
@ -217,16 +217,16 @@ module Delegate = struct
|
||||
|
||||
let add_amount c delegate amount =
|
||||
ensure_inited c delegate >>=? fun c ->
|
||||
let token_per_rolls = Constants_storage.token_per_rolls c in
|
||||
let tokens_per_roll = Constants_storage.tokens_per_roll c in
|
||||
Storage.Roll.Delegate_change.get c delegate >>=? fun change ->
|
||||
Lwt.return Tez_repr.(amount +? change) >>=? fun change ->
|
||||
Storage.Roll.Delegate_change.set c delegate change >>=? fun c ->
|
||||
delegate_pubkey c delegate >>=? fun delegate_pk ->
|
||||
let rec loop c change =
|
||||
if Tez_repr.(change < token_per_rolls) then
|
||||
if Tez_repr.(change < tokens_per_roll) then
|
||||
return c
|
||||
else
|
||||
Lwt.return Tez_repr.(change -? token_per_rolls) >>=? fun change ->
|
||||
Lwt.return Tez_repr.(change -? tokens_per_roll) >>=? fun change ->
|
||||
create_roll_in_delegate c delegate delegate_pk >>=? fun c ->
|
||||
loop c change in
|
||||
Storage.Contract.Inactive_delegate.mem c
|
||||
@ -234,13 +234,13 @@ module Delegate = struct
|
||||
if inactive then return c else loop c change
|
||||
|
||||
let remove_amount c delegate amount =
|
||||
let token_per_rolls = Constants_storage.token_per_rolls c in
|
||||
let tokens_per_roll = Constants_storage.tokens_per_roll c in
|
||||
let rec loop c change =
|
||||
if Tez_repr.(amount <= change)
|
||||
then return (c, change)
|
||||
else
|
||||
pop_roll_from_delegate c delegate >>=? fun (_, c) ->
|
||||
Lwt.return Tez_repr.(change +? token_per_rolls) >>=? fun change ->
|
||||
Lwt.return Tez_repr.(change +? tokens_per_roll) >>=? fun change ->
|
||||
loop c change in
|
||||
Storage.Roll.Delegate_change.get c delegate >>=? fun change ->
|
||||
Storage.Contract.Inactive_delegate.mem c
|
||||
@ -257,7 +257,7 @@ module Delegate = struct
|
||||
|
||||
let set_inactive ctxt delegate =
|
||||
ensure_inited ctxt delegate >>=? fun ctxt ->
|
||||
let token_per_rolls = Constants_storage.token_per_rolls ctxt in
|
||||
let tokens_per_roll = Constants_storage.tokens_per_roll ctxt in
|
||||
Storage.Roll.Delegate_change.get ctxt delegate >>=? fun change ->
|
||||
Storage.Contract.Inactive_delegate.add ctxt
|
||||
(Contract_repr.implicit_contract delegate) >>= fun ctxt ->
|
||||
@ -266,7 +266,7 @@ module Delegate = struct
|
||||
| None -> return (ctxt, change)
|
||||
| Some _roll ->
|
||||
pop_roll_from_delegate ctxt delegate >>=? fun (_, ctxt) ->
|
||||
Lwt.return Tez_repr.(change +? token_per_rolls) >>=? fun change ->
|
||||
Lwt.return Tez_repr.(change +? tokens_per_roll) >>=? fun change ->
|
||||
loop ctxt change in
|
||||
loop ctxt change >>=? fun (ctxt, change) ->
|
||||
Storage.Roll.Delegate_change.set ctxt delegate change >>=? fun ctxt ->
|
||||
@ -300,16 +300,16 @@ module Delegate = struct
|
||||
return ctxt
|
||||
else begin
|
||||
ensure_inited ctxt delegate >>=? fun ctxt ->
|
||||
let token_per_rolls = Constants_storage.token_per_rolls ctxt in
|
||||
let tokens_per_roll = Constants_storage.tokens_per_roll ctxt in
|
||||
Storage.Roll.Delegate_change.get ctxt delegate >>=? fun change ->
|
||||
Storage.Contract.Inactive_delegate.del ctxt
|
||||
(Contract_repr.implicit_contract delegate) >>= fun ctxt ->
|
||||
delegate_pubkey ctxt delegate >>=? fun delegate_pk ->
|
||||
let rec loop ctxt change =
|
||||
if Tez_repr.(change < token_per_rolls) then
|
||||
if Tez_repr.(change < tokens_per_roll) then
|
||||
return ctxt
|
||||
else
|
||||
Lwt.return Tez_repr.(change -? token_per_rolls) >>=? fun change ->
|
||||
Lwt.return Tez_repr.(change -? tokens_per_roll) >>=? fun change ->
|
||||
create_roll_in_delegate ctxt delegate delegate_pk >>=? fun ctxt ->
|
||||
loop ctxt change in
|
||||
loop ctxt change >>=? fun ctxt ->
|
||||
|
Loading…
Reference in New Issue
Block a user