Skip to content

Commit

Permalink
send_check_claimed table + RLS
Browse files Browse the repository at this point in the history
  • Loading branch information
nicky-LV committed Aug 8, 2024
1 parent f5dece5 commit 9bec9fd
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions supabase/migrations/20240808212935_send_check_claimed.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
CREATE TABLE "public"."send_check_claimed" (
chain_id numeric,
block_time numeric,
tx_hash bytea,
log_addr bytea,
token bytea,
amount numeric,
"from" bytea,
redeemer bytea
);

ALTER TABLE "public"."send_check_claimed" ENABLE ROW LEVEL SECURITY;

-- Policy for viewing claimed checks: Users can only select their own claimed checks
CREATE POLICY "Users can see their own claimed checks" ON "public"."send_check_claimed" FOR
SELECT USING (
lower(concat('0x', encode(send_check_claimed.redeemer, 'hex')))::citext in (
SELECT send_accounts.address FROM send_accounts
WHERE (
send_accounts.user_id = (
SELECT
auth.uid () AS uid
)
)
)
);

0 comments on commit 9bec9fd

Please sign in to comment.