Skip to content

Commit

Permalink
Merge pull request #519 from paraswap/BACK-1314
Browse files Browse the repository at this point in the history
Back 1314 Add support for sequential transaction preprocessing
  • Loading branch information
paraschiv-razvan authored Oct 5, 2023
2 parents 367e9ea + 67cfcd7 commit 4eef480
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paraswap/dex-lib",
"version": "2.37.0",
"version": "2.37.1",
"main": "build/index.js",
"types": "build/index.d.ts",
"repository": "https://github.com/paraswap/paraswap-dex-lib",
Expand Down
3 changes: 2 additions & 1 deletion src/dex/hashflow/hashflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
readonly isStatePollingDex = true;
readonly hasConstantPriceLargeAmounts = false;
readonly needWrapNative = false;
readonly needsSequentialPreprocessing = true;
readonly isFeeOnTransferSupported = false;
private api: HashflowApi;
private rateFetcher: RateFetcher;
Expand Down Expand Up @@ -737,7 +738,7 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
);
await this.setBlacklist(options.txOrigin);
} else {
if(e instanceof TooStrictSlippageCheckError) {
if (e instanceof TooStrictSlippageCheckError) {
this.logger.warn(
`${this.dexKey}-${this.network}: Market Maker ${mm} failed to build transaction on side ${side} with too strict slippage. Skipping restriction`,
);
Expand Down
1 change: 1 addition & 0 deletions src/dex/idex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { IDexHelper } from '../dex-helper/idex-helper';

export interface IDexTxBuilder<ExchangeData, DirectParam = null> {
needWrapNative: boolean;
needsSequentialPreprocessing?: boolean;

// Returns the ETH fee required to swap
// It is optional for a DEX to implement this
Expand Down
6 changes: 6 additions & 0 deletions src/dex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,4 +315,10 @@ export class DexAdapterService {
? this.sellAdapters[specialDexKey]
: this.buyAdapters[specialDexKey];
}

doesPreProcessingRequireSequentiality(dexKey: string): boolean {
const dex = this.getDexByKey(dexKey);

return !!dex.needsSequentialPreprocessing;
}
}
5 changes: 2 additions & 3 deletions src/dex/uniswap-v3/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export const UniswapV3Config: DexConfigMap<DexParams> = {
'https://api.studio.thegraph.com/query/44554/uniswap-v3/version/latest',
},
},
'Retro': {
Retro: {
[Network.POLYGON]: {
factory: '0x91e1B99072f238352f59e58de875691e20Dc19c1',
quoter: '0xfe08be075758935cb6cb9318d1fbb60920416d4e',
Expand All @@ -284,8 +284,7 @@ export const UniswapV3Config: DexConfigMap<DexParams> = {
chunksCount: 10,
initRetryFrequency: 10,
initHash: `0x817e07951f93017a93327ac8cc31e946540203a19e1ecc37bc1761965c2d1090`,
subgraphURL:
'https://api.thegraph.com/subgraphs/name/ruvlol/univ3-test',
subgraphURL: 'https://api.thegraph.com/subgraphs/name/ruvlol/univ3-test',
},
},
};
Expand Down
7 changes: 1 addition & 6 deletions src/dex/uniswap-v3/uniswap-v3-integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,6 @@ describe('SushiSwapV3', () => {
});
});


describe('Retro', () => {
const dexKey = 'Retro';

Expand Down Expand Up @@ -1233,14 +1232,10 @@ describe('Retro', () => {
});

it('getTopPoolsForToken', async function () {
const poolLiquidity = await retro.getTopPoolsForToken(
TokenB.address,
10,
);
const poolLiquidity = await retro.getTopPoolsForToken(TokenB.address, 10);
console.log(`${TokenASymbol} Top Pools:`, poolLiquidity);

checkPoolsLiquidity(poolLiquidity, TokenB.address, dexKey);
});
});

});

0 comments on commit 4eef480

Please sign in to comment.