Skip to content

Commit 38a5681

Browse files
dtmkengtreeoflife2
andauthored
orbiter finnce (DefiLlama#2704)
* orbiter finnce * Aggregator and Bridge-Aggregator orbiter-finance --------- Co-authored-by: treeoflife2 <sol.analyzoor@gmail.com>
1 parent 7d68764 commit 38a5681

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import type { FetchOptions, SimpleAdapter } from "../../adapters/types";
2+
import { CHAIN } from "../../helpers/chains";
3+
4+
const DEFAULT_AGGREGATOR = '0xe530d28960d48708ccf3e62aa7b42a80bc427aef'
5+
const SWAP_ROUTER: Record<string, string> = {
6+
[CHAIN.UNICHAIN]: '0x70f6060fc8b01b56869feba8361df468f98c2900',
7+
}
8+
9+
const swapEvent = "event SwapExecuted(address indexed sender, address indexed recipient, address inputToken, address outputToken, uint256 inputAmount, uint256 outputAmount, bytes extData)";
10+
11+
12+
const fetch = async (options: FetchOptions) => {
13+
const dailyVolume = options.createBalances();
14+
const target = SWAP_ROUTER[options.chain] || DEFAULT_AGGREGATOR;
15+
const logs = await options.getLogs({
16+
target,
17+
eventAbi: swapEvent,
18+
});
19+
20+
for (const l of logs) {
21+
dailyVolume.add(l.inputToken, l.inputAmount);
22+
}
23+
24+
return { dailyVolume };
25+
}
26+
27+
const adapter: SimpleAdapter = {
28+
version: 2,
29+
fetch,
30+
chains: [CHAIN.ETHEREUM, CHAIN.ARBITRUM, CHAIN.POLYGON, CHAIN.OPTIMISM, CHAIN.BSC, CHAIN.BASE, CHAIN.SCROLL, CHAIN.LINEA, CHAIN.UNICHAIN, CHAIN.BERACHAIN, CHAIN.SONIC, CHAIN.INK, CHAIN.BLAST, CHAIN.POLYGON_ZKEVM, CHAIN.SCROLL, CHAIN.MANTLE, CHAIN.MODE, CHAIN.FRAXTAL, CHAIN.FUSE, CHAIN.GRAVITY, CHAIN.WC, CHAIN.SONEIUM, CHAIN.CELO]
31+
};
32+
33+
export default adapter;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import type { FetchOptions, SimpleAdapter } from "../../adapters/types";
2+
import { CHAIN } from "../../helpers/chains";
3+
4+
const DEFAULT_AGGREGATOR = '0xe530d28960d48708ccf3e62aa7b42a80bc427aef'
5+
const SWAP_ROUTER: Record<string, string> = {
6+
[CHAIN.UNICHAIN]: '0x70f6060fc8b01b56869feba8361df468f98c2900',
7+
}
8+
9+
const bridgeEvent = "event BridgeExecuted(address indexed sender, address indexed recipient, address inputToken, address outputToken, uint256 inputAmount, bytes extData)";
10+
11+
12+
const fetch = async (options: FetchOptions) => {
13+
const dailyBridgeVolume = options.createBalances();
14+
const target = SWAP_ROUTER[options.chain] || DEFAULT_AGGREGATOR;
15+
const logs = await options.getLogs({
16+
target,
17+
eventAbi: bridgeEvent,
18+
});
19+
20+
for (const l of logs) {
21+
dailyBridgeVolume.add(l.inputToken, l.inputAmount);
22+
}
23+
24+
return { dailyBridgeVolume };
25+
}
26+
27+
const adapter: SimpleAdapter = {
28+
version: 2,
29+
fetch,
30+
chains: [CHAIN.ETHEREUM, CHAIN.ARBITRUM, CHAIN.POLYGON, CHAIN.OPTIMISM, CHAIN.BSC, CHAIN.BASE, CHAIN.SCROLL, CHAIN.LINEA, CHAIN.UNICHAIN, CHAIN.BERACHAIN, CHAIN.SONIC, CHAIN.INK, CHAIN.BLAST, CHAIN.POLYGON_ZKEVM, CHAIN.SCROLL, CHAIN.MANTLE, CHAIN.MODE, CHAIN.FRAXTAL, CHAIN.FUSE, CHAIN.GRAVITY, CHAIN.WC, CHAIN.SONEIUM, CHAIN.CELO]
31+
};
32+
33+
export default adapter;

0 commit comments

Comments
 (0)