Skip to content

Commit 7e670cf

Browse files
committed
feat: add APY calculation for Clober pools integration
1 parent 4397240 commit 7e670cf

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

src/adaptors/clober-v2/index.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
const utils = require('../utils');
2+
3+
const API_URL = 'https://app.clober.io/api/chains/143/pools';
4+
5+
interface Pool {
6+
key: string;
7+
lpCurrency: {
8+
id: string;
9+
address: string;
10+
name: string;
11+
symbol: string;
12+
decimals: number;
13+
};
14+
currencyA: {
15+
address: string;
16+
name: string;
17+
symbol: string;
18+
decimals: number;
19+
};
20+
currencyB: {
21+
address: string;
22+
name: string;
23+
symbol: string;
24+
decimals: number;
25+
};
26+
totalTvlUSD: string;
27+
apy: string;
28+
baseApy: string;
29+
merkleApy: string;
30+
}
31+
32+
interface Pools {
33+
pools: Array<Pool>;
34+
}
35+
36+
const apy = async () => {
37+
const { pools: data }: Pools = await utils.getData(API_URL);
38+
39+
const pools = data.map((pool) => {
40+
return {
41+
pool: pool.key,
42+
chain: utils.formatChain('monad'),
43+
project: 'clober-v2',
44+
symbol: pool.lpCurrency.symbol,
45+
tvlUsd: Number(pool.totalTvlUSD),
46+
apyBase: Number(pool.baseApy) || 0,
47+
apyReward: Number(pool.merkleApy) || 0,
48+
underlyingTokens: [pool.currencyA.address, pool.currencyB.address],
49+
rewardTokens: [
50+
'0x0000000000000000000000000000000000000000', // MON
51+
],
52+
url: `https://app.clober.io/earn/${pool.key}`,
53+
};
54+
});
55+
56+
return pools;
57+
};
58+
59+
module.exports = {
60+
timetravel: false,
61+
apy,
62+
};

0 commit comments

Comments
 (0)