1

I am working on releasing a token on Eth and have been tinkering with some code to allow the token to be claimed via people sending 0 eth to the contract address.

So far I have managed to implement the airdrop function and set the details of the token etc.

What I am having problems with is the fact that when I execute the contract I am getting, for example, 3m tokens sent to the creation address (which is what I want) and a further 3m tokens which are sent to 0x00000000000000 - I do not know why I am seeing the second 3m being sent elsewhere.

When I try and counter this problem by generating more then I wish and burning the remaining supply the interaction fails (probably due to the number of tokens in supply etc) and I am struggling to address where the issue is.

I am a basic coder and have copied most of this contract and amended where I can this part just has me stuck.

I basically want a token which has a 28m total supply, 3m sent to the creator and 25m to be left for people to claim via the airdrop function.

as it is I have a total supply of 28m, 3m sent to the creator and 3m essentially vanishing upon creation which gives me a total supply of 25m although the contract states 28m total supply.

[
{
    "topic": "0x8940c4b8e215f8822c5c8f0056c12652c746cbc57eedbd2a440b175971d47a77",
    "event": "Distr",
    "args": [
        "fd2b03d644df375f96cda053790e013e12a621a2",
        "3000000000000000000000000"
    ]
},
{
    "topic": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
    "event": "Transfer",
    "args": [
        "0000000000000000000000000000000000000000",
        "fd2b03d644df375f96cda053790e013e12a621a2",
        "3000000000000000000000000"
    ]
}

This is the log which I get when I execute the contract in remix.solidity, my guess is the problem lies with either this:

    function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) {

    require(_to != address(0));
    require(_amount <= balances[msg.sender]);

    balances[msg.sender] = balances[msg.sender].sub(_amount);
    balances[_to] = balances[_to].add(_amount);
    Transfer(msg.sender, _to, _amount);
    return true;
}

This:

    function distr(address _to, uint256 _amount) canDistr private returns (bool) {
    totalDistributed = totalDistributed.add(_amount);
    totalRemaining = totalRemaining.sub(_amount);
    balances[_to] = balances[_to].add(_amount);
    Distr(_to, _amount);
    Transfer(address(0), _to, _amount);
    return true;

    if (totalDistributed >= totalSupply) {
        distributionFinished = true;
    }
}

or this:

    function distribution(address[] addresses, uint256 amount) onlyOwner canDistr public {

    require(addresses.length <= 255);
    require(amount <= totalRemaining);

    for (uint i = 0; i < addresses.length; i++) {
        require(amount <= totalRemaining);
        distr(addresses[i], amount);
    }

    if (totalDistributed >= totalSupply) {
        distributionFinished = true;
    }
}

If anyone needs more info please do let me know and I appreciate any help.

1

It is ok, I have managed to solve the issue by figuring out the burn function. It appeared that the burn function was failing due to the size of the number and the requirement of considerably large numbers to be put into quotation marks.

So, when burning the 3m tokens instead of activating the function by simply putting 3000000000000000000000000 I had to put "3000000000000000000000000"

Hope that this helps someone

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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