Home

Awesome

Clarigen demo - counter contract

This repo is an example usage of clarigen, a developer tool for interacting with Clarity smart contracts.

There are two examples provided:

simple-counter

One contract with public and read-only methods

Contract: ./contracts/simple-counter.clar Tests: ./tests/simple-counter.test.ts

counter-coin

Three separate contracts, which compose of the fungible token trait, the token contract, and the counter contract that interacts with the token.

Contracts:

Development

You can clone this repo to get a feel for using Clarigen and Clarity.

Install dependencies with yarn

Whenever you update a Clarity contract, run yarn clarigen, which will automatically generate type files in ./src/clarigen. You can also run yarn clarigen --watch to automatically generate types whenever you save a .clar file.

Run tests with yarn test or yarn test --watch