mirror of
https://github.com/status-im/contracts.git
synced 2025-02-23 12:08:47 +00:00
add stoppable capability
This commit is contained in:
parent
9b916795a8
commit
129d8c2edd
@ -1,21 +1,21 @@
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
import "../common/MessageSigned.sol";
|
||||
import "../common/Controlled.sol";
|
||||
|
||||
/**
|
||||
* @notice Defines tribute to talk
|
||||
*/
|
||||
contract MessageTribute is MessageSigned {
|
||||
contract MessageTribute is MessageSigned, Controlled {
|
||||
event SetTribute(address indexed account, uint256 value);
|
||||
|
||||
mapping(address => uint256) private tributeCatalog;
|
||||
bool public stopped;
|
||||
mapping(address => uint256) tributeCatalog;
|
||||
|
||||
/**
|
||||
* @notice Set tribute of account
|
||||
* @param _value Required tribute value
|
||||
*/
|
||||
function setTribute(uint256 _value) external {
|
||||
tributeCatalog[msg.sender] = _value;
|
||||
emit SetTribute(msg.sender, _value);
|
||||
setTribute(msg.sender, _value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -29,8 +29,14 @@ contract MessageTribute is MessageSigned {
|
||||
require(time < _ttl && _ttl-time < 1 days, "Invalid TTL");
|
||||
address signer = recoverAddress(getSignHash(hashTributeMessage(_value, _ttl)), _messageSignature);
|
||||
require(signer != address(0), "Invalid signer");
|
||||
tributeCatalog[signer] = _value;
|
||||
emit SetTribute(signer, _value);
|
||||
setTribute(signer, _value);
|
||||
|
||||
}
|
||||
/**
|
||||
* @notice Stops the contract of being able to change values.
|
||||
*/
|
||||
function setStopped(bool _stopped) external onlyController {
|
||||
stopped = _stopped;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,4 +59,10 @@ contract MessageTribute is MessageSigned {
|
||||
return keccak256(abi.encodePacked(address(this), _value, _ttl));
|
||||
}
|
||||
|
||||
function setTribute(address _of, uint256 _value) internal {
|
||||
require(!stopped, "Contract stopped by Controller");
|
||||
tributeCatalog[_of] = _value;
|
||||
emit SetTribute(_of, _value);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user