zetta-contracts
v1.0.0
Published
## Contract Dependencies
Readme
Zetta Protocol System Architecture
Contract Dependencies
graph TD
A[AgentFactory] -->|Registers| B[LineageTracker]
C[ModelFactory] -->|Registers| B
D[DatasetFactory] -->|Registers| B
E[Agent] -->|Deploys| F[Service]
E -->|Created by| A
F -->|Records| B
F -->|Settles| G[Settlement]
H[SubnetRegistry] -->|Deploys| I[Subnet]
I -->|Updates| H
classDef factory fill:#f96,stroke:#333
classDef core fill:#9cf,stroke:#333
classDef subnet fill:#9f9,stroke:#333
class A,C,D factory
class B,F,G core
class H,I subnetCore Contracts
LineageTracker
- Role: Records and tracks dependencies between assets (Agent/Model/Dataset)
- Permissions:
- Owner: Can add/remove factory contract authorizations
- Authorized Factories: Can record asset dependencies
- Key Functions:
recordLineage: Records asset dependenciesgetLineage: Retrieves complete dependency tree for an asset
Settlement
- Role: Handles service fee settlement and distribution
- Permissions:
- Owner: Platform admin, verifies receipt signatures
- Key Functions:
submitReceipt: Submits service usage receipts and triggers fee distribution
Service
- Role: Manages service lifecycle and revenue distribution
- Permissions:
- Owner: Service owner
- Agent: Service creator
- Key Functions:
distributeIncome: Distributes revenue according to dependenciesisExpired: Checks if service has expired
SubnetRegistry
- Role: Manages subnet lifecycle and user-subnet relationships
- Permissions:
- Owner: Can suspend/resume subnets and update stake requirements
- Anyone: Can register new subnets and add stakes
- Key Functions:
registerSubnet: Creates new subnet with specified governance typeaddStake: Stakes tokens for subnet activationisActive: Checks if subnet meets stake requirements
Subnet
- Role: Manages subnet membership and governance
- Permissions:
- Admin: Has full control over subnet operations
- Operators: Can manage members and subnet configuration and withdraw income
- Contributors: Regular subnet members
- Key Functions:
applyForMembership: Join request based on governance typeinviteMembers: Add members in invite-only modewithdrawIncome: Withdraws income from subnet
Factory Contracts
AgentFactory
- Role: Creates and manages Agents
- Permissions:
- Owner: Can set distribution thresholds
- Dependencies:
- LineageTracker: Records Agent dependencies
DatasetFactory/ModelFactory
- Role: Creates and manages Datasets/Models
- Permissions:
- Owner: Factory contract administrator
- Dependencies:
- LineageTracker: Records asset dependencies
Permission Management Flow
Asset Creation
- Factory contracts must be authorized by LineageTracker
- Creator becomes asset Owner
Service Deployment
- Can only be deployed by Agent
- Service Owner can manage service configuration
Revenue Distribution
- Service contract automatically distributes based on dependencies
- Must meet minimum distribution threshold
Fee Settlement
- Platform admin signs receipts for verification
- Settlement contract executes actual transfers
Governance Types
DEFAULT (Invite-only)
- Members join through invitation or merkle proof
- Requires admin/operator approval
- Supports both direct invitation and merkle verification
PERMISSIONLESS
- Open membership model
- Anyone can join directly
- No approval required
PERMISSIONED
- Application-based membership
- Members must apply and be approved
- Supports application review process
Subnet Management Flow
Subnet Creation
- Register subnet through SubnetRegistry
- Set governance type and owner
- Meet stake requirements for activation
Membership Management
- Based on governance type:
- DEFAULT: Invitation/merkle proof required
- PERMISSIONLESS: Direct join
- PERMISSIONED: Application and approval
- Based on governance type:
Revenue Distribution
- Two modes:
- SUBNET_MANAGED: Income goes to subnet contract
- DIRECT: Income goes to individual recipients
- Two modes:
Access Control
- Hierarchical roles:
- DEFAULT_ADMIN_ROLE: Full control
- OPERATOR_ROLE: Member management
- CONTRIBUTOR_ROLE: Basic membership
- Hierarchical roles:
Security Features
Stake Requirements
- Subnets must maintain minimum stake
- Anyone can contribute stake
- Only owner can withdraw
Member Restrictions
- One subnet per user
- Must leave current subnet before joining another
- Support for member suspension
Governance Controls
- Type-specific membership flows
- Merkle proof verification for invite-only
- Operator management system
