diff --git a/contracts/Exchanger.sol b/contracts/Exchanger.sol index b6ae2e371d..d13b4ad14f 100644 --- a/contracts/Exchanger.sol +++ b/contracts/Exchanger.sol @@ -559,12 +559,6 @@ contract Exchanger is Owned, MixinSystemSettings, IExchanger { systemStatus().suspendSynth(currencyKey, CIRCUIT_BREAKER_SUSPENSION_REASON); } - // SIP-78 - function setLastExchangeRateForSynth(bytes32 currencyKey, uint rate) external onlyExchangeRates { - require(rate > 0, "Rate must be above 0"); - lastExchangeRate[currencyKey] = rate; - } - // SIP-139 function resetLastExchangeRate(bytes32[] calldata currencyKeys) external onlyOwner { (uint[] memory rates, bool anyRateInvalid) = exchangeRates().ratesAndInvalidForCurrencies(currencyKeys); @@ -869,12 +863,6 @@ contract Exchanger is Owned, MixinSystemSettings, IExchanger { _; } - modifier onlyExchangeRates() { - IExchangeRates _exchangeRates = exchangeRates(); - require(msg.sender == address(_exchangeRates), "Restricted to ExchangeRates"); - _; - } - // ========== EVENTS ========== event ExchangeEntryAppended( address indexed account, diff --git a/contracts/PurgeableSynth.sol b/contracts/PurgeableSynth.sol index 12f16983a2..278d8d09a2 100644 --- a/contracts/PurgeableSynth.sol +++ b/contracts/PurgeableSynth.sol @@ -50,8 +50,8 @@ contract PurgeableSynth is Synth { uint maxSupplyToPurge = exRates.effectiveValue("sUSD", maxSupplyToPurgeInUSD, currencyKey); - // Only allow purge when total supply is lte the max or the rate is frozen in ExchangeRates - require(totalSupply <= maxSupplyToPurge, "Cannot purge as total supply is above threshold and rate is not frozen."); + // Only allow purge when total supply is lte the max + require(totalSupply <= maxSupplyToPurge, "Cannot purge as total supply is above threshol."); for (uint i = 0; i < addresses.length; i++) { address holder = addresses[i]; diff --git a/contracts/interfaces/IExchanger.sol b/contracts/interfaces/IExchanger.sol index 9e291bba6a..79dd6736b8 100644 --- a/contracts/interfaces/IExchanger.sol +++ b/contracts/interfaces/IExchanger.sol @@ -70,8 +70,6 @@ interface IExchanger { uint numEntries ); - function setLastExchangeRateForSynth(bytes32 currencyKey, uint rate) external; - function resetLastExchangeRate(bytes32[] calldata currencyKeys) external; function suspendSynthWithInvalidRate(bytes32 currencyKey) external; diff --git a/test/contracts/Exchanger.spec.js b/test/contracts/Exchanger.spec.js index ccf7044d53..518e3e61eb 100644 --- a/test/contracts/Exchanger.spec.js +++ b/test/contracts/Exchanger.spec.js @@ -2498,42 +2498,6 @@ contract('Exchanger (spec tests)', async accounts => { }); }; - const itSetsLastExchangeRateForSynth = () => { - describe('setLastExchangeRateForSynth() SIP-78', () => { - it('cannot be invoked by any user', async () => { - await onlyGivenAddressCanInvoke({ - fnc: exchanger.setLastExchangeRateForSynth, - args: [sEUR, toUnit('100')], - accounts, - reason: 'Restricted to ExchangeRates', - }); - }); - - describe('when ExchangeRates is spoofed using an account', () => { - beforeEach(async () => { - await resolver.importAddresses([toBytes32('ExchangeRates')], [account1], { - from: owner, - }); - await exchanger.rebuildCache(); - }); - it('reverts when invoked by ExchangeRates with a 0 rate', async () => { - await assert.revert( - exchanger.setLastExchangeRateForSynth(sEUR, '0', { from: account1 }), - 'Rate must be above 0' - ); - }); - describe('when invoked with a real rate by ExchangeRates', () => { - beforeEach(async () => { - await exchanger.setLastExchangeRateForSynth(sEUR, toUnit('1.9'), { from: account1 }); - }); - it('then lastExchangeRate is set for the synth', async () => { - assert.bnEqual(await exchanger.lastExchangeRate(sEUR), toUnit('1.9')); - }); - }); - }); - }); - }; - const itPricesSpikeDeviation = () => { describe('priceSpikeDeviation', () => { const baseRate = 100; @@ -3386,8 +3350,6 @@ contract('Exchanger (spec tests)', async accounts => { itExchangesWithVirtual(); - itSetsLastExchangeRateForSynth(); - itPricesSpikeDeviation(); itSetsExchangeFeeRateForSynths(); @@ -3484,8 +3446,6 @@ contract('Exchanger (spec tests)', async accounts => { itExchanges(); - itSetsLastExchangeRateForSynth(); - itPricesSpikeDeviation(); itSetsExchangeFeeRateForSynths(); diff --git a/test/contracts/ExchangerWithVirtualSynth.unit.js b/test/contracts/ExchangerWithVirtualSynth.unit.js index 0a8a74e4f0..dee6b45bd2 100644 --- a/test/contracts/ExchangerWithVirtualSynth.unit.js +++ b/test/contracts/ExchangerWithVirtualSynth.unit.js @@ -25,13 +25,7 @@ contract('ExchangerWithVirtualSynth (unit tests)', async accounts => { ensureOnlyExpectedMutativeFunctions({ abi: ExchangerWithVirtualSynth.abi, ignoreParents: ['Owned', 'MixinResolver'], - expected: [ - 'exchange', - 'resetLastExchangeRate', - 'settle', - 'suspendSynthWithInvalidRate', - 'setLastExchangeRateForSynth', - ], + expected: ['exchange', 'resetLastExchangeRate', 'settle', 'suspendSynthWithInvalidRate'], }); });