Skip to main content
FlowGuard keeps shared covenant and policy types in shared/types/. The most important file for on-chain state is shared/types/covenant-types.ts. These types mirror the NFT commitment layouts used by the covenant encoding helpers in contracts/lib/StateEncoding.cash.

Where They Are Used

Shared types are consumed by:
  • frontend schedule and treasury views
  • backend transaction builders and API responses
  • indexer decode paths
  • executor services
  • internal SDK-style tooling

VaultState

VaultState is a 32-byte commitment that tracks vault lifecycle and spend-period state.
export interface VaultState {
  version: number;
  status: VaultStatus;
  rolesMask: Buffer;
  currentPeriodId: bigint;
  spentThisPeriod: bigint;
  lastUpdateTimestamp: bigint;
}
export enum VaultStatus {
  ACTIVE = 0,
  PAUSED = 1,
  EMERGENCY_LOCK = 2,
  MIGRATING = 3,
}

ProposalState

ProposalState is a 64-byte commitment used for treasury proposal approval and execution state.
export interface ProposalState {
  version: number;
  status: ProposalStatus;
  approvalCount: number;
  requiredApprovals: number;
  votingEndTimestamp: bigint;
  executionTimelock: bigint;
  payoutTotal: bigint;
  payoutHash: Buffer;
}
export enum ProposalStatus {
  DRAFT = 0,
  SUBMITTED = 1,
  VOTING = 2,
  APPROVED = 3,
  QUEUED = 4,
  EXECUTABLE = 5,
  EXECUTED = 6,
  CANCELLED = 7,
  EXPIRED = 8,
}

ScheduleState

ScheduleState is a 48-byte commitment used by schedule-style covenants.
export interface ScheduleState {
  version: number;
  scheduleType: ScheduleType;
  intervalSeconds: bigint;
  nextUnlockTimestamp: bigint;
  amountPerInterval: bigint;
  totalReleased: bigint;
  cliffTimestamp: bigint;
}
export enum ScheduleType {
  RECURRING = 0,
  LINEAR_VESTING = 1,
  STEP_VESTING = 2,
}

VoteState

VoteState is a 32-byte commitment used for locked governance vote positions.
export interface VoteState {
  version: number;
  proposalIdPrefix: Buffer;
  voteChoice: VoteChoice;
  lockTimestamp: bigint;
  unlockTimestamp: bigint;
}
export enum VoteChoice {
  AGAINST = 0,
  FOR = 1,
  ABSTAIN = 2,
}

TallyState

TallyState is the shared type used for tally-style governance state.
export interface TallyState {
  version: number;
  proposalIdPrefix: Buffer;
  votesFor: bigint;
  votesAgainst: bigint;
  votesAbstain: bigint;
  quorumThreshold: bigint;
  tallyTimestamp: bigint;
}

Generic UTXO Types

export interface UTXORef {
  txid: string;
  vout: number;
}

export interface CashTokenData {
  category: string;
  nft?: {
    capability?: 'none' | 'mutable' | 'minting';
    commitment: Buffer;
  };
  amount?: bigint;
}

export interface CovenantUTXO<TState = any> {
  utxo: UTXORef;
  address: string;
  satoshis: bigint;
  token?: CashTokenData;
  state: TState;
  height: number;
  timestamp: bigint;
}
The shared type package also exports convenience aliases such as:
  • VaultUTXO
  • ProposalUTXO
  • ScheduleUTXO
  • VoteUTXO
  • TallyUTXO

Policy Types

Treasury policy and access-model types live alongside covenant types in shared/types/policy-types.ts. Use these for DAO workspace policy editors, proposal metadata, and higher-level treasury rules that are not stored directly inside covenant NFT commitments.