-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'DefiLlama:master' into master
- Loading branch information
Showing
146 changed files
with
4,797 additions
and
782 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,88 @@ | ||
import fetchURL from "../../utils/fetchURL"; | ||
import { FetchResult } from "../../adapters/types"; | ||
import { FetchResult, SimpleAdapter, FetchOptions } from "../../adapters/types"; | ||
import { CHAIN } from "../../helpers/chains"; | ||
|
||
const URL = "https://defilama-stats.vooi.workers.dev/"; | ||
const endpoint = ""; | ||
const startTimestamp = 1714608000; // 02.05.2024 | ||
const URL = "https://vooi-rebates.fly.dev/"; | ||
const endpoint = "defillama/volumes"; | ||
const startTimestampArbitrum = 1714608000; // 02.05.2024 | ||
const startTimestampBlast = 1719792000; // 01.07.2024 | ||
const startTimestampOpBNB = 1717200000; // 01.06.2024 | ||
const startTimestampBase = 1722470400; // 01.08.2024 | ||
|
||
|
||
interface IAPIResponse { | ||
dailyVolume: string; | ||
totalVolume: string; | ||
} | ||
const fetch = async (timestamp: number): Promise<FetchResult> => { | ||
const { dailyVolume, totalVolume }: IAPIResponse = ( | ||
(await fetchURL(`${URL}${endpoint}?ts=${timestamp}`)).data | ||
); | ||
const fetchArbitrum = async (options: FetchOptions): Promise<FetchResult> => { | ||
const timestamp = options.toTimestamp | ||
const fetchData = await fetchURL(`${URL}${endpoint}?ts=${timestamp}`) // returns data for the day before | ||
let orderlyItem = fetchData.find(((item) => item.protocol == "orderly")) | ||
if (!orderlyItem) { | ||
orderlyItem = {dailyVolume: 0, totalVolume: 0} | ||
} | ||
let synfuturesItem = fetchData.filter(((item) => item.protocol == "synfutures")) | ||
if (!synfuturesItem) { | ||
synfuturesItem = {dailyVolume: 0, totalVolume: 0} | ||
} | ||
let kiloexItem = fetchData.find(((item) => item.protocol == "kiloex")) | ||
if (!kiloexItem) { | ||
kiloexItem = {dailyVolume: 0, totalVolume: 0} | ||
} | ||
let dailyVolume = Number(orderlyItem.dailyVolume) + Number(kiloexItem.dailyVolume) | ||
let totalVolume = Number(orderlyItem.totalVolume) + Number(kiloexItem.totalVolume) | ||
for (let i in synfuturesItem){ | ||
dailyVolume = Number(dailyVolume) + Number(synfuturesItem[i].dailyVolume) | ||
totalVolume = Number(totalVolume) + Number(synfuturesItem[i].totalVolume) | ||
} | ||
return { | ||
timestamp, | ||
dailyVolume, | ||
totalVolume, | ||
timestamp | ||
}; | ||
}; | ||
|
||
|
||
const fetchOpBNB = async (options: any): Promise<FetchResult> => { | ||
const timestamp = options.toTimestamp | ||
return { | ||
dailyVolume: 0, | ||
totalVolume: 0, | ||
timestamp | ||
}; | ||
}; | ||
|
||
const fetchBlast = async (options: any): Promise<FetchResult> => { | ||
const timestamp = options.toTimestamp | ||
return { | ||
dailyVolume: 0, | ||
totalVolume: 0, | ||
timestamp | ||
}; | ||
}; | ||
|
||
export default { | ||
const fetchBase = async (options: any): Promise<FetchResult> => { | ||
const timestamp = options.toTimestamp | ||
return { | ||
dailyVolume: 0, | ||
totalVolume: 0, | ||
timestamp | ||
}; | ||
}; | ||
|
||
const adapter: SimpleAdapter = { | ||
adapter: { | ||
[CHAIN.ARBITRUM]: { | ||
fetch: fetch, | ||
start: startTimestamp | ||
fetch: fetchArbitrum, | ||
start: startTimestampArbitrum | ||
}, | ||
[CHAIN.OP_BNB]: { | ||
fetch: fetchOpBNB, | ||
start: startTimestampOpBNB | ||
}, | ||
[CHAIN.BLAST]: { | ||
fetch: fetchBlast, | ||
start: startTimestampBlast | ||
}, | ||
[CHAIN.BASE]: { | ||
fetch: fetchBase, | ||
start: startTimestampBase | ||
}, | ||
}, | ||
// version: 2 // data accepts only one input to timestamp | ||
} | ||
export default adapter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { CHAIN } from "../../helpers/chains"; | ||
import { httpGet } from "../../utils/fetchURL"; | ||
import { FetchOptions } from "../../adapters/types"; | ||
|
||
const fetchVolume = async (options: FetchOptions) => { | ||
const url = `https://api-sui.cetus.zone/v2/sui/aggregator_vol?startTimestamp=${options.startOfDay}&endTimestamp=${options.startOfDay}`; | ||
const res = await httpGet(url); | ||
return { | ||
dailyVolume: res.data.list[0].totalUSD, | ||
} | ||
}; | ||
|
||
const adapter_agge: any = { | ||
version: 2, | ||
adapter: { | ||
[CHAIN.SUI]: { | ||
fetch: fetchVolume, | ||
start: 1721260800, | ||
}, | ||
}, | ||
}; | ||
|
||
export default adapter_agge; |
Oops, something went wrong.