Skip to content

Commit

Permalink
add exclude token filter; update config
Browse files Browse the repository at this point in the history
  • Loading branch information
dglowinski committed Jan 10, 2025
1 parent 2f39921 commit 3f8787e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 26 deletions.
27 changes: 1 addition & 26 deletions src/swapService/config/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,6 @@ const mainnetRoutingConfig: ChainRoutingConfig = [
},
match: { isPendlePT: true },
},
{
strategy: StrategyBalmySDK.name(),
config: {
sourcesFilter: {
includeSources: ["paraswap", "open-ocean", "li-fi", "odos", "1inch"],
},
tryExactOut: true,
},
match: {
tokensInOrOut: [SUSDS_MAINNET],
},
},
// Target debt RLP through Odos
{
strategy: StrategyBalmySDK.name(),
config: {
sourcesFilter: {
includeSources: ["odos", "1inch"],
},
},
match: {
swapperModes: [SwapperMode.TARGET_DEBT],
tokensInOrOut: [RLP_MAINNET],
},
},

// DEFAULTS
{
strategy: StrategyBalmySDK.name(),
Expand All @@ -92,6 +66,7 @@ const mainnetRoutingConfig: ChainRoutingConfig = [
strategy: StrategyCombinedUniswap.name(),
match: {
swapperModes: [SwapperMode.TARGET_DEBT],
excludeTokensInOrOut: [RLP_MAINNET, SUSDS_MAINNET],
},
},
// FALLBACKS
Expand Down
1 change: 1 addition & 0 deletions src/swapService/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export interface StrategyMatchConfig {
isRepay?: boolean
isPendlePT?: boolean
tokensInOrOut?: Address[]
excludeTokensInOrOut?: Address[]
}

export interface RoutingItem {
Expand Down
11 changes: 11 additions & 0 deletions src/swapService/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ export function matchParams(
)
return false
}
if (match.excludeTokensInOrOut) {
if (
match.excludeTokensInOrOut.some((token: Hex) => {
return (
isAddressEqual(swapParams.tokenIn.addressInfo, token) ||
isAddressEqual(swapParams.tokenOut.addressInfo, token)
)
})
)
return false
}
if (match.isRepay) {
if (swapParams.isRepay !== match.isRepay) return false
}
Expand Down

0 comments on commit 3f8787e

Please sign in to comment.