The Supply Chain directory is a truffle project that contains the required contract, migration and test files. In this exercise you are going to implement the SupplyChain.sol contract and write some tests in Solidity.
Clone this repo to your local machine.
The contract contains a framework and comments to implement the contract. Follow the comments outlined in SupplyChain.sol (in the contracts directory) to implement the contract. We have written a set of tests (in javascript) to determine if you implement the contract correctly. As an additional challenge, try writing some Solidity tests in TestSupplyChain.sol.
To test your implementation start your development blockchain by running $ truffle develop
from the terminal in the project directory. From the truffle console, compile and migrate the contracts by running compile
and migrate
. You can run the pre-written tests by running test
.
If your tests do not pass, modify the contract, recompile, redeploy and retest. Iterate until all of the tests pass.
Check out the testing files to see how tests are implemented in Javascript. We will go over the details of implementing tests later in the course.