Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back 1314 Add support for sequential transaction preprocessing #519

Merged
merged 4 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.36.2",
"version": "2.36.3-sequential-preprocessing.0",
"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;
}
paraschiv-razvan marked this conversation as resolved.
Show resolved Hide resolved
}
Loading