Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions fees/flow/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { FetchOptions, FetchResult, ProtocolType, SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";
import fetchURL from "../../utils/fetchURL";

async function fetch(_a: any, _b: any, options: FetchOptions): Promise<FetchResult> {
const start = new Date(options.startOfDay * 1000).toISOString();
const end = new Date(options.endTimestamp * 1000).toISOString();

const response = await fetchURL(`https://api.find.xyz/flowscan/v1/stats?from=${start}&metric=fees&timescale=daily&to=${end}`);

if(!response || !response.data || !response.data[0])
throw new Error('Flow fees not found');

const dailyFees = options.createBalances();
dailyFees.addCGToken('flow',response.data[0].number);

return {
dailyFees,
dailyRevenue:0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

who earns tx fees?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validators

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's still revenue as validators are kind of token holders

};
}

const methodology = {
Fees: 'Transaction and storage fees paid by users',
Revenue: 'No revenue'
}

const adapter: SimpleAdapter = {
fetch,
chains: [CHAIN.FLOW],
start: '2018-12-19',
methodology,
protocolType:ProtocolType.CHAIN
}

export default adapter
Loading