Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

This article examines ERC7586, a proposal to standardize the automatic exchange of fixed- and floating-rate payments on blockchains, enabling interest rate swaps in decentralized finance (DeFi).

This article translates, summarizes, and expands on the proposal linked below.

Overview

ERC7586 proposes a framework for standardizing interest rate swaps (IRS) on blockchains. An interest rate swap is a contract under which parties exchange fixed- and floating-rate interest payments. The aim of ERC7586 is to provide a secure and seamless way to exchange these cash flows, serving as infrastructure for decentralized finance (DeFi). By automating financial transactions and making them more transparent, the proposal seeks to make blockchain-based financial derivatives more practical.

In particular, DeFi currently lacks a common standard for handling interest rate swaps. This limits compatibility between protocols and makes efficient operation difficult. The framework addresses these problems by defining a common specification for secure and efficient on-chain interest rate swaps.

Motivation

An interest rate swap (IRS) is an agreement to exchange future interest payments based on two different interest rate arrangements. For example, one party agrees to pay interest at a fixed rate while the other pays at a floating rate. Companies and investors commonly use this arrangement to hedge interest rate risk.

Swap contracts typically calculate interest payments based on a hypothetical principal known as the notional amount. The notional amount itself is not transferred; it serves only as the basis for calculation. A benchmark index is used to calculate the floating-rate component. LIBOR and SOFR are representative examples.

However, there is currently no standard mechanism for representing these interest rate swaps on blockchains. As a result, DeFi protocols use different contract terms and data structures, creating several problems.

  • Projects build proprietary implementations, resulting in poor interoperability.
  • The transparency and verifiability of smart contract transactions are not fully utilized.
  • Inefficient contract execution and settlement impair the user experience.

ERC7586 aims to address these problems by establishing a standard framework for consistently representing and executing interest rate swap contracts on blockchains. The framework improves compatibility between DeFi platforms, records contract terms transparently and securely, and helps automate settlement and interest calculations. This can improve the reliability and efficiency of the broader DeFi market and provide a foundation for more sophisticated financial transactions.

Specification

Workflow

Under ERC7586, each contract must conform to the ERC7586 specification. All swap contracts inherit from ERC20 and tokenize the swap's cash flows (interest payments). Interest payments can therefore be treated as digital assets, enabling interoperable DeFi systems.

Interest rate swap cash flows https://eips.ethereum.org/EIPS/eip-7586

The diagram compares cash flows with and without an interest rate swap (IRS) from the perspectives of Company A (left) and Company B (right). The companies issue bonds on different terms but use an interest rate swap to adjust their payment obligations and risk exposure.

Overall structure

  • Center box: The terms of the Interest Rate Swaps (IRS) contract.

    • Company A pays a fixed rate of 5%.
    • Company B pays a floating rate of the benchmark rate plus 1%.
    • Both parties exchange interest payments on the same notional amount (1M).
  • Left side (yellow): Company A's position.

    • Issues $10M in bonds at the benchmark rate plus 2%.
    • Makes interest payments to investor group 1.
  • Right side (green): Company B's position.

    • Issues $10M in bonds at a fixed rate of 6%.
    • Makes interest payments to investor group 2.

Company A's cash flows

Without IRS

Company A issues bonds at the benchmark rate plus 2%, so the amount it pays varies as the market benchmark changes.

Payment period Benchmark rate Payment to investors
First 4% 600k
Second 3% 500k
Third 5% 700k

Payments rise when the benchmark rises and fall when it falls, making the payment amount unpredictable.

With IRS

Company A enters into a swap contract with Company B, exchanging interest payments as follows.

  • Company A pays Company B a fixed rate of 5%.
  • Company B pays Company A the benchmark rate plus 1%.

Company A's net payments effectively become fixed. The cash flows over three payment periods are shown below.

Period Received from Company B Paid to investors Paid to Company B Net payment
First 500k 600k 500k 600k
Second 400k 500k 500k 600k
Third 600k 700k 500k 600k

The net payment is 600k in every period. Company A thereby avoids fluctuations in payment amounts caused by changes in market interest rates.

