---
sip: 112
network: Ethereum
title: ETH Wrappr
status: Implemented
author: 'bojan, kaleb (@kaleb-keny)'
created: 2021-02-15T00:00:00.000Z
type: Governance
---

<!--You can leave these HTML comments in your merged SIP and delete the visible duplicate text guides, they will not appear and may be helpful to refer to if you edit it again. This is the suggested template for new SIPs. Note that an SIP number will be assigned by an editor. When opening a pull request to submit your SIP, please use an abbreviated title in the filename, `sip-draft_title_abbrev.md`. The title should be 44 characters or less.-->

## Simple Summary

<!--"If you can't explain it simply, you don't understand it well enough." Simply describe the outcome the proposed changes intends to achieve. This should be non-technical and accessible to a casual community member.-->

Allow users to wrap ETH or WETH and get sETH

## Abstract

We propose to deploy a new contract that accepts deposits in ETH or WETH and in return mints sETH in the user's wallet. After successful ETH or WETH deposit, users' ownership is transferred to Synthetix protocol. Wrappr is a conditionally bidirectional contract, meaning that if it holds WETH in its reserve, it will accept deposits in sETH and releases WETH or ETH back to the user.
WETH or ETH can be withdrawn from the contract at any point by anyone after the corresponding amount of sETH is effectively burned.

## Motivation

<!--This is the problem statement. This is the *why* of the SIP. It should clearly explain *why* the current state of the protocol is inadequate.  It is critical that you explain *why* the change is needed, if the SIP proposes changing how something is calculated, you must address *why* the current calculation is innaccurate or wrong. This is not the place to describe how the SIP will address the issue!-->

