Jungle Freaks Motor Club Smart Contract
Setup
-
Install required packages
npm install
-
Grab a copy of the Massless Smart Contract Library
- In the smart-contract-library root (on your local system) (may need elevated user permissions)
npm link
- In this Jungle Freaks Motor Club Smart Contract root (smart-contract)
npm link @massless/smart-contract-library
- In the smart-contract-library root (on your local system) (may need elevated user permissions)
-
Setup the environment
cp .env.example .env
-
Compile
npm run compile
May need to restart VS Code for it to register the typechain files.
-
On VSCode extension store library Mocha Test Explorer.
You must restart VSCode after installing Mocha Test Explorer.
Testing
A lab flask icon will appear in the left most toolbar. From here you can run or debug the relevant test.
You can also get more information like gas fees and code coverage from running the test in the terminal.
- Test (optimized)
npm run test
- Test (un-optimized)
npm run testDebug
- Coverage
npm run coverage
Coverage will complain that the contract size is too big, ignore the message as this only relates to the coverage checker.
Compile
If you only require the compiled code (ABI and/or ByteCode) you can stand-alone compile.
npm run compile
The solidity compiled .json
file will be available at /artifacts/contracts/{ContractFilename}/{ContractName}.json
. This file includes the ABI and the ByteCode.
Proper gas cost testing
This is a gross method that priority was speed. You are welcome to improve the gasCost calculation method.
- rename the folder
test
totestBackup
- rename the folder
gasCostCalcTests
totest
- calculate costs
npm run gasCost
When you are finished
- rename the folder
test
togasCostCalcTests
- rename the folder
testBackup
totest
Remix
This can be used with the Remix IDE
Ensure you install remixd is globally, you'll need to restart your terminal for remixd available on path
.
npm install -g @remix-project/remixd@0.5.2
0.5.3 throws an error
- Launch remixd
npm run remixd
- Navigate to: remix.ethereum.org
- Start the local connection by clicking the
Workspaces Dropdown
and selecting- connect to localhost -