Created
July 27, 2023 00:50
-
-
Save bayological/db0ba1471f2a59c860a0f9bf3a6fe97e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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