# DAO Governance Service

Coordinates Lilith DAO proposal lifecycles, including creation, voting, timelock
queueing, and execution while enforcing compliance and notifications.

## Pipeline

1. **Proposal registry** – persists proposals and tallies.
2. **Snapshot service** – records snapshot block for voting power.
3. **Voting eligibility** – validates voter weight and access.
4. **Vote aggregator** – updates tallies per support option.
5. **Timelock scheduler** – queues succeeded proposals for execution.
6. **Execution engine** – submits proposal actions on-chain.
7. **Notification service** – emits governance lifecycle notifications.
8. **Compliance guard** – checks creation and execution policies.

## Usage

```ts
import { createGovernanceService } from './service';

const service = createGovernanceService({
  registry,
  snapshotService,
  votingEligibility,
  voteAggregator,
  timelockScheduler,
  executionEngine,
  notificationService,
  complianceGuard,
  lifecycleDefaults: {
    votingDelaySeconds: 3600,
    votingPeriodSeconds: 172800,
    executionDelaySeconds: 86400,
    quorumPercentage: 10,
    approvalThresholdPercentage: 60,
  },
});

const { proposal } = await service.createProposal({
  metadata: {
    title: 'Initiate Meditation Council',
    summary: 'Formalize governance for sacred content curation.',
    discussionUrl: 'https://dao.lilith.ai/proposals/42',
    createdBy: '0xLilith',
    tags: ['governance'],
  },
  actions: [
    {
      target: '0xCouncilMultisig',
      signature: 'grantRole(bytes32,address)',
      calldata: '0xfeedface',
      description: 'Grant council role.',
    },
  ],
  lifecycleConfig: {
    votingDelaySeconds: 7200,
    votingPeriodSeconds: 259200,
    executionDelaySeconds: 172800,
    quorumPercentage: 12,
    approvalThresholdPercentage: 66,
  },
});
```

## Tests

```bash
npx jest --config apps/lilith/svc-dao-governance/jest.config.cjs --runInBand
```
