Building Games with Ethereum Smart Contracts by Kedar Iyer & Chris Dannen

Building Games with Ethereum Smart Contracts by Kedar Iyer & Chris Dannen

Author:Kedar Iyer & Chris Dannen
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


// Reset contract state

lastCreditorPayedOut = 0;

lastTimeOfNewCredit = block.timestamp;

profitFromCrash = 0;

creditorAddresses = new address[](0);

creditorAmounts = new uint[](0);

round += 1;

return false;

Listing 5-28Governmental Payout Code

The two lines in bold required updating a large amount of storage in the state tree. Hundreds of people had participated in the game, so hundreds of addresses and amounts had to be set to zero. The gas fee for this transaction was so high that it exceeded the block gas limit at the time, and the payout couldn’t be claimed by the winner . The winner had to wait for the block gas limit to increase before claiming the reward.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.