Prerequisites
- Sepolia ETH for gas fees
- MockUSDC in your wallet (see Quick Start to mint test tokens)
- A Sepolia RPC URL
Parameters
Every position requires four parameters:| Parameter | Type | Description |
|---|---|---|
| Side | LONG (0) or SHORT (1) | LONG profits when EUR/USD rises, SHORT profits when it falls |
| Tenor | 1D (0), 1W (1), or 1M (2) | Time to maturity — determines fixing date and initial margin requirement |
| Notional | USDC amount (6 decimals) | Position size — the face value of the forward contract |
| Margin | USDC amount (6 decimals) | Collateral locked for the position — must meet the initial margin requirement |
Steps
Check protocol mode
The protocol must be in NORMAL mode to open new positions. Other modes (DEGRADED, REDUCE_ONLY,
PAUSED) only allow closing or are fully halted.
- TypeScript
- CLI
Approve USDC spending
The PositionManager needs approval to pull USDC from your wallet when opening a position. Approve
at least the margin amount you plan to lock.
- TypeScript
- CLI
Simulate the position
Run a dry-run to verify the trade will succeed and see the computed entry strike, required margin,
and fees before committing real funds.If the margin is insufficient, the simulation reverts with
- TypeScript
- CLI
InsufficientMargin — increase your
margin amount and retry.Simulation uses
eth_call and does not consume gas or change onchain state. The entry strike
shown is based on the current forward price and may differ slightly by the time you submit the
real transaction.Open the position
Submit the actual transaction to open your forward position.Parse the
- TypeScript
- CLI
PositionOpened event from the receipt logs to extract the position ID:What Happens Next
After opening, your position accrues unrealized PnL based on the current forward price relative to your entry strike. Three outcomes are possible:- Maturity settlement — the position reaches its fixing date and settles at the fixing price
- Early termination — you close early at the current forward price (see Close a position)
- Liquidation — your equity drops below the maintenance margin threshold and a keeper liquidates the position
Troubleshooting
InsufficientMargin revert
InsufficientMargin revert
Your margin amount is below the initial margin requirement. Run the simulation first to see the
exact IM needed, then increase your
margin parameter. The IM factor is a percentage of notional
that varies by tenor — longer tenors require more margin.InsufficientAllowance revert
InsufficientAllowance revert
You did not approve enough USDC for the PositionManager. Run the approve step again with at least
the margin amount. The allowance must cover the full margin plus any fees deducted at open.
ProtocolPaused or WrongMode revert
ProtocolPaused or WrongMode revert
The protocol is not in NORMAL mode. Check the mode (Step 1) and wait until it returns to NORMAL.
Only NORMAL mode allows opening new positions.
ExceedsExposureCap revert
ExceedsExposureCap revert
The pool’s exposure limits prevent this position. The RiskManager enforces per-position, per-account,
and pool-level caps. Try a smaller notional or wait for existing positions to settle.