Commit e7933fce by Manuel Araoz

fix token style

parent 83acbbbb
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
// Everything throws instead of returning false on failure. // Everything throws instead of returning false on failure.
import 'ERC20.sol'; import 'ERC20.sol';
contract Token is ERC20 contract Token is ERC20 {
{
mapping( address => uint ) _balances; mapping( address => uint ) _balances;
mapping( address => mapping( address => uint ) ) _approvals; mapping( address => mapping( address => uint ) ) _approvals;
uint _supply; uint _supply;
...@@ -14,12 +14,15 @@ contract Token is ERC20 ...@@ -14,12 +14,15 @@ contract Token is ERC20
_balances[msg.sender] = initial_balance; _balances[msg.sender] = initial_balance;
_supply = initial_balance; _supply = initial_balance;
} }
function totalSupply() constant returns (uint supply) { function totalSupply() constant returns (uint supply) {
return _supply; return _supply;
} }
function balanceOf( address who ) constant returns (uint value) { function balanceOf( address who ) constant returns (uint value) {
return _balances[who]; return _balances[who];
} }
function transfer( address to, uint value) returns (bool ok) { function transfer( address to, uint value) returns (bool ok) {
if( _balances[msg.sender] < value ) { if( _balances[msg.sender] < value ) {
throw; throw;
...@@ -32,6 +35,7 @@ contract Token is ERC20 ...@@ -32,6 +35,7 @@ contract Token is ERC20
Transfer( msg.sender, to, value ); Transfer( msg.sender, to, value );
return true; return true;
} }
function transferFrom( address from, address to, uint value) returns (bool ok) { function transferFrom( address from, address to, uint value) returns (bool ok) {
// if you don't have enough balance, throw // if you don't have enough balance, throw
if( _balances[from] < value ) { if( _balances[from] < value ) {
...@@ -51,14 +55,17 @@ contract Token is ERC20 ...@@ -51,14 +55,17 @@ contract Token is ERC20
Transfer( from, to, value ); Transfer( from, to, value );
return true; return true;
} }
function approve(address spender, uint value) returns (bool ok) { function approve(address spender, uint value) returns (bool ok) {
_approvals[msg.sender][spender] = value; _approvals[msg.sender][spender] = value;
Approval( msg.sender, spender, value ); Approval( msg.sender, spender, value );
return true; return true;
} }
function allowance(address owner, address spender) constant returns (uint _allowance) { function allowance(address owner, address spender) constant returns (uint _allowance) {
return _approvals[owner][spender]; return _approvals[owner][spender];
} }
function safeToAdd(uint a, uint b) internal returns (bool) { function safeToAdd(uint a, uint b) internal returns (bool) {
return (a + b >= a); return (a + b >= a);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment