predikt/oracle/backend/supabase/crypto_payment_intents.sql
caelum0x 2b68bde5d5 Predikt: full Polymarket-style prediction market — web + mobile + on-chain + bots
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>
2026-07-06 23:29:50 +03:00

36 lines
1.3 KiB
SQL

-- Table for tracking processed Daimo Pay crypto payments
-- Used for idempotency to prevent double-crediting mana
create table if not exists
crypto_payment_intents (
id bigint primary key generated always as identity not null,
intent_id text not null,
user_id text not null,
created_time timestamp with time zone default now() not null,
usdc_amount numeric(20, 6),
mana_amount integer,
offer_id text
);
-- Foreign Keys
alter table crypto_payment_intents
add constraint crypto_payment_intents_user_id_fkey foreign key (user_id) references users (id);
alter table crypto_payment_intents
add constraint crypto_payment_intents_offer_id_fkey foreign key (offer_id) references personalized_mana_offers (id);
-- Row Level Security
alter table crypto_payment_intents enable row level security;
-- Indexes
drop index if exists crypto_payment_intents_pkey;
create unique index crypto_payment_intents_pkey on public.crypto_payment_intents using btree (id);
drop index if exists crypto_payment_intents_intent_id_idx;
create unique index crypto_payment_intents_intent_id_idx on public.crypto_payment_intents using btree (intent_id);
drop index if exists crypto_payment_intents_user_id_idx;
create index crypto_payment_intents_user_id_idx on public.crypto_payment_intents using btree (user_id);