Merge pull request #269 from rstormsf/uint256

change uint to uint256
pull/268/merge
Manuel Aráoz 8 years ago committed by GitHub
commit 710f77dfe1
  1. 24
      contracts/DayLimit.sol
  2. 6
      contracts/LimitBalance.sol
  3. 14
      contracts/MultisigWallet.sol
  4. 14
      contracts/SafeMath.sol
  5. 4
      contracts/lifecycle/Migrations.sol
  6. 2
      contracts/lifecycle/TokenDestructible.sol
  7. 6
      contracts/ownership/DelayedClaimable.sol
  8. 4
      contracts/ownership/HasNoTokens.sol
  9. 10
      contracts/ownership/Multisig.sol
  10. 34
      contracts/ownership/Shareable.sol
  11. 10
      contracts/payment/PullPayment.sol
  12. 12
      contracts/token/BasicToken.sol
  13. 8
      contracts/token/CrowdsaleToken.sol
  14. 8
      contracts/token/ERC20.sol
  15. 8
      contracts/token/ERC20Basic.sol
  16. 6
      contracts/token/LimitedTransferToken.sol
  17. 4
      contracts/token/MintableToken.sol
  18. 4
      contracts/token/PausableToken.sol
  19. 4
      contracts/token/SimpleToken.sol
  20. 12
      contracts/token/StandardToken.sol
  21. 20
      contracts/token/VestedToken.sol

@ -7,24 +7,24 @@ pragma solidity ^0.4.11;
*/ */
contract DayLimit { contract DayLimit {
uint public dailyLimit; uint256 public dailyLimit;
uint public spentToday; uint256 public spentToday;
uint public lastDay; uint256 public lastDay;
/** /**
* @dev Constructor that sets the passed value as a dailyLimit. * @dev Constructor that sets the passed value as a dailyLimit.
* @param _limit Uint to represent the daily limit. * @param _limit uint256 to represent the daily limit.
*/ */
function DayLimit(uint _limit) { function DayLimit(uint256 _limit) {
dailyLimit = _limit; dailyLimit = _limit;
lastDay = today(); lastDay = today();
} }
/** /**
* @dev sets the daily limit. Does not alter the amount already spent today. * @dev sets the daily limit. Does not alter the amount already spent today.
* @param _newLimit Uint to represent the new limit. * @param _newLimit uint256 to represent the new limit.
*/ */
function _setDailyLimit(uint _newLimit) internal { function _setDailyLimit(uint256 _newLimit) internal {
dailyLimit = _newLimit; dailyLimit = _newLimit;
} }
@ -37,10 +37,10 @@ contract DayLimit {
/** /**
* @dev Checks to see if there is enough resource to spend today. If true, the resource may be expended. * @dev Checks to see if there is enough resource to spend today. If true, the resource may be expended.
* @param _value Uint representing the amount of resource to spend. * @param _value uint256 representing the amount of resource to spend.
* @return A boolean that is True if the resource was spended and false otherwise. * @return A boolean that is True if the resource was spended and false otherwise.
*/ */
function underLimit(uint _value) internal returns (bool) { function underLimit(uint256 _value) internal returns (bool) {
// reset the spend limit if we're on a different day to last time. // reset the spend limit if we're on a different day to last time.
if (today() > lastDay) { if (today() > lastDay) {
spentToday = 0; spentToday = 0;
@ -57,16 +57,16 @@ contract DayLimit {
/** /**
* @dev Private function to determine today's index * @dev Private function to determine today's index
* @return Uint of today's index. * @return uint256 of today's index.
*/ */
function today() private constant returns (uint) { function today() private constant returns (uint256) {
return now / 1 days; return now / 1 days;
} }
/** /**
* @dev Simple modifier for daily limit. * @dev Simple modifier for daily limit.
*/ */
modifier limitedDaily(uint _value) { modifier limitedDaily(uint256 _value) {
if (!underLimit(_value)) { if (!underLimit(_value)) {
throw; throw;
} }

@ -9,13 +9,13 @@ pragma solidity ^0.4.11;
*/ */
contract LimitBalance { contract LimitBalance {
uint public limit; uint256 public limit;
/** /**
* @dev Constructor that sets the passed value as a limit. * @dev Constructor that sets the passed value as a limit.
* @param _limit Uint to represent the limit. * @param _limit uint256 to represent the limit.
*/ */
function LimitBalance(uint _limit) { function LimitBalance(uint256 _limit) {
limit = _limit; limit = _limit;
} }

@ -16,7 +16,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
struct Transaction { struct Transaction {
address to; address to;
uint value; uint256 value;
bytes data; bytes data;
} }
@ -25,7 +25,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
* @param _owners A list of owners. * @param _owners A list of owners.
* @param _required The amount required for a transaction to be approved. * @param _required The amount required for a transaction to be approved.
*/ */
function MultisigWallet(address[] _owners, uint _required, uint _daylimit) function MultisigWallet(address[] _owners, uint256 _required, uint256 _daylimit)
Shareable(_owners, _required) Shareable(_owners, _required)
DayLimit(_daylimit) { } DayLimit(_daylimit) { }
@ -55,7 +55,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
* @param _value The value to send * @param _value The value to send
* @param _data The data part of the transaction * @param _data The data part of the transaction
*/ */
function execute(address _to, uint _value, bytes _data) external onlyOwner returns (bytes32 _r) { function execute(address _to, uint256 _value, bytes _data) external onlyOwner returns (bytes32 _r) {
// first, take the opportunity to check that we're under the daily limit. // first, take the opportunity to check that we're under the daily limit.
if (underLimit(_value)) { if (underLimit(_value)) {
SingleTransact(msg.sender, _value, _to, _data); SingleTransact(msg.sender, _value, _to, _data);
@ -93,9 +93,9 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
/** /**
* @dev Updates the daily limit value. * @dev Updates the daily limit value.
* @param _newLimit Uint to represent the new limit. * @param _newLimit uint256 to represent the new limit.
*/ */
function setDailyLimit(uint _newLimit) onlymanyowners(keccak256(msg.data)) external { function setDailyLimit(uint256 _newLimit) onlymanyowners(keccak256(msg.data)) external {
_setDailyLimit(_newLimit); _setDailyLimit(_newLimit);
} }
@ -112,8 +112,8 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
* @dev Clears the list of transactions pending approval. * @dev Clears the list of transactions pending approval.
*/ */
function clearPending() internal { function clearPending() internal {
uint length = pendingsIndex.length; uint256 length = pendingsIndex.length;
for (uint i = 0; i < length; ++i) { for (uint256 i = 0; i < length; ++i) {
delete txs[pendingsIndex[i]]; delete txs[pendingsIndex[i]];
} }
super.clearPending(); super.clearPending();

@ -5,26 +5,26 @@ pragma solidity ^0.4.11;
* Math operations with safety checks * Math operations with safety checks
*/ */
library SafeMath { library SafeMath {
function mul(uint a, uint b) internal returns (uint) { function mul(uint256 a, uint256 b) internal returns (uint256) {
uint c = a * b; uint256 c = a * b;
assert(a == 0 || c / a == b); assert(a == 0 || c / a == b);
return c; return c;
} }
function div(uint a, uint b) internal returns (uint) { function div(uint256 a, uint256 b) internal returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0 // assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b; uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold // assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c; return c;
} }
function sub(uint a, uint b) internal returns (uint) { function sub(uint256 a, uint256 b) internal returns (uint256) {
assert(b <= a); assert(b <= a);
return a - b; return a - b;
} }
function add(uint a, uint b) internal returns (uint) { function add(uint256 a, uint256 b) internal returns (uint256) {
uint c = a + b; uint256 c = a + b;
assert(c >= a); assert(c >= a);
return c; return c;
} }

@ -8,9 +8,9 @@ import '../ownership/Ownable.sol';
* @dev This is a truffle contract, needed for truffle integration, not meant for use by Zeppelin users. * @dev This is a truffle contract, needed for truffle integration, not meant for use by Zeppelin users.
*/ */
contract Migrations is Ownable { contract Migrations is Ownable {
uint public lastCompletedMigration; uint256 public lastCompletedMigration;
function setCompleted(uint completed) onlyOwner { function setCompleted(uint256 completed) onlyOwner {
lastCompletedMigration = completed; lastCompletedMigration = completed;
} }

@ -24,7 +24,7 @@ contract TokenDestructible is Ownable {
function destroy(address[] tokens) onlyOwner { function destroy(address[] tokens) onlyOwner {
// Transfer tokens to owner // Transfer tokens to owner
for(uint i = 0; i < tokens.length; i++) { for(uint256 i = 0; i < tokens.length; i++) {
ERC20Basic token = ERC20Basic(tokens[i]); ERC20Basic token = ERC20Basic(tokens[i]);
uint256 balance = token.balanceOf(this); uint256 balance = token.balanceOf(this);
token.transfer(owner, balance); token.transfer(owner, balance);

@ -11,8 +11,8 @@ import './Claimable.sol';
*/ */
contract DelayedClaimable is Claimable { contract DelayedClaimable is Claimable {
uint public end; uint256 public end;
uint public start; uint256 public start;
/** /**
* @dev Used to specify the time period during which a pending * @dev Used to specify the time period during which a pending
@ -20,7 +20,7 @@ contract DelayedClaimable is Claimable {
* @param _start The earliest time ownership can be claimed. * @param _start The earliest time ownership can be claimed.
* @param _end The latest time ownership can be claimed. * @param _end The latest time ownership can be claimed.
*/ */
function setLimits(uint _start, uint _end) onlyOwner { function setLimits(uint256 _start, uint256 _end) onlyOwner {
if (_start > _end) if (_start > _end)
throw; throw;
end = _end; end = _end;

@ -15,10 +15,10 @@ contract HasNoTokens is Ownable {
/** /**
* @dev Reject all ERC23 compatible tokens * @dev Reject all ERC23 compatible tokens
* @param from_ address The address that is transferring the tokens * @param from_ address The address that is transferring the tokens
* @param value_ Uint the amount of the specified token * @param value_ uint256 the amount of the specified token
* @param data_ Bytes The data passed from the caller. * @param data_ Bytes The data passed from the caller.
*/ */
function tokenFallback(address from_, uint value_, bytes data_) external { function tokenFallback(address from_, uint256 value_, bytes data_) external {
throw; throw;
} }

@ -10,19 +10,19 @@ contract Multisig {
// logged events: // logged events:
// Funds has arrived into the wallet (record how much). // Funds has arrived into the wallet (record how much).
event Deposit(address _from, uint value); event Deposit(address _from, uint256 value);
// Single transaction going out of the wallet (record who signed for it, how much, and to whom it's going). // Single transaction going out of the wallet (record who signed for it, how much, and to whom it's going).
event SingleTransact(address owner, uint value, address to, bytes data); event SingleTransact(address owner, uint256 value, address to, bytes data);
// Multi-sig transaction going out of the wallet (record who signed for it last, the operation hash, how much, and to whom it's going). // Multi-sig transaction going out of the wallet (record who signed for it last, the operation hash, how much, and to whom it's going).
event MultiTransact(address owner, bytes32 operation, uint value, address to, bytes data); event MultiTransact(address owner, bytes32 operation, uint256 value, address to, bytes data);
// Confirmation still needed for a transaction. // Confirmation still needed for a transaction.
event ConfirmationNeeded(bytes32 operation, address initiator, uint value, address to, bytes data); event ConfirmationNeeded(bytes32 operation, address initiator, uint256 value, address to, bytes data);
// FUNCTIONS // FUNCTIONS
// TODO: document // TODO: document
function changeOwner(address _from, address _to) external; function changeOwner(address _from, address _to) external;
function execute(address _to, uint _value, bytes _data) external returns (bytes32); function execute(address _to, uint256 _value, bytes _data) external returns (bytes32);
function confirm(bytes32 _h) returns (bool); function confirm(bytes32 _h) returns (bool);
} }

@ -11,18 +11,18 @@ contract Shareable {
// struct for the status of a pending operation. // struct for the status of a pending operation.
struct PendingState { struct PendingState {
uint yetNeeded; uint256 yetNeeded;
uint ownersDone; uint256 ownersDone;
uint index; uint256 index;
} }
// the number of owners that must confirm the same operation before it is run. // the number of owners that must confirm the same operation before it is run.
uint public required; uint256 public required;
// list of owners // list of owners
address[256] owners; address[256] owners;
// index on the list of owners to allow reverse lookup // index on the list of owners to allow reverse lookup
mapping(address => uint) ownerIndex; mapping(address => uint256) ownerIndex;
// the ongoing operations. // the ongoing operations.
mapping(bytes32 => PendingState) pendings; mapping(bytes32 => PendingState) pendings;
bytes32[] pendingsIndex; bytes32[] pendingsIndex;
@ -59,10 +59,10 @@ contract Shareable {
* @param _owners A list of owners. * @param _owners A list of owners.
* @param _required The amount required for a transaction to be approved. * @param _required The amount required for a transaction to be approved.
*/ */
function Shareable(address[] _owners, uint _required) { function Shareable(address[] _owners, uint256 _required) {
owners[1] = msg.sender; owners[1] = msg.sender;
ownerIndex[msg.sender] = 1; ownerIndex[msg.sender] = 1;
for (uint i = 0; i < _owners.length; ++i) { for (uint256 i = 0; i < _owners.length; ++i) {
owners[2 + i] = _owners[i]; owners[2 + i] = _owners[i];
ownerIndex[_owners[i]] = 2 + i; ownerIndex[_owners[i]] = 2 + i;
} }
@ -77,12 +77,12 @@ contract Shareable {
* @param _operation A string identifying the operation. * @param _operation A string identifying the operation.
*/ */
function revoke(bytes32 _operation) external { function revoke(bytes32 _operation) external {
uint index = ownerIndex[msg.sender]; uint256 index = ownerIndex[msg.sender];
// make sure they're an owner // make sure they're an owner
if (index == 0) { if (index == 0) {
return; return;
} }
uint ownerIndexBit = 2**index; uint256 ownerIndexBit = 2**index;
var pending = pendings[_operation]; var pending = pendings[_operation];
if (pending.ownersDone & ownerIndexBit > 0) { if (pending.ownersDone & ownerIndexBit > 0) {
pending.yetNeeded++; pending.yetNeeded++;
@ -93,10 +93,10 @@ contract Shareable {
/** /**
* @dev Gets an owner by 0-indexed position (using numOwners as the count) * @dev Gets an owner by 0-indexed position (using numOwners as the count)
* @param ownerIndex Uint The index of the owner * @param ownerIndex uint256 The index of the owner
* @return The address of the owner * @return The address of the owner
*/ */
function getOwner(uint ownerIndex) external constant returns (address) { function getOwner(uint256 ownerIndex) external constant returns (address) {
return address(owners[ownerIndex + 1]); return address(owners[ownerIndex + 1]);
} }
@ -117,7 +117,7 @@ contract Shareable {
*/ */
function hasConfirmed(bytes32 _operation, address _owner) constant returns (bool) { function hasConfirmed(bytes32 _operation, address _owner) constant returns (bool) {
var pending = pendings[_operation]; var pending = pendings[_operation];
uint index = ownerIndex[_owner]; uint256 index = ownerIndex[_owner];
// make sure they're an owner // make sure they're an owner
if (index == 0) { if (index == 0) {
@ -125,7 +125,7 @@ contract Shareable {
} }
// determine the bit to set for this owner. // determine the bit to set for this owner.
uint ownerIndexBit = 2**index; uint256 ownerIndexBit = 2**index;
return !(pending.ownersDone & ownerIndexBit == 0); return !(pending.ownersDone & ownerIndexBit == 0);
} }
@ -136,7 +136,7 @@ contract Shareable {
*/ */
function confirmAndCheck(bytes32 _operation) internal returns (bool) { function confirmAndCheck(bytes32 _operation) internal returns (bool) {
// determine what index the present sender is: // determine what index the present sender is:
uint index = ownerIndex[msg.sender]; uint256 index = ownerIndex[msg.sender];
// make sure they're an owner // make sure they're an owner
if (index == 0) { if (index == 0) {
throw; throw;
@ -153,7 +153,7 @@ contract Shareable {
pendingsIndex[pending.index] = _operation; pendingsIndex[pending.index] = _operation;
} }
// determine the bit to set for this owner. // determine the bit to set for this owner.
uint ownerIndexBit = 2**index; uint256 ownerIndexBit = 2**index;
// make sure we (the message sender) haven't confirmed this operation previously. // make sure we (the message sender) haven't confirmed this operation previously.
if (pending.ownersDone & ownerIndexBit == 0) { if (pending.ownersDone & ownerIndexBit == 0) {
Confirmation(msg.sender, _operation); Confirmation(msg.sender, _operation);
@ -177,8 +177,8 @@ contract Shareable {
* @dev Clear the pending list. * @dev Clear the pending list.
*/ */
function clearPending() internal { function clearPending() internal {
uint length = pendingsIndex.length; uint256 length = pendingsIndex.length;
for (uint i = 0; i < length; ++i) { for (uint256 i = 0; i < length; ++i) {
if (pendingsIndex[i] != 0) { if (pendingsIndex[i] != 0) {
delete pendings[pendingsIndex[i]]; delete pendings[pendingsIndex[i]];
} }

@ -10,17 +10,17 @@ import '../SafeMath.sol';
* contract and use asyncSend instead of send. * contract and use asyncSend instead of send.
*/ */
contract PullPayment { contract PullPayment {
using SafeMath for uint; using SafeMath for uint256;
mapping(address => uint) public payments; mapping(address => uint256) public payments;
uint public totalPayments; uint256 public totalPayments;
/** /**
* @dev Called by the payer to store the sent amount as credit to be pulled. * @dev Called by the payer to store the sent amount as credit to be pulled.
* @param dest The destination address of the funds. * @param dest The destination address of the funds.
* @param amount The amount to transfer. * @param amount The amount to transfer.
*/ */
function asyncSend(address dest, uint amount) internal { function asyncSend(address dest, uint256 amount) internal {
payments[dest] = payments[dest].add(amount); payments[dest] = payments[dest].add(amount);
totalPayments = totalPayments.add(amount); totalPayments = totalPayments.add(amount);
} }
@ -30,7 +30,7 @@ contract PullPayment {
*/ */
function withdrawPayments() { function withdrawPayments() {
address payee = msg.sender; address payee = msg.sender;
uint payment = payments[payee]; uint256 payment = payments[payee];
if (payment == 0) { if (payment == 0) {
throw; throw;

@ -10,14 +10,14 @@ import '../SafeMath.sol';
* @dev Basic version of StandardToken, with no allowances. * @dev Basic version of StandardToken, with no allowances.
*/ */
contract BasicToken is ERC20Basic { contract BasicToken is ERC20Basic {
using SafeMath for uint; using SafeMath for uint256;
mapping(address => uint) balances; mapping(address => uint256) balances;
/** /**
* @dev Fix for the ERC20 short address attack. * @dev Fix for the ERC20 short address attack.
*/ */
modifier onlyPayloadSize(uint size) { modifier onlyPayloadSize(uint256 size) {
if(msg.data.length < size + 4) { if(msg.data.length < size + 4) {
throw; throw;
} }
@ -29,7 +29,7 @@ contract BasicToken is ERC20Basic {
* @param _to The address to transfer to. * @param _to The address to transfer to.
* @param _value The amount to be transferred. * @param _value The amount to be transferred.
*/ */
function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) { function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) {
balances[msg.sender] = balances[msg.sender].sub(_value); balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value); balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value);
@ -38,9 +38,9 @@ contract BasicToken is ERC20Basic {
/** /**
* @dev Gets the balance of the specified address. * @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of. * @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address. * @return An uint256 representing the amount owned by the passed address.
*/ */
function balanceOf(address _owner) constant returns (uint balance) { function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner]; return balances[_owner];
} }

@ -15,13 +15,13 @@ contract CrowdsaleToken is StandardToken {
string public constant name = "CrowdsaleToken"; string public constant name = "CrowdsaleToken";
string public constant symbol = "CRW"; string public constant symbol = "CRW";
uint public constant decimals = 18; uint256 public constant decimals = 18;
// replace with your fund collection multisig address // replace with your fund collection multisig address
address public constant multisig = 0x0; address public constant multisig = 0x0;
// 1 ether = 500 example tokens // 1 ether = 500 example tokens
uint public constant PRICE = 500; uint256 public constant PRICE = 500;
/** /**
* @dev Fallback function which receives ether and sends the appropriate number of tokens to the * @dev Fallback function which receives ether and sends the appropriate number of tokens to the
@ -40,7 +40,7 @@ contract CrowdsaleToken is StandardToken {
throw; throw;
} }
uint tokens = msg.value.mul(getPrice()); uint256 tokens = msg.value.mul(getPrice());
totalSupply = totalSupply.add(tokens); totalSupply = totalSupply.add(tokens);
balances[recipient] = balances[recipient].add(tokens); balances[recipient] = balances[recipient].add(tokens);
@ -54,7 +54,7 @@ contract CrowdsaleToken is StandardToken {
* @dev replace this with any other price function * @dev replace this with any other price function
* @return The price per unit of token. * @return The price per unit of token.
*/ */
function getPrice() constant returns (uint result) { function getPrice() constant returns (uint256 result) {
return PRICE; return PRICE;
} }
} }

@ -9,8 +9,8 @@ import './ERC20Basic.sol';
* @dev see https://github.com/ethereum/EIPs/issues/20 * @dev see https://github.com/ethereum/EIPs/issues/20
*/ */
contract ERC20 is ERC20Basic { contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint); function allowance(address owner, address spender) constant returns (uint256);
function transferFrom(address from, address to, uint value); function transferFrom(address from, address to, uint256 value);
function approve(address spender, uint value); function approve(address spender, uint256 value);
event Approval(address indexed owner, address indexed spender, uint value); event Approval(address indexed owner, address indexed spender, uint256 value);
} }

@ -7,8 +7,8 @@ pragma solidity ^0.4.11;
* @dev see https://github.com/ethereum/EIPs/issues/20 * @dev see https://github.com/ethereum/EIPs/issues/20
*/ */
contract ERC20Basic { contract ERC20Basic {
uint public totalSupply; uint256 public totalSupply;
function balanceOf(address who) constant returns (uint); function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint value); function transfer(address to, uint256 value);
event Transfer(address indexed from, address indexed to, uint value); event Transfer(address indexed from, address indexed to, uint256 value);
} }

@ -22,7 +22,7 @@ contract LimitedTransferToken is ERC20 {
/** /**
* @dev Checks whether it can transfer or otherwise throws. * @dev Checks whether it can transfer or otherwise throws.
*/ */
modifier canTransfer(address _sender, uint _value) { modifier canTransfer(address _sender, uint256 _value) {
if (_value > transferableTokens(_sender, uint64(now))) throw; if (_value > transferableTokens(_sender, uint64(now))) throw;
_; _;
} }
@ -32,7 +32,7 @@ contract LimitedTransferToken is ERC20 {
* @param _to The address that will recieve the tokens. * @param _to The address that will recieve the tokens.
* @param _value The amount of tokens to be transferred. * @param _value The amount of tokens to be transferred.
*/ */
function transfer(address _to, uint _value) canTransfer(msg.sender, _value) { function transfer(address _to, uint256 _value) canTransfer(msg.sender, _value) {
super.transfer(_to, _value); super.transfer(_to, _value);
} }
@ -42,7 +42,7 @@ contract LimitedTransferToken is ERC20 {
* @param _to The address that will recieve the tokens. * @param _to The address that will recieve the tokens.
* @param _value The amount of tokens to be transferred. * @param _value The amount of tokens to be transferred.
*/ */
function transferFrom(address _from, address _to, uint _value) canTransfer(_from, _value) { function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value) {
super.transferFrom(_from, _to, _value); super.transferFrom(_from, _to, _value);
} }

@ -14,7 +14,7 @@ import '../ownership/Ownable.sol';
*/ */
contract MintableToken is StandardToken, Ownable { contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint amount); event Mint(address indexed to, uint256 amount);
event MintFinished(); event MintFinished();
bool public mintingFinished = false; bool public mintingFinished = false;
@ -31,7 +31,7 @@ contract MintableToken is StandardToken, Ownable {
* @param _amount The amount of tokens to mint. * @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful. * @return A boolean that indicates if the operation was successful.
*/ */
function mint(address _to, uint _amount) onlyOwner canMint returns (bool) { function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) {
totalSupply = totalSupply.add(_amount); totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount); balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount); Mint(_to, _amount);

@ -15,11 +15,11 @@ import '../lifecycle/Pausable.sol';
contract PausableToken is Pausable, StandardToken { contract PausableToken is Pausable, StandardToken {
function transfer(address _to, uint _value) whenNotPaused { function transfer(address _to, uint256 _value) whenNotPaused {
super.transfer(_to, _value); super.transfer(_to, _value);
} }
function transferFrom(address _from, address _to, uint _value) whenNotPaused { function transferFrom(address _from, address _to, uint256 _value) whenNotPaused {
super.transferFrom(_from, _to, _value); super.transferFrom(_from, _to, _value);
} }
} }

@ -14,8 +14,8 @@ contract SimpleToken is StandardToken {
string public name = "SimpleToken"; string public name = "SimpleToken";
string public symbol = "SIM"; string public symbol = "SIM";
uint public decimals = 18; uint256 public decimals = 18;
uint public INITIAL_SUPPLY = 10000; uint256 public INITIAL_SUPPLY = 10000;
/** /**
* @dev Contructor that gives msg.sender all of existing tokens. * @dev Contructor that gives msg.sender all of existing tokens.

@ -14,16 +14,16 @@ import './ERC20.sol';
*/ */
contract StandardToken is BasicToken, ERC20 { contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) allowed; mapping (address => mapping (address => uint256)) allowed;
/** /**
* @dev Transfer tokens from one address to another * @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from * @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to * @param _to address The address which you want to transfer to
* @param _value uint the amout of tokens to be transfered * @param _value uint256 the amout of tokens to be transfered
*/ */
function transferFrom(address _from, address _to, uint _value) onlyPayloadSize(3 * 32) { function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender]; var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
@ -40,7 +40,7 @@ contract StandardToken is BasicToken, ERC20 {
* @param _spender The address which will spend the funds. * @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent. * @param _value The amount of tokens to be spent.
*/ */
function approve(address _spender, uint _value) { function approve(address _spender, uint256 _value) {
// To change the approve amount you first have to reduce the addresses` // To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not // allowance to zero by calling `approve(_spender, 0)` if it is not
@ -56,9 +56,9 @@ contract StandardToken is BasicToken, ERC20 {
* @dev Function to check the amount of tokens than an owner allowed to a spender. * @dev Function to check the amount of tokens than an owner allowed to a spender.
* @param _owner address The address which owns the funds. * @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds. * @param _spender address The address which will spend the funds.
* @return A uint specifing the amount of tokens still avaible for the spender. * @return A uint256 specifing the amount of tokens still avaible for the spender.
*/ */
function allowance(address _owner, address _spender) constant returns (uint remaining) { function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender]; return allowed[_owner][_spender];
} }

@ -50,7 +50,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
if (tokenGrantsCount(_to) > MAX_GRANTS_PER_ADDRESS) throw; // To prevent a user being spammed and have his balance locked (out of gas attack when calculating vesting). if (tokenGrantsCount(_to) > MAX_GRANTS_PER_ADDRESS) throw; // To prevent a user being spammed and have his balance locked (out of gas attack when calculating vesting).
uint count = grants[_to].push( uint256 count = grants[_to].push(
TokenGrant( TokenGrant(
_revokable ? msg.sender : 0, // avoid storing an extra 20 bytes when it is non-revokable _revokable ? msg.sender : 0, // avoid storing an extra 20 bytes when it is non-revokable
_value, _value,
@ -72,7 +72,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
* @param _holder The address which will have its tokens revoked. * @param _holder The address which will have its tokens revoked.
* @param _grantId The id of the token grant. * @param _grantId The id of the token grant.
*/ */
function revokeTokenGrant(address _holder, uint _grantId) public { function revokeTokenGrant(address _holder, uint256 _grantId) public {
TokenGrant grant = grants[_holder][_grantId]; TokenGrant grant = grants[_holder][_grantId];
if (!grant.revokable) { // Check if grant was revokable if (!grant.revokable) { // Check if grant was revokable
@ -103,7 +103,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
* @dev Calculate the total amount of transferable tokens of a holder at a given time * @dev Calculate the total amount of transferable tokens of a holder at a given time
* @param holder address The address of the holder * @param holder address The address of the holder
* @param time uint64 The specific time. * @param time uint64 The specific time.
* @return An uint representing a holder's total amount of transferable tokens. * @return An uint256 representing a holder's total amount of transferable tokens.
*/ */
function transferableTokens(address holder, uint64 time) constant public returns (uint256) { function transferableTokens(address holder, uint64 time) constant public returns (uint256) {
uint256 grantIndex = tokenGrantsCount(holder); uint256 grantIndex = tokenGrantsCount(holder);
@ -127,9 +127,9 @@ contract VestedToken is StandardToken, LimitedTransferToken {
/** /**
* @dev Check the amount of grants that an address has. * @dev Check the amount of grants that an address has.
* @param _holder The holder of the grants. * @param _holder The holder of the grants.
* @return A uint representing the total amount of grants. * @return A uint256 representing the total amount of grants.
*/ */
function tokenGrantsCount(address _holder) constant returns (uint index) { function tokenGrantsCount(address _holder) constant returns (uint256 index) {
return grants[_holder].length; return grants[_holder].length;
} }
@ -140,7 +140,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
* @param start uint64 A time representing the begining of the grant * @param start uint64 A time representing the begining of the grant
* @param cliff uint64 The cliff period. * @param cliff uint64 The cliff period.
* @param vesting uint64 The vesting period. * @param vesting uint64 The vesting period.
* @return An uint representing the amount of vested tokensof a specif grant. * @return An uint256 representing the amount of vested tokensof a specif grant.
* transferableTokens * transferableTokens
* | _/-------- vestedTokens rect * | _/-------- vestedTokens rect
* | _/ * | _/
@ -191,7 +191,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
* @return Returns all the values that represent a TokenGrant(address, value, start, cliff, * @return Returns all the values that represent a TokenGrant(address, value, start, cliff,
* revokability, burnsOnRevoke, and vesting) plus the vested value at the current time. * revokability, burnsOnRevoke, and vesting) plus the vested value at the current time.
*/ */
function tokenGrant(address _holder, uint _grantId) constant returns (address granter, uint256 value, uint256 vested, uint64 start, uint64 cliff, uint64 vesting, bool revokable, bool burnsOnRevoke) { function tokenGrant(address _holder, uint256 _grantId) constant returns (address granter, uint256 value, uint256 vested, uint64 start, uint64 cliff, uint64 vesting, bool revokable, bool burnsOnRevoke) {
TokenGrant grant = grants[_holder][_grantId]; TokenGrant grant = grants[_holder][_grantId];
granter = grant.granter; granter = grant.granter;
@ -209,7 +209,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
* @dev Get the amount of vested tokens at a specific time. * @dev Get the amount of vested tokens at a specific time.
* @param grant TokenGrant The grant to be checked. * @param grant TokenGrant The grant to be checked.
* @param time The time to be checked * @param time The time to be checked
* @return An uint representing the amount of vested tokens of a specific grant at a specific time. * @return An uint256 representing the amount of vested tokens of a specific grant at a specific time.
*/ */
function vestedTokens(TokenGrant grant, uint64 time) private constant returns (uint256) { function vestedTokens(TokenGrant grant, uint64 time) private constant returns (uint256) {
return calculateVestedTokens( return calculateVestedTokens(
@ -225,7 +225,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
* @dev Calculate the amount of non vested tokens at a specific time. * @dev Calculate the amount of non vested tokens at a specific time.
* @param grant TokenGrant The grant to be checked. * @param grant TokenGrant The grant to be checked.
* @param time uint64 The time to be checked * @param time uint64 The time to be checked
* @return An uint representing the amount of non vested tokens of a specifc grant on the * @return An uint256 representing the amount of non vested tokens of a specifc grant on the
* passed time frame. * passed time frame.
*/ */
function nonVestedTokens(TokenGrant grant, uint64 time) private constant returns (uint256) { function nonVestedTokens(TokenGrant grant, uint64 time) private constant returns (uint256) {
@ -235,7 +235,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
/** /**
* @dev Calculate the date when the holder can trasfer all its tokens * @dev Calculate the date when the holder can trasfer all its tokens
* @param holder address The address of the holder * @param holder address The address of the holder
* @return An uint representing the date of the last transferable tokens. * @return An uint256 representing the date of the last transferable tokens.
*/ */
function lastTokenIsTransferableDate(address holder) constant public returns (uint64 date) { function lastTokenIsTransferableDate(address holder) constant public returns (uint64 date) {
date = uint64(now); date = uint64(now);

Loading…
Cancel
Save