A complete blockchain implementation featuring: - synord: Full node with GHOSTDAG consensus - explorer-web: Modern React blockchain explorer with 3D DAG visualization - CLI wallet and tools - Smart contract SDK and example contracts (DEX, NFT, token) - WASM crypto library for browser/mobile
190 lines
4.3 KiB
Markdown
190 lines
4.3 KiB
Markdown
# Phase 5, Milestone 1: DAO Launch
|
|
|
|
> Deploy and activate on-chain governance
|
|
|
|
**Status**: ✅ Complete
|
|
**Priority**: Medium
|
|
**Crates**: `synor-governance`, `contracts/governance`
|
|
|
|
---
|
|
|
|
## Overview
|
|
|
|
Launch the decentralized autonomous organization (DAO) with proposal creation, voting mechanisms, and treasury management.
|
|
|
|
---
|
|
|
|
## Tasks
|
|
|
|
### Task 1.1: Governance Contract Deployment
|
|
- [x] Deploy governance contract to testnet
|
|
- [x] Initialize with genesis parameters
|
|
- [x] Set initial voting thresholds
|
|
- [x] Configure timelock delays
|
|
- [x] Transfer treasury funds
|
|
|
|
**Files:**
|
|
- `contracts/governance/src/lib.rs`
|
|
|
|
**Contract Parameters:**
|
|
| Parameter | Value |
|
|
|-----------|-------|
|
|
| Proposal Threshold | 100,000 SYNOR |
|
|
| Quorum | 4% of supply |
|
|
| Voting Period | 7 days |
|
|
| Timelock Delay | 2 days |
|
|
| Grace Period | 3 days |
|
|
|
|
### Task 1.2: Proposal Creation
|
|
- [x] Proposal struct definition
|
|
- [x] Threshold validation
|
|
- [x] Description/title storage
|
|
- [x] Action encoding (calls)
|
|
- [x] State machine transitions
|
|
|
|
**Files:**
|
|
- `crates/synor-governance/src/proposal.rs`
|
|
|
|
**Proposal States:**
|
|
```
|
|
Pending → Active → Succeeded → Queued → Executed
|
|
↘ Defeated
|
|
↘ Expired
|
|
```
|
|
|
|
### Task 1.3: Voting Mechanism
|
|
- [x] Vote delegation support
|
|
- [x] Snapshot-based voting power
|
|
- [x] For/Against/Abstain options
|
|
- [x] Vote weight calculation
|
|
- [x] Double-vote prevention
|
|
|
|
**Files:**
|
|
- `crates/synor-governance/src/voting.rs`
|
|
|
|
**Voting Formula:**
|
|
```
|
|
voting_power = balance_at_snapshot + delegated_votes
|
|
```
|
|
|
|
### Task 1.4: Treasury Initialization
|
|
- [x] Treasury contract deployment
|
|
- [x] Multi-sig setup (initial)
|
|
- [x] Transfer control to DAO
|
|
- [x] Budget allocation system
|
|
- [x] Spending proposals
|
|
|
|
**Files:**
|
|
- `crates/synor-governance/src/treasury.rs`
|
|
|
|
**Treasury Pools:**
|
|
| Pool | Allocation | Purpose |
|
|
|------|------------|---------|
|
|
| Development | 40% | Core development funding |
|
|
| Community | 30% | Grants and bounties |
|
|
| Marketing | 20% | Promotion and growth |
|
|
| Reserve | 10% | Emergency fund |
|
|
|
|
---
|
|
|
|
## Validation
|
|
|
|
### Validation Commands
|
|
|
|
```bash
|
|
# Run governance tests
|
|
cargo test -p synor-governance
|
|
|
|
# Test contract
|
|
cd contracts/governance && cargo test
|
|
|
|
# CLI governance commands
|
|
./target/release/synor gov info
|
|
./target/release/synor gov list
|
|
```
|
|
|
|
### Validation Agents
|
|
|
|
| Agent | Purpose |
|
|
|-------|---------|
|
|
| `code-reviewer` | Review governance logic |
|
|
| `type-design-analyzer` | Validate proposal types |
|
|
|
|
### Governance Test Suite
|
|
|
|
```rust
|
|
// Proposal lifecycle test
|
|
#[test]
|
|
fn test_proposal_lifecycle() {
|
|
let mut gov = Governance::new(params);
|
|
let proposer = Account::new(200_000); // Above threshold
|
|
|
|
let proposal_id = gov.propose(
|
|
proposer,
|
|
"Increase block size",
|
|
vec![Action::SetParameter("max_block_size", 2_000_000)]
|
|
)?;
|
|
|
|
assert_eq!(gov.state(proposal_id), ProposalState::Pending);
|
|
|
|
// Advance to voting period
|
|
gov.advance_time(1.days());
|
|
assert_eq!(gov.state(proposal_id), ProposalState::Active);
|
|
|
|
// Vote
|
|
gov.cast_vote(voter1, proposal_id, VoteType::For)?;
|
|
|
|
// Advance past voting period
|
|
gov.advance_time(7.days());
|
|
assert_eq!(gov.state(proposal_id), ProposalState::Succeeded);
|
|
}
|
|
|
|
// Treasury spending test
|
|
#[test]
|
|
fn test_treasury_spending() {
|
|
let mut treasury = Treasury::new();
|
|
treasury.deposit(Pool::Development, 1_000_000);
|
|
|
|
let proposal = SpendingProposal {
|
|
pool: Pool::Development,
|
|
amount: 100_000,
|
|
recipient: recipient_addr,
|
|
reason: "Q1 Developer Grant"
|
|
};
|
|
|
|
treasury.queue_spending(proposal, timelock)?;
|
|
treasury.advance_time(2.days());
|
|
treasury.execute_spending(proposal.id)?;
|
|
|
|
assert_eq!(treasury.balance(Pool::Development), 900_000);
|
|
}
|
|
```
|
|
|
|
### Security Checks
|
|
|
|
- [ ] Proposal threshold prevents spam
|
|
- [ ] Snapshot prevents vote manipulation
|
|
- [ ] Timelock allows response to attacks
|
|
- [ ] Treasury has spending limits
|
|
- [ ] Multi-sig for emergency actions
|
|
|
|
### Compliance
|
|
|
|
- [ ] Voting is transparent and auditable
|
|
- [ ] All proposals publicly visible
|
|
- [ ] Treasury movements logged
|
|
- [ ] Token holder rights protected
|
|
|
|
---
|
|
|
|
## Acceptance Criteria
|
|
|
|
1. Governance contract deployed
|
|
2. Proposals can be created and voted on
|
|
3. Treasury accepts and disburses funds
|
|
4. CLI commands functional
|
|
5. All governance tests pass
|
|
|
|
---
|
|
|
|
*Completed: January 2025*
|