Skip to main content

Smart Contract Interfaces

Dubhe Engine smart contracts are built using the Move programming language, providing type-safe, resource-oriented programming for blockchain applications.

Component Contracts

Base Component Structure

All components in Dubhe Engine follow a standardized Move struct pattern:

Component Operations

Create Component

Update Component

System Contracts

System Function Pattern

System functions operate on components and implement game logic:

Event System

Event Definitions

Access Control

Permission Patterns

Error Handling

Standard Error Codes

Error Usage

Testing Patterns

Unit Test Example

Best Practices

Security Guidelines
  1. Always validate inputs before processing
  2. Use proper access controls for administrative functions
  3. Emit events for important state changes
  4. Handle edge cases explicitly
  5. Write comprehensive tests for all functions

Next Steps

Client SDK API

Learn to interact with contracts from frontend

Schema Definitions

Understand component data structures