I'm paranoid about whether the following contract will work, and the only comments are about where I am paranoid; so, that's where the questions/paranoia really are.
This is essentially my one and only time I will ever use tokens/blockchain is this fundraiser/business-interacting token, and I do not want to use (insert software/service here; nor do I want enforced end to the fundraising period).

I have put in a bit of effort modifying this ConsenSys document and I really just want it to work (again, not interested in your software/service of choice). It's partially ego, and partially not possessing my json/utc anymore (which makes sense when you see I reference an intent to use a specific address):

(the pasting acted unexpectedly, so, I added the line)

pragma solidity ^0.4.21;

import "./EIP20Interface.sol";

contract ablockstoken is EIP20Interface {

    uint256 constant private MAX_UINT256 = 2**256 - 1;
    mapping (address => uint256) public balances;
    mapping (address => mapping (address => uint256)) public allowed;

    uint8 public decimals;      // I'm paranoid I did decimals wrong
    uint256 public totalSupply;
    string public name;                                   
    string public symbol;   

    uint price = 0.01 ether;            // and this is why
    string terms = 'Language explaining the terms of repurchasement at a later date';  

    function ablockstoken(      // faux name, I know.  Paranoia
        uint256 initialSupply,
        uint8 public decimals = 18, // and this is where I did the decimals
        string name,            // I think I've botched it
        string symbol
    ) public {

        totalSupply = initialSupply * 65536 ** uint256(decimals);  
        balanceOf[0xaddy] = totalSupply;// I mentioned in another post about my paranoia
        totalSupply = initialSupply;    // Also, remix gives an error for                    
        name = "ablockstoken";          // balanceOf regarding it being                  
        symbol = "abt";                 // undefined?

    function transfer(address _to, uint256 _value) public returns (bool success) {
        require(balances[msg.sender] >= _value);
        balances[msg.sender] -= _value;
        balances[_to] += _value;
        emit Transfer(msg.sender, _to, _value); 
        return true;

// Most of this is as ConsenSys had done it, the last four functions are different

    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
        uint256 allowance = allowed[_from][msg.sender];
        require(balances[_from] >= _value && allowance >= _value);
        balances[_to] += _value;
        balances[_from] -= _value;
        if (allowance < MAX_UINT256) {
            allowed[_from][msg.sender] -= _value;
        emit Transfer(_from, _to, _value); 
        return true;

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

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

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

    // terms mentioned at the start of contract; literal human language explanation

    function getTerms() constant returns(string) {
        return terms;

    // This was stolen from the programmingtheblockchain and should be good,
        // but does it work when added here?  Additionally, I may be confused
    // from some explanation on either ethereum.org or here, but...
    // does the token purchaser cover gas or do I need to cover it

    function withdraw() public {

    function deposit(uint256 amount) payable public {
        require(msg.value == amount);


    function getBalance() public view returns (uint256) {
        return address(this).balance;


You're not paranoid enough. I spotted multiple defects from just eyeballing it. Be responsible with other peoples' funds. If really is vital that you find people calibrate it to make it right. In most cases users deserve to the know your quality assurance process in detail.

The developer should be able to spot them, too. The code transmits the know-how of the team that built it.

Not the answer you wanted, but I hope it helps, even so,

| improve this answer | |
  • It's me and my family's business; I can't really afford other people. I was hoping it was better than multiple non-specific defects. – blc Aug 24 '18 at 4:00
  • Maybe consider rewording the question? "Audit" implies a thorough process and reputational risk. It sounds like you are on the verge of putting it on mainnet for the family business. I think you scared everyone away. On a practical basis, you can (and should consider) safely load the contract in Remix and iterate over it until it compiles, then use truffle to unit test it to confirm your functions do what the are supposed to do, and nothing they are not supposed to do. – Rob Hitchens Aug 24 '18 at 11:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.