Risk buffer calculation
StableFX defines risk buffer settings per maker and currency pair. Each setting controls how much of the taker’s and maker’s notional amounts are reserved as buffers for that trading pair.| Parameter | Description |
|---|---|
| Taker risk buffer % | Percentage of the sell currency amount held as the taker’s buffer. |
| Taker risk buffer min | Minimum value of the taker’s risk buffer in absolute terms. |
| Maker risk buffer % | Percentage of the buy currency amount held as the maker’s buffer. |
| Maker risk buffer min | Minimum value of the maker’s risk buffer in absolute terms. |
- Retrieves the risk buffer configuration for the maker and currency pair.
- Calculates both taker and maker risk buffers based on the configuration parameters.
- Returns the taker’s risk buffer in the quote response as the
collateralparameter.
Trade broadcast
After StableFX registers signatures for both the taker and maker, it broadcasts therecordTrade function to the
settlement contract. This function withdraws trade collateral from each trader’s
wallet using the Permit2 protocol.
Where to find the risk buffer
The risk buffer amount appears in several places:- Create Quote API response: Returned as the
collateralfield for the taker. See Create a quote. - Get Trade API response: Makers can find the
collateralfield in the trade response. See Get a trade. - Typed data for signing: Available in the
message.permitted.amountfield of the EIP-712 typed data.
How risk buffers affect settlement
Breach scenarios
If a trade reaches maturity but remains unsettled, StableFX calls the escrow contract’s breach function to expire the trade. The outcome depends on which party has funded: Neither party funds If neither the taker nor the maker funds before expiry, the smart contract returns both parties’ risk buffers from escrow. No breach compensation is applied. One party funds If only one party funds the trade before expiry, the non-funding party is treated as the breaching party. The contract:- Awards the non-funding party’s risk buffer to the funding party as compensation.
- Returns the funding party’s own buffer and trade funds to them.