SIP-135: L2 Shorting

Author
StatusImplemented
TypeGovernance
ImplementorMB
ReleaseSargas
ProposalLoading status...
Discussions-ToGovernance
Created2021-04-30

Implementor

Mark E. Barrasso (@barrasso)

Simple Summary

Deploy sUSD shorts for sETH and sBTC onto L2.

Overview

Refactor and optimise the L1 shorting mechanism to be deployable on Optimism.

Rationale

There is currently no plan to deploy iSynths onto L2. This means that L2 users will not be able to access inverse price exposure. The shorting mechanism on L1 has proved successful, with around $50m of open interest. However, transactions are expensive, making the mechanism unviable for smaller trades.

Deploying this mechanism onto L2 will solve both of the above problems.

Technical Specification

The mechanism for shorting is described in SIP 103. The majority of work in this SIP is around reducing code size to conform with OVM requirements.

It also proposes some improvements to the UX. Depositing and withdrawing collateral are not subject to an interaction delay. This allows users to combine these functions with a call to draw/repay. Liquidations are also not subject to an interaction delay.

Shorts can be repaid with the underlying collateral, to prevent the user from having to purchase the shorted asset.

The interface will look like this:


function open(uint collateral, uint amount, bytes32 currency) external returns (uint id);

function close(uint id) external;

function repay(
    address borrower,
    uint id,
    uint amount
) external returns (uint short, uint collateral);

function repayWithCollateral(uint id, uint repayAmount) external returns (uint short, uint collateral);

function draw(uint id, uint amount) external returns (uint short, uint collateral);

function liquidate(address borrower, uint id, uint amount) external;

The interaction delay will be set to 0 initially. In the event that frontrunning becomes an issue, it can be increased by SCCP.

Additionally, in order to reduce the contract size of Collateral.sol due to contract size limitations on L2 (the L1 version is already near the limit) we are creating a new utility contract called CollateralUtil.sol and moving the following view functions into the util contract:

function collateralRatio(uint id, address account) public view returns (uint cratio);

function maxLoan(uint amount, bytes32 currency) public view returns (uint max);

function liquidationAmount(Loan memory loan) public view returns (uint amount);

function collateralRedeemed(bytes32 currency, uint amount) public view returns (uint collateral);

function areSynthsAndCurrenciesSet(bytes32[] calldata _synthNamesInResolver, bytes32[] calldata _synthKeys);

From our findings on initial testing for front running risk exposure on L2 we have determined that the risk is mitigated and we can use an interaction delay of 0. Of course, we can increase the interaction delay as we continue to measure how much front running risk exposure there is for different interaction delay levels.

We're also adding support for the following:

  1. Ability to close the loan with collateral.
  2. Removing the interaction delay if a short position is in liquidation state.
  3. If a synth is blocked then ensuring the shorts for that synth are also blocked.

Collapsible shorts - ability to close the loan with collateral

The ability to close the short position, utilizing the sUSD collateral locked to repay the excess debt. The mechanism is detailed in SIP 122 for collapsible loans.

To summarize how this will work:

  • Allow the borrower (user) to repay their short position with their sUSD collateral.
  • Charge the effective exchange fee for sUSD -> sETH / sBTC + a service fee that is configurable.
  • Burn the sUSD collateral and reduces the borrowed sETH / sBTC units by the amount repaid (less exchange fees).

The effective exchange fee for exchanging sUSD to the borrowed debt (sETH, sBTC) will be charged for swapping the sUSD collateral to repay the loan. A base % fee to be charged and payable to the feepool for the function to repay using sUSD collateral instead of acquiring the borrowed synth to repay the borrowed synth. Default base fee would be 0 bps (0.0%) on top of the exchange fee and as mentioned above the base fee is a configurable value.

Removing the interaction delay if a short position is in liquidation state

Currently multi-collateral loans (including sUSD shorts) have an interaction delay which blocks simultaneous loan interactions as a safety precaution. The interaction delay persists even when the loan is an under-collateralized state, which is problematic because of the following reasons:

  1. The interaction delay could censor borrowers from rescuing their collateral from liquidation via debt repayment, collateral deposit or loan closing.

  2. It prevents the liquidator from being able to settle the borrowers' debt, until the timer expires. Hence, loans could go under-water during times of accelerated persistent decline in prices.

  3. Depositing collateral to an existing loan should not reset the interaction delay.

The improvement consists of bypassing the interaction delay entirely when the loan is in an under-collateralized state. This would allow the borrower or liquidator to bring the loan back into health promptly without delay.

Ensure synths exchange is enabled for shorts

  • Update SystemStatus.sol contract

  • Update SystemStatus.requireSynthExchangeActive() to check that synth is active and not suspended by the decentralised circuit breaker or other suspension reasons.

Test Cases

Unit tests included with implementation.

Configurable Values (Via SCCP)

  • Minimum collateral required to open a short (Default: 100 sUSD)

  • Collapsible short loans base fee (Default: 0 bps)

  • Issue fee rate (Default: 40 bps)

  • Adding shorting against other synth assets beyond just sETH and sBTC. Will be proposed via an SCCP.

Copyright and related rights waived via CC0.