Skip to content

Commit

Permalink
fix: add network to params
Browse files Browse the repository at this point in the history
  • Loading branch information
Verisana committed Sep 25, 2023
1 parent 91d9334 commit e1a70f4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/dex-helper/dummy-dex-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export class DummyDexHelper implements IDexHelper {
web3Provider: Web3;
getTokenUSDPrice: (token: Token, amount: bigint) => Promise<number>;
executeOnWorkerPool: (
network: number,
dexKeys: string,
methodSelector: string,
payload: any[],
Expand Down Expand Up @@ -288,6 +289,7 @@ export class DummyDexHelper implements IDexHelper {
);

this.executeOnWorkerPool = async (
network: number,
dexKey: string,
methodSelector: string,
payload: any[],
Expand Down
2 changes: 1 addition & 1 deletion src/dex-helper/idex-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { Token } from '../types';
import { ConfigHelper } from '../config';
import { MultiWrapper } from '../lib/multi-wrapper';
import { PromiseScheduler } from '../lib/promise-scheduler';
import { AsyncOrSync } from 'ts-essentials';

export interface IDexHelper {
config: ConfigHelper;
Expand All @@ -23,6 +22,7 @@ export interface IDexHelper {
blockManager: IBlockManager;
getLogger: LoggerConstructor;
executeOnWorkerPool: (
network: number,
dexKey: string,
methodSelector: string,
// For POC it is ok to have any
Expand Down
2 changes: 2 additions & 0 deletions src/dex/algebra/algebra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,12 +529,14 @@ export class Algebra extends SimpleExchange implements IDex<AlgebraData> {

const outputFunc = this.getOutputs;
const unitResult = (await this.dexHelper.executeOnWorkerPool(
this.network,
this.dexKey,
'getOutputs',
[state, [unitAmount], zeroForOne, side, balanceDestToken],
)) as ReturnType<typeof outputFunc>;

const pricesResult = (await this.dexHelper.executeOnWorkerPool(
this.network,
this.dexKey,
'getOutputs',
[state, _amounts, zeroForOne, side, balanceDestToken],
Expand Down
2 changes: 2 additions & 0 deletions src/dex/pancakeswap-v3/pancakeswap-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,12 +609,14 @@ export class PancakeswapV3
_destAddress === pool.token0 ? state.balance0 : state.balance1;

const unitResult = (await this.dexHelper.executeOnWorkerPool(
this.network,
this.dexKey,
'getOutputs',
[state, [unitAmount], zeroForOne, side, balanceDestToken],
)) as ReturnType<typeof this.getOutputs>;

const pricesResult = (await this.dexHelper.executeOnWorkerPool(
this.network,
this.dexKey,
'getOutputs',
[state, _amounts, zeroForOne, side, balanceDestToken],
Expand Down
2 changes: 2 additions & 0 deletions src/dex/uniswap-v3/uniswap-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,12 +642,14 @@ export class UniswapV3
_destAddress === pool.token0 ? state.balance0 : state.balance1;

const unitResult = (await this.dexHelper.executeOnWorkerPool(
this.network,
this.dexKey,
'getOutputs',
[state, [unitAmount], zeroForOne, side, balanceDestToken],
)) as ReturnType<typeof this.getOutputs>;

const pricesResult = (await this.dexHelper.executeOnWorkerPool(
this.network,
this.dexKey,
'getOutputs',
[state, _amounts, zeroForOne, side, balanceDestToken],
Expand Down

0 comments on commit e1a70f4

Please sign in to comment.