0

I did ethereum token for test in ropsten network, when i try buy some token, there is error in transaction: https://ropsten.etherscan.io/tx/0x14b75395c6db502172dc7e6fddda0fc4c319e4e9cbdbfa39ae4c16c68c99367f

Contract source is here - https://ropsten.etherscan.io/address/0x944d80528b1669119bfc635aea0f088f1697dc63#code

How fix it?

1 Answer 1

2

You sent 0.2 ether to this contract, but the contract code says:

// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
    revert();
}

The transaction was reverted because the contract does not accept ether.

6
  • thanks, but its not solve problem, i get same error in new contract without that part of code: ropsten.etherscan.io/tx/…
    – klvb
    Commented Mar 16, 2018 at 20:20
  • 1
    The default for a contract is to not accept ether. If you want the contract to accept ether, you need to write a payable function that doesn't revert. E.g. function () public payable { /* do something here */ }
    – user19510
    Commented Mar 16, 2018 at 20:21
  • can you send me what exactly add to code? I dont know. What exactly write to "do something here" to make it works?
    – klvb
    Commented Mar 17, 2018 at 18:04
  • I don't know what you want your code to do. You're the one writing it.
    – user19510
    Commented Mar 17, 2018 at 19:22
  • allright, i did new smart contract here: ropsten.etherscan.io/address/… I fixed here failed transactions. But what i need to do - when i send some ethereum, i want get some token. And how you can see, when i sent 0.2 ethereum i didnt get any token and tokens still have only owner.
    – klvb
    Commented Mar 17, 2018 at 19:33

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.