ahashim / smart-contracts

The underlying smart-contracts that power Critter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

📜 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

About

The underlying smart-contracts that power Critter

License:Apache License 2.0


Languages

Language:TypeScript 58.7%Language:Solidity 25.7%Language:JavaScript 15.1%Language:Makefile 0.3%Language:Dockerfile 0.1%Language:Shell 0.0%