mintExactAmount function
Mint a conservatively sized lot-rounded position whose premium does not exceed
max_premium. The result may be one lot below the largest fitting quantity and
must meet min_quantity.
Fees, builder fees, and EWMA congestion penalties are charged on top of
max_premium, so max_cost — not max_premium — bounds the all-in USDC
withdrawal (premium + trader-paid fee + builder_fee + EWMA penalty).
max_cost is required: unlike mint_exact_quantity's guards there is no value
that disables it, because the budget shape exists to bound spend. The sizing
budget is first capped to the account's available USDC after settlement; fees
still require additional available USDC at payment time. Any unspent premium
dust remains in the account because order quantity must be an integer number of
position_lot_size lots.
Implementation
MoveCallBuilder mintExactAmount(
{dynamic arguments, String? package, Map<String, dynamic>? config}) {
final packageAddress = package ??
(config?['predictPackageId'] as String?) ??
'@local-pkg/deepbook_predict';
return (tx) => tx.moveCall(
'$packageAddress::expiry_market::mint_exact_amount',
arguments: normalizeMoveArguments(
tx,
withConfigDefaults(
arguments, config, const {'config': 'protocolConfig'}),
[
null,
null,
null,
null,
null,
'u64',
'u64',
'u64',
'u64',
'u64',
'0x2::accumulator::AccumulatorRoot',
'0x2::clock::Clock'
],
[
'market',
'wrapper',
'auth',
'config',
'pricer',
'lowerTick',
'higherTick',
'maxPremium',
'minQuantity',
'maxCost'
]),
);
}