Interest rate swaps

INTEREST RATE SWAP 1 Parties agree terms 2 PartyA sends notional USDXT to SwapContract 3 PartyB sends notional USDXT to SwapContract 4 PartyA sends fixed interest USDXT to SwapContract 5 PartyB sends floating interest USDXT to SwapContract 6 SwapContract nets interest USDXT 7 SwapContract sends net interest USDXT to owed party 8 SwapContract returns notional USDXT to PartyA 9 SwapContract returns notional USDXT to PartyB

INTEREST RATE SWAP FLOW
Setup
1 PartyA agrees to pay fixed rate to PartyB
2 PartyB agrees to pay floating rate to PartyA
3 Both parties agree notional amount and maturity
Initiation
4 PartyA deposits notional USDXT to SwapContract
5 PartyB deposits notional USDXT to SwapContract
6 SwapContract locks both deposits until maturity
Settlement at Maturity
7 Admin sets floating rate in SwapContract
8 SwapContract calculates fixed payment from notional
9 SwapContract calculates floating payment from notional
10 SwapContract nets payments to find difference
11 SwapContract returns notional USDXT to PartyA
12 SwapContract returns notional USDXT to PartyB
13 SwapContract sends net interest USDXT to owed party


Setup
1 PartyA agrees to pay fixed rate to PartyB
2 PartyB agrees to pay floating rate to PartyA
3 Both parties agree notional amount and maturity

Initiation
4 PartyA deposits notional USDXT to SwapContract
5 PartyB deposits notional USDXT to SwapContract
6 SwapContract locks both deposits until maturity

Rate Management
7 Admin updates floating rate in SwapContract as needed
8 SwapContract stores current floating rate for all swaps

Settlement at Maturity
9 Admin calls settleSwap when swap reaches maturity
10 SwapContract calculates annualized fixed payment
11 SwapContract calculates annualized floating payment using current rate
12 SwapContract nets payments to find difference
13 SwapContract returns notional USDXT to PartyA
14 SwapContract returns notional USDXT to PartyB
15 SwapContract sends net interest USDXT to owed party



INTEREST RATE SWAP ATOMIC HTLC FLOW
Setup
1 PartyA agrees to pay fixed rate to PartyB
2 PartyB agrees to pay floating rate to PartyA
3 Both parties agree notional amount maturity bespoke rates and secret hash
Atomic Initiation
4 SwapContract creates swap struct with bespoke floating rate
5 PartyA transfers notional USDXT to SwapContract
6 PartyB transfers notional USDXT to SwapContract
7 SwapContract marks notionalDeposited only after both transfers succeed
8 If either transfer fails entire transaction reverts
Per-Swap Rate Management
9 Admin updates specific swap's floating rate as needed
10 Each swap maintains its own floating rate for bespoke terms
Atomic HTLC Settlement at Maturity
11 Admin reveals secret preimage to unlock specific swap
12 SwapContract verifies preimage matches swap's hashlock
13 SwapContract calculates payments using swap's specific rates
14 SwapContract transfers notional USDXT to PartyA
15 SwapContract transfers notional USDXT to PartyB
16 SwapContract transfers net interest USDXT to owed party
17 All transfers must succeed or entire settlement reverts
Atomic Refund Path
18 If admin doesn't settle after maturity either party can refund
19 SwapContract returns notional USDXT to PartyA
20 SwapContract returns notional USDXT to PartyB
21 Both refunds must succeed or transaction reverts



ENHANCED INTEREST RATE SWAP FLOW
Setup
1 PartyA agrees to pay fixed rate to PartyB
2 PartyB agrees to pay floating rate to PartyA
3 Both parties agree notional amount maturity rates secret hash and day count convention
Atomic Initiation with Gas Optimization
4 SwapContract creates swap with day count convention ACT_360 ACT_365 or ACTUAL
5 PartyA transfers 18-decimal collateral to SwapContract
6 PartyB transfers 18-decimal collateral to SwapContract
7 SwapContract marks notionalDeposited only after both succeed
8 SwapContract emits NotionalDeposited and SwapInitiated events
Restricted Rate Management
9 Admin updates swap's floating rate only before maturity
10 Rate updates blocked after maturity for finality
11 Each swap maintains bespoke floating rate
Enhanced Settlement with Storage Reclaim
12 Admin settles at maturity with preimage verification
13 SwapContract calculates payments using day count convention
14 SwapContract transfers notional and net payment atomically
15 SwapContract emits SwapSettled event
16 SwapContract deletes swap storage to reclaim gas
Enhanced Refund with Storage Reclaim
17 Either party can refund after maturity if not settled
18 SwapContract returns notional amounts atomically
19 SwapContract emits SwapRefunded event
20 SwapContract deletes swap storage to reclaim gas

Last updated