Company B's cash flows

Without IRS

Company B issues bonds at a fixed rate of 6%, paying investors the same amount each period.

Payment period Payment to investors
First 600k
Second 600k
Third 600k

Because its rate is fixed, Company B is at a relative disadvantage when the market benchmark falls.

With IRS

Company B enters into a swap contract with Company A, paying Company A the benchmark rate plus 1% and receiving a fixed rate of 5%.

Company B's actual payments then change as follows.

Period Received from Company A Paid to investors Paid to Company A Net payment
First 500k 600k 500k 600k
Second 500k 600k 400k 500k
Third 500k 600k 600k 700k

Company B's net payments fluctuate with the benchmark. Its originally fixed-rate payments effectively become floating-rate payments. When market interest rates fall, Company B benefits from lower payments.

What the diagram illustrates

The diagram shows how the companies adjust their respective interest rate exposures through a swap.

  • Company A stabilizes its payments by converting a floating rate into a fixed rate.
  • Company B converts a fixed rate into a floating rate to benefit when market interest rates fall.

An interest rate swap thus allows each company to obtain its preferred interest rate structure by exchanging payment obligations.

Interface

javascript
pragma solidity ^0.8.0;

/**
* @title ERC-7586 Interest Rate Swaps
*/
interface IERC7586 /** is ERC20, ERC165 */ {
    // events
    /**
    * @notice MUST be emitted when interest rates are swapped
    * @param _amount the interest difference to be transferred
    * @param _account the recipient account to send the interest difference to. MUST be either the `payer` or the `receiver`
    */
    event Swap(uint256 _amount, address _account);

    /**
    * @notice MUST be emitted when the swap contract is terminated
    * @param _payer the swap payer
    * @param _receiver the swap receiver
    */
    event TerminateSwap(address indexed _payer, address indexed _receiver);

    // functions
    /**
    *  @notice Returns the IRS `payer` account address. The party who agreed to pay fixed interest
    */
    function fixedRatePayer() external view returns(address);

    /**
    *  @notice Returns the IRS `receiver` account address. The party who agreed to pay floating interest
    */
    function floatingRatePayer() external view returns(address);

    /**
    * @notice Returns the number of decimals the swap rate and spread use - e.g. `4` means to divide the rates by `10000`
    *         To express the interest rates in basis points unit, the decimal MUST be equal to `2`. This means rates MUST be divided by `100`
    *         1 basis point = 0.01% = 0.0001
    *         ex: if interest rate = 2.5%, then swapRate() => 250 `basis points`
    */
    function ratesDecimals() external view returns(uint8);

    /**
    *  @notice Returns the fixed interest rate. All rates MUST be multiplied by 10^(ratesDecimals)
    */
    function swapRate() external view returns(uint256);

    /**
    *  @notice Returns the floating rate spread, i.e. the fixed part of the floating interest rate. All rates MUST be multiplied by 10^(ratesDecimals)
    *          floatingRate = benchmark + spread
    */
    function spread() external view returns(uint256);

    /**
    * @notice Returns the day count basis
    *         For example, 0 can denote actual/actual, 1 can denote actual/360, and so on
    */
    function dayCountBasis() external view returns(uint8);

    /**
    *  @notice Returns the contract address of the currency for which the notional amount is denominated (Example: USDC contract address).
    *          Returns the zero address if the notional is expressed in FIAT currency like USD
    */
    function notionalCurrency() external view returns(address);

    /**
    * @notice Returns an array of acceptable contract address of the assets to be transferred when swapping IRS
    *         The two counterparties may wish to get the payment in different currencies.
    *         Ex: if the payer wants to receive the payment in USDC and the receiver in DAI, then the function should return [USDC, DAI] or [DAI, USDC]
    */
    function paymentAssets() external view returns(address[] memory);

    /**
    *  @notice Returns the notional amount in unit of asset to be transferred when swapping IRS. This amount serves as the basis for calculating the interest payments, and may not be exchanged
    *          Example: If the two parties aggreed to swap interest rates in USDC, then the notional amount may be equal to 1,000,000 USDC 
    */
    function notionalAmount() external view returns(uint256);

