diff --git a/cowprotocol/accounting/token_imbalances/balance_changes_4021257.sql b/cowprotocol/accounting/token_imbalances/balance_changes_4021257.sql index fa31bc3f..8b1e404b 100644 --- a/cowprotocol/accounting/token_imbalances/balance_changes_4021257.sql +++ b/cowprotocol/accounting/token_imbalances/balance_changes_4021257.sql @@ -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