/girl-scout-cookies-contract

a smart contract built in Solidity to enable trustless sales of your favorite thin mints.

Primary LanguageSolidity

🍪 Girl Scout Cookies Smart Contract 🍪

For BUS 498 (Directed Topics in Information Systems - Blockchain) by Amy Ru (@ameru), Adam Watson (@apwats), and Shusei Yokoi (@Shusei25)

For our class project, we decided to build a smart contract for Girl Scouts to sell their famous Girl Scout Cookies.

Project Features

On top of the base trustless sales smart contract, here are the additional features we've implemented:

  • An inventory catalog to log unique item descriptors of each cookie box, such as their id tag, name, description, and quantity
  • Events which trigger notifications to a Girl Scout or shipment of a box of cookies
  • Set the default price of any box of Girl Scout cookies to 0.005 ETH
  • Created a cart-like function that keeps track of total number of boxes and price subtotal
  • Included time expiry to avoid sending out stale cookies

Deploying the Contract

This is the start screen containing your wallet and contract fields:

Start

Here are the results after the contract is created. This will cost you some ETH.

ResultsafterContractCreationShowingDecreaseinETH

This is the createCart object where you can create your Cart view:

CreateCartandContractView

Here is the status of the contract after you create your cart:

ResultsAfterCartCreation

This is the status of the contract when you confirm your purchase:

ConfirmPurchaseDemo

Perks of being the middleman, and the plight of being a girl scout - it seems as if the full value of the purchase wasn't issued to the cookie seller.

aftertheTransactionbutwechargedtoolittlesotheylostmoney

Contract status after confirmation is received:

after_confirmReceived_State3Locked

Test Cases for Errors

This is the error you will get when you try to access privileged activity without privileged access:

ErrorForPrivelegedActivity(confirmReceived)

This is the error you will get when the input for buyer and seller are the same:

BuyerCannotBeSellerERROR

This is the error you will get if you try to buy stale cookies:

StaleCookieERROR