Skip to content

Instantly share code, notes, and snippets.

Created July 27, 2023 00:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
* @title BreakerBox
* @notice The BreakerBox checks the criteria defined in separate breaker contracts
* to determine whether or not buying or selling should be allowed for a
* specified rateFeedIDs. The contract stores references to all breakers
* that hold criteria to be checked, rateFeedIDs that
* can make use of the BreakerBox & their current trading.
contract BreakerBox is IBreakerBox, Ownable {
using SafeMath for uint256;
/* ==================== State Variables ==================== */
address[] public rateFeedIDs;
// Maps a rate feed to a boolean indicating whether it has been added to the BreakerBox.
mapping(address => bool) public rateFeedStatus;
// Maps a rate feed to its breakers and their breaker status. (rateFeedID => (breaker => BreakerStatus)
mapping(address => mapping(address => BreakerStatus)) public rateFeedBreakerStatus;
// Maps a rate feed to the associated trading mode.
mapping(address => uint8) public rateFeedTradingMode;
// Maps a rate feed to its dependent rate feeds.
mapping(address => address[]) public rateFeedDependencies;
// Maps a breaker to the associated trading mode it should activate when triggered.
mapping(address => uint8) public breakerTradingMode;
// List of breakers to be checked.
address[] public breakers;
// Address of the Mento SortedOracles contract
ISortedOracles public sortedOracles;
// -- Code omitted for brevity -- //
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment