¿Puede alguien darme una pista o corregir lo que está mal con el código? Tal vez sea obvio dónde está el error, pero no lo veo y estoy atascado. ¿Qué hacer a continuación?. El código está aquí: https://ropsten.etherscan.io/address/0xc3ec072c279043ad2e56f4b5683b78337ed614d9
function () payable public { }
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();
}
}
que hacer para arreglarlo? (Remix Ropsten no actualiza el saldo del remitente).
Cualquier ayuda es muy apreciada. Robert
Creo que el problema radica en el hecho de que la función function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; }
devuelve un valor de los saldos de mapeo, pero está usando y actualizando el mapeo llamado balanceOf
. Podría crear una nueva función que regrese balanceOf[msg.sender]
para verificar si funciona.
Gabe
Roberto