-
Notifications
You must be signed in to change notification settings - Fork 950
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1661 from Sharpelabs/main
add sharpe perp, sharpe bridge. sharpe-dex
- Loading branch information
Showing
3 changed files
with
111 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import fetchURL from "../../utils/fetchURL"; | ||
import { FetchResultV2 } from "../../adapters/types"; | ||
import { CHAIN } from "../../helpers/chains"; | ||
|
||
const fetch = async (options: any): Promise<FetchResultV2> => { | ||
let timestamp = options.toTimestamp | ||
|
||
const fetchOptions:any = {method: 'GET'}; | ||
|
||
const data:any = await fetchURL('https://api-evm.orderly.network/v1/public/volume/stats?broker_id=sharpe_ai') | ||
const dailyData:any = await fetchURL('https://base-api.sharpe.ai/api/dailySharpePerpVolume') | ||
|
||
return { | ||
totalVolume: data?.data?.perp_volume_ltd, | ||
dailyVolume: dailyData?.dailyVolume | ||
}; | ||
}; | ||
// CHAIN.ARBITRUM, CHAIN.MANTLE, CHAIN.OPTIMISM, CHAIN.BASE, | ||
export default { | ||
adapter: { | ||
[CHAIN.ETHEREUM]: { | ||
fetch: fetch, | ||
start: 1711963031 | ||
}, | ||
}, | ||
version: 2 | ||
} |
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,54 @@ | ||
import { Chain } from "@defillama/sdk/build/general"; | ||
import { FetchOptions, FetchResultVolume, SimpleAdapter } from "../../adapters/types"; | ||
import { CHAIN } from "../../helpers/chains"; | ||
|
||
type IContract = { | ||
[c: string | Chain]: string; | ||
} | ||
|
||
const contract: IContract = { | ||
[CHAIN.AURORA]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
[CHAIN.ARBITRUM]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
[CHAIN.OPTIMISM]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
[CHAIN.BASE]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
[CHAIN.ETHEREUM]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
[CHAIN.AVAX]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
[CHAIN.BSC]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
[CHAIN.LINEA]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
[CHAIN.MANTA]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
[CHAIN.POLYGON]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
[CHAIN.POLYGON_ZKEVM]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
[CHAIN.FANTOM]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
[CHAIN.MODE]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
[CHAIN.SCROLL]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
[CHAIN.ZKSYNC]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
[CHAIN.METIS]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
[CHAIN.XDAI]: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', | ||
} | ||
|
||
const fetch: any = async (timestamp: number, _, { chain, getLogs, createBalances, }: FetchOptions): Promise<FetchResultVolume> => { | ||
const dailyVolume = createBalances(); | ||
const data: any[] = await getLogs({ | ||
target: contract[chain], | ||
eventAbi: 'event LiFiTransferStarted(bytes32 indexed transactionId, string bridge, string integrator, address referrer, address sendingAssetId, address receiver, uint256 minAmount, uint256 destinationChainId,bool hasSourceSwaps,bool hasDestinationCall )' | ||
}); | ||
data.forEach((e: any) => { | ||
if (e.integrator === 'sharpe.ai') { | ||
dailyVolume.add(e.sendingAssetId, e.minAmount); | ||
} | ||
}); | ||
|
||
return { dailyBridgeVolume: dailyVolume, timestamp, } as any; | ||
}; | ||
|
||
const adapter: SimpleAdapter = { | ||
version: 2, | ||
adapter: Object.keys(contract).reduce((acc, chain) => { | ||
return { | ||
...acc, | ||
[chain]: { fetch, start: 1711963031, } | ||
} | ||
}, {}) | ||
}; | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { ChainBlocks, FetchOptions, SimpleAdapter } from "../../adapters/types"; | ||
import { CHAIN } from "../../helpers/chains"; | ||
import { getUniqStartOfTodayTimestamp } from "../../helpers/getUniSubgraphVolume"; | ||
import { getPrices } from "../../utils/prices"; | ||
import fetchURL from "../../utils/fetchURL"; | ||
|
||
|
||
const fetch = async () => { | ||
|
||
const data:any = await fetchURL('https://base-api.sharpe.ai/api/dexVolume') | ||
const dailyData:any = await fetchURL('https://base-api.sharpe.ai/api/dailySharpeDexVolume') | ||
|
||
return { | ||
totalVolume: data?.totalVolume, | ||
dailyVolume: dailyData?.dailyVolume | ||
}; | ||
}; | ||
|
||
|
||
const adapter: SimpleAdapter = { | ||
version: 2, | ||
adapter: { | ||
[CHAIN.ETHEREUM]: { | ||
fetch, | ||
start: 1711963031, | ||
}, | ||
}, | ||
}; | ||
|
||
export default adapter; |