Skip to content

Commit

Permalink
add gmgnai
Browse files Browse the repository at this point in the history
  • Loading branch information
0xngmi committed Nov 24, 2024
1 parent 5a6a0f5 commit 934e103
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions fees/gmgnai.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { FetchOptions, SimpleAdapter } from "../adapters/types";
import { CHAIN } from "../helpers/chains";
import { queryDuneSql } from "../helpers/dune";

const fetch: any = async (options: FetchOptions) => {
const fees = await queryDuneSql(options, `
WITH
allFeePayments AS (
SELECT
tx_id,
'SOL' AS feeTokenType,
balance_change / 1e9 AS fee_token_amount,
'So11111111111111111111111111111111111111112' AS fee_token_mint_address
FROM
solana.account_activity
WHERE
tx_success
AND address = 'BB5dnY55FXS1e1NXqZDwCzgdYJdMCj3B92PU6Q5Fb6DT'
AND balance_change > 0
AND TIME_RANGE
)
SELECT
SUM(fee_token_amount) AS fee
FROM
dex_solana.trades AS trades
JOIN allFeePayments AS feePayments ON trades.tx_id = feePayments.tx_id
WHERE
trades.trader_id != 'BB5dnY55FXS1e1NXqZDwCzgdYJdMCj3B92PU6Q5Fb6DT'
AND TIME_RANGE
`)
const dailyFees = options.createBalances()
dailyFees.add('So11111111111111111111111111111111111111112', fees[0].fee*1e9);
return { dailyFees, dailyRevenue: dailyFees, }
}

const adapter: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.SOLANA]: {
fetch: fetch,
start: '2024-03-20'
},
},
isExpensiveAdapter: true
};

export default adapter;

0 comments on commit 934e103

Please sign in to comment.