Skip to content

Commit

Permalink
solve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
aburkut committed Dec 12, 2024
2 parents b17e935 + 738c886 commit 409aceb
Show file tree
Hide file tree
Showing 36 changed files with 10,046 additions and 31 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paraswap/dex-lib",
"version": "4.0.1-cables.0",
"version": "4.0.2",
"main": "build/index.js",
"types": "build/index.d.ts",
"repository": "https://github.com/paraswap/paraswap-dex-lib",
Expand Down Expand Up @@ -52,6 +52,7 @@
},
"dependencies": {
"@0x/utils": "^4.5.2",
"@balancer-labs/balancer-maths": "^0.0.19",
"@balancer-labs/sor": "4.1.1-beta.4",
"@bgd-labs/aave-address-book": "2.21.1",
"@ethersproject/abi": "^5.7.0",
Expand Down
78 changes: 78 additions & 0 deletions scripts/run-dex-integration-v3.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// npx ts-node scripts/run-dex-integration-v3.ts
/* eslint-disable no-console */
import dotenv from 'dotenv';
dotenv.config();

import { Network, SwapSide } from '../src/constants';
import { BalancerV3 } from '../src/dex/balancer-v3/balancer-v3';
import { DummyDexHelper } from '../src/dex-helper/index';
import { BI_POWS } from '../src/bigint-constants';

const stataUSDC = {
address: '0x8a88124522dbbf1e56352ba3de1d9f78c143751e'.toLowerCase(),
decimals: 6,
};

const stataDAI = {
address: '0xde46e43f46ff74a23a65ebb0580cbe3dfe684a17'.toLowerCase(),
decimals: 18,
};

const stataUSDT = {
address: '0x978206fae13faf5a8d293fb614326b237684b750'.toLowerCase(),
decimals: 6,
};

const bal = {
address: '0xb19382073c7a0addbb56ac6af1808fa49e377b75'.toLowerCase(),
decimals: 18,
};

const daiAave = {
address: '0xff34b3d4aee8ddcd6f9afffb6fe49bd371b8a357'.toLowerCase(),
decimals: 18,
};

const usdcAave = {
address: '0x94a9d9ac8a22534e3faca9f4e7f2e2cf85d5e4c8'.toLowerCase(),
decimals: 6,
};

const amounts = [0n, BI_POWS[6], BI_POWS[7], BI_POWS[8]];

async function main() {
const dexHelper = new DummyDexHelper(Network.SEPOLIA);
const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();

const balancerV3 = new BalancerV3(Network.SEPOLIA, 'BalancerV3', dexHelper);

await balancerV3.initializePricing(blocknumber);

const from = stataUSDC;
const to = stataUSDT;
// const from = daiAave;
// const to = usdcAave;

const pools = await balancerV3.getPoolIdentifiers(
from,
to,
SwapSide.SELL,
blocknumber,
);
console.log('Pool Identifiers: ', from.address, to.address, pools);

const prices = await balancerV3.getPricesVolume(
from,
to,
amounts,
SwapSide.SELL,
blocknumber,
pools,
);
console.log('Pool Prices: ', prices);

const poolLiquidity = await balancerV3.getTopPoolsForToken(from.address, 10);
console.log('Top Pools:', poolLiquidity);
}

main();
Loading

0 comments on commit 409aceb

Please sign in to comment.