requestSupply function
Queue a supply request: pull amount USDC from account custody into queue
escrow, recording the account's receive address as the fill recipient. The pull
auto-settles any flush-delivered USDC first. The flush charges the protocol's
supply fee — zero by default — on the USDC it takes in and prices shares on the
remainder, so min_plp_out is measured after that fee. The account receives
minted PLP only at a mark that mints at least min_plp_out for the whole
amount — a price floor, not a promise of that many shares: if the pool cap
leaves room for only part of the deposit, the fill is proportionally smaller at
the same price and the remainder stays queued with its limit rescaled. At the
shipped attempt count of one, a flush whose mark quotes less cancels and refunds
the request there and then; a higher configured count lets it rest and retry
that many flushes first. Returns the queue index, the handle used to cancel
before the flush.
Implementation
MoveCallBuilder requestSupply(
{dynamic arguments, String? package, Map<String, dynamic>? config}) {
final packageAddress = package ??
(config?['predictPackageId'] as String?) ??
'@local-pkg/deepbook_predict';
return (tx) => tx.moveCall(
'$packageAddress::plp::request_supply',
arguments: normalizeMoveArguments(
tx,
withConfigDefaults(arguments, config,
const {'vault': 'poolVault', 'config': 'protocolConfig'}),
[
null,
null,
null,
null,
'u64',
'u64',
'0x2::accumulator::AccumulatorRoot',
'0x2::clock::Clock'
],
[
'vault',
'wrapper',
'auth',
'config',
'amount',
'minPlpOut'
]),
);
}