Liquidity_baking_machine.SymbolicMachine
type t = contract_id state
The state of the SymbolicMachine
.
val get_xtz_balance : contract_id -> t -> xtz
get_xtz_balance c state
returns the amount of mumav owned by c
in state
.
val get_tzbtc_balance : contract_id -> contract_id env -> t -> tzbtc
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 : contract_id -> contract_id env -> t -> liquidity
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 : contract_id env -> t -> liquidity
get_cpmm_total_liquidity env state
fetches the current amount of liquidity tokens distributed by the CPMM contract from the state state
.
val predict_required_tzbtc_deposit : xtz -> contract_id env -> t -> tzbtc
predict_required_tzbtc_deposit xtz_deposit env state
predicts the deposit in TzBTC which will be required by the CPMM contract when executing a step AddLiquidity
with xtz_deposit
from state
.
val build :
?invariant:(contract_id env -> t -> bool) ->
?subsidy:xtz ->
specs ->
t * contract_id env
build specs
computes (1) an initial state for the
SymbolicMachine
, and (2) the environment associated to this state.
The machine enforces the resulting state is consistent with the specs
given as inputs, and raises an Assert_failure
exception if it does not.
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:(contract_id env -> t -> bool) ->
contract_id step ->
contract_id env ->
t ->
t
step s env state
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:(contract_id env -> t -> bool) ->
contract_id step list ->
contract_id env ->
t ->
t
run steps env state
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.