+ {formatDate(quarter.startsOn)} -{" "} + {formatDate(quarter.endsOn)} +
++ {quarter.label} +
++ {quarter.publishedAt + ? `Published ${formatTimestamp(quarter.publishedAt)}` + : "Ready for publication preview"} +
+ +diff --git a/drizzle/0017_happy_silver_fox.sql b/drizzle/0017_happy_silver_fox.sql
new file mode 100644
index 0000000..a507418
--- /dev/null
+++ b/drizzle/0017_happy_silver_fox.sql
@@ -0,0 +1,21 @@
+CREATE TYPE "public"."quarter_balance_validation_status" AS ENUM('not_ready', 'needs_review', 'validated', 'acknowledged');--> statement-breakpoint
+CREATE TABLE "quarter_balance_validations" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "quarter_id" uuid NOT NULL,
+ "status" "quarter_balance_validation_status" NOT NULL,
+ "checked_count" integer DEFAULT 0 NOT NULL,
+ "variance_count" integer DEFAULT 0 NOT NULL,
+ "excluded_count" integer DEFAULT 0 NOT NULL,
+ "total_variance_usd" numeric(18, 2) DEFAULT '0' NOT NULL,
+ "details" jsonb NOT NULL,
+ "acknowledgement_note_encrypted" jsonb,
+ "acknowledged_by_wallet_address" text,
+ "acknowledged_at" timestamp with time zone,
+ "source_sync_run_id" text,
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+ALTER TABLE "quarter_balance_validations" ADD CONSTRAINT "quarter_balance_validations_quarter_id_quarters_id_fk" FOREIGN KEY ("quarter_id") REFERENCES "public"."quarters"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+CREATE UNIQUE INDEX "quarter_balance_validations_quarter_id_unique" ON "quarter_balance_validations" USING btree ("quarter_id");--> statement-breakpoint
+CREATE INDEX "quarter_balance_validations_status_idx" ON "quarter_balance_validations" USING btree ("status");
\ No newline at end of file
diff --git a/drizzle/meta/0017_snapshot.json b/drizzle/meta/0017_snapshot.json
new file mode 100644
index 0000000..52e22d4
--- /dev/null
+++ b/drizzle/meta/0017_snapshot.json
@@ -0,0 +1,3421 @@
+{
+ "id": "ff86d741-30e9-45db-b97a-77e362681d59",
+ "prevId": "fb72f035-f07f-44d1-b3a6-a50b692ac32c",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.app_users": {
+ "name": "app_users",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "wallet_address": {
+ "name": "wallet_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "display_name_encrypted": {
+ "name": "display_name_encrypted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "app_users_wallet_address_unique": {
+ "name": "app_users_wallet_address_unique",
+ "columns": [
+ {
+ "expression": "lower(\"wallet_address\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.audit_events": {
+ "name": "audit_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "actor_user_id": {
+ "name": "actor_user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_wallet_address": {
+ "name": "actor_wallet_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "audit_action",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_table": {
+ "name": "subject_table",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_id": {
+ "name": "subject_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quarter_id": {
+ "name": "quarter_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "audit_events_subject_idx": {
+ "name": "audit_events_subject_idx",
+ "columns": [
+ {
+ "expression": "subject_table",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "audit_events_actor_user_id_idx": {
+ "name": "audit_events_actor_user_id_idx",
+ "columns": [
+ {
+ "expression": "actor_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "audit_events_quarter_id_idx": {
+ "name": "audit_events_quarter_id_idx",
+ "columns": [
+ {
+ "expression": "quarter_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "audit_events_created_at_idx": {
+ "name": "audit_events_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "audit_events_actor_user_id_app_users_id_fk": {
+ "name": "audit_events_actor_user_id_app_users_id_fk",
+ "tableFrom": "audit_events",
+ "tableTo": "app_users",
+ "columnsFrom": [
+ "actor_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "audit_events_quarter_id_quarters_id_fk": {
+ "name": "audit_events_quarter_id_quarters_id_fk",
+ "tableFrom": "audit_events",
+ "tableTo": "quarters",
+ "columnsFrom": [
+ "quarter_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.cleric_roles": {
+ "name": "cleric_roles",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "wallet_address": {
+ "name": "wallet_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "granted_by_user_id": {
+ "name": "granted_by_user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_by_user_id": {
+ "name": "revoked_by_user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "cleric_roles_wallet_address_idx": {
+ "name": "cleric_roles_wallet_address_idx",
+ "columns": [
+ {
+ "expression": "lower(\"wallet_address\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "cleric_roles_active_idx": {
+ "name": "cleric_roles_active_idx",
+ "columns": [
+ {
+ "expression": "lower(\"wallet_address\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "revoked_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "cleric_roles_granted_by_user_id_app_users_id_fk": {
+ "name": "cleric_roles_granted_by_user_id_app_users_id_fk",
+ "tableFrom": "cleric_roles",
+ "tableTo": "app_users",
+ "columnsFrom": [
+ "granted_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "cleric_roles_revoked_by_user_id_app_users_id_fk": {
+ "name": "cleric_roles_revoked_by_user_id_app_users_id_fk",
+ "tableFrom": "cleric_roles",
+ "tableTo": "app_users",
+ "columnsFrom": [
+ "revoked_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.dao_proposals": {
+ "name": "dao_proposals",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "dao_address": {
+ "name": "dao_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "chain_id": {
+ "name": "chain_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "proposal_id": {
+ "name": "proposal_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "proposal_number": {
+ "name": "proposal_number",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_tx_hash": {
+ "name": "execution_tx_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "executed_at": {
+ "name": "executed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "daohaus_url": {
+ "name": "daohaus_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "raw_metadata": {
+ "name": "raw_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "dao_proposals_chain_dao_proposal_unique": {
+ "name": "dao_proposals_chain_dao_proposal_unique",
+ "columns": [
+ {
+ "expression": "chain_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"dao_address\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "proposal_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dao_proposals_chain_execution_tx_unique": {
+ "name": "dao_proposals_chain_execution_tx_unique",
+ "columns": [
+ {
+ "expression": "chain_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"execution_tx_hash\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dao_proposals_executed_at_idx": {
+ "name": "dao_proposals_executed_at_idx",
+ "columns": [
+ {
+ "expression": "executed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dao_proposals_status_idx": {
+ "name": "dao_proposals_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.entities": {
+ "name": "entities",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "type": {
+ "name": "type",
+ "type": "entity_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name_encrypted": {
+ "name": "name_encrypted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "website_encrypted": {
+ "name": "website_encrypted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes_encrypted": {
+ "name": "notes_encrypted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_member": {
+ "name": "is_member",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "entities_type_idx": {
+ "name": "entities_type_idx",
+ "columns": [
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "entities_archived_at_idx": {
+ "name": "entities_archived_at_idx",
+ "columns": [
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.entity_addresses": {
+ "name": "entity_addresses",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "entity_id": {
+ "name": "entity_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "address": {
+ "name": "address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "chain_id": {
+ "name": "chain_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "label_encrypted": {
+ "name": "label_encrypted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "entity_addresses_entity_id_idx": {
+ "name": "entity_addresses_entity_id_idx",
+ "columns": [
+ {
+ "expression": "entity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "entity_addresses_address_idx": {
+ "name": "entity_addresses_address_idx",
+ "columns": [
+ {
+ "expression": "address",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "entity_addresses_chain_address_unique": {
+ "name": "entity_addresses_chain_address_unique",
+ "columns": [
+ {
+ "expression": "coalesce(\"chain_id\", -1)",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"address\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "entity_addresses_entity_id_entities_id_fk": {
+ "name": "entity_addresses_entity_id_entities_id_fk",
+ "tableFrom": "entity_addresses",
+ "tableTo": "entities",
+ "columnsFrom": [
+ "entity_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.ledger_entries": {
+ "name": "ledger_entries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "quarter_id": {
+ "name": "quarter_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "ledger_source",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_external_id": {
+ "name": "source_external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "category": {
+ "name": "category",
+ "type": "ledger_category",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'uncategorized'"
+ },
+ "verification_status": {
+ "name": "verification_status",
+ "type": "verification_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'verified'"
+ },
+ "occurred_at": {
+ "name": "occurred_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "chain_id": {
+ "name": "chain_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tx_hash": {
+ "name": "tx_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "treasury_account_id": {
+ "name": "treasury_account_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "treasury_transaction_transfer_id": {
+ "name": "treasury_transaction_transfer_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "asset_symbol": {
+ "name": "asset_symbol",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "asset_amount": {
+ "name": "asset_amount",
+ "type": "numeric(36, 18)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "usd_amount": {
+ "name": "usd_amount",
+ "type": "numeric(18, 2)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "counterparty_entity_id": {
+ "name": "counterparty_entity_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "raid_id": {
+ "name": "raid_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rip_id": {
+ "name": "rip_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes_encrypted": {
+ "name": "notes_encrypted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_metadata": {
+ "name": "source_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "ledger_entries_quarter_id_idx": {
+ "name": "ledger_entries_quarter_id_idx",
+ "columns": [
+ {
+ "expression": "quarter_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "ledger_entries_category_idx": {
+ "name": "ledger_entries_category_idx",
+ "columns": [
+ {
+ "expression": "category",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "ledger_entries_source_external_id_unique": {
+ "name": "ledger_entries_source_external_id_unique",
+ "columns": [
+ {
+ "expression": "source_external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "ledger_entries_tx_hash_idx": {
+ "name": "ledger_entries_tx_hash_idx",
+ "columns": [
+ {
+ "expression": "tx_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "ledger_entries_treasury_transfer_unique": {
+ "name": "ledger_entries_treasury_transfer_unique",
+ "columns": [
+ {
+ "expression": "treasury_transaction_transfer_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "ledger_entries_raid_id_idx": {
+ "name": "ledger_entries_raid_id_idx",
+ "columns": [
+ {
+ "expression": "raid_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "ledger_entries_rip_id_idx": {
+ "name": "ledger_entries_rip_id_idx",
+ "columns": [
+ {
+ "expression": "rip_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "ledger_entries_occurred_at_idx": {
+ "name": "ledger_entries_occurred_at_idx",
+ "columns": [
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "ledger_entries_quarter_id_quarters_id_fk": {
+ "name": "ledger_entries_quarter_id_quarters_id_fk",
+ "tableFrom": "ledger_entries",
+ "tableTo": "quarters",
+ "columnsFrom": [
+ "quarter_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "ledger_entries_treasury_account_id_treasury_accounts_id_fk": {
+ "name": "ledger_entries_treasury_account_id_treasury_accounts_id_fk",
+ "tableFrom": "ledger_entries",
+ "tableTo": "treasury_accounts",
+ "columnsFrom": [
+ "treasury_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "ledger_entries_treasury_transaction_transfer_id_treasury_transaction_transfers_id_fk": {
+ "name": "ledger_entries_treasury_transaction_transfer_id_treasury_transaction_transfers_id_fk",
+ "tableFrom": "ledger_entries",
+ "tableTo": "treasury_transaction_transfers",
+ "columnsFrom": [
+ "treasury_transaction_transfer_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "ledger_entries_counterparty_entity_id_entities_id_fk": {
+ "name": "ledger_entries_counterparty_entity_id_entities_id_fk",
+ "tableFrom": "ledger_entries",
+ "tableTo": "entities",
+ "columnsFrom": [
+ "counterparty_entity_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "ledger_entries_raid_id_raids_id_fk": {
+ "name": "ledger_entries_raid_id_raids_id_fk",
+ "tableFrom": "ledger_entries",
+ "tableTo": "raids",
+ "columnsFrom": [
+ "raid_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "ledger_entries_rip_id_rips_id_fk": {
+ "name": "ledger_entries_rip_id_rips_id_fk",
+ "tableFrom": "ledger_entries",
+ "tableTo": "rips",
+ "columnsFrom": [
+ "rip_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.membership_activities": {
+ "name": "membership_activities",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "quarter_id": {
+ "name": "quarter_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dao_proposal_id": {
+ "name": "dao_proposal_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "membership_activity_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "dao_address": {
+ "name": "dao_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "chain_id": {
+ "name": "chain_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "member_address": {
+ "name": "member_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "recipient_address": {
+ "name": "recipient_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tx_hash": {
+ "name": "tx_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "executed_at": {
+ "name": "executed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "proposal_id": {
+ "name": "proposal_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "proposal_title": {
+ "name": "proposal_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "asset_address": {
+ "name": "asset_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "asset_symbol": {
+ "name": "asset_symbol",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "asset_amount": {
+ "name": "asset_amount",
+ "type": "numeric(36, 18)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "usd_amount": {
+ "name": "usd_amount",
+ "type": "numeric(18, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "shares": {
+ "name": "shares",
+ "type": "numeric(36, 18)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "loot": {
+ "name": "loot",
+ "type": "numeric(36, 18)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "raw_metadata": {
+ "name": "raw_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "membership_activities_chain_tx_type_member_unique": {
+ "name": "membership_activities_chain_tx_type_member_unique",
+ "columns": [
+ {
+ "expression": "chain_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"tx_hash\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"member_address\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "membership_activities_quarter_id_idx": {
+ "name": "membership_activities_quarter_id_idx",
+ "columns": [
+ {
+ "expression": "quarter_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "membership_activities_dao_proposal_id_idx": {
+ "name": "membership_activities_dao_proposal_id_idx",
+ "columns": [
+ {
+ "expression": "dao_proposal_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "membership_activities_executed_at_idx": {
+ "name": "membership_activities_executed_at_idx",
+ "columns": [
+ {
+ "expression": "executed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "membership_activities_type_idx": {
+ "name": "membership_activities_type_idx",
+ "columns": [
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "membership_activities_member_address_idx": {
+ "name": "membership_activities_member_address_idx",
+ "columns": [
+ {
+ "expression": "member_address",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "membership_activities_quarter_id_quarters_id_fk": {
+ "name": "membership_activities_quarter_id_quarters_id_fk",
+ "tableFrom": "membership_activities",
+ "tableTo": "quarters",
+ "columnsFrom": [
+ "quarter_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "membership_activities_dao_proposal_id_dao_proposals_id_fk": {
+ "name": "membership_activities_dao_proposal_id_dao_proposals_id_fk",
+ "tableFrom": "membership_activities",
+ "tableTo": "dao_proposals",
+ "columnsFrom": [
+ "dao_proposal_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.quarter_balance_snapshots": {
+ "name": "quarter_balance_snapshots",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "quarter_id": {
+ "name": "quarter_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "treasury_account_id": {
+ "name": "treasury_account_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "boundary": {
+ "name": "boundary",
+ "type": "quarter_balance_boundary",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_address": {
+ "name": "account_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "chain_id": {
+ "name": "chain_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "block_number": {
+ "name": "block_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "block_timestamp": {
+ "name": "block_timestamp",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "symbol": {
+ "name": "symbol",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "decimals": {
+ "name": "decimals",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "raw_amount": {
+ "name": "raw_amount",
+ "type": "numeric(78, 0)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "balance": {
+ "name": "balance",
+ "type": "numeric(36, 18)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "usd_price": {
+ "name": "usd_price",
+ "type": "numeric(18, 8)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "usd_value": {
+ "name": "usd_value",
+ "type": "numeric(18, 2)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "price_source": {
+ "name": "price_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "quarter_balance_snapshots_quarter_boundary_idx": {
+ "name": "quarter_balance_snapshots_quarter_boundary_idx",
+ "columns": [
+ {
+ "expression": "quarter_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "boundary",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "quarter_balance_snapshots_unique": {
+ "name": "quarter_balance_snapshots_unique",
+ "columns": [
+ {
+ "expression": "quarter_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "boundary",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "chain_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"account_address\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "symbol",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "quarter_balance_snapshots_quarter_id_quarters_id_fk": {
+ "name": "quarter_balance_snapshots_quarter_id_quarters_id_fk",
+ "tableFrom": "quarter_balance_snapshots",
+ "tableTo": "quarters",
+ "columnsFrom": [
+ "quarter_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "quarter_balance_snapshots_treasury_account_id_treasury_accounts_id_fk": {
+ "name": "quarter_balance_snapshots_treasury_account_id_treasury_accounts_id_fk",
+ "tableFrom": "quarter_balance_snapshots",
+ "tableTo": "treasury_accounts",
+ "columnsFrom": [
+ "treasury_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.quarter_balance_validations": {
+ "name": "quarter_balance_validations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "quarter_id": {
+ "name": "quarter_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "quarter_balance_validation_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "checked_count": {
+ "name": "checked_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "variance_count": {
+ "name": "variance_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "excluded_count": {
+ "name": "excluded_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "total_variance_usd": {
+ "name": "total_variance_usd",
+ "type": "numeric(18, 2)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'0'"
+ },
+ "details": {
+ "name": "details",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "acknowledgement_note_encrypted": {
+ "name": "acknowledgement_note_encrypted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "acknowledged_by_wallet_address": {
+ "name": "acknowledged_by_wallet_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "acknowledged_at": {
+ "name": "acknowledged_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_sync_run_id": {
+ "name": "source_sync_run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "quarter_balance_validations_quarter_id_unique": {
+ "name": "quarter_balance_validations_quarter_id_unique",
+ "columns": [
+ {
+ "expression": "quarter_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "quarter_balance_validations_status_idx": {
+ "name": "quarter_balance_validations_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "quarter_balance_validations_quarter_id_quarters_id_fk": {
+ "name": "quarter_balance_validations_quarter_id_quarters_id_fk",
+ "tableFrom": "quarter_balance_validations",
+ "tableTo": "quarters",
+ "columnsFrom": [
+ "quarter_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.quarter_sync_statuses": {
+ "name": "quarter_sync_statuses",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "quarter_id": {
+ "name": "quarter_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "overall_status": {
+ "name": "overall_status",
+ "type": "quarter_sync_overall_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'idle'"
+ },
+ "current_step": {
+ "name": "current_step",
+ "type": "quarter_sync_step",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transactions_status": {
+ "name": "transactions_status",
+ "type": "quarter_sync_step_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "proposals_status": {
+ "name": "proposals_status",
+ "type": "quarter_sync_step_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "membership_status": {
+ "name": "membership_status",
+ "type": "quarter_sync_step_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "balances_status": {
+ "name": "balances_status",
+ "type": "quarter_sync_step_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "finalize_status": {
+ "name": "finalize_status",
+ "type": "quarter_sync_step_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "transactions_started_at": {
+ "name": "transactions_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transactions_completed_at": {
+ "name": "transactions_completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "proposals_started_at": {
+ "name": "proposals_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "proposals_completed_at": {
+ "name": "proposals_completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "membership_started_at": {
+ "name": "membership_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "membership_completed_at": {
+ "name": "membership_completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "balances_started_at": {
+ "name": "balances_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "balances_completed_at": {
+ "name": "balances_completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finalize_started_at": {
+ "name": "finalize_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finalize_completed_at": {
+ "name": "finalize_completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transactions_error": {
+ "name": "transactions_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "proposals_error": {
+ "name": "proposals_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "membership_error": {
+ "name": "membership_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "balances_error": {
+ "name": "balances_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finalize_error": {
+ "name": "finalize_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "imported_transactions": {
+ "name": "imported_transactions",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "imported_transfers": {
+ "name": "imported_transfers",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "scanned_transfers": {
+ "name": "scanned_transfers",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "sync_error_count": {
+ "name": "sync_error_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "proposal_linked_transactions": {
+ "name": "proposal_linked_transactions",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "proposal_matches": {
+ "name": "proposal_matches",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "membership_activities": {
+ "name": "membership_activities",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_synced_at": {
+ "name": "last_synced_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "quarter_sync_statuses_quarter_id_unique": {
+ "name": "quarter_sync_statuses_quarter_id_unique",
+ "columns": [
+ {
+ "expression": "quarter_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "quarter_sync_statuses_overall_status_idx": {
+ "name": "quarter_sync_statuses_overall_status_idx",
+ "columns": [
+ {
+ "expression": "overall_status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "quarter_sync_statuses_last_synced_at_idx": {
+ "name": "quarter_sync_statuses_last_synced_at_idx",
+ "columns": [
+ {
+ "expression": "last_synced_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "quarter_sync_statuses_quarter_id_quarters_id_fk": {
+ "name": "quarter_sync_statuses_quarter_id_quarters_id_fk",
+ "tableFrom": "quarter_sync_statuses",
+ "tableTo": "quarters",
+ "columnsFrom": [
+ "quarter_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.quarters": {
+ "name": "quarters",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "year": {
+ "name": "year",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "quarter": {
+ "name": "quarter",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "starts_on": {
+ "name": "starts_on",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ends_on": {
+ "name": "ends_on",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "quarter_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'draft'"
+ },
+ "published_at": {
+ "name": "published_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reopened_at": {
+ "name": "reopened_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "quarters_year_quarter_unique": {
+ "name": "quarters_year_quarter_unique",
+ "columns": [
+ {
+ "expression": "year",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "quarter",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "quarters_status_idx": {
+ "name": "quarters_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.raids": {
+ "name": "raids",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "client_entity_id": {
+ "name": "client_entity_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name_encrypted": {
+ "name": "name_encrypted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "notes_encrypted": {
+ "name": "notes_encrypted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "raids_client_entity_id_idx": {
+ "name": "raids_client_entity_id_idx",
+ "columns": [
+ {
+ "expression": "client_entity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "raids_archived_at_idx": {
+ "name": "raids_archived_at_idx",
+ "columns": [
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "raids_client_entity_id_entities_id_fk": {
+ "name": "raids_client_entity_id_entities_id_fk",
+ "tableFrom": "raids",
+ "tableTo": "entities",
+ "columnsFrom": [
+ "client_entity_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.rips": {
+ "name": "rips",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "title_encrypted": {
+ "name": "title_encrypted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url_encrypted": {
+ "name": "url_encrypted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_wallet_address": {
+ "name": "created_by_wallet_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "rips_created_at_idx": {
+ "name": "rips_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "rips_created_by_wallet_address_idx": {
+ "name": "rips_created_by_wallet_address_idx",
+ "columns": [
+ {
+ "expression": "lower(\"created_by_wallet_address\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.treasury_accounts": {
+ "name": "treasury_accounts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name_encrypted": {
+ "name": "name_encrypted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "address": {
+ "name": "address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "chain_id": {
+ "name": "chain_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "treasury_account_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_dao_controlled": {
+ "name": "is_dao_controlled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "notes_encrypted": {
+ "name": "notes_encrypted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "treasury_accounts_chain_address_unique": {
+ "name": "treasury_accounts_chain_address_unique",
+ "columns": [
+ {
+ "expression": "chain_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "address",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "treasury_accounts_type_idx": {
+ "name": "treasury_accounts_type_idx",
+ "columns": [
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "treasury_accounts_archived_at_idx": {
+ "name": "treasury_accounts_archived_at_idx",
+ "columns": [
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.treasury_balance_assets": {
+ "name": "treasury_balance_assets",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "snapshot_id": {
+ "name": "snapshot_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "symbol": {
+ "name": "symbol",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "decimals": {
+ "name": "decimals",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "raw_amount": {
+ "name": "raw_amount",
+ "type": "numeric(78, 0)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "balance": {
+ "name": "balance",
+ "type": "numeric(36, 18)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "usd_price": {
+ "name": "usd_price",
+ "type": "numeric(18, 8)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "usd_value": {
+ "name": "usd_value",
+ "type": "numeric(18, 2)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "treasury_balance_assets_snapshot_id_idx": {
+ "name": "treasury_balance_assets_snapshot_id_idx",
+ "columns": [
+ {
+ "expression": "snapshot_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "treasury_balance_assets_snapshot_symbol_unique": {
+ "name": "treasury_balance_assets_snapshot_symbol_unique",
+ "columns": [
+ {
+ "expression": "snapshot_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "symbol",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "treasury_balance_assets_snapshot_id_treasury_balance_snapshots_id_fk": {
+ "name": "treasury_balance_assets_snapshot_id_treasury_balance_snapshots_id_fk",
+ "tableFrom": "treasury_balance_assets",
+ "tableTo": "treasury_balance_snapshots",
+ "columnsFrom": [
+ "snapshot_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.treasury_balance_snapshots": {
+ "name": "treasury_balance_snapshots",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "account_address": {
+ "name": "account_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "chain_id": {
+ "name": "chain_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "treasury_snapshot_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "total_usd": {
+ "name": "total_usd",
+ "type": "numeric(18, 2)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "synced_at": {
+ "name": "synced_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "treasury_balance_snapshots_chain_account_synced_idx": {
+ "name": "treasury_balance_snapshots_chain_account_synced_idx",
+ "columns": [
+ {
+ "expression": "chain_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "account_address",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "synced_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "treasury_balance_snapshots_synced_at_idx": {
+ "name": "treasury_balance_snapshots_synced_at_idx",
+ "columns": [
+ {
+ "expression": "synced_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.treasury_transaction_transfers": {
+ "name": "treasury_transaction_transfers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "treasury_transaction_id": {
+ "name": "treasury_transaction_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "treasury_account_id": {
+ "name": "treasury_account_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transfer_id": {
+ "name": "transfer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "direction": {
+ "name": "direction",
+ "type": "treasury_transfer_direction",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "transfer_type": {
+ "name": "transfer_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_address": {
+ "name": "account_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "chain_id": {
+ "name": "chain_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tx_hash": {
+ "name": "tx_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "executed_at": {
+ "name": "executed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "from_address": {
+ "name": "from_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "to_address": {
+ "name": "to_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token_address": {
+ "name": "token_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "asset_symbol": {
+ "name": "asset_symbol",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "asset_name": {
+ "name": "asset_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "decimals": {
+ "name": "decimals",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "raw_amount": {
+ "name": "raw_amount",
+ "type": "numeric(78, 0)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount": {
+ "name": "amount",
+ "type": "numeric(36, 18)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "usd_price": {
+ "name": "usd_price",
+ "type": "numeric(18, 8)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "usd_amount": {
+ "name": "usd_amount",
+ "type": "numeric(18, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "raw_metadata": {
+ "name": "raw_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "treasury_transaction_transfers_chain_transfer_unique": {
+ "name": "treasury_transaction_transfers_chain_transfer_unique",
+ "columns": [
+ {
+ "expression": "chain_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"account_address\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "transfer_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "treasury_transaction_transfers_transaction_id_idx": {
+ "name": "treasury_transaction_transfers_transaction_id_idx",
+ "columns": [
+ {
+ "expression": "treasury_transaction_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "treasury_transaction_transfers_treasury_account_id_idx": {
+ "name": "treasury_transaction_transfers_treasury_account_id_idx",
+ "columns": [
+ {
+ "expression": "treasury_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "treasury_transaction_transfers_tx_hash_idx": {
+ "name": "treasury_transaction_transfers_tx_hash_idx",
+ "columns": [
+ {
+ "expression": "tx_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "treasury_transaction_transfers_executed_at_idx": {
+ "name": "treasury_transaction_transfers_executed_at_idx",
+ "columns": [
+ {
+ "expression": "executed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "treasury_transaction_transfers_treasury_transaction_id_treasury_transactions_id_fk": {
+ "name": "treasury_transaction_transfers_treasury_transaction_id_treasury_transactions_id_fk",
+ "tableFrom": "treasury_transaction_transfers",
+ "tableTo": "treasury_transactions",
+ "columnsFrom": [
+ "treasury_transaction_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "treasury_transaction_transfers_treasury_account_id_treasury_accounts_id_fk": {
+ "name": "treasury_transaction_transfers_treasury_account_id_treasury_accounts_id_fk",
+ "tableFrom": "treasury_transaction_transfers",
+ "tableTo": "treasury_accounts",
+ "columnsFrom": [
+ "treasury_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.treasury_transactions": {
+ "name": "treasury_transactions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "dao_proposal_id": {
+ "name": "dao_proposal_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "treasury_account_id": {
+ "name": "treasury_account_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "ledger_source",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_address": {
+ "name": "account_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "chain_id": {
+ "name": "chain_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tx_hash": {
+ "name": "tx_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "safe_transaction_hash": {
+ "name": "safe_transaction_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transaction_type": {
+ "name": "transaction_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "executed_at": {
+ "name": "executed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "block_number": {
+ "name": "block_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "raw_metadata": {
+ "name": "raw_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "imported_at": {
+ "name": "imported_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "treasury_transactions_chain_account_tx_unique": {
+ "name": "treasury_transactions_chain_account_tx_unique",
+ "columns": [
+ {
+ "expression": "chain_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"account_address\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"tx_hash\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "treasury_transactions_tx_hash_idx": {
+ "name": "treasury_transactions_tx_hash_idx",
+ "columns": [
+ {
+ "expression": "tx_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "treasury_transactions_account_executed_idx": {
+ "name": "treasury_transactions_account_executed_idx",
+ "columns": [
+ {
+ "expression": "chain_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "account_address",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "executed_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "treasury_transactions_treasury_account_id_idx": {
+ "name": "treasury_transactions_treasury_account_id_idx",
+ "columns": [
+ {
+ "expression": "treasury_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "treasury_transactions_dao_proposal_id_idx": {
+ "name": "treasury_transactions_dao_proposal_id_idx",
+ "columns": [
+ {
+ "expression": "dao_proposal_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "treasury_transactions_dao_proposal_id_dao_proposals_id_fk": {
+ "name": "treasury_transactions_dao_proposal_id_dao_proposals_id_fk",
+ "tableFrom": "treasury_transactions",
+ "tableTo": "dao_proposals",
+ "columnsFrom": [
+ "dao_proposal_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "treasury_transactions_treasury_account_id_treasury_accounts_id_fk": {
+ "name": "treasury_transactions_treasury_account_id_treasury_accounts_id_fk",
+ "tableFrom": "treasury_transactions",
+ "tableTo": "treasury_accounts",
+ "columnsFrom": [
+ "treasury_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {
+ "public.audit_action": {
+ "name": "audit_action",
+ "schema": "public",
+ "values": [
+ "create",
+ "update",
+ "delete",
+ "import",
+ "classify",
+ "publish",
+ "reopen",
+ "grant_role",
+ "revoke_role"
+ ]
+ },
+ "public.entity_type": {
+ "name": "entity_type",
+ "schema": "public",
+ "values": [
+ "client",
+ "provider",
+ "subcontractor"
+ ]
+ },
+ "public.ledger_category": {
+ "name": "ledger_category",
+ "schema": "public",
+ "values": [
+ "raid_revenue",
+ "raid_spoils",
+ "subcontractor_payout",
+ "rip_expense",
+ "provider_expense",
+ "member_dues",
+ "ragequit",
+ "treasury_transfer",
+ "uncategorized"
+ ]
+ },
+ "public.ledger_source": {
+ "name": "ledger_source",
+ "schema": "public",
+ "values": [
+ "main_safe",
+ "side_vault",
+ "operator",
+ "manual",
+ "bank_csv",
+ "dao_proposal"
+ ]
+ },
+ "public.membership_activity_type": {
+ "name": "membership_activity_type",
+ "schema": "public",
+ "values": [
+ "join",
+ "ragequit"
+ ]
+ },
+ "public.quarter_balance_boundary": {
+ "name": "quarter_balance_boundary",
+ "schema": "public",
+ "values": [
+ "opening",
+ "closing"
+ ]
+ },
+ "public.quarter_balance_validation_status": {
+ "name": "quarter_balance_validation_status",
+ "schema": "public",
+ "values": [
+ "not_ready",
+ "needs_review",
+ "validated",
+ "acknowledged"
+ ]
+ },
+ "public.quarter_status": {
+ "name": "quarter_status",
+ "schema": "public",
+ "values": [
+ "draft",
+ "ready_for_review",
+ "published",
+ "reopened"
+ ]
+ },
+ "public.quarter_sync_overall_status": {
+ "name": "quarter_sync_overall_status",
+ "schema": "public",
+ "values": [
+ "idle",
+ "running",
+ "success",
+ "partial",
+ "failed"
+ ]
+ },
+ "public.quarter_sync_step": {
+ "name": "quarter_sync_step",
+ "schema": "public",
+ "values": [
+ "transactions",
+ "proposals",
+ "membership",
+ "balances",
+ "finalize"
+ ]
+ },
+ "public.quarter_sync_step_status": {
+ "name": "quarter_sync_step_status",
+ "schema": "public",
+ "values": [
+ "pending",
+ "running",
+ "success",
+ "failed"
+ ]
+ },
+ "public.treasury_account_type": {
+ "name": "treasury_account_type",
+ "schema": "public",
+ "values": [
+ "main_safe",
+ "side_vault",
+ "operator",
+ "bank"
+ ]
+ },
+ "public.treasury_snapshot_status": {
+ "name": "treasury_snapshot_status",
+ "schema": "public",
+ "values": [
+ "pending_live_sync",
+ "synced",
+ "stale_syncing",
+ "partial",
+ "failed"
+ ]
+ },
+ "public.treasury_transfer_direction": {
+ "name": "treasury_transfer_direction",
+ "schema": "public",
+ "values": [
+ "inflow",
+ "outflow",
+ "internal"
+ ]
+ },
+ "public.verification_status": {
+ "name": "verification_status",
+ "schema": "public",
+ "values": [
+ "verified",
+ "unverified"
+ ]
+ }
+ },
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json
index 533ac45..2969331 100644
--- a/drizzle/meta/_journal.json
+++ b/drizzle/meta/_journal.json
@@ -120,6 +120,13 @@
"when": 1781746972671,
"tag": "0016_rapid_loa",
"breakpoints": true
+ },
+ {
+ "idx": 17,
+ "version": "7",
+ "when": 1781793308630,
+ "tag": "0017_happy_silver_fox",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/src/app/admin/quarters/[id]/transactions/actions.ts b/src/app/admin/quarters/[id]/transactions/actions.ts
index e0743be..840ad52 100644
--- a/src/app/admin/quarters/[id]/transactions/actions.ts
+++ b/src/app/admin/quarters/[id]/transactions/actions.ts
@@ -32,6 +32,11 @@ import {
} from "@/lib/core-entity-mutations";
import { syncMembershipActivitiesForPeriod } from "@/lib/membership-activity";
import { syncQuarterBalances } from "@/lib/quarter-balances";
+import {
+ acknowledgeQuarterBalanceValidation,
+ deleteQuarterBalanceValidation,
+ runQuarterBalanceValidation,
+} from "@/lib/quarter-balance-validation";
import {
assertClassificationEntityMatchesCategory,
assertRaidIsAvailable,
@@ -49,6 +54,7 @@ import {
startOrResumeQuarterSync,
type QuarterSyncStatus,
} from "@/lib/quarter-sync";
+import { getQuarterClassificationSummary } from "@/lib/quarters";
import { assertRipIsAvailable } from "@/lib/rips";
import { syncTreasuryTransactions } from "@/lib/treasury/transactions";
@@ -594,6 +600,7 @@ export async function confirmBankCsvImport(
summary: "Imported bank CSV rows",
});
+ await invalidateQuarterValidation(quarter.id);
revalidatePath("/admin/quarters");
revalidatePath(getTransactionsPath(quarter.id));
@@ -698,6 +705,7 @@ export async function createManualProviderExpense(
summary: "Created manual provider expense",
});
+ await invalidateQuarterValidation(quarter.id);
revalidatePath("/admin/quarters");
revalidatePath(getTransactionsPath(quarter.id));
@@ -781,6 +789,7 @@ export async function syncQuarterTransactions(formData: FormData) {
throw new Error("Quarter is required");
}
+ await invalidateQuarterValidation(quarterId);
let status = await startQuarterSync(quarterId);
status = await syncQuarterTransactionsStep({
quarterId,
@@ -818,10 +827,18 @@ export async function syncQuarterTransactions(formData: FormData) {
function revalidateQuarterSyncPaths(quarterId: string) {
revalidatePath("/admin/quarters");
revalidatePath(getTransactionsPath(quarterId));
+ revalidatePath("/reports");
+ revalidatePath(`/reports/quarters/${quarterId}`);
revalidatePath("/proposals");
revalidatePath("/membership");
}
+async function invalidateQuarterValidation(quarterId: string) {
+ await deleteQuarterBalanceValidation(quarterId);
+ revalidatePath("/reports");
+ revalidatePath(`/reports/quarters/${quarterId}`);
+}
+
function throwIfStepFailed(status: QuarterSyncStatus, step: string) {
const error =
step === "transactions"
@@ -839,6 +856,83 @@ function throwIfStepFailed(status: QuarterSyncStatus, step: string) {
}
}
+export async function runBalanceValidation(formData: FormData) {
+ const session = await requireAdminSession();
+ const quarterId = getString(formData, "quarterId");
+
+ if (!quarterId) {
+ throw new Error("Quarter is required");
+ }
+
+ const quarter = await getQuarterById(quarterId);
+ const [classificationSummary, syncStatus] = await Promise.all([
+ getQuarterClassificationSummary({
+ endsOn: quarter.endsOn,
+ startsOn: quarter.startsOn,
+ }),
+ getQuarterSyncStatus(quarterId),
+ ]);
+ const validation = await runQuarterBalanceValidation({
+ classificationSummary,
+ quarter,
+ syncStatus,
+ });
+
+ await writeAuditEvent({
+ action: "update",
+ actorWalletAddress: session.address,
+ metadata: {
+ excludedCount: validation.excludedCount,
+ status: validation.status,
+ varianceCount: validation.varianceCount,
+ },
+ quarterId,
+ subjectId: validation.id,
+ subjectTable: "quarter_balance_validations",
+ summary: "Ran quarter balance validation",
+ });
+
+ revalidateQuarterSyncPaths(quarterId);
+ redirect(`${getTransactionsPath(quarterId)}?validation=${validation.status}`);
+}
+
+export async function acknowledgeBalanceVariance(formData: FormData) {
+ const session = await requireAdminSession();
+ const walletAddress = session.address;
+ const quarterId = getString(formData, "quarterId");
+ const note = getString(formData, "note");
+
+ if (!quarterId) {
+ throw new Error("Quarter is required");
+ }
+
+ if (!walletAddress) {
+ throw new Error("Admin wallet address is required");
+ }
+
+ const validation = await acknowledgeQuarterBalanceValidation({
+ note,
+ quarterId,
+ walletAddress,
+ });
+
+ await writeAuditEvent({
+ action: "update",
+ actorWalletAddress: walletAddress,
+ metadata: {
+ excludedCount: validation.excludedCount,
+ varianceCount: validation.varianceCount,
+ },
+ quarterId,
+ subjectId: validation.id,
+ subjectTable: "quarter_balance_validations",
+ summary: "Acknowledged quarter balance variance",
+ });
+
+ revalidateQuarterSyncPaths(quarterId);
+ redirect(`${getTransactionsPath(quarterId)}?validation=acknowledged`);
+}
+
export async function startQuarterSync(quarterId: string) {
await requireAdminSession();
@@ -1229,8 +1323,11 @@ export async function classifyQuarterTransfer(formData: FormData) {
summary: "Saved transaction classification",
});
+ await invalidateQuarterValidation(quarterId);
revalidatePath("/admin/quarters");
revalidatePath(getTransactionsPath(quarterId));
+ revalidatePath("/reports");
+ revalidatePath(`/reports/quarters/${quarterId}`);
const params = new URLSearchParams({
classified: "1",
@@ -1344,8 +1441,11 @@ export async function updateLedgerEntryClassification(formData: FormData) {
summary: "Updated ledger entry classification",
});
+ await invalidateQuarterValidation(quarterId);
revalidatePath("/admin/quarters");
revalidatePath(getTransactionsPath(quarterId));
+ revalidatePath("/reports");
+ revalidatePath(`/reports/quarters/${quarterId}`);
const params = new URLSearchParams({
classified: "1",
diff --git a/src/app/admin/quarters/[id]/transactions/page.tsx b/src/app/admin/quarters/[id]/transactions/page.tsx
index 51afb34..0e16b6b 100644
--- a/src/app/admin/quarters/[id]/transactions/page.tsx
+++ b/src/app/admin/quarters/[id]/transactions/page.tsx
@@ -18,8 +18,11 @@ import { Button } from "@/components/ui/button";
import { BankCsvImportPanel } from "@/app/admin/quarters/[id]/transactions/bank-csv-import-panel";
import { ClassificationLinkedFields } from "@/app/admin/quarters/[id]/transactions/classification-linked-fields";
import { ManualProviderExpenseButton } from "@/app/admin/quarters/[id]/transactions/manual-provider-expense-panel";
+import { updateQuarterStatus } from "@/app/admin/quarters/actions";
import {
+ acknowledgeBalanceVariance,
classifyQuarterTransfer,
+ runBalanceValidation,
updateLedgerEntryClassification,
} from "@/app/admin/quarters/[id]/transactions/actions";
import { RemoveManualLedgerEntryForm } from "@/app/raids/remove-manual-revenue-form";
@@ -44,6 +47,11 @@ import {
type QuarterBalanceRow,
type QuarterAccountBalanceSummary,
} from "@/lib/quarter-balances";
+import {
+ getQuarterBalanceValidation,
+ getQuarterValidationReadiness,
+ type QuarterBalanceValidation,
+} from "@/lib/quarter-balance-validation";
import {
getCategoryLabel,
IMPORTED_TRANSFER_CLASSIFICATION_CATEGORIES,
@@ -346,6 +354,233 @@ function QuarterBalancesPanel({
);
}
+function BalanceValidationPanel({
+ canRun,
+ readinessReason,
+ validation,
+ quarterId,
+ quarterStatus,
+}: {
+ canRun: boolean;
+ readinessReason: string | null;
+ validation: QuarterBalanceValidation | null;
+ quarterId: string;
+ quarterStatus: QuarterSummary["status"];
+}) {
+ const status = validation?.status ?? "not_ready";
+ const statusCopy =
+ status === "validated"
+ ? {
+ label: "Validated",
+ tone: "border-emerald-600/25 bg-emerald-600/10 text-emerald-800",
+ }
+ : status === "acknowledged"
+ ? {
+ label: "Acknowledged",
+ tone: "border-amber-500/30 bg-amber-500/10 text-amber-800",
+ }
+ : status === "needs_review"
+ ? {
+ label: "Needs Review",
+ tone: "border-primary/25 bg-primary/10 text-primary",
+ }
+ : {
+ label: "Not Ready",
+ tone: "border-border bg-background text-muted-foreground",
+ };
+ const topVariances = validation?.details.variances.slice(0, 5) ?? [];
+ const validationSatisfied =
+ validation?.status === "validated" || validation?.status === "acknowledged";
+ const canMarkReady =
+ validationSatisfied &&
+ quarterStatus !== "ready_for_review" &&
+ quarterStatus !== "published";
+
+ return (
+
+ Balance Validation
+
+ Compare opening balances plus classified token movement against
+ synced closing balances.
+ {variance.accountName}
+ {formatAddress(variance.accountAddress)}
+ {row.reason}
+ {row.source} · {getCategoryLabel(row.category as LedgerCategory)} ·{" "}
+ {formatTokenAmount(row.assetAmount)} {row.assetSymbol}
+ Variance acknowledged
+ {validation.acknowledgementNote}
+
+ {validation.acknowledgedByWalletAddress
+ ? formatAddress(validation.acknowledgedByWalletAddress)
+ : "Unknown wallet"}
+ {validation.acknowledgedAt
+ ? ` · ${formatTimestamp(validation.acknowledgedAt)}`
+ : ""}
+ {readinessReason}
+ Reconcile ledger activity
+
+
+
+ ) : null}
+
+ {topVariances.length > 0 ? (
+
+
+
+
+
+
+
+ {topVariances.map((variance) => (
+ Account
+ Asset
+ Opening
+ Movement
+ Expected
+ Actual
+ Difference
+
+
+ ))}
+
+
+
+
+ {variance.assetSymbol}
+
+ {variance.opening}
+ {variance.movement}
+
+ {variance.expectedClosing}
+
+
+ {variance.actualClosing}
+
+
+ {variance.difference}
+
+
+ {validation.details.excludedRows.length} excluded ledger row
+ {validation.details.excludedRows.length === 1 ? "" : "s"}
+
+
+ {validation.details.excludedRows.slice(0, 8).map((row) => (
+
+
Reports
+Reports
++ Published accounting reports for member review and export. +
++ {formatDate(quarter.startsOn)} -{" "} + {formatDate(quarter.endsOn)} +
++ {quarter.publishedAt + ? `Published ${formatTimestamp(quarter.publishedAt)}` + : "Ready for publication preview"} +
+ +Quarter Report
+{message}
+{label}
+{formatCurrency(value)}
+ {detail ? ( ++ {detail} +
+ ) : null} +| Name | +Entries | +Total | +
|---|---|---|
| Total | ++ {totals.entries} + | ++ {formatCurrency(totals.totalUsd)} + | +
| + {row.label} + | +{row.entries} | ++ {formatCurrency(row.totalUsd)} + | +
Balances
+| Account | +Opening | +Closing | ++ Net Change + | +
|---|---|---|---|
| Total | ++ {formatCurrency(total.openingUsd)} + | ++ {formatCurrency(total.closingUsd)} + | ++ {formatCurrency(total.netChangeUsd)} + | +
|
+ {balance.accountName} ++ {formatAddress(balance.accountAddress)} + + |
+ + {formatCurrency(balance.openingUsd)} + | ++ {formatCurrency(balance.closingUsd)} + | ++ {formatCurrency(balance.netChangeUsd)} + | +
+ Quarter Report +
++ {formatDate(quarter.startsOn)} - {formatDate(quarter.endsOn)} +
+ {quarter.publishedAt ? ( ++ Published {formatTimestamp(quarter.publishedAt)} +
+ ) : null} ++ Balance Validation +
++ {quarter.balanceValidation?.status === "acknowledged" + ? "Published with acknowledged variance." + : "Balances validated against classified ledger activity."} +
+Ledger
++ Download the XLSX export for the full ledger, balances, proposals, + membership events, RIPs, and provider expense tabs. +
+- Current Treasury Balance -
-- {formatCurrency(snapshot.totalUsd)} -
-{syncCopy}
- {justUpdated ? ( -
- Updated just now
+
+ Current Treasury Balance
+
+ {formatCurrency(snapshot.totalUsd)}
{syncCopy}
+ Updated just now
+ Account
+ Balance by chain
+
- {account.name}
-
- {formatCurrency(account.totalUsd)}
- Account
- Address not configured
-
+ {account.name}
+
+ {formatCurrency(account.totalUsd)}
+
+ Address not configured
+ {asset.symbol}
+ {asset.chainIds.map(getChainName).join(", ")}
+
{formatNumber(asset.balance)} {asset.symbol}
-
-
-
-
+
+
+ Included accounts
+ Included accounts
- {formatAddress(account.address)}
-
-
+ {formatAddress(account.address)}
+
+