Skip to content

Commit

Permalink
add withdrawal and deposit events tracking (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
harisang authored Dec 23, 2024
1 parent c256f1f commit 1952792
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,38 @@ weth_deposits_withdrawals_arbitrum as (

special_balance_changes_arbitrum as ( -- noqa: ST03
select * from weth_deposits_withdrawals_arbitrum
),

weth_deposits_withdrawals_base as (
-- deposits (contract deposits ETH to get WETH)
select
evt_block_time as block_time,
evt_tx_hash as tx_hash,
contract_address as token_address,
0x0000000000000000000000000000000000000000 as sender,
0x9008d19f58aabd9ed0d60971565aa8510560ab41 as receiver,
wad as amount
from weth_base.WETH9_evt_Deposit
where
evt_block_time >= cast('{{start_time}}' as timestamp) and evt_block_time < cast('{{end_time}}' as timestamp) -- partition column
and dst = 0x9008d19f58aabd9ed0d60971565aa8510560ab41
union distinct
-- withdrawals (contract withdraws ETH by returning WETH)
select
evt_block_time as block_time,
evt_tx_hash as tx_hash,
contract_address as token_address,
0x9008d19f58aabd9ed0d60971565aa8510560ab41 as sender,
0x0000000000000000000000000000000000000000 as receiver,
wad as amount
from weth_base.WETH9_evt_Withdrawal
where
evt_block_time >= cast('{{start_time}}' as timestamp) and evt_block_time < cast('{{end_time}}' as timestamp) -- partition column
and src = 0x9008d19f58aabd9ed0d60971565aa8510560ab41
),

special_balance_changes_base as ( -- noqa: ST03
select * from weth_deposits_withdrawals_base
)

-- combine results
Expand Down

0 comments on commit 1952792

Please sign in to comment.