You need:
- VS Code: a popular code editor that supports extensions
- the Solidity (Wake) extension for VS Code: it compiles the contracts and lets you deploy and call them
Open this folder in VS Code. Compiler 0.8.26.
contracts/LabLending.sol is finished. In the extension's Deploy & Interact panel:
- Deploy
LabLendingfrom the first account. That account is the admin. - Call
addStudentwith the second account's address, then add two items:addItem("Oscilloscope")andaddItem("Multimeter"). - Switch to the second account. Call
borrow(0, 60), thengetLoan(0): it returns two values. - Call
borrowBatch([1, 0], [60, 60]). It reverts, and item 1 is still available. - Wait a minute, send any transaction, then call
getOverdueItems().
Then break it on purpose:
- Borrow for 8 days (
691200seconds). Which error? - Borrow for 90 seconds. Why does that fail too?
- Return item 0 from the admin account.
- Call
addItemfrom the second account. - In
borrow, changeItem storage itemtoItem memory item. Redeploy, borrow, and read the item.
Fill in the functions marked TODO in contracts/Attendance.sol, one at a time.
To try it by hand, deploy it with 900 (a 15-minute session).
After each TODO, check it: open checks/AttendanceChecks.sol, deploy the check with the
TODO's number (Check1Enroll, Check2Sessions, Check3CheckIn, Check4Batch,
Check5Percent, or Check6AtRisk for the extra) and call run(). If it goes through,
the TODO works. If it reverts, the message says what to fix.
Redeploy the check after every change to Attendance.sol. A check can't see events
(no contract can), so look for your events in the transaction log yourself.
Part of ack3 education: hands-on material for NIE-BLO at FIT ČVUT, published by ack3. Contracts compile and deploy with Wake for VS Code.