# SIP-139: Allow owner to reset the decentralized circuit breaker pricing

Author Justin J Moses Implemented Governance Ethereum TBD TBD 2021-05-17

## Simple Summary

Add a protected function to reset the last price of an exchange for some synths.

## Abstract

Create a function in the Exchanger contract that can reset the Exchanger.lastExchangeRate(bytes32) for the given synths to their current market price. This function needs to be restricted to the owner as an attacker could call it if they see a large price spike and then trade into or out of that synth for profit.

## Motivation

There is currently an issue where when a synth has been suspended due to SIP-65 and if the new rate is legitimate (and not some fault of a faulty oracle or pricing mechanism) and remains at this new rate (rather than spiking and returning), then resuming a synth will likely result in it being suspended again next exchange and is effectively stuck - unless the price shifts significantly back towards when the last trade happened.

## Specification

### Overview

Add an additional function to Exchanger that resets the lastExchangeRate[currencyKey] to the latest rate from the ExchangeRates contract. It may only be called by the owner.

### Rationale

While it could be argued that the SystemStatus.resumeSynth() function be in charge of resetting this rate, the SystemStatus contract has been designed to not know the rest of the system, and is purely holding state. In addition, there's a function Exchanger.setLastExchangeRateForSynth() that only ExchangeRates can invoke, which could be exposed to the owner in ExchangeRates, however updating ExchangeRates involves a more complex deployment and is not preferable at this time.

### Technical Specification


interface IExchanger {

// Restricted to owner
function resetLastExchangeRate(bytes32[] calldata currencyKeys) external;

}


### Test Cases

• When resetLastExchangeRate is invoked by a non-owner, then it always reverts.
• When resetLastExchangeRate is invoked by an owner for bytes32[] currencyKeys, then for each currencyKey in the array, it updates lastExchangeRate[currencyKey] to ExchangeRates.rateForCurrency(currencyKey).

### Configurable Values (Via SCCP)

N/A

Copyright and related rights waived via CC0.