    /**
    *  @notice Returns the number of times payments must be realized in 1 year
    */
    function paymentFrequency() external view returns(uint256);

    /**
    *  @notice Returns an array of specific dates on which the fix interest payments are exchanged. Each date MUST be a Unix timestamp like the one returned by block.timestamp
    *          The length of the array returned by this function MUST equal the total number of swaps that should be realized
    *
    *  OPTIONAL
    */
    function fixPaymentDates() external view returns(uint256[] memory);

    /**
    *  @notice Returns an array of specific dates on which the floating interest payments are exchanged. Each date MUST be a Unix timestamp like the one returned by block.timestamp
    *          The length of the array returned by this function MUST equal the total number of swaps that should be realized
    *
    *  OPTIONAL
    */
    function floatingPaymentDates() external view returns(uint256[] memory);

    /**
    *  @notice Returns the starting date of the swap contract. This is a Unix Timestamp like the one returned by block.timestamp
    */
    function startingDate() external view returns(uint256);

    /**
    *  @notice Returns the maturity date of the swap contract. This is a Unix Timestamp like the one returned by block.timestamp
    */
    function maturityDate() external view returns(uint256);

    /**
    *  @notice Returns the benchmark (the reference rate). All rates MUST be multiplied by 10^(ratesDecimals)
    *          Example: value of one the following rates: CF BIRC, EURIBOR, HIBOR, SHIBOR, SOFR, SONIA, TONAR, etc.
    *                   Or set manually
    */
    function benchmark() external view returns(uint256);

    /**
    *  @notice Returns the oracle contract address for acceptable reference rates (benchmark), or the zero address when the two parties agreed to set the benchmark manually.
    *          This contract SHOULD be used to fetch real time benchmark rate
    *          Example: Contract address for `CF BIRC`
    *
    *  OPTIONAL. The two parties MAY agree to set the benchmark manually
    */
    function oracleContractsForBenchmark() external view returns(address);

    /**
    *  @notice Makes swap calculation and transfers the payment to counterparties
    */
    function swap() external returns(bool);

    /**
    *  @notice Terminates the swap contract before its maturity date. MUST be called by either the `payer`or the `receiver`.
    */
    function terminateSwap() external;
}

Events

Swap
javascript
event Swap(uint256 _amount, address _account);

Emitted when interest payments are exchanged. The event is emitted when swap executes and pays the difference between fixed- and floating-rate interest. It allows observers to track the swap and its payment recipient on-chain.

Parameters

  • _amount
    • The amount of the interest differential being exchanged.
  • _account
    • The address receiving the interest payment.
    • Must be either the payer or the receiver.
TerminateSwap
javascript
event TerminateSwap(address indexed _payer, address indexed _receiver);

Emitted when a swap contract terminates. It signals early termination of the agreement before maturity and identifies the parties involved.

Parameters

  • _payer
    • The address of the fixed-rate payer.
  • _receiver
    • The address of the floating-rate payer.

Functions

fixedRatePayer
javascript
function fixedRatePayer() external view returns(address);

Returns the address of the party paying the fixed rate. This is the wallet address of the fixed-rate payer.

Return value

  • address
    • The address of the fixed-rate payer.
floatingRatePayer
javascript
function floatingRatePayer() external view returns(address);

Returns the address of the party paying the floating rate. This party pays interest linked to the benchmark rate.

Return value

  • address
    • The address of the floating-rate payer.
ratesDecimals
javascript
function ratesDecimals() external view returns(uint8);

Returns the number of decimal places used for the swap rate and spread. For example, a value of 4 means that the rate is divided by 10,000. To express rates in basis points, this value must be set to 2. One basis point is 0.01%, or 0.0001.

Return value

  • uint8
    • The number of decimal places.
swapRate
javascript
function swapRate() external view returns(uint256);

Returns the fixed interest rate. The rate is returned as an integer scaled by 10^(ratesDecimals). For example, a rate of 2.5% is returned as 250 basis points.

Return value

  • uint256
    • The fixed interest rate.
