MOHAMAD23Untitled Query
Updated 2022-08-25
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
WITH INFO AS (
SELECT concat('0x',substr(data,27,40)) as game_contract
, ethereum.public.udf_hex_to_int(substr(data,3+17*64,64)) as num
, TX_HASH
FROM optimism.core.fact_event_logs
WHERE topics[0] = '0x889e2060e46779287c2fcbf489c195ef20f5b44a74e3dcb58d491ae073c1370f'
and contract_address = '0x2b91c14ce9aa828ed124d12541452a017d8a2148'
),
TRX AS (
SELECT concat('0x',substr(INPUT_DATA,35,40)) as game_contract1,FROM_ADDRESS as address__,
CASE
WHEN
(ethereum.public.udf_hex_to_int(SUBSTR(INPUT_DATA, 203, 64))/pow(10,18) )> 0.001
THEN ethereum.public.udf_hex_to_int(SUBSTR(INPUT_DATA, 203, 64))/pow(10,18)
ELSE ethereum.public.udf_hex_to_int(SUBSTR(INPUT_DATA, 203, 64))/pow(10,6)
END AS VALUE_
FROM optimism.core.fact_transactions
where TO_ADDRESS = lower('0x170a5714112daeff20e798b6e92e25b86ea603c1') and BLOCK_TIMESTAMP >= DATEADD(day,-14, GETDATE()) and VALUE_ is not null
),
SPORTS_ AS(
SELECT game_contract,
CASE
when num = 9001 then 'Footbal'
when num = 9002 then 'Footbal'
when num = 9003 then 'Baseball'
when num = 9004 then 'Basketball'
when num = 9005 then 'Basketball'
when num = 9006 then 'Hockey '
when num = 9007 then 'MMA'
when num = 9008 then 'WNBA'
when num = 9010 then 'Soccer'
when num = 9011 then 'Soccer'
when num = 9012 then 'Soccer'
when num = 9013 then 'Soccer'
Run a query to Download Data