In this assignment, you will write unit and functional testing scripts in TypeScript. A complete Solidity contract will be given to you.

As with all assignments, don’t hesitate to Google, but do not copy verbatim or directly from your peers. Your code must compile and run to receive any credit.

Submission guidelines: Push frequently to your GitHub Classroom repository before due.

GitHub Classroom invite for HW5: https://classroom.github.com/a/wyzVCBlE

Deadline: Nov 15, 2022 16:00 PST


ComeFundMe (6%)

The given smart contract, ComeFundMe, is a fundraising platform on Ethereum. Anyone can start a new campaign and others can donate to it. The donated funds cannot be refunded. The initiator of the campaign can end the campaign and collect raised funds at any time.

1) Deploying to Göerli and Verifying (1%)

  1. Deploy ComeFundMe onto the Göerli test-net and verify it.
  2. Paste the link to your deployed contract on Göerli Etherscan into README.md.
    1. Make sure the source code is visible on Etherscan.

2) Bootstrapping the Testing Script (0%)

  1. Create a new TypeScript file under folder test, give it a relevant name and make sure it ends with .test.ts.
  2. Copy over lines 1 - 16 from HW4’s testing script.

3) Unit Tests (3%)

You must write at least 2 unit tests for every single Solidity function. Make sure you clearly group them by using describe.

4) Functional Tests (2%)

You must write 2 sets of functional tests. One test that walks through a fundraising process normally, the other test where you try to perform actions that shouldn’t be allowed and check if the smart contract stops you. At least 2 reverts should be triggered and caught.


Extra Credit (3% + ?%)