danhan Aurory Staking
    Updated 2022-07-20
    with unstaketx as(
    SELECT BLOCK_TIMESTAMP,
    SIGNERS[0] as wallet,
    INNER_INSTRUCTIONS[array_size(INNER_INSTRUCTIONS)-1]:instructions[1]:parsed:info:amount/1e9 * -1 as am
    from solana.core.fact_transactions
    WHERE INNER_INSTRUCTIONS[array_size(INNER_INSTRUCTIONS)-1]:instructions[1]:parsed:info:source::string = 'FysGks3izhgVhrUkub9QQWCTEVAdhkZKYSNK2F25maGD'
    and INSTRUCTIONS[array_size(INSTRUCTIONS)-1]:accounts[0] = 'AURYydfxJib1ZkTir1Jn1J9ECYUtjb6rKQVmtYaixWPP'
    and INSTRUCTIONS[array_size(INSTRUCTIONS)-1]:programId = 'STkwf3sbMapjy7KV3hgrJtcVvY4SvRxWQ8pj4Enw1i5'
    and BLOCK_TIMESTAMP >= CURRENT_DATE - 60
    ),
    unstake as(
    SELECT date(BLOCK_TIMESTAMP) as "Date",
    sum(am) as total_staked,
    sum(total_staked) over (order by "Date") as cumu,
    COUNT(DISTINCT wallet) as wallets,
    'Unstake' as type
    from unstaketx
    group by 1
    ),
    staketx as(
    SELECT BLOCK_TIMESTAMP,
    SIGNERS[0] as wallet,
    INNER_INSTRUCTIONS[array_size(INNER_INSTRUCTIONS)-1]:instructions[1]:parsed:info:amount/1e9 as am
    from solana.core.fact_transactions
    where INNER_INSTRUCTIONS[array_size(INNER_INSTRUCTIONS)-1]:instructions[1]:parsed:info:destination::string = 'FysGks3izhgVhrUkub9QQWCTEVAdhkZKYSNK2F25maGD'
    and INSTRUCTIONS[array_size(INSTRUCTIONS)-1]:accounts[0] = 'AURYydfxJib1ZkTir1Jn1J9ECYUtjb6rKQVmtYaixWPP'
    and INSTRUCTIONS[array_size(INSTRUCTIONS)-1]:programId = 'STkwf3sbMapjy7KV3hgrJtcVvY4SvRxWQ8pj4Enw1i5'
    and BLOCK_TIMESTAMP >= CURRENT_DATE - 60
    ),
    stake as(
    SELECT date(BLOCK_TIMESTAMP) as "Date",
    sum(am) as total_staked,
    sum(total_staked) over (order by "Date") as cumu,
    Run a query to Download Data