Skip to main content
This recipe gets you from zero to a compiled contract manifest. As an example, we use the simple-token solution from from-token-to-amm (solutions/02-simple-token).

Prerequisites

Get the code

The example contract lives in from-token-to-amm in the demos repo. Clone it:
From here, every command in this tutorial assumes you’re in the from-token-to-amm workspace. The example we build is under solutions/02-simple-token/. Genie is the Grid’s Rust SDK for writing contracts; gen genie is its CLI, used here to install the build toolchain and compile crates to artifacts. Before starting, make sure your machine has the contract toolchain (a recent rustc/cargo, the riscv32im-unknown-none-elf target, and the RISC-V linker and objcopy). Check and install it with:
Run without --install to only report what’s missing. Without the riscv32im-unknown-none-elf target in place, every gen genie build below fails.

Step 1: Build one example contract

The example is a multi-component token contract: a root component (metadata and install gatekeeper), plus issuer and holder components you install after deploy. Build it:
gen genie build accepts a path to a contract crate directory (the folder that contains Cargo.toml).

Step 2: Read what the build produced

The build writes into that crate’s artifacts/ directory. For this contract, the important output is:
The repo ships the manifest and ABI JSON files; the build step produces the .o binaries that were missing until now.

The manifest (*_modules.json)

It lists every component in the contract and where to find its binary and ABI on disk:
  • contract_name — logical name of the contract; used in generated client code and logs.
  • modules — one entry per component type this contract defines. Index 0 is always the root component created at deploy time.
  • object_path / abi_path — paths relative to the manifest file to the compiled binary and ABI.

What’s next