1

I am using the MyAdvancedToken code from: https://www.ethereum.org/token

I transferred tokens from owner account into the contract, to fund any buy(). Now, I want those tokens back. Is there any way to transfer them, except for sell()? Because of decimals issue, I could never buy that many tokens back.

I have seen similar questions, but I thought I could use transferFrom(), and enter the contract address in the _from field. However, that seems to fail:

function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
        require(_value <= allowance[_from][msg.sender]);     // Check allowance
        allowance[_from][msg.sender] -= _value;
        _transfer(_from, _to, _value);
        return true;
    }

Is there a way to do an allowance to get this to work? And why can't the contract address send the tokens using transferFrom? Thanks.

1 Answer 1

0

You can't get allowance to work because only address that have tokens can give allowance to transfer them, in your situation its contract address. From the same reason transferFrom won't work, it only will work if you have allowance to transfer needed amount of tokens.

However i think you still can use sell in case you have access to owner address. First you could use setPrices function to set sell price to 0, then you would be able to to buy any amount of coins you need, and return price back if you want. Or you could just use mintToken function to create tokens for your address.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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