Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add goplus-locker fees #2263

Closed
wants to merge 6 commits into from
Closed
Changes from all 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
38 changes: 23 additions & 15 deletions fees/goplus-locker.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
import { Adapter, FetchOptions, } from "../adapters/types";
import { CHAIN } from "../helpers/chains";
import { addTokensReceived } from "../helpers/token";
import ADDRESSES from '../helpers/coreAssets.json';
import { queryDune } from "../helpers/dune";
import moment from "moment";

const CHAIN_CONFIG = {
[CHAIN.ETHEREUM]: { start: 20790869 },
[CHAIN.BSC]: { start: 42387186 },
[CHAIN.BASE]: { start: 20014325 },
[CHAIN.ARBITRUM]: { start: 279127453 },
[CHAIN.GRAVITY]: { start: 23719062 },
[CHAIN.MORPH]: { start: 1125634 }
}

const fetch: any = async (options: FetchOptions) => {
const dailyFees = options.createBalances();

let feeTo = "0x521faacdfa097ad35a32387727e468f7fd032fd6";

// add native fee
let feeTo = "0x521faAcDFA097ad35a32387727e468F7fD032fD6";

await options.api.sumTokens({ owner: feeTo, token: ADDRESSES.null });
await options.fromApi.sumTokens({ owner: feeTo, token: ADDRESSES.null });
dailyFees.addBalances(options.api.getBalancesV2());
dailyFees.subtract(options.fromApi.getBalancesV2());

await addTokensReceived({ balances: dailyFees, target: feeTo, options, })
let startDate = new Date();
startDate.setTime(options.startTimestamp * 1000);
let start = moment(startDate).format("YYYY-MM-DD hh:mm:ss");
let endDate = new Date();
endDate.setTime(options.endTimestamp * 1000);
let end = moment(endDate).format("YYYY-MM-DD hh:mm:ss");

const values = await queryDune('4444430', {
Copy link
Contributor

Choose a reason for hiding this comment

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

how that dune query diff our function addTokensReceived

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You said the indexer only support eth chain, the database I queried on dune supports eth,bsc,base,arbitrum... and many other evm chains we will deployed our project on.

Copy link
Contributor

Choose a reason for hiding this comment

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

no prev you use our indexer, now adapter use function addTokensReceived is support many chain

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, then keep using the addTokensReceived method as before, you can ignore this pull request,thanks.

chain: options.chain == 'bsc' ? 'bnb' : options.chain,
start,
end,
to: feeTo
})

values.forEach((e: { contract_address: string; amount_raw: string; }) => {
dailyFees.add(e.contract_address, e.amount_raw);
});

return { dailyFees, dailyRevenue: dailyFees, dailyProtocolRevenue: dailyFees, }
}
Expand All @@ -36,10 +44,10 @@ const adapter: Adapter = {
[CHAIN.BSC]: { fetch, start: '2024-09-19', },
[CHAIN.BASE]: { fetch, start: '2024-09-20', },
[CHAIN.ARBITRUM]: { fetch, start: '2024-11-28', },
[CHAIN.GRAVITY]: { fetch, start: '2024-12-11', },
[CHAIN.MORPH]: { fetch, start: '2024-12-11', },
// [CHAIN.GRAVITY]: { fetch, start: '2024-12-11', },
// [CHAIN.MORPH]: { fetch, start: '2024-12-11', },
},

}

export default adapter;
export default adapter;
Loading