Contracts
This section covers everything related to the on-chain Move layer of a Dubhe DApp:
| Topic | What it covers |
|---|---|
| Schemas | Declare on-chain data in dubhe.config.ts, generate typed Move modules with schemagen, and understand the storage model |
| Address System | Derive caller identity correctly in system functions; namespace isolation rules |
| Storage Fees | How write fees are calculated, how to top up a DApp’s credit balance, and benchmark numbers |
| Access Control | DappKey namespace isolation, public(package) write restriction, version/pause/admin guards |
| DApp Admin | Update metadata, two-step ownership transfer, emergency pause, credit top-up |
| Testing | Unit test patterns, multi-caller scenarios, #[expected_failure], and testing deploy hooks |
| Upgrading | Add new resources, bump versions, block stale packages, and register upgrades on-chain |
What is the on-chain layer?
A Dubhe DApp consists of two layers:
dubhe.config.ts → schemagen → sources/codegen/ ← data layer (auto-generated)
sources/systems/ ← logic layer (you write this)
│
▼
Dubhe Framework (on-chain, already deployed)You only write code in two places:
dubhe.config.ts— declare what data your contract has (resources, enums, errors)sources/systems/— write your game rules or business logic using the generated APIs
Everything else — storage, events, fee metering, versioning — is handled by the Framework automatically.