Skip to content

Commit

Permalink
Merge pull request paraswap#506 from paraswap/fix/1291-generic-rfq-id…
Browse files Browse the repository at this point in the history
…entifier

BACK-1291: Fix generic RFQ issue
  • Loading branch information
mwamedacen authored Sep 18, 2023
2 parents a0ef66b + 585e635 commit 1711268
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 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.35.4",
"version": "2.35.5",
"main": "build/index.js",
"types": "build/index.d.ts",
"repository": "https://github.com/paraswap/paraswap-dex-lib",
Expand Down
9 changes: 7 additions & 2 deletions src/dex/generic-rfq/generic-rfq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
PreprocessTransactionOptions,
Config,
PoolLiquidity,
Address,
} from '../../types';
import { Network, SwapSide } from '../../constants';
import { IDexHelper } from '../../dex-helper';
Expand Down Expand Up @@ -61,15 +62,19 @@ export class GenericRFQ extends ParaSwapLimitOrders {
return;
}

getIdentifier(srcToken: Address, destToken: Address) {
// Keep only destination token in order to prevent taping into the same market maker liquidity during same swap (double spending)
return `${this.dexKey}_${destToken}`.toLowerCase();
}

async getPoolIdentifiers(
srcToken: Token,
destToken: Token,
side: SwapSide,
blockNumber: number,
): Promise<string[]> {
const _destToken = this.dexHelper.config.wrapETH(destToken);
// Keep only destination token in order to prevent taping into the same market maker liquidity during same swap (double spending)
return [`${this.dexKey}_${_destToken.address}`.toLowerCase()];
return [this.getIdentifier(srcToken.address, _destToken.address)];
}

calcOutsFromAmounts(
Expand Down

0 comments on commit 1711268

Please sign in to comment.