smart-contracts
smart-contracts copied to clipboard
The underlying smart-contracts that power Critter
📜 Smart Contracts
The underlying smart-contracts that power Critter.
Requirements:
Start a local node
make node
Starts a local hardhat network
node and opens a JSON RPC port on localhost:8545
.
Start the CRTTR
console
make console
Deploys all Critter contracts to the local node, and opens a node.js repl to interact with them. Under the hood, it uses the ethers library to communicate with the deployed contracts, so its full API is available to use.
Additional objects include:
-
hh
: an instance of hardhat, including all available tasks. -
ahmed
,barbie
,carlos
,owner
: each returns an individual contract instance connected to the respective signer.- Each signer is given 10000 ETH.
- Each signer (except
owner
) has a Critter account created.
All public contract methods are available on these instances. For example:
🦔 <CRTTR>: await ahmed.createSqueak('hello blockchain!');
...
🦔 <CRTTR>: await ahmed.balanceOf(ahmed.signer.address); // BigNumber { value: "1" }
Run unit tests
make test
This also reports the gas costs for every contract function called.
Test coverage report
make coverage
Contract size report
make size