Skip to content

EtherCollateral

Description

Implemented in SIP 35: Skinny Ether Collateral

Beyond the fact that many people in the Ethereum community asked for ETH to be introduced as collateral, there are many positive implications for adding it to the system. Firstly, it makes it easier for a newcomer to start trading on Synthetix.Exchange. If they have ETH, they can try it out without selling their ETH for Synths.

Adding Ether as collateral also contributes to the Synth supply, and thus trading fees, while diversifying the collateral. This increases the system’s scalability while also protecting it from potential SNX price shocks, without diluting the value of SNX.

This was an understandable concern from SNX stakers once the community began discussing adding ETH — that it would need to be implemented in a way that didn’t dilute the value of SNX. in this model, ETH stakers don’t receive fees or rewards as they take no risk for the debt pool.

By locking collateral, ETH stakers will create a debt they need to repay if they want to withdraw their ETH and leave the system. This is similar to the debt that SNX stakers create when they lock their SNX as collateral, but the difference is that ETH stakers will not take on risk of debt pool fluctuations. In other words, ETH stakers are not participating in the ‘pooled debt’ aspect of the system — their debt will be denominated in ETH, and will be the same when they leave as when they enter.

For example, if Alice locks 150 ETH as collateral, she can borrow 100 sETH. Even if she uses that sETH to make a series of trades that allow her to increase that 100 sETH to 200 sETH, she only needs to pay back 100 sETH to unstake her 150 ETH. That profit is instead added to the SNX stakers’ pooled debt (see page 2 of the litepaper for more details). Of course, because they do not take on the same risk as SNX stakers, ETH stakers do not receive sUSD trading fees or SNX staking rewards.

The final few details you should know are that the minting fee and interest rate paid by ETH stakers is also paid to SNX stakers and the minimum position size is 1 ETH. At the end of the three month trial period, all outstanding loans must be paid back. There will be a one week grace period, after which anyone will be able to send sETH to close the position and claim the outstanding ETH.

Source: contracts/EtherCollateral.sol

Architecture

Libraries

Inheritance Graph

graph TD EtherCollateral[EtherCollateral] --> Pausable[Pausable] EtherCollateral[EtherCollateral] --> MixinResolver[MixinResolver] Pausable[Pausable] --> Owned[Owned] MixinResolver[MixinResolver] --> Owned[Owned]

Structs

SynthLoanStruct

Source

Field Type Description
account address Address of the loan creator
collateralAmount uint256 Amount of ETH locked as collateral
loanAmount uint256 Amount of sETH issued for the loan
timeCreated uint256 Timestamp of the loan creation
loanID uint256 Unique ID number of the loan
timeClosed uint256 Timestamp of when the loan is closed

Variables

accountLoanLimit

Source

Type: uint256

accountOpenLoanCounter

Source

Type: mapping(address => uint256)

accountsSynthLoans

Source

Type: mapping(address => struct EtherCollateral.SynthLoanStruct[])

collateralizationRatio

Source

Type: uint256

interestPerSecond

Source

Type: uint256

interestRate

Source

Type: uint256

issueFeeRate

Source

Type: uint256

issueLimit

Source

Type: uint256

liquidationDeadline

Source

Type: uint256

loanLiquidationOpen

Source

Type: bool

minLoanSize

Source

Type: uint256

totalIssuedSynths

Source

Type: uint256

totalLoansCreated

Source

Type: uint256

totalOpenLoanCount

Source

Type: uint256

Constructor

constructor

Source

Details

Signature

(address _owner, address _resolver)

Visibility

public

State Mutability

nonpayable

Views

accruedInterestOnLoan

Source

Details

Signature

accruedInterestOnLoan(uint256 _loanAmount, uint256 _seconds) returns (uint256)

Visibility

public

State Mutability

view

calculateMintingFee

Source

Details

Signature

calculateMintingFee(address _account, uint256 _loanID) returns (uint256)

Visibility

external

State Mutability

view

collateralAmountForLoan

Source

Details

Signature

collateralAmountForLoan(uint256 loanAmount) returns (uint256)

Visibility

external

State Mutability

view

currentInterestOnLoan

Source

Details

Signature

currentInterestOnLoan(address _account, uint256 _loanID) returns (uint256)

Visibility

external

State Mutability

view

getContractInfo

Source

Details

Signature

getContractInfo() returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, bool)

Visibility

external

State Mutability

view

getLoan

Source

Details

Signature

