Cron.Cat CosmWasm Contracts
The "crontracts" for cosmwasm runtime of croncat service
1.0.0
CronCat helps you automate your favorite DeFi apps, NFTs, wallets, DAOs and cat naps. It brings "if this, then that" to blockchains.
This codebase covers the CosmWasm implementation and is deployed to several testnet and mainnet chains. For more details on the active networks, see the deployed contracts.
Website: https://cron.cat
Testnet website: https://testnet.cron.cat
Documentation: https://docs.cron.cat/docs
CronCat Agent daemon: https://github.com/CronCats/croncat-rs
Security audit: https://github.com/oak-security/audit-reports/tree/master/CronCat
Leverage CronCat automation in you CosmWasm contracts: https://docs.cron.cat/docs/integration/
DM us on Twitter: https://twitter.com/croncats
Join our Discord: https://discord.gg/GJY7QBsDft
Verifying code on-chain
To verify CronCat code on chain, you'll need a couple things. This is not particularly unique to CronCat, but is detailed here in an effort to help less technical people understand how they can be empowered to assist in stewarding safety in the ecosystem.
For this example, we'll cover how one might verify a CronCat smart contract that's been proposed to be uploaded to Stargaze, a permissioned chain.
Items we'll need:
- Link to the governance proposal
- The daemon (which is also the node binary for validation and RPC purposes, as well as a CLI) of the network in question
- Instructions and basic utilities like
sha256sum
, which likely comes standard with modern operating systems.
Governance proposal
Let's take an example from this real-world proposal: https://www.mintscan.io/stargaze/proposals/174
So the ID of this proposal is the number 174
which we'll use shortly.
Daemon
In this case, we want to find, clone, and build the open-source repository for the Stargaze daemon/CLI. For Stargaze this lives at: https://github.com/public-awesome/stargaze
Follow the directions there and in the protocol's documentation, which includes installing Golang and running commands like make install
. These instructions are common and discoverable in documentation, like here.
It's important to check out the correct release instead of cloning the repository and using the main
branch. As a rule of thumb, you may find the latest branch/tag by selecting the latest version from the right-hand column under Releases. Follow the directions in the documentation and README, and ensure that you can run starsd version
and see the expected version.
Instructions
Ensure you have sha256sum
on your computer by running sha256sum --help
. It should not return something that sounds like, "what the heck is that?" If it does, use Chat GPT to figure out how to get that installed on your operating system.
Let's download the code from prop 174. Here is the command that tells starsd
to connect to mainnet, spit out info about the proposal, filter out the smart contract's bytecode, base64-decode it, unzip it (not to a file/directory), and finally throw the unzipped gobbledegook into a little utility that prints out the checksum.
starsd q gov proposal 174 --output json --node https://rpc.stargaze-apis.com:443 --chain-id stargaze-1 | jq -r '.content.wasm_byte_code' | base64 -d | gzip -dc | sha256sum
Now that we have the checksum printed to our screen, we can compare it to the CronCat factory contract whose code lives in this repository.
To build all the CronCat smart contracts, at the root of this project (where this README is) you'll run:
just optimize
If you see an error about not having just
you'll need to run cargo install just
. (Again, if you ever see a message about your computer not having base64, gzip, sha256sum, just, or something else, just Chat GPT how to install that given your operating system.)
The optimization will require Docker, so make sure you have that. Docker is essential in creating the exact binary we need, because it strips away user-centric paths that would otherwise make each person's computer potentially create unique checksums. Since the entire point is to create a reproducible smart contract binary, we use Docker. This is normal across other ecosystems as well.
Note: this optimization will take a while. Meditate for 10 minutes, then give your friends and life partners the loving words they need.
When the optimization has finished and it looks like you're finally allowed to type into your terminal normally again, there will be smart contract binaries output to the artifacts
directory.
Finally, we run a simple command to print out the checksum of our compiled binary:
sha256sum artifacts/croncat_factory.wasm
This will print out a checksum that should match the output of the long starsd
command earlier. If they match, you know the governance proposal is for uploading a smart contract that you can read the code for.