-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: accept skippable actions in order planner (#298)
- Loading branch information
Showing
63 changed files
with
519 additions
and
863 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
sdk/order-planner-common/src/utils/GenerateStrategyName.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,5 @@ | ||
import { ISimulation, SimulationType } from '@summerfi/sdk-common/simulation' | ||
|
||
export function generateStrategyName(simulation: ISimulation<SimulationType>): string { | ||
// TODO: temporary workaround to use the right simulation name | ||
if ( | ||
simulation.simulationType === SimulationType.Refinance || | ||
simulation.simulationType === SimulationType.RefinanceDifferentPair || | ||
simulation.simulationType === SimulationType.RefinanceDifferentCollateral || | ||
simulation.simulationType === SimulationType.RefinanceDifferentDebt || | ||
simulation.simulationType === SimulationType.RefinanceNoDebt || | ||
simulation.simulationType === SimulationType.RefinanceNoDebtDifferentCollateral | ||
) { | ||
return `Refinance${simulation.sourcePosition?.pool.id.protocol.name}${simulation.targetPosition.pool.id.protocol.name}` | ||
} | ||
|
||
return `${simulation.simulationType}${simulation.sourcePosition?.pool.id.protocol.name}${simulation.targetPosition?.pool.id.protocol.name}` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { BaseAction } from './BaseAction' | ||
import { InputSlotsMapping } from '../types/InputSlotsMapping' | ||
import { ActionCall } from './Types' | ||
import { IAction } from '../interfaces/IAction' | ||
|
||
export class SkippedAction extends BaseAction<typeof SkippedAction.Config> { | ||
static Config = { | ||
name: 'SkippedAction', | ||
version: 0, | ||
parametersAbi: ['()'], | ||
storageInputs: [], | ||
storageOutputs: [], | ||
} as const | ||
|
||
private _skippedAction: IAction | ||
|
||
public constructor(skippedAction: IAction) { | ||
super() | ||
|
||
this._skippedAction = skippedAction | ||
} | ||
|
||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
public encodeCall(paramsMapping?: InputSlotsMapping): ActionCall { | ||
return { | ||
name: this._skippedAction.config.name, | ||
callData: '0x', | ||
targetHash: this._skippedAction.getActionHash(), | ||
skipped: true, | ||
} | ||
} | ||
|
||
public get config() { | ||
return SkippedAction.Config | ||
} | ||
|
||
public getVersionedName(): string { | ||
return this._skippedAction.getVersionedName() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,3 @@ | ||
export type { | ||
ActionConfig, | ||
ActionCall, | ||
ActionCallBatch, | ||
ActionStorageName, | ||
ActionInputStorageNames, | ||
ActionOutputStorageNames, | ||
ActionVersion, | ||
} from './Types' | ||
export { BaseAction } from './BaseAction' | ||
export type * from './Types' | ||
export * from './BaseAction' | ||
export * from './SkippedAction' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.