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¶
Related Contracts¶
Structs¶
SynthLoanStruct
¶
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
¶
Type: uint256
accountOpenLoanCounter
¶
Type: mapping(address => uint256)
accountsSynthLoans
¶
Type: mapping(address => struct EtherCollateral.SynthLoanStruct[])
collateralizationRatio
¶
Type: uint256
interestPerSecond
¶
Type: uint256
interestRate
¶
Type: uint256
issueFeeRate
¶
Type: uint256
issueLimit
¶
Type: uint256
liquidationDeadline
¶
Type: uint256
loanLiquidationOpen
¶
Type: bool
minLoanSize
¶
Type: uint256
totalIssuedSynths
¶
Type: uint256
totalLoansCreated
¶
Type: uint256
totalOpenLoanCount
¶
Type: uint256
Constructor¶
constructor
¶
Details
Signature
constructor(address _owner, address _resolver)
Visibility
public
State Mutability
``
Views¶
accruedInterestOnLoan
¶
Details
Signature
accruedInterestOnLoan(uint256 _loanAmount, uint256 _seconds) view returns (uint256 interestAmount)
Visibility
public
State Mutability
view
calculateMintingFee
¶
Details
Signature
calculateMintingFee(address _account, uint256 _loanID) view returns (uint256)
Visibility
external
State Mutability
view
collateralAmountForLoan
¶
Details
Signature
collateralAmountForLoan(uint256 loanAmount) view returns (uint256)
Visibility
external
State Mutability
view
currentInterestOnLoan
¶
Details
Signature
currentInterestOnLoan(address _account, uint256 _loanID) view returns (uint256)
Visibility
external
State Mutability
view
getContractInfo
¶
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
¶
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
¶
Details
Signature
issuanceRatio() view returns (uint256)
Visibility
public
State Mutability
view
loanAmountFromCollateral
¶
Details
Signature
loanAmountFromCollateral(uint256 collateralAmount) view returns (uint256)
Visibility
public
State Mutability
view
loanLifeSpan
¶
Details
Signature
loanLifeSpan(address _account, uint256 _loanID) view returns (uint256 loanLifeSpanResult)
Visibility
external
State Mutability
view
openLoanIDsByAccount
¶
Details
Signature
openLoanIDsByAccount(address _account) view returns (uint256[])
Visibility
external
State Mutability
view
resolverAddressesRequired
¶
Details
Signature
resolverAddressesRequired() view returns (bytes32[] addresses)
Visibility
public
State Mutability
view
Restricted Functions¶
setAccountLoanLimit
¶
Details
Signature
setAccountLoanLimit(uint256 _loanLimit)
Visibility
external
State Mutability
``
Requires
Modifiers
Emits
setCollateralizationRatio
¶
Details
Signature
setCollateralizationRatio(uint256 ratio)
Visibility
external
State Mutability
``
Requires
Modifiers
Emits
setInterestRate
¶
Details
Signature
setInterestRate(uint256 _interestRate)
Visibility
external
State Mutability
``
Requires
Modifiers
Emits
setIssueFeeRate
¶
Details
Signature
setIssueFeeRate(uint256 _issueFeeRate)
Visibility
external
State Mutability
``
Modifiers
Emits
setIssueLimit
¶
Details
Signature
setIssueLimit(uint256 _issueLimit)
Visibility
external
State Mutability
``
Modifiers
Emits
setLoanLiquidationOpen
¶
Details
Signature
setLoanLiquidationOpen(bool _loanLiquidationOpen)
Visibility
external
State Mutability
``
Requires
Modifiers
Emits
setMinLoanSize
¶
Details
Signature
setMinLoanSize(uint256 _minLoanSize)
Visibility
external
State Mutability
``
Modifiers
Emits
Internal Functions¶
depot
¶
Details
Signature
depot() view returns (contract IDepot)
Visibility
internal
State Mutability
view
exchangeRates
¶
Details
Signature
exchangeRates() view returns (contract IExchangeRates)
Visibility
internal
State Mutability
view
synthsETH
¶
Details
Signature
synthsETH() view returns (contract ISynth)
Visibility
internal
State Mutability
view
synthsUSD
¶
Details
Signature
synthsUSD() view returns (contract ISynth)
Visibility
internal
State Mutability
view
systemStatus
¶
Details
Signature
systemStatus() view returns (contract ISystemStatus)
Visibility
internal
State Mutability
view
External Functions¶
closeLoan
¶
Details
Signature
closeLoan(uint256 loanID)
Visibility
external
State Mutability
``
Modifiers
liquidateUnclosedLoan
¶
Details
Signature
liquidateUnclosedLoan(address _loanCreatorsAddress, uint256 _loanID)
Visibility
external
State Mutability
``
Requires
Modifiers
Emits
openLoan
¶
Details
Signature
openLoan() payable returns (uint256 loanID)
Visibility
external
State Mutability
payable
Requires
Modifiers
Emits
Modifiers¶
sETHRateNotInvalid
¶
Events¶
AccountLoanLimitUpdated
¶
Signature: AccountLoanLimitUpdated(uint256 loanLimit)
CollateralizationRatioUpdated
¶
Signature: CollateralizationRatioUpdated(uint256 ratio)
InterestRateUpdated
¶
Signature: InterestRateUpdated(uint256 interestRate)
IssueFeeRateUpdated
¶
Signature: IssueFeeRateUpdated(uint256 issueFeeRate)
IssueLimitUpdated
¶
Signature: IssueLimitUpdated(uint256 issueLimit)
LoanClosed
¶
Signature: LoanClosed(address account, uint256 loanID, uint256 feesPaid)
LoanCreated
¶
Signature: LoanCreated(address account, uint256 loanID, uint256 amount)
LoanLiquidated
¶
Signature: LoanLiquidated(address account, uint256 loanID, address liquidator)
LoanLiquidationOpenUpdated
¶
Signature: LoanLiquidationOpenUpdated(bool loanLiquidationOpen)
MinLoanSizeUpdated
¶
Signature: MinLoanSizeUpdated(uint256 minLoanSize)