PurgeableSynth¶
Description¶
This is a Synth where all the holders can be force-exchanged back to oUSD
at current rates so that the contract can be removed from the system or otherwise repurposed. In order to be liquidated, a Synth must either be frozen (if it is an inverse synth) or have its total outstanding supply worth less than 100\,000 USD. Hence it is mainly useful for eliminating Synths which are unused or at the end of their useful life. The value of the token is read from the system's central ExchangeRates contract.
Purgeable synths were introduced by SIP-3 in response to increasing gas costs associated with minting, and to allow faster reconfiguration of inverse synths.
Source: PurgeableSynth.sol
Architecture¶
Inheritance Graph¶
Related Contracts¶
Libraries¶
SafeDecimalMath
foruint
Variables¶
maxSupplyToPurgeInUSD
¶
Purging this Synth is disallowed unless the value of its supply is less than this. Initialised to 100\,000.
Type: uint public
exchangeRates
¶
The contract address to obtain price information from.
It is necessary to know the current price of this Synth to work out whether it is below the purging threshold.
Type: ExchangeRates public
Functions¶
contructor
¶
Initialises the exchangeRates
address, and the inherited Synth
instance.
Details
Signature
constructor(address _proxy, TokenState _tokenState, Oikos _oikos, IFeePool _feePool, string _tokenName, string _tokenSymbol, address _owner, bytes32 _currencyKey, ExchangeRates _exchangeRates) public
Superconstructors
purge
¶
Allows the owner to liquidate all holders of this token back to oUSD
if the total value of this Synth is worth less than maxSupplyToPurgeInUSD
US dollars at current prices, or if the token is an inverse synth whose price is frozen.
If this is successfully invoked, balances in the provided list of addresses will be deleted, and an equivalent value of oUSD credited to their account.
Details
Signature
purge(address[] addresses) external
Modifiers
Preconditions
- Either:
- This Synth's total is less than the value of
maxSupplyToPurgeInUSD
priced in terms of this currency; or - This currency's price is frozen.
- This Synth's total is less than the value of
- This currency's price must not be stale.
Emits
Purged(holder, amountHeld)
for eachholder
inaddresses
. TheamountHeld
is theholder
's balance of this currency at the time of liquidation.
setExchangeRates
¶
Allows the owner to set the address of the exchange rates contract.
Details
Signature
setExchangeRates(ExchangeRates _exchangeRates)
Modifiers
Preconditions
- The caller must be the owner of this contract.
Events¶
Purged
¶
Records that a balance of this currency was liquidated back to oUSD
for a particular account.
This event is emitted from the Synth's proxy with the emitPurged
function.
Signature: Purged(address indexed account, uint value)