Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prod airdrop QA #11329

Merged
merged 2 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
handle_lc,amount
isaacsolo,1642
sammiezonana,2058
dharit,2493
secretpanda007,2547
lvl13icewizard,954
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
begin;
do $$ begin -- run only on prod
if exists (
select *
from "blocks"
where "blockhash" = '0xe9b0f40bb2356d4fbedde96671503475c1c6c994c7eda082f046f7e9923c6e16'
) then -- check whether the data has already been backfilled and return early for idempotency
if exists (
select 1
from user_challenges
where challenge_id = 'o' -- not future proof but safe for now
) then return;
end if;
-- ========== one shot trigger ==========
WITH max_block AS (
SELECT MAX(number) AS completed_blocknumber
FROM blocks
),
one_shot_users as (
select temp.handle_lc,
temp.amount,
users.user_id
from temp_stage_one_shot temp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is temp_stage_one_shot?

join users on temp.handle_lc = users.handle_lc
)
INSERT INTO user_challenges (
user_id,
challenge_id,
specifier,
is_complete,
current_step_count,
completed_blocknumber,
amount,
created_at,
completed_at
)
SELECT osu.user_id,
'o' as challenge_id,
concat(to_hex(user_id), ':', to_hex(1)) AS specifier,
-- user_id:nth_shot for future proofing
TRUE AS is_complete,
0 AS current_step_count,
mb.completed_blocknumber,
CAST(osu.amount AS INT) AS amount,
NOW() AS created_at,
NOW() AS created_at
FROM one_shot_users osu,
max_block mb;
end if;
end $$;
commit;
2 changes: 1 addition & 1 deletion packages/discovery-provider/src/challenges/challenges.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
"name": "ONE_SHOT",
"type": "aggregate",
"amount": 1,
"active": false,
"active": true,
"step_count": 2147483647,
"starting_block": 0,
"weekly_pool": 2147483647,
Expand Down