DubheSuiContracts

Contracts

This section covers everything related to the on-chain Move layer of a Dubhe DApp.

Read the pages in order — each one builds on the previous:

#TopicWhat it covers
1ResourcesDeclare on-chain data as resources in dubhe.config.ts, run generate, and use the generated storage APIs
2Error HandlingDefine typed errors in config; use assertion helpers in system contracts
3SystemsWrite business logic — entry function anatomy, five system patterns, guard order, deploy_hook
4Access ControlDappKey namespace isolation, public(package) write restriction, version/pause/admin guards
5DApp AdminMetadata, two-step ownership transfer, emergency pause, credit top-up
6Storage FeesHow write fees are calculated, lazy settlement, and how to top up a DApp’s credit balance
7TestingUnit test patterns, multi-caller scenarios, and #[expected_failure]
8UpgradingAdd new resources, bump versions, block stale packages, and register upgrades on-chain
Address SystemMulti-chain address utilities — only needed for Dubhe Channel cross-chain integration

What is the on-chain layer?

A Dubhe DApp consists of two layers:

dubhe.config.ts  →  generate  →  sources/codegen/   ← data layer (auto-generated)
                                   sources/systems/   ← logic layer (you write this)


                               Dubhe Framework (on-chain, already deployed)

You write code in two places:

  • dubhe.config.ts — declare what data your contract stores (resources, enums, errors)
  • sources/systems/ — write business logic using the generated resource APIs

Everything else — storage, events, fee metering, versioning — is handled by the Framework automatically.