Skip to content

Tapp Exchange #3537

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
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
62 changes: 62 additions & 0 deletions dexs/tapp-exchange/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import {SimpleAdapter} from "../../adapters/types";
import {CHAIN} from "../../helpers/chains";
import {postURL} from "../../utils/fetchURL";
import {randomInt} from "node:crypto";
import {getTimestampAtStartOfDayUTC} from "../../utils/date";

const URL = 'https://api.tapp.exchange/api/v1'


interface TappDefillamaDimension {
dailyVolume: number;
dailyFee: number;
dailyRevenue: number;
}

const getDefillamaDimension = async (start: number, end: number) => {
const body = {
"method": "public/defillama_dimension",
"jsonrpc": "2.0",
"id": randomInt(1, 1000),
"params": {
"startTime": start,
"endTime": end,
}
}
const dimension: { result: TappDefillamaDimension } = await postURL(URL, body)


return dimension.result;
}


const fetch = async (timestamp: number) => {
const startOfDay = getTimestampAtStartOfDayUTC(timestamp) * 1000;
const endOfDay = startOfDay + 24 * 60 * 60 * 1000 - 1000;

const {dailyFee, dailyVolume, dailyRevenue} = await getDefillamaDimension(startOfDay, endOfDay);

return {
dailyFees: dailyFee,
dailyRevenue: dailyRevenue,
dailyVolume: dailyVolume,
};
}

const adapter: SimpleAdapter = {
adapter: {
[CHAIN.APTOS]: {
fetch: fetch,
start: "2025-06-12",
meta: {
methodology: {
Fees: "Total fees from swaps, based on the fee tier of each pool.",
Revenue: "Calculated as 33% of the total fees.",
Volume: "The total volume from all trades, calculated as the sum of input amounts for every swap transaction.",
}
}
},
},
};

export default adapter;
3 changes: 3 additions & 0 deletions fees/tapp-exchange.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import adapter from "../dexs/tapp-exchange";

export default adapter;
Loading