Construct a trade from a set of input_pools
with the following condition, Demands offers below the target rate.
Meaning the differential rate of the demand at the highest rate is below the provided rate.
This function does not consider pool fees, Assumes all pools have zero fee.
the supply token of the trade
the demand token of the trade
the target rate
a list of input cauldron pools
the constructed trade result or null if no trade can be generated with the given condition
Construct a trade from a set of input_pools
with the following condition, Demands as much possible with a target average rate.
Meaning the differential rate of the demand at the highest rate is below the provided rate.
the supply token of the trade
the demand token of the trade
the target rate
a list of input cauldron pools
the constructed trade result or null
Construct a trade from a set of input_pools
with the following condition, Demands at least the target amount
at the best rate.
The best rate is estimated based on the state of input_pools
and the fixed cost of network transaction fee.
the supply token of the trade
the demand token of the trade
the order's target demand
a list of input cauldron pools
the network fee to be paid per byte
the constructed trade result
Construct a trade from a set of input_pools
with the following condition, Supply at most the target amount
at the best rate.
The best rate is estimated based on the state of input_pools
and the fixed cost of network transaction fee.
the supply token of the trade
the demand token of the trade
the order's target demand
a list of input cauldron pools
the network fee to be paid per byte
the constructed trade result
Create a chain of transactions from constructed trade.
a list of trades with pools.
a set of spendable coins used provide the supply side of the trade
a set of rules for the trade's payout + a pocket change
an optional message to insert in the transaction as an OP_RETURN output
the rate of network fee (sat/byte)
Optional
controller: CreateChainedTradeTxControlleran optional controller used when generating the transactions
the trade's transaction result.
Create a transaction from constructed trade.
a list of trades with pools.
a set of spendable coins used provide the supply side of the trade
a set of rules for the trade's payout + a pocket change
an optional message to insert in the transaction as an OP_RETURN output
the rate of network fee (sat/byte)
the trade's transaction result.
Generate a pool's locking with PoolV0Parameters
{ withdraw_pubkey_hash }
the pool's p2sh locking bytecode
the subject token_id
the min token in reserve needed for any cauldron pool.
the subject output
the min bch amount required for the output to meet the network threshold
the subject output
the preferred bch amount for a token output
Get the default exchange rate's denominator
the default denominator value of the rate
the default preferred token bch amount
Set the default exchange rate's denominator. A higher value will increase the rate's percision, A lower value reduces it. initial value: 10000000000000n
the default rate's denominator
Verify the validity of a TradeTxResult, Expecting all generated transactions should be valid.
the result of createTradeTx or createChainedTradeTx
Cauldron pool selector & transaction generator tool. Features: