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