getLoan(address _account, uint256 _loanID) returns (address, uint256, uint256, uint256, uint256, uint256, uint256, uint256)

Visibility

external

State Mutability

view

issuanceRatio

Source

Details

Signature

issuanceRatio() returns (uint256)

Visibility

public

State Mutability

view

loanAmountFromCollateral

Source

Details

Signature

loanAmountFromCollateral(uint256 collateralAmount) returns (uint256)

Visibility

public

State Mutability

view

loanLifeSpan

Source

Details

Signature

loanLifeSpan(address _account, uint256 _loanID) returns (uint256)

Visibility

external

State Mutability

view

openLoanIDsByAccount

Source

Details

Signature

openLoanIDsByAccount(address _account) returns (uint256[])

Visibility

external

State Mutability

view

Restricted Functions

setAccountLoanLimit

Source

Details

Signature

setAccountLoanLimit(uint256 _loanLimit)

Visibility

external

State Mutability

nonpayable

Requires

Modifiers

Emits

setCollateralizationRatio

Source

Details

Signature

setCollateralizationRatio(uint256 ratio)

Visibility

external

State Mutability

nonpayable

Requires

Modifiers

Emits

setInterestRate

Source

Details

Signature

setInterestRate(uint256 _interestRate)

Visibility

external

State Mutability

nonpayable

Requires

Modifiers

Emits

setIssueFeeRate

Source

Details

Signature

setIssueFeeRate(uint256 _issueFeeRate)

Visibility

external

State Mutability

nonpayable

Modifiers

Emits

setIssueLimit

Source

Details

Signature

setIssueLimit(uint256 _issueLimit)

Visibility

external

State Mutability

nonpayable

Modifiers

Emits

setLoanLiquidationOpen

Source

Details

Signature

setLoanLiquidationOpen(bool _loanLiquidationOpen)

Visibility

external

State Mutability

nonpayable

Requires

Modifiers

Emits

setMinLoanSize

Source

Details

Signature

setMinLoanSize(uint256 _minLoanSize)

Visibility

external

State Mutability

nonpayable

Modifiers

Emits

Internal Functions

depot

Source

Details

Signature

depot() returns (contract IDepot)

Visibility

internal

State Mutability

view

exchangeRates

Source

Details

Signature

exchangeRates() returns (contract IExchangeRates)

Visibility

internal

State Mutability

view

synthsETH

Source

Details

Signature

synthsETH() returns (contract ISynth)

Visibility

internal

State Mutability

view

synthsUSD

Source

Details

Signature

synthsUSD() returns (contract ISynth)

Visibility

internal

State Mutability

view

systemStatus

Source

Details

Signature

systemStatus() returns (contract ISystemStatus)

Visibility

internal

State Mutability

view

External Functions

closeLoan

Source

Details

Signature

closeLoan(uint256 loanID)

Visibility

external

State Mutability

nonpayable

Modifiers

liquidateUnclosedLoan

Source

Details

Signature

liquidateUnclosedLoan(address _loanCreatorsAddress, uint256 _loanID)

Visibility

external

State Mutability

nonpayable

Requires

Modifiers

Emits

openLoan

Source

Details

Signature

openLoan() returns (uint256)

Visibility

external

State Mutability

payable

Requires

Modifiers

Emits

Modifiers

sETHRateNotStale

Source

Events

AccountLoanLimitUpdated

Source

Signature: AccountLoanLimitUpdated(uint256 loanLimit)

CollateralizationRatioUpdated

Source

Signature: CollateralizationRatioUpdated(uint256 ratio)

InterestRateUpdated

Source

Signature: InterestRateUpdated(uint256 interestRate)

IssueFeeRateUpdated

Source

Signature: IssueFeeRateUpdated(uint256 issueFeeRate)

IssueLimitUpdated

Source

Signature: IssueLimitUpdated(uint256 issueLimit)

LoanClosed

Source

Signature: LoanClosed(address account, uint256 loanID, uint256 feesPaid)

LoanCreated

Source

Signature: LoanCreated(address account, uint256 loanID, uint256 amount)

LoanLiquidated

Source

Signature: LoanLiquidated(address account, uint256 loanID, address liquidator)

LoanLiquidationOpenUpdated

Source

Signature: LoanLiquidationOpenUpdated(bool loanLiquidationOpen)

MinLoanSizeUpdated

Source

Signature: MinLoanSizeUpdated(uint256 minLoanSize)