Query editor
withdeposit_sol as (--sol balance is deposited into liquidity pool and reserve PDA in the same action. So we have to use account_activity here.SELECTdate_trunc('week', call_block_time) as week, sum(lamports/1e9) as depositsFROM marinade_solana.marinade_finance_call_depositgroup by 1), deposit_stake as (--must get the stake account that got authed to mnde, some of which get merged later on https://dune.com/queries/3235834SELECTdate_trunc('week',aa.block_time) as week, sum(element_at(post_balances, array_position(account_keys, dep.account_stakeAccount))/1e9) as deposits_stakeFROM solana.transactions aaJOIN marinade_solana.marinade_finance_call_depositStakeAccount depON dep.call_tx_id = aa.idAND dep.call_block_slot = aa.block_slotWHERE 1=1and aa.successand aa.block_time >= timestamp '2021-08-01'and contains(aa.account_keys,'MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD') --this makes it fastergroup by 1), withdraw_stake as (SELECTdate_trunc('week', c.call_block_time) as week, -1*sum(tr.lamports/1e9) as amount_claimedFROM marinade_solana.marinade_finance_call_claim cJOIN system_program_solana.system_program_call_Transfer trON c.call_tx_id = tr.call_tx_idAND c.call_outer_instruction_index = tr.call_outer_instruction_indexAND COALESCE(c.call_inner_instruction_index,0) + 1 = tr.call_inner_instruction_indexAND tr.account_from = 'Du3Ysj1wKbxPKkuPPnvzQLQh8oMSVifs3jGZjJWXFmHN'group by 1), withdraw_sol as (SELECTdate_trunc('week', c.call_block_time) as week, -1*sum(tr.lamports/1e9) as amount_liquid_unstakedFROM marinade_solana.marinade_finance_call_liquidUnstake cJOIN system_program_solana.system_program_call_Transfer trON c.call_tx_id = tr.call_tx_idAND c.call_outer_instruction_index = tr.call_outer_instruction_indexAND COALESCE(c.call_inner_instruction_index,0) + 1 = tr.call_inner_instruction_indexAND tr.account_from = 'UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q' --liq pool sol leggroup by 1), stake_fees as (--fees earned by jito staked validators (delegated)SELECTdate_trunc('week',block_time) week, sum(lamports/pow(10,9)) as rewardsFROM solana.rewards --validator reward paid out every epoch, these are just staking rewards. fees/votes are paid to the delegated validators and not the stake pool.WHERE recipient IN (SELECTaccount_stakeAccount