spread
javascript
function spread() external view returns(uint256);

Returns the fixed component of the floating interest rate, known as the spread. The floating rate is calculated as the benchmark rate plus the spread. The spread is a fixed additive value determined by risk and market conditions.

Return value

  • uint256
    • The spread.
dayCountBasis
javascript
function dayCountBasis() external view returns(uint8);

Returns the day-count convention used for interest calculations. For example, 0 can represent Actual/Actual, while 1 can represent Actual/360.

Return value

  • uint8
    • The code identifying the day-count convention.
notionalCurrency
javascript
function notionalCurrency() external view returns(address);

Returns the address of the currency contract in which the notional amount is denominated. For example, it may return the contract address of a token such as USDC. If the notional amount is denominated in fiat currency (such as USD), it returns the zero address.

Return value

  • address
    • The currency contract address or the zero address.

paymentAssets

javascript
function paymentAssets() external view returns(address[] memory);

Returns the contract addresses of assets that can be used for swap payments. This accommodates parties that prefer to make and receive payments in different currencies. For example, if the payer uses USDC and the receiver prefers DAI, it returns an array such as [USDC, DAI].

Return value

  • address[]
    • An array of contract addresses for eligible payment assets.
notionalAmount
javascript
function notionalAmount() external view returns(uint256);

Returns the notional amount on which swap calculations are based. This amount is used to calculate interest payments but is not itself exchanged. For example, a swap with a notional amount of one million USDC would use a value of 1,000,000.

Return value

  • uint256
    • The notional amount.
paymentFrequency
javascript
function paymentFrequency() external view returns(uint256);

Returns the number of payments per year. The payment frequency is defined in the contract, for example annually, semiannually, or quarterly.

Return value

  • uint256
    • The payment frequency.
fixPaymentDates
javascript
function fixPaymentDates() external view returns(uint256[] memory);

Returns the dates on which fixed-rate payments are due. Each date is returned as a Unix timestamp (in the same format as block.timestamp). The length of the array must match the scheduled number of swaps. This function is optional.

Return value

  • uint256[]
    • An array of fixed-rate payment dates.
floatingPaymentDates
javascript
function floatingPaymentDates() external view returns(uint256[] memory);

Returns the dates on which floating-rate payments are due. These are also Unix timestamps, and the length of the array must match the total number of swaps. This function is optional.

Return value

  • uint256[]
    • An array of floating-rate payment dates.
startingDate
javascript
function startingDate() external view returns(uint256);

Returns the swap's start date. This is the Unix timestamp at which the swap contract begins.

Return value

  • uint256
    • The start date.
maturityDate
javascript
function maturityDate() external view returns(uint256);

Returns the swap's maturity date. This is the date on which the contract ends, expressed as a Unix timestamp.

Return value

  • uint256
    • The maturity date.
benchmark
javascript
function benchmark() external view returns(uint256);

Returns the benchmark interest rate. Representative benchmarks include SOFR, EURIBOR, SONIA, and TONAR. The rate is returned as a value scaled by 10^(ratesDecimals).

Return value

  • uint256
    • The benchmark interest rate.
oracleContractsForBenchmark
javascript
function oracleContractsForBenchmark() external view returns(address);

Returns the address of the oracle contract supplying the benchmark interest rate. This is the address of the external data source used to obtain the benchmark rate automatically. If both parties agree to set the rate manually, the function returns the zero address. This function is optional.

Return value

  • address
    • The oracle contract address or the zero address.
swap
javascript
function swap() external returns(bool);

Calculates the swap and executes the payment between the parties. It calculates the difference between the fixed and floating interest payments and transfers the corresponding assets.

Return value

  • bool
    • true if the swap succeeds.
terminateSwap
javascript
function terminateSwap() external;

Terminates the swap contract before maturity. Either the payer or the receiver can call this function. It is used when the swap agreement is to end early.

Tokenizing swap cash flows

Interest payments in an interest rate swap must be tokenized as ERC20 tokens. Digital tokens representing the interest payments for each swap are issued and allocated to the respective parties. Each time a swap is executed, one token is burned from each party's account.

