Skip to content

Commit

Permalink
add fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aburkut committed Dec 9, 2024
1 parent 4fa11c1 commit 3333d40
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/dex/stader/stader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
Logger,
PoolLiquidity,
PoolPrices,
SimpleExchangeParam,
Token,
TransferFeeParams,
} from '../../types';
Expand All @@ -29,7 +28,6 @@ import * as CALLDATA_GAS_COST from '../../calldata-gas-cost';
import _ from 'lodash';
import { extractReturnAmountPosition } from '../../executor/utils';
import { getDexKeysWithNetwork, isETHAddress } from '../../utils';
import { ethers } from 'ethers';

export class Stader
extends SimpleExchange
Expand Down Expand Up @@ -105,6 +103,8 @@ export class Stader
transferFees?: TransferFeeParams | undefined,
isFirstSwap?: boolean | undefined,
): Promise<ExchangePrices<StaderData> | null> {
if (side === SwapSide.BUY) return null;

const pool = this.ethxPool;
if (!pool.getState(blockNumber)) return null;

Expand Down Expand Up @@ -132,8 +132,6 @@ export class Stader
destToken: Token | string,
side: SwapSide,
): boolean {
if (side === SwapSide.BUY) return false;

const srcTokenAddress = (
typeof srcToken === 'string' ? srcToken : srcToken.address
).toLowerCase();
Expand All @@ -156,6 +154,8 @@ export class Stader
_data: StaderData,
_side: SwapSide,
): DexExchangeParam {
if (_side === SwapSide.BUY) throw new Error(`Buy not supported`);

const swapData = this.SSPMInterface.encodeFunctionData(
SSPMFunctions.deposit,
[_recipient],
Expand Down Expand Up @@ -187,6 +187,8 @@ export class Stader
side: SwapSide,
blockNumber: number,
): Promise<string[]> {
if (side === SwapSide.BUY) return [];

if (!this.isEligibleSwap(srcToken, destToken, side)) return [];

return [`${ETHER_ADDRESS}_${destToken.address}`.toLowerCase()];
Expand Down

0 comments on commit 3333d40

Please sign in to comment.