Move Contracts

The move-contracts/ directory contains custom Smart Assembly extension examples. You build contracts here that change the default behavior of programmable assemblies by defining a typed witness struct and calling the extendable world functions.


Extension Examples

Package Purpose
smart_gate Custom rules for space travel — toll gates, tribe-only access, corpse bounty collection. Issues JumpPermits based on arbitrary logic.
storage_unit Custom rules for item deposits and withdrawals — vending machines, trade hubs, item gating.
tokens Standalone token contracts (e.g. for use with gates or storage units).

More standalone contracts (multisig, DAO, etc.) will be added over time.

Tip

To understand how extensions work, read the typed witness pattern documentation and the Smart Assemblies Overview page.


Prerequisites


Build and Publish

Custom contracts depend on the world contract being published on either localnet or testnet.

Testnet

On testnet the published world package is automatically resolved when deploying the custom contract:

cd move-contracts/smart_gate
sui move build -e testnet
sui client publish -e testnet

Localnet

Since the local network is short-lived, you need to manually resolve to the published world package address by providing the path to the published ephemeral file:

cd move-contracts/smart_gate
sui client test-publish --build-env testnet --pubfile-path ../../deployments/localnet/Pub.localnet.toml
Note

This assumes Pub.localnet.toml was copied to deployments/localnet/ during the artifact copy step. See the Docker Flow or Host Flow for details.

In Docker

Contracts are at /workspace/builder-scaffold/move-contracts/. From inside the container you can publish the same way on either localnet or testnet.


After Publishing

From the publish output, set two environment variables in your .env:

Variable Source
BUILDER_PACKAGE_ID The package ID from the publish transaction output
EXTENSION_CONFIG_ID The ExtensionConfig object ID from the publish output

Then run the TypeScript scripts in order. Full step-by-step instructions are in the Docker Flow or Host Flow.

Smart Gate Script Order

cd /workspace/builder-scaffold   # or the builder-scaffold root on host
pnpm install
pnpm configure-rules
pnpm authorise-gate
pnpm authorise-storage-unit
pnpm issue-tribe-jump-permit
pnpm jump-with-permit
pnpm collect-corpse-bounty

Formatting and Linting

From the repo root:

pnpm fmt          # format Move files
pnpm fmt:check    # check formatting (CI)
pnpm lint         # build + Move linter