Ether Wrapper: Minting sETH with Ether directly¶
The EtherWrapper, introduced with SIP-112, brings with it the ability to mint sETH
directly using either ETH
in the NativeEtherWrapper
or WETH
in the EtherWrapper
itself.
Tip: Native Ether
As the EtherWrapper
has been designed for both L1 and L2 Optimism, it supports WETH (wrapped ether) by default. Thus when using the NativeEtherWrapper
contract on L1, the Ether is simply wrapped on it's way and as such to see the total amount of Ether in both wrappers, simply look at the WETH holdings of https://contracts.synthetix.io/EtherWrapper.
Using Wrapper Ether (all environments)¶
Destination contract (address & ABI): EtherWrapper
Views¶
burnFeeRate
The percentage (stored as a decimal with 18 places) of sETH that will be deducted when burningcapacity
The remaining amount of WETH that can be sent to theEtherWrapper
mintFeeRate
The percentage (stored as a decimal with 18 places) of sETH that will be deducted when mintinggetReserves
The amount of WETH held in theEtherWrapper
(this includes all Ether that was sent via theNativeEtherWrapper
which wraps toWETH
first)
Mint sETH with WETH¶
Methods¶
WETH Approval Required to Mint
EtherWrapper
needs to be approved to spend the user's WETH
(as it needs to send it to itself for payment)
Events Emitted¶
For each mint, among other events, one primary event will be emitted:
name | emitted on | address account |
uint principal |
uint fee |
uint amountIn |
---|---|---|---|---|---|
Minted |
EtherWrapper |
msg.sender |
The amount minus the fee (or the remaining capacity of the EtherWrapper if amount would reach the limit.) |
the fee in sETH that is deducted via the mintFeeRate |
the total amountIn |
Example Transactions on Mainnet¶
Burn sETH to WETH¶
Contract¶
Destination contract (address & ABI): EtherWrapper
Methods¶
No Approval Required to Burn
EtherWrapper
does NOT need approval to burn, as sETH
can be burned in-place directly using protected functionality.
Events Emitted¶
For each burn, among other events, two will be emitted:
name | emitted on | address account |
uint principal |
uint fee |
uint amountIn |
---|---|---|---|---|---|
Burned |
EtherWrapper |
msg.sender |
The amount minus the fee (or the remaining reserves in the contract (getReserves ).) |
the fee in sETH that is deducted via the burnFeeRate |
the total amountIn |
Using native Ether (L1 only)¶
Destination contract (address & ABI): NativeEtherWrapper
Views¶
- (Use
EtherWrapper
views above - theNativeEtherWrapper
is simply a convenience contract that wraps ETH to WETH then forwards the WETH to theEtherWrapper
)
Mint sETH with ETH¶
Methods¶
No Approval Requied
NativeEtherWrapper
does not need approval to mint sETH as it accepts payable
Ether
Events Emitted¶
For each mint, among other events, two will be emitted:
name | emitted on | address account |
uint principal |
uint fee |
uint amountIn |
---|---|---|---|---|---|
Minted |
EtherWrapper |
msg.sender |
The amount minus the fee (or the remaining capacity of the EtherWrapper if amount would reach the limit.) |
the fee in sETH that is deducted via the mintFeeRate |
the amount of Ether sent with the transaction (the transaction value ) |
name | emitted on | address account |
uint amountIn |
---|---|---|---|
Minted |
NativeEtherWrapper |
msg.sender |
the total amountIn |
Example Transactions on Mainnet¶
Burn sETH to ETH¶
Methods¶
sETH Approval Required to Burn
NativeEtherWrapper
needs to be approved to spend the user's sETH
(as it needs to send it to itself in order to invoke EtherWrapper.burn()
)
Events Emitted¶
For each burn, among other events, two will be emitted:
name | emitted on | address account |
uint principal |
uint fee |
uint amountIn |
---|---|---|---|---|---|
Burned |
EtherWrapper |
msg.sender |
The amount minus the fee (or the remaining reserves in the contract (getReserves ).) |
the fee in sETH that is deducted via the burnFeeRate |
the total amountIn |
name | emitted on | address account |
uint amountIn |
---|---|---|---|
Burned |
NativeEtherWrapper |
msg.sender |
the total amountIn |
Example Transactions on Mainnet¶
Code Snippets¶
Exchanging ETH for sUSD
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
Tracking changes to parameters¶
There are three parameters in the EtherWrapper, which are managed by Synthetix governance and can be changed through the SCCP process (see SCCP-102 for a good example).
Parameter | Description |
---|---|
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 |
These can be tracked via listening to events on the SystemSettings contract:
name | emitted on | uint maxETH |
---|---|---|
EtherWrapperMaxETHUpdated |
SystemSettings |
The new maximum ETH cap of the wrapper. |
name | emitted on | uint rate |
---|---|---|
EtherWrapperMintFeeRateUpdated |
SystemSettings |
The new mint fee rate |
EtherWrapperBurnFeeRateUpdated |
SystemSettings |
The new burn fee rate |