From 5eea131f1e7b886f01d48e5337c25d1f76847944 Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Fri, 14 Oct 2016 12:58:35 -0300 Subject: [PATCH] extract simpler version of Token into separate file --- contracts/Bounty.sol | 13 ++++++----- .../CrowdsaleToken.sol} | 10 +++++---- contracts/token/SimpleToken.sol | 22 +++++++++++++++++++ 3 files changed, 35 insertions(+), 10 deletions(-) rename contracts/{examples/ExampleToken.sol => token/CrowdsaleToken.sol} (77%) create mode 100644 contracts/token/SimpleToken.sol diff --git a/contracts/Bounty.sol b/contracts/Bounty.sol index 77e2e9e78..3f8bf8d4a 100644 --- a/contracts/Bounty.sol +++ b/contracts/Bounty.sol @@ -1,10 +1,10 @@ pragma solidity ^0.4.0; import './PullPayment.sol'; -import './examples/ExampleToken.sol'; +import './token/SimpleToken.sol'; /* * Bounty - * This bounty will pay out if you can cause a ExampleToken's balance + * This bounty will pay out if you can cause a SimpleToken's balance * to be lower than its totalSupply, which would mean that it doesn't * have sufficient ether for everyone to withdraw. */ @@ -17,16 +17,17 @@ contract Bounty is PullPayment { if (claimed) throw; } - function createTarget() returns(ExampleToken) { - ExampleToken target = new ExampleToken(); + function createTarget() returns(SimpleToken) { + SimpleToken target = new SimpleToken(); researchers[target] = msg.sender; return target; } - function claim(ExampleToken target) { + function claim(SimpleToken target) { address researcher = researchers[target]; if (researcher == 0) throw; - // check ExampleToken contract invariants + // Check SimpleToken contract invariants + // Customize this to the specifics of your contract if (target.totalSupply() == target.balance) { throw; } diff --git a/contracts/examples/ExampleToken.sol b/contracts/token/CrowdsaleToken.sol similarity index 77% rename from contracts/examples/ExampleToken.sol rename to contracts/token/CrowdsaleToken.sol index 3bdbbf6a2..7fd363cb0 100644 --- a/contracts/examples/ExampleToken.sol +++ b/contracts/token/CrowdsaleToken.sol @@ -2,15 +2,17 @@ pragma solidity ^0.4.0; import "../StandardToken.sol"; -contract ExampleToken is StandardToken { +/* + * Simple ERC20 Token example, with crowdsale token creation + */ +contract CrowdsaleToken is StandardToken { - string public name = "ExampleToken"; - string public symbol = "TOK"; + string public name = "CrowdsaleToken"; + string public symbol = "CRW"; uint public decimals = 18; // 1 ether = 500 example tokens uint PRICE = 500; - function () payable { createTokens(msg.sender); diff --git a/contracts/token/SimpleToken.sol b/contracts/token/SimpleToken.sol new file mode 100644 index 000000000..ccb34769f --- /dev/null +++ b/contracts/token/SimpleToken.sol @@ -0,0 +1,22 @@ +pragma solidity ^0.4.0; + +import "../StandardToken.sol"; + +/* + * Very simple ERC20 Token example, where all tokens are pre-assigned + * to the creator. Note they can later distribute these tokens + * as they wish using `transfer` and other `StandardToken` functions. + */ +contract SimpleToken is StandardToken { + + string public name = "SimpleToken"; + string public symbol = "SIM"; + uint public decimals = 18; + uint public INITIAL_SUPPLY = 10000; + + function SimpleToken() { + totalSupply = INITIAL_SUPPLY; + balances[msg.sender] = INITIAL_SUPPLY; + } + +}