We are experiencing a chronic shortage of Synths which is reflected on the market where Synths are being constantly traded above their peg since mid-2020 as can be seen here on [CRV](https://www.curve.fi/trade/susdv2/SUSD-USDC/6h).
Even with the introduction of Multi-Collateral Loans in SIP-97, problems with the peg persisted. One explanation is that those loans are relatively capital inefficient since they require over-collateralization and thus are not effective tools for arbitrage and bringing synths to peg.

## Specification

<!--The specification should describe the syntax and semantics of any new feature, there are five sections
1. Overview
2. Rationale
3. Technical Specification
4. Test Cases
5. Configurable Values
-->

### Overview

<!--This is a high level overview of *how* the SIP will solve the problem. The overview should clearly describe how the new feature will be implemented.-->

sETH is freshly minted whenever a user deposits ETH or WETH into the contract. The user can deposit any amount desired however, this is subject to not exceeding the `maxETH` configurable via SCCP.
There is no duration, interest rate or collateralization ratio, as any user can at any time buy back WETH or ETH available in the contract by burning sETH.
Minters benefit as minting sETH and burning sETH are subject to a `mintingFeeRate` and `burningFeeRate`, both of which are paid to the fee pool after conversion into `sUSD`.
The contract supports both ETH and WETH, and automatically handles wrapping/unwrapping ETH for the user.

### Rationale

<!--This is where you explain the reasoning behind how you propose to solve the problem. Why did you propose to implement the change in this way, what were the considerations and trade-offs. The rationale fleshes out what motivated the design and why particular design decisions were made. It should describe alternate designs that were considered and related work. The rationale may also provide evidence of consensus within the community, and should discuss important objections or concerns raised during discussion.-->

The main purpose of this proposal rests on the following points:

- Allowing ETH holders to easily enter and exit Kwenta with the least amount of friction possible. This venue is more efficient than trading ETH for synths on an AMM, due to the slippage. In addition, the current loan program bears collateralization as mentioned previously which cannot be lowered due to the collateralization and interest rate levied being undifferentiated across different borrowing options.
- The contract would release sETH during times of surging demand and absorb extra synth supply when that demand recedes. Therefore it would automatically act as a peg balancing layer that allows arbers to enter and exit with the least friction possible, helping align the different [pegs](https://www.curve.fi/seth/). One arb example, would be to mint sETH against ETH and swap the sETH for ETH on CRV.
- The debt pool would be mostly neutral initially as the increase in sETH supply would be offset by the increase in ETH locked in the wappr contract. However, as users swap the freshly minted sETH to other synths, this would lead to a reduction in the sETH skew as ETH locked acts as a counter-weight against the long sETH position, as the total debt calculation would be reduced by the amount of ETH locked in the contract. Hence, the need to incentivize farmers to assume a short sETH positions would be decreased.
- The minting and burning fees effectively create a new revenue stream for minters who would effectively be getting a cut from the profit generated by actors arbitraging points of inefficiency.
- The pressure to fix the peg by reducing the collateralization ratio (increasing the solvency risk on minters) is somewhat reduced by having this contract at the spartan's council disposal, as another tool to help steer the peg towards parity (by changing the minting & burning fee as well as the `maxETH` parameter).
- Supporting WETH makes the contract compatible with L2, specifically the Optimism OVM (OVM doesn’t support native ETH, instead contracts can use a [native WETH deployment](https://community.optimism.io/docs/protocol/evm-comparison.html#native-weth)), as well as reduces interaction complexity for users coming from DeFi, where WETH is the norm.

### Technical Specification

#### Contracts

Two contracts are required to be deployed:

- `EtherWrapper.sol` which is able to mint `sETH` against WETH deposited and release WETH against `sETH` burned.
- `NativeEtherWrappr.sol` which is a thin wrapper around `EtherWrapper.sol`, that supports interacting with native ether on L1.

#### Interfaces

The entry points for users on `IEtherWrapper.sol` implements the following interface.

```sol
interface IEtherWrapper.sol {
    function mint(uint amount) external;
    function burn(uint amount) external;
}
```

The `NativeEtherWrapper` has a similar interface. The contract calls into `EtherWrapper` for `mint` and `burn`, converting sent ETH into WETH for the `mint` function, and received `WETH` into `ETH` for the `burn` function.

```sol
interface INativeEtherWrapper {
    function mint() external payable;
    function burn(uint amount) external;
}
```

#### L2 Specification

`NativeEtherWrapper` is not deployed for L2, as using native ETH opcodes (`callvalue`, `balance`) in the OVM will revert.

#### Key Bounds

- The upper bound on the amount of _Minting_ is determined with a helper function, `capacity`, defined by max(`maxETH`- `WETH`, 0) with `WETH` being the amount locked in the contract. In case the user attempts to mint an amount greater than the upper bound, then `capacity` is minted and the residual is returned to the user (please refer to test cases for calculation specs).

- The upper bound on the amount of _Burning_ is computed as `WETH` locked in the contract multiplied `(1+burnFeeRate)` (please refer to test cases for calculation specs).

- `mintFeeRate` and `burnFeeRate` are both bounded between 0% and 100%, inclusive.

### Test Cases

- Given that a user has `u` amount of ETH and `u` WETH and the contract has `c` amount of ETH in spare capacity
  - Given that `u` is larger than or equal to `c`
    - When the user attempts to deposit `u` ETH into the contract
      - ✅ Then it succeeds and the following take place:
        - `c` ETH is wrapped into WETH and is locked in the contract
        - `c(1-mintFeeRate)` is minted into the user's wallet in sETH
        - `c*mintFeeRate` worth of sETH is sent to the fee pool in the form of sUSD
        - `u - c` worth of ETH is refunded back to the user
    - When the user attempts to deposit `u` WETH into the contract
      - ✅ Then it succeeds and the following take place:
      - `c` WETH is locked up in the contract
      - `c(1-mintFeeRate)` is minted into the user's wallet in sETH
        - `c*mintFeeRate` worth of sETH is sent to the fee pool in the form of sUSD
        - `u - c` worth of WETH is refunded back to the user
  - Given that `u` is strictly lower than `c`
    - When the user attempts to deposit `u` ETH into the contract
      - ✅ Then it succeeds and the following take place:
        - `u` ETH is wrapped into WETH and is locked in the contract
        - `u(1-mintFeeRate)` is minted into the user's wallet in sETH
        - `u*mintFeeRate` worth of sETH is sent to the fee pool in the form of sUSD
    - When the user attempts to deposit `u` WETH into the contract
      - ✅ Then it succeeds and the following take place:
        - `u` WETH is locked up in the contract
        - `u(1-mintFeeRate)` is minted into the user's wallet in sETH
        - `u*mintFeeRate` worth of sETH is sent to the fee pool in the form of sUSD
- Given that the contract's capacity is zero, as `maxETH` is locked in the contract
  - When the user attempts deposit ETH or WETH into the contract
    - ❌ Then the transaction reverts due to max capacity being reached
- Given that a user has `u` amount of sETH and the contract holds `c` amount of WETH
  - Given that `u` is larger than or equal to `c(1+burnFeeRate)`
    - When the user attempts to draw out ETH from the contract by burning `u` sETH and flagging withdrawal in ETH
      - ✅ Then it succeeds and the following take place:
        - `c` WETH is unwrapped to ETH and is sent to the user
        - `c` sETH is burned
        - `c * burnFeeRate` worth of sETH is swapped to sUSD and sent to the fee pool
        - `u - c(1+burnFeeRate)` worth of sETH is refunded back to the user
    - When the user attempts to draw out WETH from the contract by burning `u` sETH and flagging withdrawal in WETH
      - ✅ Then it succeeds and the following take place:
        - `c` WETH is sent to the user
        - `c` sETH is burned
        - `c * burnFeeRate` worth of sETH is swapped to sUSD and sent to the fee pool
        - `u - c(1+burnFeeRate)` worth of sETH is refunded back to the user
  - Given that `u` is strictly lower than `c(1+burnFeeRate)`
    - When the user attempts to draw out ETH from the contract by burning `u` sETH and flagging withdrawal in ETH
      - ✅ Then it succeeds and the following take place:
        - `u (1-burnFeeRate)` worth of WETH is unwrapped to ETH and is sent to the user
        - `u * burnFeeRate` worth of sETH is swapped to sUSD and sent to the fee pool
        - `u (1 - burnFeeRate)` sETH is burned
    - When the user attempts to draw out WETH from the contract by burning `u` sETH and flagging withdrawal in WETH
      - ✅ Then it succeeds and the following take place:
        - `u (1-burnFeeRate)` worth of WETH is sent to the user
        - `u * burnFeeRate` worth of sETH is swapped to sUSD and sent to the fee pool
        - `u (1 - burnFeeRate)` sETH is burned
- Given that the contract's holds no WETH

  - When the user attempts draw out ETH or WETH from the contract
    - ❌ Then the transaction reverts due to the contract being out of WETH

- Given that a user attemps to mint with `WETH` and `msg.value` is greater than zero then the following takes place:
  - ❌ The transaction reverts due to the user minting with both `WETH` and `ETH`

### Configurable Values (Via SCCP)

<!--Please list all values configurable via SCCP under this implementation.-->

For the wrappr contract, the following values must be set:

- `maxETH` the maximum amount of ETH held by contract.
- `mintFeeRate` the fee for depositing ETH into the contract.
- `burnFeeRate` the fee for burning sETH and releasing ETH from the contract

### Proposed Initial Values

The following values are proposed as an initial configuration:

- `maxETH` 5,000
- `mintFeeRate` 5 bp
- `burnFeeRate` 5 bp

## Copyright

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).