Skip to content
Open
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
39 changes: 39 additions & 0 deletions dexs/dipcoin-perps/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";
import { httpGet } from "../../utils/fetchURL";
import BigNumber from "bignumber.js";

const fetch = async () => {
const symbols = (
await httpGet("https://gray-api.dipcoin.io/api/perp-market-api/list")
)?.data?.map((i: any) => i.symbol);
const volumes = await Promise.all(
symbols.map(async (symbol) => {
const ticker = await httpGet(
`https://gray-api.dipcoin.io/api/perp-market-api/ticker?symbol=${symbol}`
);
const volumeValue = ticker?.data?.volume24h || 0;

return BigNumber(volumeValue);
})
);
const sum = volumes
.reduce((acc, volume) => acc.plus(volume), BigNumber(0))
.div(1e18)
.toNumber();

return {
dailyVolume: sum,
};
};

const adapter: SimpleAdapter = {
adapter: {
[CHAIN.SUI]: {
fetch: fetch,
runAtCurrTime: true,
},
},
};

export default adapter;
23 changes: 23 additions & 0 deletions dexs/dipcoin/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";
import { httpGet } from "../../utils/fetchURL";

const fetch = async () => {
const totalVolume = (await httpGet(`https://api.dipcoin.io/api/index/stats/line`))?.data?.[0]?.volume

return {
dailyVolume: totalVolume,
};
};


const adapter: SimpleAdapter = {
adapter:{
[CHAIN.SUI]:{
fetch: fetch,
runAtCurrTime: true
}
}
};

export default adapter;
44 changes: 44 additions & 0 deletions fees/dipcoin-perps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { httpGet } from "../utils/fetchURL";
import { FetchResultFees, SimpleAdapter } from "../adapters/types";
import { CHAIN } from "../helpers/chains";
import BigNumber from "bignumber.js";

const fetch = async (_: number): Promise<FetchResultFees> => {
const symbols = (
await httpGet("https://gray-api.dipcoin.io/api/perp-market-api/list")
)?.data?.map((i: any) => i.symbol);
const volumes = await Promise.all(
symbols.map(async (symbol: string) => {
const ticker = await httpGet(
`https://gray-api.dipcoin.io/api/perp-market-api/ticker?symbol=${symbol}`
);
const volumeValue = ticker?.data?.volume24h || 0;

return BigNumber(volumeValue);
})
);

const fees = volumes
.reduce((acc, volume) => acc.plus(volume), BigNumber(0))
.div(1e18)
.multipliedBy(0.0004)
.toNumber();

return {
dailyFees: fees,
dailyRevenue: fees,
};
};

const adapter: SimpleAdapter = {
version: 1,
adapter: {
[CHAIN.SUI]: {
fetch,
start: "2025-10-15",
runAtCurrTime: true,
},
},
};

export default adapter;
29 changes: 29 additions & 0 deletions fees/dipcoin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import fetchURL from "../utils/fetchURL";
import { FetchResultFees, SimpleAdapter } from "../adapters/types";
import { CHAIN } from "../helpers/chains";

const fetch = async (_: number): Promise<FetchResultFees> => {
const pools = (await fetchURL("https://api.dipcoin.io/api/pools"))?.data;

let spotFees = 0;
for (const pool of pools) {
spotFees += Number(pool.fee24h);
}

return {
dailyFees: spotFees,
};
};

const adapter: SimpleAdapter = {
version: 1,
adapter: {
[CHAIN.SUI]: {
fetch,
start: "2025-05-20",
runAtCurrTime: true,
},
},
};

export default adapter;
Loading