0

Ethereum wallet displays:

It seems this transaction will fail.

But why? Here is the code:

function () payable {
    uint amount = 0;
    amount += msg.value;
    balanceOf[msg.sender] += amount;
    amountRaised += amount;
    tokenReward.transfer(msg.sender, amount / price);
    FundTransfer(msg.sender, amount, true);
}

This code doesn't throw exception or smth... Please help me. I get Crowdsale contract code from ethereum website

2
  • Could you share the actual code of the contract? You claim to have gotten it from ethereum.org/crowdsale, but the code I see there doesn't match the snippet you've pasted here.
    – user19510
    Sep 28, 2017 at 6:57
  • I think you'll also need to share the address of tokenReward.
    – user19510
    Sep 28, 2017 at 6:57

1 Answer 1

1

The obvious thing to look for would be whether tokenReward is correctly defined , and if it is whether it throws an error or uses too much gas when receiving funds.

To be sure we'd need to see the full contract, and the failing transaction.

2

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.