Skip to content

Commit

Permalink
avoid splits in prices
Browse files Browse the repository at this point in the history
  • Loading branch information
p0mvn committed Mar 8, 2024
1 parent e58fca9 commit e0b75a8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions domain/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,5 @@ type PoolsConfig struct {
TransmuterCodeIDs []uint64 `mapstructure:"transmuter-code-ids"`
GeneralCosmWasmCodeIDs []uint64 `mapstructure:"general-cosmwasm-code-ids"`
}

const DisableSplitRoutes = 0
2 changes: 1 addition & 1 deletion router/usecase/router_usecase.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func (r *routerUseCaseImpl) GetOptimalQuoteFromConfig(ctx context.Context, token
}
}

if len(rankedRoutes) == 1 {
if len(rankedRoutes) == 1 || router.config.MaxSplitRoutes == domain.DisableSplitRoutes {
return topSingleRouteQuote, nil
}

Expand Down
2 changes: 2 additions & 0 deletions tokens/usecase/pricing/chain/pricing_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ func (c *chainPricing) GetPrice(ctx context.Context, baseDenom string, quoteDeno
routerConfig.MaxRoutes = c.maxRoutes
routerConfig.MaxPoolsPerRoute = c.maxPoolsPerRoute
routerConfig.MinOSMOLiquidity = c.minOSMOLiquidity
// Disable split routes
routerConfig.MaxSplitIterations = domain.DisableSplitRoutes

// Compute a quote for one quote coin.
quote, err := c.RUsecase.GetOptimalQuoteFromConfig(ctx, oneQuoteCoin, baseDenom, routerConfig)
Expand Down

0 comments on commit e0b75a8

Please sign in to comment.