{"eip":7586,"title":"Interest Rate Swaps","description":"Interest rate swaps derivative contracts","authors":["Samuel Gwlanold Edoumou (@Edoumou)"],"status":"Review","type":"Standards Track","category":"ERC","created":"2023-12-31","requires":[20,165],"discussionsTo":"https://ethereum-magicians.org/t/interest-rate-swaps/17777","repo":"ERCs","label":"ERC-7586","officialUrl":"https://eips.ethereum.org/EIPS/eip-7586","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7586.md","url":"https://eips.huatuo.xyz/eip-7586/","tldr":{"en":"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.","ja":"オンチェーン金利スワップのインターフェース。2 者が想定元本に対する固定金利と変動金利の利息を交換し、将来の各支払いは ERC-20 としてトークン化され、swap() の呼び出しで決済される。","ko":"온체인 금리 스왑을 위한 인터페이스. 두 당사자가 명목 원금에 대한 고정 금리와 변동 금리 이자를 교환하고, 향후 각 지급은 ERC-20으로 토큰화되어 swap() 호출로 정산된다.","zh":"链上利率互换的接口：双方就名义本金交换固定利率和浮动利率的利息，每笔未来支付都被代币化为 ERC-20，并通过调用 swap() 结算。"},"tags":["defi","derivatives","interest-rates","erc20","finance"],"explainers":{"en":{"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"],"related":[20,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7586/","markdown":"## What problem does it solve?\n\nAn 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.\n\nThere 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.\n\n## How it works\n\nThe swap contract is itself an [ERC-20](/eip-20/) token (and supports [ERC-165](/eip-165/)). Its view functions describe the deal:\n\n| Function | Meaning |\n| --- | --- |\n| `fixedRatePayer()` / `floatingRatePayer()` | The two counterparties |\n| `swapRate()` | Fixed rate, scaled by `10^ratesDecimals()` |\n| `benchmark()` + `spread()` | Floating rate = benchmark + spread |\n| `oracleContractsForBenchmark()` | Oracle for the benchmark, or zero address if set manually |\n| `notionalAmount()`, `notionalCurrency()` | Base for interest calculations (zero address = fiat) |\n| `paymentAssets()` | Tokens each side may be paid in, e.g. USDC and DAI |\n| `paymentFrequency()`, `dayCountBasis()` | Payments per year, day-count convention code |\n| `startingDate()`, `maturityDate()` | Unix timestamps |\n| `fixPaymentDates()`, `floatingPaymentDates()` | Optional explicit schedules |\n\nWith `ratesDecimals() == 2`, rates are in basis points: 2.5 % is `250`.\n\nSettlement:\n\n- `swap()` computes both interest legs for the period, transfers only the **net difference** to whichever side is owed, and emits `Swap(amount, account)`.\n- Each scheduled payment is represented by an ERC-20 token held by each party; on every `swap()` one token is burned from each side.\n- `terminateSwap()` lets either party end the contract early; it emits `TerminateSwap`.\n\n## Sample code\n\nReading the terms and settling a period (ethers v6):\n\n```ts\nimport { Contract, Wallet, JsonRpcProvider } from \"ethers\";\n\nconst abi = [\n  \"function swapRate() view returns (uint256)\",\n  \"function spread() view returns (uint256)\",\n  \"function benchmark() view returns (uint256)\",\n  \"function ratesDecimals() view returns (uint8)\",\n  \"function notionalAmount() view returns (uint256)\",\n  \"function paymentFrequency() view returns (uint256)\",\n  \"function swap() returns (bool)\",\n  \"event Swap(uint256 _amount, address _account)\",\n];\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst party = new Wallet(process.env.PARTY_KEY!, provider);\nconst irs = new Contract(process.env.IRS!, abi, party);\n\nconst [fixed, spread, bench, dec, notional, freq] = await Promise.all([\n  irs.swapRate(), irs.spread(), irs.benchmark(), irs.ratesDecimals(),\n  irs.notionalAmount(), irs.paymentFrequency(),\n]);\nconst scale = 10n ** BigInt(dec) * 100n; // rate units -\u003e fraction\nconst fixedLeg = (notional * fixed) / scale / freq;\nconst floatLeg = (notional * (bench + spread)) / scale / freq;\nconsole.log(\"net this period:\", fixedLeg \u003e floatLeg ? fixedLeg - floatLeg : floatLeg - fixedLeg);\n\nconst receipt = await (await irs.swap()).wait();\n```\n\nThe calculation above ignores day-count conventions; real implementations apply `dayCountBasis()`.\n\n## Things to know\n\n- **Status: Review.** The interface may still change.\n- 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.\n- When the benchmark comes from an oracle, the swap is only as reliable as that oracle. Manual benchmarks require trust between the parties.\n- `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.\n- Derivatives regulation may apply depending on jurisdiction; the standard does not address it.\n"},"ja":{"lang":"ja","tldr":"オンチェーン金利スワップのインターフェース。2 者が想定元本に対する固定金利と変動金利の利息を交換し、将来の各支払いは ERC-20 としてトークン化され、swap() の呼び出しで決済される。","tags":["defi","derivatives","interest-rates","erc20","finance"],"related":[20,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7586/","markdown":"## 何を解決するのか\n\n金利スワップ（IRS）は、最も一般的な金融デリバティブの 1 つです。一方が固定金利を、もう一方が変動金利（SOFR や EURIBOR などのベンチマークにスプレッドを加えたもの）を支払い、どちらも同じ想定元本に対して計算されます。これにより、借り手と貸し手は金利変動に対するヘッジができます。\n\nこうした契約をオンチェーンで表現する標準的な方法がなかったため、実装ごとに条件や決済の公開のしかたが異なっていました。ERC-7586 は、条件、決済の呼び出し、トークン化されたキャッシュフローについて 1 つのインターフェースを定義します。\n\n## 仕組み\n\nスワップコントラクト自体が [ERC-20](/eip-20/) トークンです（[ERC-165](/eip-165/) にも対応）。view 関数が取引内容を記述します。\n\n| 関数 | 意味 |\n| --- | --- |\n| `fixedRatePayer()` / `floatingRatePayer()` | 2 つの取引相手 |\n| `swapRate()` | 固定金利。`10^ratesDecimals()` でスケールされる |\n| `benchmark()` + `spread()` | 変動金利 = ベンチマーク + スプレッド |\n| `oracleContractsForBenchmark()` | ベンチマークのオラクル。手動設定ならゼロアドレス |\n| `notionalAmount()`、`notionalCurrency()` | 利息計算の基準（ゼロアドレス = 法定通貨） |\n| `paymentAssets()` | 各側が受け取れるトークン（例: USDC と DAI） |\n| `paymentFrequency()`、`dayCountBasis()` | 年間の支払い回数、日数計算方式のコード |\n| `startingDate()`、`maturityDate()` | Unix タイムスタンプ |\n| `fixPaymentDates()`、`floatingPaymentDates()` | 任意の明示的なスケジュール |\n\n`ratesDecimals() == 2` の場合、金利はベーシスポイントで表され、2.5 % は `250` です。\n\n決済:\n\n- `swap()` はその期間の両方の利息を計算し、**差額（ネット）だけ** を受け取る側に送金して、`Swap(amount, account)` を emit します。\n- 予定された各支払いは、各当事者が保有する ERC-20 トークンで表されます。`swap()` のたびに、各側から 1 トークンが burn されます。\n- `terminateSwap()` により、どちらの当事者も契約を早期に終了できます。`TerminateSwap` を emit します。\n\n## サンプルコード\n\n条件を読み取り、1 期分を決済する（ethers v6）:\n\n```ts\nimport { Contract, Wallet, JsonRpcProvider } from \"ethers\";\n\nconst abi = [\n  \"function swapRate() view returns (uint256)\",\n  \"function spread() view returns (uint256)\",\n  \"function benchmark() view returns (uint256)\",\n  \"function ratesDecimals() view returns (uint8)\",\n  \"function notionalAmount() view returns (uint256)\",\n  \"function paymentFrequency() view returns (uint256)\",\n  \"function swap() returns (bool)\",\n  \"event Swap(uint256 _amount, address _account)\",\n];\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst party = new Wallet(process.env.PARTY_KEY!, provider);\nconst irs = new Contract(process.env.IRS!, abi, party);\n\nconst [fixed, spread, bench, dec, notional, freq] = await Promise.all([\n  irs.swapRate(), irs.spread(), irs.benchmark(), irs.ratesDecimals(),\n  irs.notionalAmount(), irs.paymentFrequency(),\n]);\nconst scale = 10n ** BigInt(dec) * 100n; // rate units -\u003e fraction\nconst fixedLeg = (notional * fixed) / scale / freq;\nconst floatLeg = (notional * (bench + spread)) / scale / freq;\nconsole.log(\"net this period:\", fixedLeg \u003e floatLeg ? fixedLeg - floatLeg : floatLeg - fixedLeg);\n\nconst receipt = await (await irs.swap()).wait();\n```\n\n上の計算は日数計算方式を無視しています。実際の実装では `dayCountBasis()` を適用します。\n\n## 知っておくべきこと\n\n- **ステータス: Review。** インターフェースはまだ変わる可能性があります。\n- 信用リスクは現実のものです。双方がコントラクト内で担保を差し入れない限り、一方が単に支払わないことがありえます。この標準は担保や証拠金を定義していません。\n- ベンチマークがオラクルから来る場合、スワップの信頼性はそのオラクルの信頼性次第です。手動のベンチマークは、当事者間の信頼を必要とします。\n- 示された例（0 = actual/actual、1 = actual/360）以外の `dayCountBasis` のコードは仕様で定められていないため、双方がその意味に合意する必要があります。\n- 法域によってはデリバティブ規制が適用されることがあります。この標準はそれを扱いません。\n"},"ko":{"lang":"ko","tldr":"온체인 금리 스왑을 위한 인터페이스. 두 당사자가 명목 원금에 대한 고정 금리와 변동 금리 이자를 교환하고, 향후 각 지급은 ERC-20으로 토큰화되어 swap() 호출로 정산된다.","tags":["defi","derivatives","interest-rates","erc20","finance"],"related":[20,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7586/","markdown":"## 어떤 문제를 해결하나요?\n\n금리 스왑(IRS)은 가장 흔한 금융 파생상품 중 하나입니다. 한쪽은 고정 금리를, 다른 쪽은 변동 금리(SOFR나 EURIBOR 같은 벤치마크에 스프레드를 더한 값)를 지급하며, 둘 다 같은 명목 원금을 기준으로 계산합니다. 이를 통해 차입자와 대출자는 금리 변동에 대비해 헤지할 수 있습니다.\n\n이런 계약을 온체인에서 표현하는 표준 방식이 없었기 때문에, 구현마다 조건과 정산을 노출하는 방식이 달랐습니다. ERC-7586은 조건, 정산 호출, 토큰화된 현금 흐름에 대한 하나의 인터페이스를 정의합니다.\n\n## 어떻게 동작하나요?\n\n스왑 컨트랙트 자체가 [ERC-20](/eip-20/) 토큰입니다([ERC-165](/eip-165/)도 지원). view 함수가 거래 내용을 설명합니다.\n\n| 함수 | 의미 |\n| --- | --- |\n| `fixedRatePayer()` / `floatingRatePayer()` | 두 거래 상대방 |\n| `swapRate()` | 고정 금리. `10^ratesDecimals()`로 스케일됨 |\n| `benchmark()` + `spread()` | 변동 금리 = 벤치마크 + 스프레드 |\n| `oracleContractsForBenchmark()` | 벤치마크용 오라클. 수동 설정이면 제로 주소 |\n| `notionalAmount()`, `notionalCurrency()` | 이자 계산의 기준(제로 주소 = 법정화폐) |\n| `paymentAssets()` | 각 측이 받을 수 있는 토큰(예: USDC와 DAI) |\n| `paymentFrequency()`, `dayCountBasis()` | 연간 지급 횟수, 일수 계산 관행 코드 |\n| `startingDate()`, `maturityDate()` | Unix 타임스탬프 |\n| `fixPaymentDates()`, `floatingPaymentDates()` | 선택적인 명시적 일정 |\n\n`ratesDecimals() == 2`이면 금리는 베이시스 포인트로 표현되며, 2.5 %는 `250`입니다.\n\n정산:\n\n- `swap()`은 해당 기간의 두 이자를 계산하고, **차액(순액)만** 받을 쪽에 전송하며 `Swap(amount, account)`를 emit합니다.\n- 예정된 각 지급은 각 당사자가 보유한 ERC-20 토큰으로 표현되며, `swap()`을 호출할 때마다 양쪽에서 토큰 하나씩 burn됩니다.\n- `terminateSwap()`으로 어느 쪽이든 계약을 조기에 종료할 수 있으며 `TerminateSwap`을 emit합니다.\n\n## 샘플 코드\n\n조건을 읽고 한 기간을 정산(ethers v6):\n\n```ts\nimport { Contract, Wallet, JsonRpcProvider } from \"ethers\";\n\nconst abi = [\n  \"function swapRate() view returns (uint256)\",\n  \"function spread() view returns (uint256)\",\n  \"function benchmark() view returns (uint256)\",\n  \"function ratesDecimals() view returns (uint8)\",\n  \"function notionalAmount() view returns (uint256)\",\n  \"function paymentFrequency() view returns (uint256)\",\n  \"function swap() returns (bool)\",\n  \"event Swap(uint256 _amount, address _account)\",\n];\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst party = new Wallet(process.env.PARTY_KEY!, provider);\nconst irs = new Contract(process.env.IRS!, abi, party);\n\nconst [fixed, spread, bench, dec, notional, freq] = await Promise.all([\n  irs.swapRate(), irs.spread(), irs.benchmark(), irs.ratesDecimals(),\n  irs.notionalAmount(), irs.paymentFrequency(),\n]);\nconst scale = 10n ** BigInt(dec) * 100n; // rate units -\u003e fraction\nconst fixedLeg = (notional * fixed) / scale / freq;\nconst floatLeg = (notional * (bench + spread)) / scale / freq;\nconsole.log(\"net this period:\", fixedLeg \u003e floatLeg ? fixedLeg - floatLeg : floatLeg - fixedLeg);\n\nconst receipt = await (await irs.swap()).wait();\n```\n\n위 계산은 일수 계산 관행을 무시합니다. 실제 구현은 `dayCountBasis()`를 적용합니다.\n\n## 알아둘 점\n\n- **상태: Review.** 인터페이스가 아직 바뀔 수 있습니다.\n- 신용 위험은 현실입니다. 양쪽이 컨트랙트에 담보를 예치하지 않는 한 한쪽이 그냥 지급하지 않을 수 있습니다. 이 표준은 담보나 증거금을 정의하지 않습니다.\n- 벤치마크가 오라클에서 오는 경우 스왑의 신뢰성은 그 오라클의 신뢰성만큼입니다. 수동 벤치마크는 당사자 간의 신뢰가 필요합니다.\n- 제시된 예시(0 = actual/actual, 1 = actual/360) 외의 `dayCountBasis` 코드는 명세에 고정되어 있지 않으므로, 양쪽이 그 의미에 합의해야 합니다.\n- 관할권에 따라 파생상품 규제가 적용될 수 있습니다. 이 표준은 이를 다루지 않습니다.\n"},"zh":{"lang":"zh","tldr":"链上利率互换的接口：双方就名义本金交换固定利率和浮动利率的利息，每笔未来支付都被代币化为 ERC-20，并通过调用 swap() 结算。","tags":["defi","derivatives","interest-rates","erc20","finance"],"related":[20,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7586/","markdown":"## 它解决什么问题？\n\n利率互换（IRS）是最常见的金融衍生品之一：一方支付固定利率，另一方支付浮动利率（SOFR 或 EURIBOR 等基准利率加上利差），两者都基于同一名义本金计算。它让借款人和出借人可以对冲利率变动的风险。\n\n此前没有在链上表示这类合约的标准方式，因此每个实现披露条款和结算的方式各不相同。ERC-7586 为条款、结算调用和代币化的现金流定义了一个统一的接口。\n\n## 它如何运作\n\n互换合约本身就是一个 [ERC-20](/eip-20/) 代币（并支持 [ERC-165](/eip-165/)）。它的 view 函数描述交易内容：\n\n| 函数 | 含义 |\n| --- | --- |\n| `fixedRatePayer()` / `floatingRatePayer()` | 两个交易对手 |\n| `swapRate()` | 固定利率，按 `10^ratesDecimals()` 缩放 |\n| `benchmark()` + `spread()` | 浮动利率 = 基准利率 + 利差 |\n| `oracleContractsForBenchmark()` | 基准利率的预言机；如为手动设置则为零地址 |\n| `notionalAmount()`、`notionalCurrency()` | 利息计算的基数（零地址 = 法币） |\n| `paymentAssets()` | 各方可收取的代币，例如 USDC 和 DAI |\n| `paymentFrequency()`、`dayCountBasis()` | 每年支付次数、计息天数惯例代码 |\n| `startingDate()`、`maturityDate()` | Unix 时间戳 |\n| `fixPaymentDates()`、`floatingPaymentDates()` | 可选的明确日程 |\n\n当 `ratesDecimals() == 2` 时，利率以基点表示：2.5 % 即 `250`。\n\n结算：\n\n- `swap()` 计算该期两条利息腿，只把 **净差额** 转给应收的一方，并触发 `Swap(amount, account)`。\n- 每笔计划支付由各方持有的一个 ERC-20 代币表示；每次 `swap()` 时，双方各销毁一个代币。\n- `terminateSwap()` 让任何一方都可以提前终止合约；它会触发 `TerminateSwap`。\n\n## 示例代码\n\n读取条款并结算一期（ethers v6）：\n\n```ts\nimport { Contract, Wallet, JsonRpcProvider } from \"ethers\";\n\nconst abi = [\n  \"function swapRate() view returns (uint256)\",\n  \"function spread() view returns (uint256)\",\n  \"function benchmark() view returns (uint256)\",\n  \"function ratesDecimals() view returns (uint8)\",\n  \"function notionalAmount() view returns (uint256)\",\n  \"function paymentFrequency() view returns (uint256)\",\n  \"function swap() returns (bool)\",\n  \"event Swap(uint256 _amount, address _account)\",\n];\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst party = new Wallet(process.env.PARTY_KEY!, provider);\nconst irs = new Contract(process.env.IRS!, abi, party);\n\nconst [fixed, spread, bench, dec, notional, freq] = await Promise.all([\n  irs.swapRate(), irs.spread(), irs.benchmark(), irs.ratesDecimals(),\n  irs.notionalAmount(), irs.paymentFrequency(),\n]);\nconst scale = 10n ** BigInt(dec) * 100n; // rate units -\u003e fraction\nconst fixedLeg = (notional * fixed) / scale / freq;\nconst floatLeg = (notional * (bench + spread)) / scale / freq;\nconsole.log(\"net this period:\", fixedLeg \u003e floatLeg ? fixedLeg - floatLeg : floatLeg - fixedLeg);\n\nconst receipt = await (await irs.swap()).wait();\n```\n\n上面的计算忽略了计息天数惯例；真实的实现会应用 `dayCountBasis()`。\n\n## 需要注意\n\n- **状态：Review。** 接口仍可能变化。\n- 信用风险是真实存在的：除非双方都在合约中提交抵押品，否则一方可能干脆不付款。该标准没有定义抵押品或保证金。\n- 当基准利率来自预言机时，互换的可靠性不会超过该预言机。手动设置基准利率需要双方互相信任。\n- 除给出的示例（0 = actual/actual，1 = actual/360）之外，`dayCountBasis` 的代码没有被规范固定，因此双方必须就其含义达成一致。\n- 视司法管辖区而定，可能适用衍生品监管；该标准不涉及这一点。\n"}}}
