Maybe anyone could help me to solve this issue. I have a function which user has to invoke to claim his/her winnings. The transaction succeeds, however the user does not receive any ether from the contract. The boolean claimed[msg.sender] is set to true after his/her first tx, so it is not possible to call this function multiple times (preventing from multiple claims). The function is:

claimWinnings() {
require(!claimed[msg.sender]);

uint256 winnings = getWinnings(msg.sender);
claimed[msg.sender] = true;

Claim(msg.sender, winnings);
msg.sender.transfer(winnings);
}

Apr 8, 2018, 7:27 PM
Have Claim return bool then assign it to claimed map. Its also better to have claimed mapping to uint, to represent amount have withdrawn
Apr 9, 2018, 12:05 AM

© 2024 Draquery.com All rights reserved.