solutions/02-simple-token).
Prerequisites
- The
genCLI on yourPATH. See Install the CLI.
Get the code
The example contract lives in from-token-to-amm in the demos repo. Clone it: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:
--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: aroot 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’sartifacts/ directory. For this contract, the important output is:
.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. Index0is 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
- Deploy a contract to DevNet — push and deploy on DevNet with
gen client.
