aldabra/crates/aldabra-dao/examples/dump_governor.rs
Sulkta 564ba3ccb5 chore: scrub internal session-log narrative from code comments
Wide sweep across the codebase to remove leftover artifacts of internal
development sessions, internal entity naming, and audit-code references
that point at non-public docs. The technical reasoning for each piece
of code stays; the "Caught 2026-05-XX while debugging XYZ at preprod"
narrative goes.

Categories scrubbed:
- Dated session-log comments ("Caught/Surfaced/Discovered 2026-05-XX")
  → rewritten as neutral technical reasoning.
- Internal audit codes (AUDIT-H2, AUDIT-C2, AUDIT-M2, AUDIT-H5, etc.)
  referencing a non-public audit doc → labels stripped, fix reasoning
  kept.
- Internal-entity names in code comments (Sulkta-specific, Sulkta runs
  X, Terrapin/TRP as gov-token names) → generic phrasing.
- Test fixture helper `sulkta_cfg` → `test_dao_cfg`; test DAO name
  string `"sulkta"` → `"test-dao"`. On-chain addresses in test fixtures
  kept (they're real-world wire-byte test data on public chain).
- Cross-references to memory files / non-public audit docs
  (`internal notes`, `aiken-escrow/README.md`)
  → reasoning inlined or removed.
- Test names renamed: `decodes_sulkta_live_governor_datum` →
  `decodes_live_governor_datum`, `decodes_sulkta_live_proposal_zero` →
  `decodes_live_finished_proposal`, etc.

Kept (legitimate):
- Cross-references to in-repo audit docs (aiken-escrow/README.md, aiken-escrow/README.md) — they ARE the
  public artifacts being referenced.
- HIGH-1/HIGH-2/MED-2/LOW labels on escrow fixes — these correspond to
  findings in the in-repo audit doc.
- TODO markers — legitimate work-still-to-do.
2026-05-10 21:29:40 -07:00

45 lines
1.5 KiB
Rust

//! Dump a sample GovernorDatum as PlutusData CBOR hex.
//!
//! Useful for constructing the inline datum for a governor bootstrap
//! tx — edit the values in `main()` to your DAO's parameters and run:
//!
//! ```sh
//! cargo run --example dump_governor -p aldabra-dao --release
//! ```
//!
//! Pipe the output hex into `wallet_plutus_mint_unsigned`'s
//! `dest_inline_datum_cbor_hex` arg.
use aldabra_dao::agora::proposal::{ProposalThresholds, ProposalTimingConfig};
use aldabra_dao::agora::GovernorDatum;
use pallas_codec::minicbor;
fn main() {
let g = GovernorDatum {
proposal_thresholds: ProposalThresholds {
execute: 50,
create: 100,
to_voting: 100,
vote: 1,
cosign: 1,
},
next_proposal_id: 0,
proposal_timings: ProposalTimingConfig {
// Short timings for preprod testing — flip these up for
// any real DAO on mainnet (e.g. 7d/7d/48h/24h/1h/30min).
draft_time: 60_000,
voting_time: 60_000,
locking_time: 30_000,
executing_time: 30_000,
min_stake_voting_time: 60_000,
voting_time_range_max_width: 30_000,
},
create_proposal_time_range_max_width: 30_000,
maximum_created_proposals_per_stake: 20,
};
let pd = g.to_plutus_data().expect("encode GovernorDatum");
let mut buf = Vec::new();
minicbor::encode(&pd, &mut buf).expect("encode CBOR");
let hex: String = buf.iter().map(|b| format!("{:02x}", b)).collect();
println!("{}", hex);
}