PartyB Batch Actions
The PartyB Batch Actions Facet allows PartyB to open multiple positions or fill multiple close requests in a single transaction using one batch Muon signature. Under heavy loads, obtaining individual Muon signatures and sending separate transactions for each quote significantly slows down solver response times. Batch methods address this by processing multiple quotes atomically. The underlying logic is implemented in the PartyBBatchActionsFacetImpl library.
Overview
The PartyB Batch Actions Facet provides the following key functionalities:
Batch Open Positions: Opens multiple positions in a single transaction, each with its own filled amount and price.
Batch Fill Close Requests: Fills multiple close requests in a single transaction, each with its own filled amount and close price.
Both functions use a single PairUpnlAndPricesSig Muon signature that covers all quotes in the batch, rather than requiring a separate signature per quote.
openPositions()
Opens positions for multiple quotes in a single transaction. For each quote, PartyB can open with either the full amount requested by the user or a specific fraction of it. The opened position's size cannot be excessively small or large.
Function Signature:
function openPositions(
uint256[] memory quoteIds,
uint256[] memory filledAmounts,
uint256[] memory openedPrices,
PairUpnlAndPricesSig memory upnlSig
) external whenNotPartyBOpenPositionsPaused;Parameters:
quoteIds: The IDs of the quotes to open positions for.filledAmounts: The amounts to fill for each quote. Can be the full requested quantity or a partial fill.openedPrices: The opening prices for each position.upnlSig: A single MuonPairUpnlAndPricesSigcovering all quotes in the batch.
Access: Only callable by PartyB.
Events Emitted:
Events are emitted internally by the implementation for each opened position (e.g., OpenPosition per quote).
fillCloseRequests()
Fills close requests for multiple quotes in a single transaction. For LIMIT orders, PartyB can fill in multiple steps, each at a different price. For MARKET orders, the close must be filled entirely in one step.
Function Signature:
Parameters:
quoteIds: The IDs of the quotes whose close requests should be filled.filledAmounts: The amounts to fill for each close request. LIMIT orders support partial fills; MARKET orders must be filled fully.closedPrices: The closing prices for each position.upnlSig: A single MuonPairUpnlAndPricesSigcovering all quotes in the batch.
Access: Only callable by PartyB.
Events Emitted (per quote):
FillCloseRequest(uint256 quoteId, address partyA, address partyB, uint256 filledAmount, uint256 closedPrice, QuoteStatus status, uint256 closeId)— legacy eventFillCloseRequest(uint256 quoteId, address partyA, address partyB, uint256 filledAmount, uint256 closedPrice, QuoteStatus status, uint256 closeId, LockedValues lockedValues)— new event with locked values included
Last updated

