ETH Price: $3,834.62 (+5.46%)

Contract Diff Checker

Contract Name:
PitchToken

Contract Source Code:

File 1 of 1 : PitchToken

pragma solidity ^0.4.4;

pragma solidity ^0.4.4;


/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {

  /**
  * @dev Multiplies two numbers, throws on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    if (a == 0) {
      return 0;
    }
    uint256 c = a * b;
    assert(c / a == b);
    return c;
  }

  /**
  * @dev Integer division of two numbers, truncating the quotient.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return c;
  }

  /**
  * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    assert(b <= a);
    return a - b;
  }

  /**
  * @dev Adds two numbers, throws on overflow.
  */
  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}



contract PitchToken {
    using SafeMath for uint256;

    address public owner;
    mapping (address => uint256) balances;
    mapping (address => mapping (address => uint256)) allowed;

    uint256 public totalSupply;
    bool private saleComplete;

    string public name;
    uint8 public decimals;
    string public symbol;
    string public version = "H1.0";

    function PitchToken() public {
        name = "PITCH";
        symbol = "PITCH";

        decimals = 9;
        totalSupply = (1618000000 * (10**uint(decimals)));

        owner = msg.sender;
        balances[msg.sender] = totalSupply;

        saleComplete = false;
        Transfer(address(0), msg.sender, totalSupply);
    }

    modifier isOwner() {
        require(msg.sender == owner);
        _;
    }

    function balanceOf(address _owner) public constant returns (uint256 balance) {
        return balances[_owner];
    }

    function approve(address _spender, uint256 _value) public returns (bool success) {
        require(msg.sender == owner || saleComplete);
        
        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    }

    function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
        return allowed[_owner][_spender];
    }

    function transfer(address _to, uint256 _value) public returns (bool) {
        require(_to != address(0));
        require(_value <= balances[msg.sender]);
        require(msg.sender == owner || saleComplete);

        balances[msg.sender] = balances[msg.sender].sub(_value);
        balances[_to] = balances[_to].add(_value);

        Transfer(msg.sender, _to, _value);

        return true;
    }

    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
        require(_to != address(0));
        require(_value <= balances[_from] && _value <= allowed[_from][msg.sender]);

        allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
        balances[_from] = balances[_from].sub(_value);
        balances[_to] = balances[_to].add(_value);

        Transfer(_from, _to, _value);

        return true;
    }

    function isSaleComplete() view public returns (bool complete) {
        return saleComplete;
    }

    function completeSale() public returns (bool complete) {
        if (msg.sender != owner) {
            return false;
        }

        saleComplete = true;
        return saleComplete;
    }

    function () public {
        //if ether is sent to this address, send it back.
        revert();
    }

    event Transfer(address indexed from, address indexed to, uint tokens);
    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}

Please enter a contract address above to load the contract details and source code.

Context size (optional):