0

I try to deploy my ERC20 token. My steps are:

1) I created a contact with Remix (by some manual) https://gist.github.com/pistol88/a934da7fcaa93a92f4c4de60df56a0cf

contract TestToken is ERC20Standard {
     constructor() public {
        totalSupply = 100000000;
        name = "Test Token";
        decimals = 6;
        symbol = "TST";
        version = "1.0";
        balances[msg.sender] = totalSupply;
    }
}

2) I compiled files without any problems (with 0.5.7 compiler)

3) I deployed contract to Ropsten Test Network without problems. https://ropsten.etherscan.io/tx/0x6f638935f8c5b37b2165efad2ad7947363d17f766d5d41a1f61c1f10207af8e7

4) So, now I see the different token in contract at the explorer https://ropsten.etherscan.io/address/0x09d7837e1b63d8820895399c55b4c25abeb29af0 (tab Contract): "contract NewToken is ERC20Standard {function FTT() private {"

5) I'm trying to send assets to another address. I see an error like this https://ropsten.etherscan.io/tx/0x04c52bc0465ec6b44426dbc0276f65d23555fd9a9507f8595be8551747aec4aa "Warning! Error encountered during contract execution [Reverted]"

My primary question is: why are contacts from Remix editor and explorer different?

My secondary question is: how can I find the description of transaction error? Remix says only "0x0 Transaction mined but execution failed" with "logs []"?

1

This is what I thought, Maybe when you compile the contract, the compiler not compiling the changes of your contract. That's why the contracts on remix and etherscan is different. And it looks like the deployed bytecode it similiar with other contracts, that's why the code tab is already verified. I try to redeploy your contract and succesfully verified the contract. https://ropsten.etherscan.io/address/0xc0760316fe4d9e946a71c9ed863c842e8b13cefe

Btw, I found a bug on your code. Your code do add and sub operation, but not changing the balances storage.

function transfer(address _recipient, uint _value) public onlyPayloadSize(2*32) {
    require(balances[msg.sender] >= _value && _value > 0);
    balances[msg.sender].sub(_value);
    balances[_recipient].add(_value);
    emit Transfer(msg.sender, _recipient, _value);        
    }

transfer function should be like: fixed version

I recommend you to use ERC20 abstract contract by OpenZeppelin. It's really helpful.

For the second question, I'm often facing the same problem. Sorry can't help with this.

  • Thank you! Very helpful answer. Tomorrow I'll try to clean my cookies, browser extensions, etc. Looks like there some local bug with my Remix. – Ilya Egorov Jul 16 at 18:58
0

It looks like, you don't have any tokens in your account, thus the transaction fails.

enter image description here

0

The reason why my contract was failing is... My inattention.

At the "Deploy & Run" plugin I have been choosing a wrong entry point file, not my contract.

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.