Merge pull request #17 from richard-ramos/feat/controlled

feat: make Discover controlled and able to update ceiling
This commit is contained in:
Andy Tudhope 2019-07-25 16:26:20 +02:00 committed by GitHub
commit 7b0505a531
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 1 deletions

View File

@ -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.