(Pictured above: You right now)

This is an open-book, open-Internet, open-everything except for messaging apps and talking final. You may not collaborate — any attempts to cheat will end poorly. Seriously, don’t do it. I’m not interested in filing any more SJACS forms. Grading is automated through GitHub Actions. What you see is what you get. No regrades are allowed.

Any clarification questions should be posted privately on Piazza. But please, post them early.

Submission guidelines: Push into the given template repository. Make sure you push often.

GitHub Classroom invite: https://classroom.github.com/a/kwjn1qUE

Deadline: Dec 8, 2022, 23:59 PST


Contract Implementation (40%)

Overview

You will implement a smart contract that powers an online shopping website.

This website sells items. Each item has their own name, image URL, description, inventory (items left), price (in ETH and membership points), and membership points gained per item purchased. Each item is looked up using their unique SKU.

As mentioned above, there is a membership system in place. With the purchase of every item, a certain amount of points are earned. Each user can later use their points balance to redeem items.

For the shop administrator, there are functions in place that allow them to add, disable, and edit items, as well as a dedicated restock function. They also need a way to withdraw Ether.

For shoppers, there is a function for them to purchase an item. No refunds are available.

Events are given in the interface and should be emitted at the appropriate time, per description.

Implementation

A commented interface is given. You must implement everything in accordance to the guidelines presented in the interface. Failure to closely follow instructions can possibly lead to test cases failing to run and thus receiving a zero. As grading is entirely automated and there are no regrades available, please just... follow instructions.

Clarifications

  1. For the sake of simplicity, price in membership points and membership points gained per item purchased will be the same number. This doesn’t make sense in real life, but here we are.