A Lua smart contract for the AO (Arweave) ecosystem that manages a collection of achievement badges called "Cheese Mints". Cheese Mints can be created, updated, and awarded to addresses with role-based access control.
Cheese Mints are on-chain achievements that can be awarded to users. Each Cheese Mint has:
- Name (up to 250 characters)
- Description (up to 1000 characters)
- Points value
- Icon (Arweave transaction ID)
- Category
The contract supports both individual and bulk awarding of Cheese Mints to addresses.
- Node.js 24+
- npm
- Busted (for running Lua tests)
npm installBundles Lua source files into deployable contract files:
npm run bundleOutput is written to dist/collection/process.lua.
Bundles contracts and runs the Lua test suite:
npm testnpm run cleanCreate a .env file with the following variables:
| Variable | Description | Default |
|---|---|---|
PROCESS_NAME |
Name for the AO process | (required) |
PROCESS_SOURCE_PATH |
Path to bundled Lua source | (required) |
DEPLOYER_PRIVATE_KEY_PATH |
Path to Arweave wallet JWK | (required) |
APP_NAME |
Application name tag | Cheese-Mint |
SCHEDULER |
AO scheduler address | _GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA |
AUTHORITY |
Authority address | fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY |
AOS_MODULE_ID |
AO module ID | ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s |
CALL_INIT_HANDLER |
Call init handler after spawn | false |
INIT_DATA_PATH |
Path to init data JSON | (required if CALL_INIT_HANDLER=true) |
INIT_DELAY_MS |
Delay before init call | 30000 |
npx tsx scripts/spawn.tsnpx tsx scripts/send-action-message.tsnpx tsx scripts/dryrun-view-state.tsBuild and run using Docker:
docker build -t cheese-mints .The Dockerfile uses a multi-stage build:
- Builder stage: Installs dependencies and bundles Lua contracts
- Runtime stage: Minimal image with production dependencies and bundled output
Update-Roles- Update access control rolesView-Roles- View current role assignments
Create-Cheese-Mint- Create a new Cheese Mint definitionUpdate-Cheese-Mint- Update an existing Cheese MintRemove-Cheese-Mint- Remove a Cheese Mint from the collection
Award-Cheese-Mint- Award a Cheese Mint to an addressBulk-Award-Cheese-Mint- Award multiple Cheese Mints to multiple addressesRevoke-Cheese-Mint- Revoke a Cheese Mint from an address
The contract uses role-based access control. Available roles:
owner- Full access to all handlersadmin- Full access to all handlers- Handler-specific roles (e.g.,
Create-Cheese-Mint,Award-Cheese-Mint)
cheese-mints/
├── src/
│ └── contracts/
│ ├── collection/
│ │ └── collection.lua # Main contract
│ └── common/
│ └── acl.lua # Access control module
├── spec/
│ ├── collection/
│ │ └── init.spec.lua # Contract tests
│ ├── hyper-aos.lua
│ └── setup.lua
├── scripts/
│ ├── bundle.ts # Lua bundler script
│ ├── spawn.ts # Deploy new AO process
│ ├── send-action-message.ts # Send messages to process
│ ├── dryrun-view-state.ts # Query process state
│ ├── publish-view.ts
│ └── util/
│ ├── lua-bundler.ts
│ └── send-aos-message.ts
├── Dockerfile
├── package.json
└── tsconfig.json
AGPL-3.0