Skip to content

Commit

Permalink
add transfer out
Browse files Browse the repository at this point in the history
  • Loading branch information
dtmkeng committed Feb 26, 2024
1 parent cfd3aa8 commit 192a592
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions fees/maestro.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CHAIN } from "../helpers/chains";
import { Adapter, FetchOptions, } from "../adapters/types";
import { getTokenDiff } from "../helpers/token";
import { queryIndexer } from "../helpers/indexer";

const dispatcher: any = {
[CHAIN.ETHEREUM]: "0x7776607E2E0bD61052e60d59F1fDd11dFbeC27e8",
Expand All @@ -14,6 +15,19 @@ async function fetch(timestamp: number, _1: any, options: FetchOptions) {
await getTokenDiff({ options, target: feesAddress, balances: dailyFees, tokens: [] })
const logs = await options.getLogs({ target: dispatcher[options.chain], eventAbi: 'event BalanceTransfer (address to, uint256 amount)', })
logs.map((log: any) => dailyFees.addGasToken(log.amount))
if (CHAIN.ETHEREUM === options.chain) {
const eth_out: any = await queryIndexer(`
SELECT
sum("value") / 1e18 AS eth_out
FROM
ethereum.transactions
WHERE
from_address = '\\xB0999731f7c2581844658A9d2ced1be0077b7397'
AND data = '\\x'
AND block_time BETWEEN llama_replace_date_range;
`, options);
dailyFees.addGasToken(eth_out[0].eth_out * 1e18)
}
return { timestamp, dailyFees, dailyRevenue: dailyFees, }
}

Expand Down

0 comments on commit 192a592

Please sign in to comment.