Skip to content

Commit

Permalink
Merge pull request #832 from paraswap/aburkut/back-1760-fluid-dex-data
Browse files Browse the repository at this point in the history
remove useless data for FluidDex
  • Loading branch information
aburkut authored Nov 12, 2024
2 parents d948e82 + 25bfab5 commit 96d4a07
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 24 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": "3.11.2",
"version": "3.11.3",
"main": "build/index.js",
"types": "build/index.d.ts",
"repository": "https://github.com/paraswap/paraswap-dex-lib",
Expand Down
26 changes: 8 additions & 18 deletions src/dex/fluid-dex/fluid-dex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,14 @@ export class FluidDex extends SimpleExchange implements IDex<FluidDexData> {
): Promise<string[]> {
if (side === SwapSide.BUY) return [];

const pool = await this.getPoolByTokenPair(
srcToken.address,
destToken.address,
);
const pool = this.getPoolByTokenPair(srcToken.address, destToken.address);
return pool ? [pool.id] : [];
}

async getPoolByTokenPair(
getPoolByTokenPair(
srcToken: Address,
destToken: Address,
): Promise<FluidDexPool | null> {
): FluidDexPool | null {
const srcAddress = srcToken.toLowerCase();
const destAddress = destToken.toLowerCase();

Expand Down Expand Up @@ -193,10 +190,7 @@ export class FluidDex extends SimpleExchange implements IDex<FluidDexData> {

if (side === SwapSide.BUY) return null;
// Get the pool to use.
const pool = await this.getPoolByTokenPair(
srcToken.address,
destToken.address,
);
const pool = this.getPoolByTokenPair(srcToken.address, destToken.address);
if (!pool) return null;

// Make sure the pool meets the optional limitPools filter.
Expand Down Expand Up @@ -229,11 +223,7 @@ export class FluidDex extends SimpleExchange implements IDex<FluidDexData> {
unit: getBigIntPow(
(side === SwapSide.SELL ? destToken : srcToken).decimals,
),
data: {
colReserves: currentPoolReserves.collateralReserves,
debtReserves: currentPoolReserves.debtReserves,
exchange: this.dexKey,
},
data: {},
exchange: this.dexKey,
poolIdentifier: pool.id,
gasCost: FLUID_DEX_GAS_COST,
Expand Down Expand Up @@ -270,13 +260,13 @@ export class FluidDex extends SimpleExchange implements IDex<FluidDexData> {
side: SwapSide,
): AdapterExchangeParam {
if (side === SwapSide.BUY) throw new Error(`Buy not supported`);
const { exchange } = data;

// Encode here the payload for adapter
const payload = '';
const pool = this.getPoolByTokenPair(srcToken, destToken);

return {
targetExchange: exchange,
targetExchange: pool!.address,
payload,
networkFee: '0',
};
Expand Down Expand Up @@ -316,7 +306,7 @@ export class FluidDex extends SimpleExchange implements IDex<FluidDexData> {
'amountOut_',
);

const pool = await this.getPoolByTokenPair(srcToken, destToken);
const pool = this.getPoolByTokenPair(srcToken, destToken);

if (pool!.token0.toLowerCase() !== srcToken.toLowerCase()) {
args = [false, BigInt(srcAmount), BigInt(destAmount), recipient];
Expand Down
6 changes: 1 addition & 5 deletions src/dex/fluid-dex/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ export interface PoolWithReserves {
debtReserves: DebtReserves;
}

export type FluidDexData = {
colReserves: CollateralReserves;
debtReserves: DebtReserves;
exchange: Address;
};
export type FluidDexData = {};

// Each pool has a contract address and token pairs.
export type FluidDexPool = {
Expand Down

0 comments on commit 96d4a07

Please sign in to comment.