πLST ecosystem on Solana
This guide will assist you in creating a dashboard on the Top Ledger platform, which displays a variety of key metrics for the LST ecosystem on Solana.
Last updated
This guide will assist you in creating a dashboard on the Top Ledger platform, which displays a variety of key metrics for the LST ecosystem on Solana.
Last updated
with
cte_reward
as
(
select date(block_time) as block_date,stake_pool,signer,tx_id,(staking_reward/1e9 )as amount
from tl_solana.liquid_staking
where instruction_type in ('UpdateDeactivated','UpdateActive')
)
,
cte_deposit
as
(
select date(block_time) as block_date,stake_pool,signer,tx_id,
case when instruction_type in ('Deposit','DepositSol','DepositStake') then amount/1e9 else -amount/1e9 end as amount
from tl_solana.liquid_staking
where instruction_type in ('Claim','LiquidUnstake','Deposit','WithdrawStake','WithdrawSol','DepositSol','DepositStake')
)
,
cte_deposit_stake
as (
select a.block_date,stake_pool,signer,tx_id,amount*sol as amount
from
(
select date(block_time) as block_date,signer,stake_pool,tx_id,mint_amount/1e9 as amount
from tl_solana.liquid_staking
where instruction_type in ('DepositStakeAccount')
)a
join
(
select a.block_date,b.price_in_usd /a.price_in_usd as sol
from
(
select *
from tl_solana.prices
where mint='mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So'
)a
join
(
select *
from tl_solana.prices
where mint='So11111111111111111111111111111111111111112'
)b on a.block_date=b.block_date
)b
on a.block_date=b.block_date
)
select month, stake_pool,amount
from(
select date_trunc('week',block_date) as month, case when stake_pool='8szGkuLTAux9XMgZ2vtY39jVSowEcpBfFfD8hXSEqdGC' then 'msol'
when stake_pool='stk9ApL5HeVAwPLr3TLhDXdZS8ptVu7zp6ov8HFDuMi' then 'bsol'
when stake_pool='Jito4APyf642JPZPx3hGc6WWJ8zPKtRbRs4P815Awbb' then 'jitosol'
when stake_pool='CtMyWsrUtAwXWiGr9WjHT5fC3p3fgV8cyGpLTo2LJzG1' then 'jpool'
--when stake_pool='7ge2xKsZXmqPxa3YmXxXmzCp9Hc2ezrTxh6PECaxCwrL' then 'daosol'
when stake_pool='CgntPoLka5pD5fesJYhGmUCF8KU1QS1ZmZiuAuMZr2az' then 'cgntso'
when stake_pool='2qyEeSAWKfU18AFthrF7JA8z8ZCi1yt76Tqs917vwQTV' then 'laineSOL'
when stake_pool='DqhH94PjkZsjAqEze2BEkWhFQJ6EyU6MdtMphMgnXqeK' then 'mrgnLST'
else null end as stake_pool,
sum(amount) as amount
from
(
select *
from cte_deposit
union all
select *
from cte_reward
union all
select *
from cte_deposit_stake
)
group by 1,2
)
where stake_pool is not null
order by 1 descwith
cte_reward
as
(
select date(block_time) as block_date,stake_pool,tx_id,signer,(staking_reward/1e9 )as amount
from tl_solana.liquid_staking
where instruction_type in ('UpdateDeactivated','UpdateActive')
)
,
cte_deposit
as
(
select date(block_time) as block_date,stake_pool,tx_id,signer,
case when instruction_type in ('Deposit','DepositSol','DepositStake') then amount/1e9 else -amount/1e9 end as amount
from tl_solana.liquid_staking
where instruction_type in ('Claim','LiquidUnstake','Deposit','WithdrawStake','WithdrawSol','DepositSol','DepositStake')
)
,
cte_deposit_stake
as (
select a.block_date,stake_pool,tx_id,signer,amount*sol as amount
from
(
select date(block_time) as block_date,stake_pool,tx_id,signer,mint_amount/1e9 as amount
from tl_solana.liquid_staking
where instruction_type in ('DepositStakeAccount')
)a
join
(
select a.block_date,b.price_in_usd /a.price_in_usd as sol
from
(
select *
from tl_solana.prices
where mint='mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So'
)a
join
(
select *
from tl_solana.prices
where mint='So11111111111111111111111111111111111111112'
)b on a.block_date=b.block_date
)b
on a.block_date=b.block_date
)
select block_date, stake_pool,amount,transfer,wallet,unique_wallet,
sum(amount)over(partition by stake_pool order by block_date) as tvl,
sum(unique_wallet)over( order by block_date) as cumulative_wallets,
sum(unique_wallet)over(partition by stake_pool order by block_date) as cumulative_wallets_by_pool,
sum(transfer)over(partition by stake_pool order by block_date) as cumulative_transfer_pool,
sum(transfer)over( order by block_date) as cumulative_transfer
from(
select block_date, case when stake_pool='8szGkuLTAux9XMgZ2vtY39jVSowEcpBfFfD8hXSEqdGC' then 'Marinade'
when stake_pool='stk9ApL5HeVAwPLr3TLhDXdZS8ptVu7zp6ov8HFDuMi' then 'Sol blaze'
when stake_pool='Jito4APyf642JPZPx3hGc6WWJ8zPKtRbRs4P815Awbb' then 'Jito'
when stake_pool='CtMyWsrUtAwXWiGr9WjHT5fC3p3fgV8cyGpLTo2LJzG1' then 'Jpool'
--when stake_pool='7ge2xKsZXmqPxa3YmXxXmzCp9Hc2ezrTxh6PECaxCwrL' then 'Daosol'
when stake_pool='CgntPoLka5pD5fesJYhGmUCF8KU1QS1ZmZiuAuMZr2az' then 'Cogent crypto'
when stake_pool='2qyEeSAWKfU18AFthrF7JA8z8ZCi1yt76Tqs917vwQTV' then 'LaineSOL'
when stake_pool='DqhH94PjkZsjAqEze2BEkWhFQJ6EyU6MdtMphMgnXqeK' then 'Marginfi'
else null end as stake_pool,
count(distinct tx_id) as transfer,
count(signer) as wallet,
count(case when rn=1 then signer end) as unique_wallet,
sum(amount) as amount
from
(
select *,row_number()over(partition by signer order by block_date) as rn
from
(
select *
from cte_deposit
union all
select *
from cte_reward
union all
select *
from cte_deposit_stake
)
)
group by 1,2
)
where stake_pool is not null
order by 1 desc