Open leochan007 opened 6 years ago
I'm currently facing the same issue, crowdsales execution terminate at the point tokenReward.transfer(msg.sender, amount / price);
it give me the following error
Are you able to work around it? Please help!
@samsoft00 i use open zepplin library. 1.7.0 version. allowancecrowdsale.
@samsoft00 create token first. create crowdsale. then u have to approve tokenwallet to crowdsale.
I think there are two more issues with the example.
Rounding: e.g. if I have an etherCostOfEachToken = 2
and I send 1 ether to the contract the contract takes the 1 ether as a donation and leaves me without any tokens.
The last person has to buy the exact amount of remaining tokens otherwise the contract will fail.
@leochan007 can you explain how to use the code you posted. On the example of the ethereum
homepage, I 1st create a token, 2nd I transfer all the tokens to the crowdSale contract's
address, 3rd buyers send ether to the crowdSale
contract, 4th after the deadline I need to call safeWithdrawal
How does this change with the allowance, does it solve the problems I mentioned above (I see it has a remainingTokens
function)? Many thx
function () payable { require(!crowdsaleClosed); uint amount = msg.value; balanceOf[msg.sender] += amount; amountRaised += amount; tokenReward.transfer(msg.sender, amount / price); FundTransfer(msg.sender, amount, true); }
is this correct for crowsale??
anyone who wanna buytoken may don't have token at all. how to transfer the token to himself?