Skip to content

Commit

Permalink
setup and camelot
Browse files Browse the repository at this point in the history
  • Loading branch information
mantasfam committed Jun 27, 2024
1 parent 4fe374a commit 8d5b70f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ CORE_NODE_URL=https://core.public.infstones.com
BASE_NODE_URL=https://base.llamarpc.com
LINEA_NODE_URL=https://rpc.linea.build
BTTC_NODE_URL=https://rpc.bittorrentchain.io
XAI_NODE_URL=
##======================== LOGSTASH ========================
LOGSTASH_PORT=
LOGSTASH_HOST=
Expand Down
1 change: 1 addition & 0 deletions src/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@ nodeUrls['LINEA_NODE_URL'] = process.env['LINEA_NODE_URL'];
nodeUrls['WAX_NODE_URL'] = process.env['WAX_NODE_URL'];
nodeUrls['APTOS_NODE_URL'] = process.env['APTOS_NODE_URL'];
nodeUrls['BTTC_NODE_URL'] = process.env['BTTC_NODE_URL'];
nodeUrls['XAI_NODE_URL'] = process.env['XAI_NODE_URL'];

export { config, nodeUrls };
3 changes: 2 additions & 1 deletion src/constants/contracts.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"base": "0x4200000000000000000000000000000000000006",
"core": "0x40375C92d9FAf44d2f9db9Bd9ba41a3317a2404f",
"linea": "0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f",
"bttc": "0x0000000000000000000000000000000000001010"
"bttc": "0x0000000000000000000000000000000000001010",
"xai": "0x3fb787101dc6be47cfe18aeee15404dcc842e6af"
},
"BULK_BALANCE_ADDRESSES": {
"ethereum": "0xb173393e08496209ad1cd9d57c769de76bdcea5a",
Expand Down
41 changes: 41 additions & 0 deletions src/factory/providers/xai/camelot/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import formatter from '../../../../util/formatter';
import uniswapV2 from '../../../../util/calculators/uniswapV2';
import uniswapV3 from '../../../../util/calculators/uniswapV3chain';
import { ITvlParams, ITvlReturn } from '../../../../interfaces/ITvl';

const START_BLOCK = 2398999;
const V2_FACTORY_ADDRESS = '0x18E621B64d7808c3C47bccbbD7485d23F257D26f';
const V3_FACTORY_ADDRESS = '0xD8676fBdfa5b56BB2298D452c9768f51e80e34AE';

async function tvl(params: ITvlParams): Promise<Partial<ITvlReturn>> {
const { block, chain, provider, web3 } = params;
if (block < START_BLOCK) {
return { balances: {} };
}

let balances = {};

const v2 = await uniswapV2.getTvl(
V2_FACTORY_ADDRESS,
block,
chain,
provider,
web3,
);

balances = await uniswapV3.getTvl(
V3_FACTORY_ADDRESS,
START_BLOCK,
block,
chain,
provider,
web3,
true,
);

balances = formatter.sum([v2.balances, balances]);

return { balances };
}

export { tvl };

0 comments on commit 8d5b70f

Please sign in to comment.