---
eip: 7586
label: ERC-7586
title: Interest Rate Swaps
status: Review
type: Standards Track
category: ERC
created: 2023-12-31
requires: 20, 165
official: https://eips.ethereum.org/EIPS/eip-7586
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7586.md
canonical: https://eips.huatuo.xyz/eip-7586/
lang: en
tldr: An interface for on-chain interest rate swaps, where two parties exchange fixed-rate and floating-rate interest on a notional amount, with each future payment tokenised as ERC-20 and settled by a swap() call.
tags: [defi, derivatives, interest-rates, erc20, finance]
---

# ERC-7586: Interest Rate Swaps

> Interest rate swaps derivative contracts

**TL;DR:** An interface for on-chain interest rate swaps, where two parties exchange fixed-rate and floating-rate interest on a notional amount, with each future payment tokenised as ERC-20 and settled by a swap() call.

## What problem does it solve?

An interest rate swap (IRS) is one of the most common financial derivatives: one party pays a fixed rate, the other pays a floating rate (a benchmark such as SOFR or EURIBOR plus a spread), both calculated on the same notional amount. It lets borrowers and lenders hedge against rate changes.

There was no standard way to represent such a contract on-chain, so every implementation would expose its terms and settlement differently. ERC-7586 defines one interface for the terms, the settlement call and the tokenised cash flows.

## How it works

The swap contract is itself an [ERC-20](/eip-20/) token (and supports [ERC-165](/eip-165/)). Its view functions describe the deal:

| Function | Meaning |
| --- | --- |
| `fixedRatePayer()` / `floatingRatePayer()` | The two counterparties |
| `swapRate()` | Fixed rate, scaled by `10^ratesDecimals()` |
| `benchmark()` + `spread()` | Floating rate = benchmark + spread |
| `oracleContractsForBenchmark()` | Oracle for the benchmark, or zero address if set manually |
| `notionalAmount()`, `notionalCurrency()` | Base for interest calculations (zero address = fiat) |
| `paymentAssets()` | Tokens each side may be paid in, e.g. USDC and DAI |
| `paymentFrequency()`, `dayCountBasis()` | Payments per year, day-count convention code |
| `startingDate()`, `maturityDate()` | Unix timestamps |
| `fixPaymentDates()`, `floatingPaymentDates()` | Optional explicit schedules |

With `ratesDecimals() == 2`, rates are in basis points: 2.5 % is `250`.

Settlement:

- `swap()` computes both interest legs for the period, transfers only the **net difference** to whichever side is owed, and emits `Swap(amount, account)`.
- Each scheduled payment is represented by an ERC-20 token held by each party; on every `swap()` one token is burned from each side.
- `terminateSwap()` lets either party end the contract early; it emits `TerminateSwap`.

## Sample code

Reading the terms and settling a period (ethers v6):

```ts
import { Contract, Wallet, JsonRpcProvider } from "ethers";

const abi = [
  "function swapRate() view returns (uint256)",
  "function spread() view returns (uint256)",
  "function benchmark() view returns (uint256)",
  "function ratesDecimals() view returns (uint8)",
  "function notionalAmount() view returns (uint256)",
  "function paymentFrequency() view returns (uint256)",
  "function swap() returns (bool)",
  "event Swap(uint256 _amount, address _account)",
];

const provider = new JsonRpcProvider(process.env.RPC_URL);
const party = new Wallet(process.env.PARTY_KEY!, provider);
const irs = new Contract(process.env.IRS!, abi, party);

const [fixed, spread, bench, dec, notional, freq] = await Promise.all([
  irs.swapRate(), irs.spread(), irs.benchmark(), irs.ratesDecimals(),
  irs.notionalAmount(), irs.paymentFrequency(),
]);
const scale = 10n ** BigInt(dec) * 100n; // rate units -> fraction
const fixedLeg = (notional * fixed) / scale / freq;
const floatLeg = (notional * (bench + spread)) / scale / freq;
console.log("net this period:", fixedLeg > floatLeg ? fixedLeg - floatLeg : floatLeg - fixedLeg);

const receipt = await (await irs.swap()).wait();
```

The calculation above ignores day-count conventions; real implementations apply `dayCountBasis()`.

## Things to know

- **Status: Review.** The interface may still change.
- Credit risk is real: unless both sides post collateral in the contract, a party can simply fail to pay. The standard does not define collateral or margin.
- When the benchmark comes from an oracle, the swap is only as reliable as that oracle. Manual benchmarks require trust between the parties.
- `dayCountBasis` codes beyond the examples given (0 = actual/actual, 1 = actual/360) are not fixed by the spec, so both parties must agree on their meaning.
- Derivatives regulation may apply depending on jurisdiction; the standard does not address it.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-7586