Token burns can therefore be used to verify that each payment has been fulfilled, making the history of interest payments fully traceable on the blockchain.

This tokenization mechanism substantially improves the security, transparency, and automation of interest rate swaps in DeFi.

Additional considerations

ERC7586 is designed to allow parties to an interest rate swap to set transaction terms flexibly. This enables participants ranging from financial institutions to individual investors to implement on-chain swaps securely and according to their needs.

Flexible parameter configuration

The standard allows parties to define the following essential interest rate swap parameters.

Parameter Details
Notional Amount The basis for calculating interest payments. It is not exchanged but determines the amount on which interest is paid.
Interest Rates Both fixed and floating rates can be configured. The swapRate() and spread() functions retrieve the relevant values.
Payment Frequency Defines how many interest payments are made per year, such as annually, semiannually, or quarterly.
Payment Dates Individual payment dates can be specified as Unix timestamps (an optional feature).

Combining these parameters allows parties to construct a range of financial contracts, from simple swaps to complex composite swaps. The framework maintains standardization while allowing flexibility in contract design.

Extensibility through optional features

ERC7586 accommodates different use cases by making several features OPTIONAL when designing a contract.

Examples include the following.

  • Payment Dates can be set explicitly or determined automatically based on the payment frequency.
  • The Benchmark Rate can be obtained from an oracle (an external data provider contract) or set manually by agreement between the parties.

Distinguishing mandatory from optional features gives the framework enough flexibility to support everything from simple implementations to sophisticated financial transactions.

Reliability through oracles

The reliability of an interest rate swap depends on the accuracy of the benchmark rate. The standard includes a mechanism for integrating oracles to obtain current interest rate data.

For example, oracleContractsForBenchmark() can be used to obtain the latest rates for SOFR (United States), EURIBOR (Europe), or TONAR (Japan) automatically. This offers several benefits.

  • The benchmark can be updated to reflect the latest market rates.
  • It reduces manual configuration errors and helps keep contract terms transparent and objective.
  • Automated smart contract execution improves transaction accuracy and efficiency.

Integrating oracles also creates responsibilities for system design. Developers should select reliable oracles and prepare fallback mechanisms for failures.

Compatibility

ERC7586 is compatible with ERC20.

Reference implementation

https://eips.ethereum.org/assets/eip-7586/ERC7586.sol

Security

Implementing a swap contract conforming to ERC7586 requires careful evaluation of several risk factors. The following table summarizes the main risks.

Risk type Description
Interest Rate Risk Market interest rate movements may cause substantial changes in swap payments. For example, a sharp rise in floating rates increases the burden on the floating-rate payer.
Credit Risk One or both parties may fail to fulfill their payment obligations (default), potentially preventing normal swap settlement.
ERC20 Risk Because the design relies on ERC20 tokens, developers must consider ERC20-related security concerns, including reentrancy attacks and approval-related bugs.

These risks concern not only system design but also the participants' understanding of the agreement. Before executing a swap, both parties must confirm that they fully understand and accept these risks.

Approaches to security

  • Interest rate risk management Use oracles to obtain current rate data and define conditions for automatically terminating the contract during extreme market movements (for example, triggers for terminateSwap()).
  • Credit risk management Use deposits or a collateral contract alongside the swap to enable a degree of settlement even if one party defaults.
  • Smart contract robustness To mitigate vulnerabilities associated with ERC20 integration, use reentrancy guards and implement approve and transferFrom operations carefully.
  • Oracle reliability Reduce the risk of data manipulation by avoiding reliance on a single oracle and averaging rates from multiple data sources.

References

Samuel Gwlanold Edoumou (@Edoumou), "ERC-7586: Interest Rate Swaps [DRAFT]," Ethereum Improvement Proposals, no. 7586, December 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7586.

Conclusion

This article examined ERC7586, a proposal to standardize automatic exchanges of fixed- and floating-rate payments on blockchains and enable interest rate swaps in decentralized finance (DeFi).

If you have questions, feel free to contact me via direct message on Twitter.

Twitter @cardene777

I also publish articles on other platforms:

https://chaldene.net/