Skip to content

Commit

Permalink
Added a decimal point to the token contract.
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Apr 20, 2017
1 parent 51555b7 commit 1cfc010
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
7 changes: 4 additions & 3 deletions contracts/CrowdsaleToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@ contract CrowdsaleToken is ReleasableToken, MintableToken, UpgradeableToken {

string public symbol;

/** We don't want to support decimal places as it's not very well handled by different wallets */
uint public decimals = 0;
uint public decimals;

/**
* Construct the token.
*
* This token must be created through a team multisig wallet, so that it is owned by that wallet.
*/
function CrowdsaleToken(string _name, string _symbol, uint _initialSupply) {
function CrowdsaleToken(string _name, string _symbol, uint _initialSupply, uint _decimals) {

// Create from team multisig
owner = msg.sender;
Expand All @@ -45,6 +44,8 @@ contract CrowdsaleToken is ReleasableToken, MintableToken, UpgradeableToken {

totalSupply = _initialSupply;

decimals = _decimals;

// Create initially all balance on the team multisig
balances[msg.sender] = totalSupply;
}
Expand Down
1 change: 1 addition & 0 deletions crowdsales/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ unit_test:
_name: Example-testnet
_symbol: EXA
_initialSupply: 0
_decimals: 0
#
# Pricing strategy
#
Expand Down
11 changes: 6 additions & 5 deletions ico/cmd/deploytoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
@click.option('--address', nargs=1, help='Address to deploy from and who becomes as a owner (must exist on geth)', required=True)
@click.option('--release-agent', nargs=1, help='Address that acts as a release agent (can be same as owner)', default=None)
@click.option('--minting-agent', nargs=1, help='Address that acts as a minting agent (can be same as owner)', default=None)
@click.option('--name', nargs=1, required=True, help='How many days presale is frozen for', type=str)
@click.option('--symbol', nargs=1, required=True, help='What is the minimum pre-ico buy in (ether)', type=str)
@click.option('--supply', nargs=1, default=21000000, help='What is the minimum pre-ico buy in (ether)', type=int)
def main(chain, address, name, symbol, supply, minting_agent, release_agent):
@click.option('--name', nargs=1, required=True, help='Token name', type=str)
@click.option('--symbol', nargs=1, required=True, help='Token symbol', type=str)
@click.option('--supply', nargs=1, default=21000000, help='What is the initial token supply', type=int)
@click.option('--decimals', nargs=1, default=0, help='How many decimal points the token has', type=int)
def main(chain, address, name, symbol, supply, decimals, minting_agent, release_agent):
"""Deploy a CrowdsaleToken contract.
Example:
Expand All @@ -45,7 +46,7 @@ def main(chain, address, name, symbol, supply, minting_agent, release_agent):
request_account_unlock(c, address, None)

transaction = {"from": address}
args = [name, symbol, supply]
args = [name, symbol, supply, decimals]

# This does deployment with all dependencies linked in

Expand Down
2 changes: 2 additions & 0 deletions ico/cmd/rebuildcrowdsale.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def main(chain, address, name, symbol, supply, minting_agent, release_agent):
"""

raise NotImplementedError()

project = Project()

with project.get_chain(chain) as c:
Expand Down
2 changes: 1 addition & 1 deletion ico/tests/contracts/test_relaunch_with_new_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def token(empty_token):
def new_token(chain, team_multisig, token_name, token_symbol) -> Contract:
"""Get another token contract with 0 initial issuance."""

args = [token_name, token_symbol, 0] # Owner set
args = [token_name, token_symbol, 0, 0] # Owner set

tx = {
"from": team_multisig
Expand Down
4 changes: 2 additions & 2 deletions ico/tests/fixtures/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def token_owner(beneficiary):
def token(chain, team_multisig, token_name, token_symbol, initial_supply) -> Contract:
"""Create the token contract."""

args = [token_name, token_symbol, initial_supply] # Owner set
args = [token_name, token_symbol, initial_supply, 0] # Owner set

tx = {
"from": team_multisig
Expand All @@ -86,7 +86,7 @@ def token(chain, team_multisig, token_name, token_symbol, initial_supply) -> Con
def empty_token(chain, team_multisig, token_name, token_symbol) -> Contract:
"""Create the token contract without initial supply."""

args = [token_name, token_symbol, 0] # Owner set
args = [token_name, token_symbol, 0, 0] # Owner set

tx = {
"from": team_multisig
Expand Down

0 comments on commit 1cfc010

Please sign in to comment.