aboutsummaryrefslogtreecommitdiffstats
path: root/test/compilationTests/zeppelin/token/MintableToken.sol
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-07-05 18:28:15 +0800
committerchriseth <chris@ethereum.org>2017-07-05 18:39:55 +0800
commitac84b36144f746662e5ddb984d283e053c7d06ba (patch)
treef50ee438a384e60574a4c28ea32d2b6ae2315795 /test/compilationTests/zeppelin/token/MintableToken.sol
parent05a26fc98c1201057c618c536ca0537e456c9b15 (diff)
downloaddexon-solidity-ac84b36144f746662e5ddb984d283e053c7d06ba.tar.gz
dexon-solidity-ac84b36144f746662e5ddb984d283e053c7d06ba.tar.zst
dexon-solidity-ac84b36144f746662e5ddb984d283e053c7d06ba.zip
Added various contracts for testing.
Diffstat (limited to 'test/compilationTests/zeppelin/token/MintableToken.sol')
-rw-r--r--test/compilationTests/zeppelin/token/MintableToken.sol50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/compilationTests/zeppelin/token/MintableToken.sol b/test/compilationTests/zeppelin/token/MintableToken.sol
new file mode 100644
index 00000000..505d13c3
--- /dev/null
+++ b/test/compilationTests/zeppelin/token/MintableToken.sol
@@ -0,0 +1,50 @@
+pragma solidity ^0.4.11;
+
+
+import './StandardToken.sol';
+import '../ownership/Ownable.sol';
+
+
+
+/**
+ * @title Mintable token
+ * @dev Simple ERC20 Token example, with mintable token creation
+ * @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
+ * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
+ */
+
+contract MintableToken is StandardToken, Ownable {
+ event Mint(address indexed to, uint256 amount);
+ event MintFinished();
+
+ bool public mintingFinished = false;
+
+
+ modifier canMint() {
+ if(mintingFinished) throw;
+ _;
+ }
+
+ /**
+ * @dev Function to mint tokens
+ * @param _to The address that will recieve the minted tokens.
+ * @param _amount The amount of tokens to mint.
+ * @return A boolean that indicates if the operation was successful.
+ */
+ function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) {
+ totalSupply = totalSupply.add(_amount);
+ balances[_to] = balances[_to].add(_amount);
+ Mint(_to, _amount);
+ return true;
+ }
+
+ /**
+ * @dev Function to stop minting new tokens.
+ * @return True if the operation was successful.
+ */
+ function finishMinting() onlyOwner returns (bool) {
+ mintingFinished = true;
+ MintFinished();
+ return true;
+ }
+}