From 2ac676594dd20c18974beff12058e4ca6258aeb4 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Wed, 24 Jul 2019 08:30:42 -0400 Subject: [PATCH] feat: make Discover controlled and able to update ceiling --- contracts/Discover.sol | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/contracts/Discover.sol b/contracts/Discover.sol index c3cbdcb..0417aea 100644 --- a/contracts/Discover.sol +++ b/contracts/Discover.sol @@ -4,9 +4,10 @@ import "./token/MiniMeTokenInterface.sol"; import "./token/ApproveAndCallFallBack.sol"; import "./utils/SafeMath.sol"; import "./utils/BancorFormula.sol"; +import "./common/Controlled.sol"; -contract Discover is ApproveAndCallFallBack, BancorFormula { +contract Discover is Controlled, ApproveAndCallFallBack, BancorFormula { using SafeMath for uint; // Could be any MiniMe token @@ -49,6 +50,8 @@ contract Discover is ApproveAndCallFallBack, BancorFormula { event Downvote(bytes32 indexed id, uint newEffectiveBalance); event Withdraw(bytes32 indexed id, uint newEffectiveBalance); event MetadataUpdated(bytes32 indexed id); + event CeilingUpdated(uint oldCeiling, uint newCeiling); + constructor(MiniMeTokenInterface _SNT) public { SNT = _SNT; @@ -64,6 +67,18 @@ contract Discover is ApproveAndCallFallBack, BancorFormula { safeMax = uint(77).mul(max).div(100); // Limited by accuracy of BancorFormula } + /** + * @dev Update ceiling + * @param _newCeiling New ceiling value + */ + function setCeiling(uint _newCeiling) external onlyController { + emit CeilingUpdated(ceiling, _newCeiling); + + ceiling = _newCeiling; + max = total.mul(ceiling).div(decimals); + safeMax = uint(77).mul(max).div(100); + } + /** * @dev Anyone can create a DApp (i.e an arb piece of data this contract happens to care about). * @param _id bytes32 unique identifier.