Weigh the gas of Pasar Kepeng's coin on a local chain: balances, receipts, events, approve, rollups. 14 levels, right in the browser.
What the levels ask
Every stall has a kepeng board on its phone that shows its kepeng balance, and the board is opened three times a morning: morning, midday, closing. Fill saldoLapak so every board shows the right kepeng balance, and opening a board sends no transaction at all.
Mrs. Ijah just opened her peanut salad stall. The teacher pays 3 kepeng for peanut salad and Bagas 1.5 kepeng for a palm-sugar iced drink, from the pay page on their phones. Fill the amount the pay page sends and the way the board shows the balance, so Mrs. Ijah really receives 4.5 kepeng and her board says 4.5.
Order number 7 is boxed rice at Mrs. Ijah’s stall. The neighbourhood head and the teacher both think they have to pay it, in the same second, and the contract only takes one. Fill the pay page so the phone whose transaction went through says Lunas, and the phone whose transaction reverted says Gagal.
The loket laptop sends Rara’s (10) and Bagas’s (5) exchanged kepeng from one account, at once. Bagas has to go first because his minibus is leaving. Fill the sending account and the order of the sends so both arrive, and Bagas’s send enters the block first.
Order number 9 was paid by the neighbourhood head at eight. At half past nine the teacher tries to pay it too. Fill the refusal in bayarPesanan so the second payment is refused, and the teacher’s phone can say Sudah dibayar Pak RT (already paid by the neighbourhood head).
Six people change rupiah at the loket. Each tukar checks the committee and reads the rate, and the committee caps each exchange at 57,000 gas (the red line on the scale). Fill the kinds of the panitia and kurs variables so the contract compiles, the rate is still set when the contract is deployed, and each exchange is under the limit.
Four new stalls register in the PasarKepeng contract: the owner, the rent, and takings that start at zero. Each registration may use 50,000 gas at most. Fill the two Lapak fields so it compiles, each stall’s phone shows the right rent, and each registration is under the limit.
Mrs. Lastri wants to see today’s sales history on her phone. Nine sales, a block a sale, and each bayar may use 60,000 gas at most. Fill how the contract records a sale and how the page reads it, so every stall’s history is complete and paying stays under the limit.
A busy Sunday: 120 sales at six stalls. The market node gives 50 logs a request at most, and the history page asks for the logs whose lapak is its own stall. Fill the Terjual event declaration so each stall’s phone can say how many sales it made.
The Best-Selling Stall prize: 10 kepeng for the stall with the most sales today, picked by the HadiahLapak contract through pilih(). Fill the line in bayar so pilih() names the stall that sold most often.
In the evening the stalls change their kepeng back to rupiah at the loket. The LoketTukar contract pulls kepeng with transferFrom, then records the rupiah. Mrs. Sari changes 20 kepeng, Mr. Tono 12. Fill the line before the deposit so the rupiah is recorded right, and afterwards the loket can pull none of their kepeng.
Every recorded visitor gets one kepeng when the market closes. Mr. Aris rehearses with 10 visitors, then 100, then the expected crowd on the day: 1,000, each time on a fresh chain. Fill tutupHari so that in all three rehearsals every visitor gets the prize.