forked from DefiLlama/dimension-adapters
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
73 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { FetchOptions, SimpleAdapter } from "../adapters/types"; | ||
import { CHAIN } from "../helpers/chains"; | ||
import { fetchPools } from "./shadow-exchange"; | ||
|
||
type TStartTime = { | ||
[key: string]: number; | ||
}; | ||
|
||
const startTimeV2: TStartTime = { | ||
[CHAIN.SONIC]: 1735129946, | ||
}; | ||
|
||
const fetch = async (options: FetchOptions) => { | ||
const pools = (await fetchPools(options)).filter((pool) => !pool.isCL) | ||
const dailyFees = pools.reduce((acc, pool) => acc + Number(pool.feesUSD), 0); | ||
const dailyVolume = pools.reduce((acc, pool) => acc + Number(pool.volumeUSD), 0); | ||
|
||
return { | ||
dailyVolume, | ||
dailyFees, | ||
dailyUserFees: dailyFees, | ||
dailyRevenue: dailyFees, | ||
dailyHoldersRevenue: dailyFees, | ||
}; | ||
|
||
} | ||
|
||
const methodology = { | ||
UserFees: "User pays fees on each swap.", | ||
ProtocolRevenue: "Revenue going to the protocol.", | ||
HoldersRevenue: "User fees are distributed among holders.", | ||
}; | ||
const adapter: SimpleAdapter = { | ||
version: 2, | ||
adapter: { | ||
[CHAIN.SONIC]: { | ||
fetch, | ||
start: startTimeV2[CHAIN.SONIC], | ||
meta: { | ||
methodology: methodology | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default adapter; |