Appearance
Understanding Interest Rate Swaps
This page explains what a fixed-vs-floating swap is and how Jetty implements it on Solana.
1. What a Swap Does
Concept
A swap exchanges cash flows based on two rate legs:
- a fixed leg
- a floating leg
No principal is exchanged. Only PnL from rate differences is settled.
Example
You hold exposure to a variable borrow APR and want predictability. You enter pay-fixed/receive-float to offset borrow-rate increases.
Technical Detail
In Jetty, each position stores:
- signed notional
- locked fixed rate
- last settled floating index snapshot
- expiry timestamp
2. How Jetty Settlement Works
Concept
Funding settlement is lazy: it happens when the position is touched by a transaction.
Example
If you do not trade for several hours, the next interaction settles all accumulated index movement since the prior touch.
Technical Detail
text
funding_delta = notional * (floating_index_now - floating_index_last)The delta is applied to realized_pnl_wad, then floating_index_last is updated.
3. Mark-to-Market (Unrealized PnL)
Concept
Unrealized PnL reflects the value of closing now at the current mark rate.
Example
If market fixed rates move in your favor versus your entry rate, unrealized MTM is positive and account health improves.
Technical Detail
MTM depends on:
- current mark rate
- entry fixed rate
- signed notional
- effective time to expiry
4. Expiry and Historical Oracle Proofs
Concept
Expired positions must settle using the oracle index at expiry time, not the current index.
Example
A position expires at T. You close it later at T + 2 days. Final funding still uses the proven historical index at T.
Technical Detail
Jetty verifies a Merkle proof from OracleHistory and interpolates the index inside the proved interval when needed.
5. Risk You Should Track
- Market risk: mark moves against your position.
- Funding risk: floating index moves against your signed notional.
- Liquidity risk: larger trades face larger impact.
- Oracle risk: stale or incorrect oracle updates can distort settlement.
- Liquidation risk: health below maintenance enables partial liquidation.
6. Practical Workflow
- Choose market and expiry tenor.
- Choose direction and notional.
- Check quoted fixed rate, fee, and margin impact.
- Open position.
- Monitor health and realized/unrealized PnL.
- Reduce or close before expiry when possible.