Demonstrates how to use and interact with "variables" in Clarity by incrementing a 32-bit unsigned integer and an additional Clarity function to retrieve the incremented value.
The counter.clar contract includes the following functionality.
count-up
function increments the designated "32-bit unsigned integer" for the account holder, and that value is wrapped inside thecounters
, which is declared as amap
data structure in Clarityget-count (...)
function retrieves the latest count from thecounters
map for a given account holder
To add a new contract, use Clarinet.
- You can manually test your your contracts in the Clarinet console.
- You can programmatically test your contracts with unit tests.