Skip to content

Commit

Permalink
Filter pools using totalShares in SG.
Browse files Browse the repository at this point in the history
  • Loading branch information
johngrantuk committed Jun 14, 2022
1 parent 4f36466 commit 63c583e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions balancer-js/examples/swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Contract } from '@ethersproject/contracts';

dotenv.config();

const { TRADER_KEY, TRADER_ADDRESS } = process.env;
const { TRADER_KEY } = process.env;

const network = Network.MAINNET;
const rpcUrl = `http://127.0.0.1:8545`;
Expand Down Expand Up @@ -63,7 +63,7 @@ async function executePoolFetching() {
maxPools: 4,
});

const userAddress = TRADER_ADDRESS as string;
const userAddress = wallet.address;
const deadline = BigNumber.from(`${Math.ceil(Date.now() / 1000) + 60}`); // 60 seconds from now
const maxSlippage = 50; // 50 bsp = 0.5%

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class SubgraphPoolDataService implements PoolDataService {

private async getLinearPools() {
const { pool0, pool1000 } = await this.client.Pools({
where: { swapEnabled: true },
where: { swapEnabled: true, totalShares_gt: '0' },
orderBy: Pool_OrderBy.TotalLiquidity,
orderDirection: OrderDirection.Desc,
});
Expand All @@ -83,7 +83,7 @@ export class SubgraphPoolDataService implements PoolDataService {

private async getNonLinearPools() {
const { pools } = await this.client.PoolsWithoutLinear({
where: { swapEnabled: true },
where: { swapEnabled: true, totalShares_gt: '0' },
orderBy: Pool_OrderBy.TotalLiquidity,
orderDirection: OrderDirection.Desc,
first: 1000,
Expand Down

0 comments on commit 63c583e

Please sign in to comment.