Working tree is now the canonical repo. Off-chain play-money + trustless on-chain (FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution, mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
34 lines
1.4 KiB
SQL
34 lines
1.4 KiB
SQL
-- This file is autogenerated from regen-schema.ts
|
|
create table if not exists
|
|
charity_giveaways (
|
|
giveaway_num integer primary key not null,
|
|
name text not null,
|
|
prize_amount_usd numeric not null,
|
|
close_time timestamp with time zone not null,
|
|
winning_ticket_id text,
|
|
-- Provably fair: nonce stores the Bitcoin block hash used to determine the winner.
|
|
-- NULL until winner is selected. The block used is the first one mined after close_time.
|
|
-- Users can verify by looking up the first block after close_time on any block explorer.
|
|
-- Note: Giveaway #1 used the old method (random nonce + last 10 timestamps).
|
|
nonce text,
|
|
created_time timestamp with time zone default now() not null
|
|
);
|
|
|
|
-- Row Level Security
|
|
-- IMPORTANT: No public read policy! The nonce column is sensitive and must
|
|
-- only be exposed through the API after winner selection.
|
|
-- All access goes through the backend API which uses service role.
|
|
alter table charity_giveaways enable row level security;
|
|
|
|
-- Drop any existing public read policy
|
|
drop policy if exists "public read" on charity_giveaways;
|
|
|
|
-- Indexes
|
|
drop index if exists charity_giveaways_pkey;
|
|
|
|
create unique index charity_giveaways_pkey on public.charity_giveaways using btree (giveaway_num);
|
|
|
|
drop index if exists charity_giveaways_close_time;
|
|
|
|
create index charity_giveaways_close_time on public.charity_giveaways using btree (close_time);
|