SIP-354: Perps v3 Asymmetric Funding

fifa, Sunny Vempati
ProposalLoading status...

Simple Summary

Introduces an asymmetric funding rate mechanism for Perps V3.


Based on the configured parameters, asymmetry can be introduced to funding rates to add a net cost to traders monopolizing open interest. When trade is closed, the interest accrued is realized by the LPs backing the Perps supermarket.


While Perps V2 was supported by a large pool of collateral (SNX stakers) from inception, isolated deployments of Perps V3 will need to bootstrap liquidity and markets. Scaling positions and liquidity in concert is crucial for bounding LP risk appropriately. Perps V3 also implements a locking of LP collateral to ensure that open positions are backed by underlying collateral. However, without economic incentives to discourage total utilization of LP collateral, it is possible to engineer costless locking of LP collateral. The introduction of asymmetric funding provides acts as both an incentive for additional LPs to enter the market while also encouraging closing of positions to liberate LP collateral in a timely manner.



This SIP proposes to upgrades the perps contracts to introduce 3 new parameters to enable asymmetric funding across any markets within the supermarket. For simplicity of accounting, this can be implemented as an interest rate that is only activated at very high levels of locked LP collateral; though in practice, it will be surfaced to end users as an asymmetric funding rate (e.g. 10% funding, 5% 'interest' = +5% for short, -15% for long)

The parameters:

uint256 lowUtilizationInterestRateGradient
uint256 interestRateGradientBreakpoint
uint256 highUtilizationInterestRateGradient


The interest accrued is based on which side of the interestRateGradientBreakpoint the utilization % is. Below the breakpoint means the interest rate grows at the rate defined by lowUtilizationInterestRateGradient and anything above means the interest rate grows at the rate defined by highUtilizationInterestRateGradient.

The utilization rate is calculated as follows:

lockedOi / marketCreditCapacity

Note: lockedOi is the entire open interest of all markets in the supermarket multiplied by their respective lockedOiRatio.

The interest is accrued by each trader based on their contribution to the locked open interest.

Technical Specification


function setInterestRateParameters(
  uint128 lowUtilizationInterestRateGradient,
  uint128 interestRateGradientBreakpoint,
  uint128 highUtilizationInterestRateGradient
) external;

function getInterestRateParameters()
  returns (
    uint128 lowUtilizationInterestRateGradient,
    uint128 interestRateGradientBreakpoint,
    uint128 highUtilizationInterestRateGradient

Because utilization rate is dependent on delegated collateral from the LP side, there is no hook that forces the rate on the perps supermarket to be updated when someone (un)delegates. For this reason, a convenience method to manually update the interest rate that could be called the LP app has been added:

function updateInterestRate() external;

New views have been added to surface the current utliziationRate or the computed interestRate of the supermarket:

  * @notice Returns the current market interest rate
  * @return rate
function interestRate() external view returns (uint128 rate);

  * @notice Returns the super market utilization rate
  * @dev The rate is the minimumCredit / delegatedCollateral available.
  * @dev Locked credit is the sum of all markets open interest * configured lockedOiRatio
  * @dev delegatedCollateral is the credit capacity available to the supermarket
  * @return rate
  * @return delegatedCollateral
  * @return lockedCredit credit locked based on OI & lockedOiRatio
function utilizationRate()
    returns (uint256 rate, uint256 delegatedCollateral, uint256 lockedCredit);

The integrators can get a trader's owed interest by calling the previously available getOpenPosition which now returns that value:

    function getOpenPosition(
        uint128 accountId,
        uint128 marketId
        returns (
          int256 totalPnl,
          int256 accruedFunding,
          int128 positionSize,
+         uint256 owedInterest

New events added:

  * @notice Gets emitted when the interest rate is updated.
event InterestRateUpdated(uint128 indexed superMarketId, uint128 interestRate);

  * @notice Emitted when interest rate parameters are set
event InterestRateParametersSet(
    uint256 lowUtilizationInterestRateGradient,
    uint256 interestRateGradientBreakpoint,
    uint256 highUtilizationInterestRateGradient

  * @notice Gets emitted after any trade settles and includes interest charged to the trader on previous position
event InterestCharged(uint128 indexed accountId, uint256 interest);

Test Cases

New test scenarios have been added to InterestRate.test.ts.

  • 2 traders, each in different markets.
  • 1 trader opens a trade
  • the other trader opens and closes trades on a separate market with differing times

Check both trader1 and trader2 have accrued the proper interest based on configured interest rate parameters.

Another test scenario added for when the interest rate parameters are turned off after being turned on: InterestRate.reset.test.ts

  • Assert functionality that interest stops accruing after interest rate parameters have been disabled but previous interest accrued is preserved.

Added new tests to GlobalPerpsMarket.test.ts:

  • setInterestRateParameters
  • getInterestRateParameters

Configurable Values (Via SCCP)

Please list all values configurable via SCCP under this implementation.

Copyright and related rights waived via CC0.