SIP-309: Market-locked Collateral (V3)

NetworkEthereum & Optimism
ImplementorDaniel Beal (@dbeal-eth)
ProposalLoading status...

Simple Summary

This SIP proposes adding functionality that allows markets to prevent withdrawal of delegated collateral.


This functionality allows a market to specify an amount of dollar-denominated credit under which pools are unable to remove the collateral/liquidity they are providing to it. This only applies when an account or pool is withdrawing from a market. It does not directly consider factor in collateral price fluctuations and it will not prevent from increasing the liquidity provided to a pool or market.


There are some cases where it is necessary for a market to control withdrawal of collateral. Some examples:

  • In a spot market implementation, the market may want to ensure it always has a certain margin of collateral available to prevent insolvency from sudden price fluctuations.
  • In an insurance market implmentation, purchasers of a policy may want a guarantee that backers are not able to withdraw all of the liquidity if claims appear imminent.

Technical Specification


The implementation involves adding a new function to the market interface, which specifies the amount of credit under which the lock should be applied, and updates to the core system that respect these values.


A major benefit of this approach is that it allows a market to dynamically calculate a locked value (as opposed to requiring a function call on the market manager to update the value). This allows a market to consider dynamic values, such as price fluctuations, when calculating an amount to lock. The locked value is dollar-denominated (rather than denominated in the collateral types) because it greatly simplifies implementation, is future-proof to the addition of new collateral types, and still allows the composition of collateral backing a market to be considered in the calculation of its locked value.

Technical Specification

The IMarket interface is modified to add a new function, function locked(uint128 marketId) external view returns (uint);. This is called by the core system to assess the amount of collateral value that should be locked from withdrawal. Markets that do not need this functionality can simply return 0.

The MarketManager introduces a new concept, capacity lock, which is a boolean state defined as self.capacity < Market.locked(marketId). Market.locked(marketId) is the amount returned by the market's locked function and self.capacity is amount of liquidity/credit current allocated to the market (per SIP-303). The capacity lock state determines whether a withdrawal/deleverage can take place.

If any market in a given pool is capacity locked, a call to delegateCollateral with a decreased collateralAmount or leverage for this pool with revert. Calls to setPoolConfiguration with a decreased weight or maxDebtPerShare for the relevant market will also revert. Increasing the amount of the credit provided to a pool or market in both of these circumstances will work per usual.

Test Cases

Tests will be added to existing cases for setPoolConfiguration() and delegateCollateral() to demonstrate that the locked value is handled appropriately.

Configurable Values (Via SCCP)


Copyright and related rights waived via CC0.