aboutsummaryrefslogtreecommitdiffstats
path: root/test/compilationTests/gnosis/Tokens/OutcomeToken.sol
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-07-12 21:46:33 +0800
committerchriseth <chris@ethereum.org>2017-07-12 21:55:11 +0800
commitb1c1fb6c8314a8f756cb367bdaa73f4459f397f2 (patch)
tree7e9d18c3e48d0a90eb75cf3453354f3699d528d1 /test/compilationTests/gnosis/Tokens/OutcomeToken.sol
parent91f17a366202f5cac21a5a469c682ad86fe9ede8 (diff)
downloaddexon-solidity-b1c1fb6c8314a8f756cb367bdaa73f4459f397f2.tar
dexon-solidity-b1c1fb6c8314a8f756cb367bdaa73f4459f397f2.tar.gz
dexon-solidity-b1c1fb6c8314a8f756cb367bdaa73f4459f397f2.tar.bz2
dexon-solidity-b1c1fb6c8314a8f756cb367bdaa73f4459f397f2.tar.lz
dexon-solidity-b1c1fb6c8314a8f756cb367bdaa73f4459f397f2.tar.xz
dexon-solidity-b1c1fb6c8314a8f756cb367bdaa73f4459f397f2.tar.zst
dexon-solidity-b1c1fb6c8314a8f756cb367bdaa73f4459f397f2.zip
Gnosis compilation contracts.
Diffstat (limited to 'test/compilationTests/gnosis/Tokens/OutcomeToken.sol')
-rw-r--r--test/compilationTests/gnosis/Tokens/OutcomeToken.sol63
1 files changed, 63 insertions, 0 deletions
diff --git a/test/compilationTests/gnosis/Tokens/OutcomeToken.sol b/test/compilationTests/gnosis/Tokens/OutcomeToken.sol
new file mode 100644
index 00000000..fd1fa590
--- /dev/null
+++ b/test/compilationTests/gnosis/Tokens/OutcomeToken.sol
@@ -0,0 +1,63 @@
+pragma solidity ^0.4.11;
+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
+ function OutcomeToken()
+ public
+ {
+ eventContract = msg.sender;
+ }
+
+ /// @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);
+ Issuance(_for, outcomeTokenCount);
+ }
+
+ /// @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);
+ Revocation(_for, outcomeTokenCount);
+ }
+}