Force Actions Facet
Force Actions Facet (Options 0.2.1)
The Force Actions Facet serves as the safety net for traders dealing with an unresponsive counterparty. If PartyB goes silent due to any reason — a PartyA's funds could be locked indefinitely in a pending state. This aims to prevent that from happening by giving PartyA a way to unilaterally cancel stuck intents after a protocol-defined timeout has passed.
There are no role restrictions here. Any non-paused party can call these functions, as long as the relevant timeouts have elapsed.
Key Concepts:
Open Intent: A request from PartyA to open a position that has been locked (matched to a PartyB) but not yet filled. If PartyB doesn't fill it within the required window, PartyA can force-cancel it.
Close Intent: A request from PartyA to close an existing position that PartyB has locked but not yet settled. If PartyB stalls on the close, PartyA can force-cancel it and the position remains open.
Force Cancel Timeouts: Two separate timeouts govern when force actions become available —
forceCancelOpenIntentTimeoutfor open intents andforceCancelCloseIntentTimeoutfor close intents. Both are configured via the Control Facet.Non-Destructive on Close: Force-cancelling a close intent does not close the position — it simply cancels the pending close request, returning the position to an open state so PartyA can try again or proceed differently.
forceCancelOpenIntent()
Force-cancels an open intent that has been locked by a PartyB but not filled within the required timeout window. Calling this returns the intent to a cancelled state and releases any collateral that was locked against it.
Function Signature:
function forceCancelOpenIntent(
uint256 intentId
) external whenPartyNotPaused(msg.sender);Parameters:
intentId: The unique identifier of the open intent to force-cancel.
Example Usage:
forceCancelCloseIntent()
Force-cancels a close intent that has been locked by a PartyB but not settled within the required timeout. This does not close the position — it cancels the pending close request and leaves the position open, giving PartyA the ability to submit a new close request.
Function Signature:
Parameters:
intentId: The unique identifier of the close intent to force-cancel.
Example Usage:
Internal Logic:
LibForceActions.forceCancelCloseIntent()checks that enough time has passed since the close intent was locked, usingforceCancelCloseIntentTimeout. Reverts if called too early.The library confirms the caller is the PartyA of the relevant trade.
The close intent is cancelled. The underlying position reverts to its open state — the trade itself is untouched.
Event: Emits
ForceCancelCloseIntentwith the intent ID.
Last updated
