2018-10-24 12:52:11 +00:00
|
|
|
pragma solidity >=0.0;
|
2017-07-12 13:46:33 +00:00
|
|
|
import "../Tokens/StandardToken.sol";
|
|
|
|
|
|
|
|
|
|
|
|
/// @title Outcome token contract - Issuing and revoking outcome tokens
|
|
|
|
/// @author Stefan George - <stefan@gnosis.pm>
|
|
|
|
contract OutcomeToken is StandardToken {
|
|
|
|
using Math for *;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Events
|
|
|
|
*/
|
|
|
|
event Issuance(address indexed owner, uint amount);
|
|
|
|
event Revocation(address indexed owner, uint amount);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Storage
|
|
|
|
*/
|
|
|
|
address public eventContract;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Modifiers
|
|
|
|
*/
|
|
|
|
modifier isEventContract () {
|
|
|
|
// Only event contract is allowed to proceed
|
|
|
|
require(msg.sender == eventContract);
|
|
|
|
_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Public functions
|
|
|
|
*/
|
|
|
|
/// @dev Constructor sets events contract address
|
2018-06-25 13:02:20 +00:00
|
|
|
constructor()
|
2017-07-12 13:46:33 +00:00
|
|
|
{
|
|
|
|
eventContract = msg.sender;
|
|
|
|
}
|
2018-08-01 19:57:12 +00:00
|
|
|
|
2017-07-12 13:46:33 +00:00
|
|
|
/// @dev Events contract issues new tokens for address. Returns success
|
|
|
|
/// @param _for Address of receiver
|
|
|
|
/// @param outcomeTokenCount Number of tokens to issue
|
|
|
|
function issue(address _for, uint outcomeTokenCount)
|
|
|
|
public
|
|
|
|
isEventContract
|
|
|
|
{
|
|
|
|
balances[_for] = balances[_for].add(outcomeTokenCount);
|
|
|
|
totalTokens = totalTokens.add(outcomeTokenCount);
|
2018-06-27 08:35:38 +00:00
|
|
|
emit Issuance(_for, outcomeTokenCount);
|
2017-07-12 13:46:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// @dev Events contract revokes tokens for address. Returns success
|
|
|
|
/// @param _for Address of token holder
|
|
|
|
/// @param outcomeTokenCount Number of tokens to revoke
|
|
|
|
function revoke(address _for, uint outcomeTokenCount)
|
|
|
|
public
|
|
|
|
isEventContract
|
|
|
|
{
|
|
|
|
balances[_for] = balances[_for].sub(outcomeTokenCount);
|
|
|
|
totalTokens = totalTokens.sub(outcomeTokenCount);
|
2018-06-27 08:35:38 +00:00
|
|
|
emit Revocation(_for, outcomeTokenCount);
|
2017-07-12 13:46:33 +00:00
|
|
|
}
|
|
|
|
}
|