Query editor
/*MIT LicenseCopyright (c) 2024 Berry_BearPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.Follow me on X: https://x.com/DeFi_Berry_Bear*/WITHuser_balance AS (SELECTdate,address,SUM(SUM(amount)) OVER (PARTITION BYaddressORDER BYdate) as daily_cumulative_balance -- get the cumulative balance of the holdersFROM(SELECTdate_trunc('day', evt_block_time) as date,tr."from" AS address,- (tr.value / 1e18) AS amountFROMerc20_mantle.evt_transfer trWHERE"from" != 0x0000000000000000000000000000000000000000 -- exclude mint/burn addressesAND evt_block_time >= TIMESTAMP '2024-01-08 00:00:00'AND contract_address = 0x4515A45337F461A11Ff0FE8aBF3c606AE5dC00c9 -- contract_address of the erc20 tokenUNION ALLSELECTdate_trunc('day', evt_block_time) as date,tr."to" AS address,(tr.value / 1e18) AS amountFROMerc20_mantle.evt_transfer trWHERE"to" != 0x0000000000000000000000000000000000000000 -- exclude mint/burn addressesAND evt_block_time >= TIMESTAMP '2024-01-08 00:00:00'AND contract_address = 0x4515A45337F461A11Ff0FE8aBF3c606AE5dC00c9 -- contract_address of the erc20 token) xGROUP BY1,2),setLeadData as (SELECT*,