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*/-- wallet inWITH input AS (SELECTROUND(COALESCE( SUM(tr.value / 1e18), 0), 4) AS inputFROM merchant_moe_mantle.MoeToken_evt_Transfer AS trWHEREtr."to" = {{wallet}}),-- wallet outoutput AS (SELECTROUND(COALESCE( - SUM(tr.value / 1e18), 0 ), 4) AS outputFROM merchant_moe_mantle.MoeToken_evt_Transfer AS trWHEREtr."from" = {{wallet}}),-- Get token priceprice AS (SELECTpriceFROM prices.hourWHEREblockchain = 'mantle'AND symbol = 'MOE'ORDER by TIMESTAMP descLIMIT 1),-- staked instaked as (select ROUND(COALESCE(sum( (value / 1e18) ), 0), 4) as amount from erc20_mantle.evt_transferwhere "to" = 0xb3938E6ee233E7847a5F17bb843E9bD0Aa07e116and "from" = {{wallet}}limit 1),-- staked outunstaked as (select ROUND( COALESCE(( sum( (value / 1e18) ) * -1 ), 0), 4) as amount from erc20_mantle.evt_transferwhere "from" = 0xb3938E6ee233E7847a5F17bb843E9bD0Aa07e116