Skip to content

Commit

Permalink
fix: merge issues
Browse files Browse the repository at this point in the history
  • Loading branch information
zerotucks committed Apr 3, 2024
1 parent d9ddcf0 commit 4321824
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class OrderPlanner implements IOrderPlanner {
return actionBuildersMap[step.type] as ActionBuilder<T>
}

private _getStrategyName(simulation: Simulation<SimulationType>): string {
private _getStrategyName(simulation: ISimulation<SimulationType>): string {
return `${simulation.simulationType}${simulation.sourcePosition?.pool.protocol.name}${simulation.targetPosition?.pool.protocol.name}`
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { FlashloanProvider, ISimulation, SimulationType, TokenTransferTargetType } from '@summerfi/sdk-common/simulation'
import {
FlashloanAction,
SetApprovalAction,
ReturnFundsAction,
} from '@summerfi/protocol-plugins/plugins/common'
import { FlashloanProvider, ISimulation, SimulationType } from '@summerfi/sdk-common/simulation'
import { DeploymentIndex } from '@summerfi/deployment-utils'
import { ISwapManager } from '@summerfi/swap-common/interfaces'
import { Address, AddressValue, ChainFamilyMap, ChainInfo } from '@summerfi/sdk-common/common'
import { ProtocolName } from '@summerfi/sdk-common/protocols'
import { IPositionsManager } from '@summerfi/sdk-common/orders'
import { SetupDeployments } from '../utils/SetupDeployments'
import { UserMock } from '../mocks/UserMock'
Expand All @@ -18,7 +24,6 @@ import {
import assert from 'assert'
import { IUser } from '@summerfi/sdk-common/user'
import {
IContractProvider,
IPriceService,
IProtocolPluginsRegistry,
ITokenService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class RefinanceSimulationManager extends IRPCClient {

public async simulateRefinancePosition(
params: IRefinanceParameters,
): Promise<Simulation<SimulationType.Refinance>> {
): Promise<ISimulation<SimulationType.Refinance>> {
const refinanceParameters: IRefinanceParameters = {
position: {
positionId: params.position.positionId,
Expand Down
2 changes: 1 addition & 1 deletion sdk/sdk-common/src/common/implementation/TokenAmount.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BigNumber } from 'bignumber.js'
import {Percentage} from "./Percentage";
import { Percentage } from './Percentage'
import { Token } from './Token'
import { SerializationService } from '../../services/SerializationService'
import { ITokenAmount } from '../interfaces/ITokenAmount'
Expand Down
4 changes: 2 additions & 2 deletions sdk/sdk-common/src/swap/SimulatedSwapData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { QuoteData } from './QuoteData'
export type SimulatedSwapData = Omit<QuoteData, 'estimatedGas' | 'routes'> & {
slippage: Percentage
/* This is the impacted price that takes into account trade size */
offerPrice: Price;
offerPrice: Price
/* This is the un-impacted blend of market prices from various DEXs */
marketPrice: Price;
marketPrice: Price
priceImpact: Percentage
summerFee: TokenAmount
}
Empty file.
4 changes: 2 additions & 2 deletions sdk/sdk-e2e/tests/refinanceMakerSpark.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ProtocolName, isLendingPool } from '@summerfi/sdk-common/protocols'
import { makeSDK, type Chain, type User, Protocol } from '@summerfi/sdk-client'
import { TokenSymbol } from '@summerfi/sdk-common/common/enums'
import { IPositionsManager, IRefinanceParameters, Order } from '@summerfi/sdk-common/orders'
import { Simulation, SimulationType } from '@summerfi/sdk-common/simulation'
import { ISimulation, SimulationType } from '@summerfi/sdk-common/simulation'
import { TransactionUtils } from './utils/TransactionUtils'
import {
decodeActionCalldata,
Expand Down Expand Up @@ -162,7 +162,7 @@ describe.skip('Refinance Maker Spark | SDK', () => {
assert(false, 'Spark pool type is not lending')
}

const refinanceSimulation: Simulation<SimulationType.Refinance> =
const refinanceSimulation: ISimulation<SimulationType.Refinance> =
await sdk.simulator.refinance.simulateRefinancePosition({
position: makerPosition,
targetPool: sparkPool,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {
import type {
ReferenceableField,
SimulationStrategy,
ValueReference,
Expand Down
22 changes: 20 additions & 2 deletions sdk/testing-utils/src/mocks/SwapManagerMock.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import { Address, ChainInfo, Percentage, Token, TokenAmount } from '@summerfi/sdk-common/common'
import {
Address,
ChainInfo,
Percentage,
Token,
TokenAmount,
CurrencySymbol,
} from '@summerfi/sdk-common/common'
import { SpotData, SwapData, QuoteData } from '@summerfi/sdk-common/swap'
import { ISwapManager } from '@summerfi/swap-common/interfaces'
import { QuoteData, SwapData } from '@summerfi/swap-common/types'

export class SwapManagerMock implements ISwapManager {
private _swapDataReturnValue: SwapData = {} as SwapData
private _quoteDataReturnValue: QuoteData = {} as QuoteData

private _spotPricesReturnValue: SpotData = {} as SpotData

private _lastGetSwapDataExactInputParams:
| {
chainInfo: ChainInfo
Expand All @@ -32,6 +41,15 @@ export class SwapManagerMock implements ISwapManager {
this._quoteDataReturnValue = quoteData
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async getSpotPrices(params: {
chainInfo: ChainInfo
tokens: Token[]
quoteCurrency?: CurrencySymbol
}): Promise<SpotData> {
return this._spotPricesReturnValue
}

async getSwapDataExactInput(params: {
chainInfo: ChainInfo
fromAmount: TokenAmount
Expand Down

0 comments on commit 4321824

Please sign in to comment.