When a user requests a solver to open a position:
- User makes off-chain request to solver
- Solver prepares to batch sendQuote + lockQuote + openPosition in one transaction
- User calls deallocate before solver's transaction lands
- Solver's transaction fails due to insufficient user funds
Muon now provides a pendingBalance value representing funds committed to off-chain operations. The new safeDeallocate function ensures:
availableBalance >= pendingBalance + deallocateAmount
New Signature Struct
struct SingleUpnlWithPendingBalanceSig {
bytes reqId;
uint256 timestamp;
int256 upnl;
uint256 pendingBalance; // Funds reserved for pending off-chain operations
bytes gatewaySignature;
IMuonSignatureVerifier.SchnorrSign sigs;
}