Liquidity_baking_machine.ConcreteMachine
A machine that can execute scenarios onchain.
type t = Block.t
The state of the ConcreteMachine
.
val get_xtz_balance :
Mavryk_protocol_alpha.Protocol.Alpha_context.Contract.t ->
t ->
xtz Mavryk_base.TzPervasives.tzresult Lwt.t
get_xtz_balance c state
returns the amount of mumav owned by c
in state
.
val get_tzbtc_balance :
Mavryk_protocol_alpha.Protocol.Alpha_context.Contract.t ->
Mavryk_protocol_alpha.Protocol.Alpha_context.Contract.t env ->
t ->
tzbtc Mavryk_base.TzPervasives.tzresult Lwt.t
get_tzbtc_balance c env state
returns the amount of TzBTC owned by c
in state
, according to the TzBTC
contract.
val get_liquidity_balance :
Mavryk_protocol_alpha.Protocol.Alpha_context.Contract.t ->
Mavryk_protocol_alpha.Protocol.Alpha_context.Contract.t env ->
t ->
liquidity Mavryk_base.TzPervasives.tzresult Lwt.t
get_liquidity_balance c env state
returns the amount of liquidity token owned by c
in state
, according to the Liquidity
contract.
val get_cpmm_total_liquidity :
Mavryk_protocol_alpha.Protocol.Alpha_context.Contract.t env ->
t ->
liquidity Mavryk_base.TzPervasives.tzresult Lwt.t
get_cpmm_total_liquidity env state
fetches the current amount of liquidity tokens distributed by the CPMM contract from the state state
.
val build :
?invariant:
(Mavryk_protocol_alpha.Protocol.Alpha_context.Contract.t env ->
t ->
bool Mavryk_base.TzPervasives.tzresult Lwt.t) ->
?subsidy:xtz ->
specs ->
(t * Mavryk_protocol_alpha.Protocol.Alpha_context.Contract.t env)
Mavryk_base.TzPervasives.tzresult
Lwt.t
build specs
asynchronously computes (1) an initial block for the ConcreteMachine
, and (2) the environment associated to this block.
The machine enforces the resulting state is consistent with the specs
given as inputs, and raises an Assert_failure
exception if it does not. It also enforces that the machines used underneath remain in sync.
One can use the optional argument subsidy
to set the subsidy amount to a given value (by default, we use the same as the main chain). Additionally, the invariant
optional argument can be used to verify that a given invariant holds at the end of the initialization.
val step :
?invariant:
(Mavryk_protocol_alpha.Protocol.Alpha_context.Contract.t env ->
t ->
bool Mavryk_base.TzPervasives.tzresult Lwt.t) ->
Mavryk_protocol_alpha.Protocol.Alpha_context.Contract.t step ->
Mavryk_protocol_alpha.Protocol.Alpha_context.Contract.t env ->
t ->
t Mavryk_base.TzPervasives.tzresult Lwt.t
step s env state
asynchronously executes a single step s
from state
.
The invariant
optional argument can be used to verify that a given invariant holds after each baked block.
val run :
?invariant:
(Mavryk_protocol_alpha.Protocol.Alpha_context.Contract.t env ->
t ->
bool Mavryk_base.TzPervasives.tzresult Lwt.t) ->
contract_id step list ->
Mavryk_protocol_alpha.Protocol.Alpha_context.Contract.t env ->
t ->
t Mavryk_base.TzPervasives.tzresult Lwt.t
run lss env state
asynchronously executes a list of steps from state
.
The invariant
optional argument can be used to verify that a given invariant holds after each baked block.