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

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

constructor(address _owner, address _resolver)

Visibility

public

State Mutability

``

Views

accruedInterestOnLoan

Source

Details

Signature

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

Visibility

public

State Mutability

view

calculateMintingFee

Source

Details

Signature

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

Visibility

external

State Mutability

view

collateralAmountForLoan

Source

Details

Signature

collateralAmountForLoan(uint256 loanAmount) view returns (uint256)

Visibility

external

State Mutability

view

currentInterestOnLoan

Source

Details

Signature

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

Visibility

external

State Mutability

view

getContractInfo

Source

Details

Signature

getContractInfo() view returns (uint256 _collateralizationRatio, uint256 _issuanceRatio, uint256 _interestRate, uint256 _interestPerSecond, uint256 _issueFeeRate, uint256 _issueLimit, uint256 _minLoanSize, uint256 _totalIssuedSynths, uint256 _totalLoansCreated, uint256 _totalOpenLoanCount, uint256 _ethBalance, uint256 _liquidationDeadline, bool _loanLiquidationOpen)

Visibility

external

State Mutability

view

getLoan

Source

Details

Signature

getLoan(address _account, uint256 _loanID) view returns (address account, uint256 collateralAmount, uint256 loanAmount, uint256 timeCreated, uint256 loanID, uint256 timeClosed, uint256 interest, uint256 totalFees)

Visibility

external

State Mutability

view

issuanceRatio

Source

Details

Signature

issuanceRatio() view returns (uint256)

Visibility

public

State Mutability

view

loanAmountFromCollateral

Source

Details

Signature

loanAmountFromCollateral(uint256 collateralAmount) view returns (uint256)

Visibility

public

State Mutability

view

loanLifeSpan

Source

Details

Signature

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

Visibility

external

State Mutability

view

openLoanIDsByAccount

Source

Details

Signature

openLoanIDsByAccount(address _account) view returns (uint256[])

Visibility

external

State Mutability

view

resolverAddressesRequired

Source

Details

Signature

resolverAddressesRequired() view returns (bytes32[] addresses)

Visibility

public

State Mutability

view

Restricted Functions

setAccountLoanLimit

Source

Details

Signature

setAccountLoanLimit(uint256 _loanLimit)

Visibility

external

State Mutability

``

Requires

Modifiers

Emits

setCollateralizationRatio

Source

Details

Signature

setCollateralizationRatio(uint256 ratio)

Visibility

external

State Mutability

``

Requires

Modifiers

Emits

setInterestRate

Source

Details

Signature

setInterestRate(uint256 _interestRate)

Visibility

external

State Mutability

``

Requires

Modifiers

Emits

setIssueFeeRate

Source

Details

Signature

setIssueFeeRate(uint256 _issueFeeRate)

Visibility

external

State Mutability

``

Modifiers

Emits

setIssueLimit

Source

Details

Signature

setIssueLimit(uint256 _issueLimit)

Visibility

external

State Mutability

``

Modifiers

Emits

setLoanLiquidationOpen

Source

Details

Signature

setLoanLiquidationOpen(bool _loanLiquidationOpen)

Visibility

external

State Mutability

``

Requires

Modifiers

Emits

setMinLoanSize

Source

Details

Signature

setMinLoanSize(uint256 _minLoanSize)

Visibility

external

State Mutability

``

Modifiers

Emits

Internal Functions

depot

Source

Details

Signature

depot() view returns (contract IDepot)

Visibility

internal

State Mutability

view

exchangeRates

Source

Details

Signature

exchangeRates() view returns (contract IExchangeRates)

Visibility

internal

State Mutability

view

synthsETH

Source

Details

Signature

synthsETH() view returns (contract ISynth)

Visibility

internal

State Mutability

view

synthsUSD

Source

Details

Signature

synthsUSD() view returns (contract ISynth)

Visibility

internal

State Mutability

view

systemStatus

Source

Details

Signature

systemStatus() view returns (contract ISystemStatus)

Visibility

internal

State Mutability

view

External Functions

closeLoan

Source

Details

Signature

closeLoan(uint256 loanID)

Visibility

external

State Mutability

``

Modifiers

liquidateUnclosedLoan

Source

Details

Signature

liquidateUnclosedLoan(address _loanCreatorsAddress, uint256 _loanID)

Visibility

external

State Mutability

``

Requires

Modifiers

Emits

openLoan

Source

Details

Signature

openLoan() payable returns (uint256 loanID)

Visibility

external

State Mutability

payable

Requires

Modifiers

Emits

Modifiers

sETHRateNotInvalid

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)