I'm using Ropsten Testnet and Remix.
Is there an obvious error in this code? Why does not he accept eth.
function () payable public { buy(); }
function buy () payable public whenNotPaused beforeDeadline afterStartTime saleNotClosed {
require(msg.value >= minContribution);
// Update the sender's balance of wei contributed and the amount raised
uint amount = msg.value;
uint currentBalance = balanceOf[msg.sender];
balanceOf[msg.sender] = currentBalance.add(amount);
amountRaised = amountRaised.add(amount);
// Compute the number of tokens to be rewarded to the sender
// Note: it's important for this calculation that both wei
// and PDT have the same number of decimal places (18)
uint numTokens = amount.mul(rate);
// Transfer the tokens from the crowdsale supply to the sender
if (tokenReward.transferFrom(tokenReward.owner(), msg.sender, numTokens)) {
FundTransfer(msg.sender, amount, true);
// Check if the funding goal or cap have been reached
// TODO check impact on gas cost
checkFundingGoal();
checkFundingCap();
}
else {
revert();
}
}
The Crowdsale contract has an allowance. The gas limit has been increased in many ways. My ether wallet warning !
The full code is here: https://ropsten.etherscan.io/address/0x500c3ff2c1a561cd0fda1cf0c77fe0d17af5fda5
What I'm missing here?. Thank you in advance for your answer. The last question was unanswered, so I ask again !