Skip to content

Commit

Permalink
multiplex routerProcessor based on routerVendor
Browse files Browse the repository at this point in the history
  • Loading branch information
yogurtandjam committed May 29, 2024
1 parent 5914f0d commit af7ae33
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ package exchange.dydx.abacus.state.model
import exchange.dydx.abacus.protocols.LocalizerProtocol
import exchange.dydx.abacus.state.app.helper.Formatter
import exchange.dydx.abacus.state.manager.V4Environment
import exchange.dydx.abacus.state.v2.supervisor.OnboardingConfigs

class PerpTradingStateMachine(
environment: V4Environment?,
localizer: LocalizerProtocol?,
formatter: Formatter?,
maxSubaccountNumber: Int,
useParentSubaccount: Boolean,
routerVendor: OnboardingConfigs.RouterVendor,
) :
TradingStateMachine(environment, localizer, formatter, maxSubaccountNumber, useParentSubaccount) {
TradingStateMachine(environment, localizer, formatter, maxSubaccountNumber, useParentSubaccount, routerVendor = routerVendor) {
/*
Placeholder for now. Eventually, the code specifically for Perpetual will be in this class
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import exchange.dydx.abacus.processor.assets.AssetsProcessor
import exchange.dydx.abacus.processor.configs.ConfigsProcessor
import exchange.dydx.abacus.processor.launchIncentive.LaunchIncentiveProcessor
import exchange.dydx.abacus.processor.markets.MarketsSummaryProcessor
import exchange.dydx.abacus.processor.router.skip.SkipProcessor
import exchange.dydx.abacus.processor.router.squid.SquidProcessor
import exchange.dydx.abacus.processor.wallet.WalletProcessor
import exchange.dydx.abacus.protocols.LocalizerProtocol
Expand All @@ -49,6 +50,7 @@ import exchange.dydx.abacus.state.manager.BlockAndTime
import exchange.dydx.abacus.state.manager.EnvironmentFeatureFlags
import exchange.dydx.abacus.state.manager.TokenInfo
import exchange.dydx.abacus.state.manager.V4Environment
import exchange.dydx.abacus.state.v2.supervisor.OnboardingConfigs
import exchange.dydx.abacus.utils.IList
import exchange.dydx.abacus.utils.Logger
import exchange.dydx.abacus.utils.Parser
Expand Down Expand Up @@ -80,6 +82,7 @@ open class TradingStateMachine(
private val formatter: Formatter?,
private val maxSubaccountNumber: Int,
private val useParentSubaccount: Boolean,
private val routerVendor: OnboardingConfigs.RouterVendor,
) {
internal val parser: ParserProtocol = Parser()
internal val marketsProcessor = MarketsSummaryProcessor(parser)
Expand All @@ -90,7 +93,7 @@ open class TradingStateMachine(
}
internal val walletProcessor = WalletProcessor(parser)
internal val configsProcessor = ConfigsProcessor(parser)
internal val routerProcessor = SquidProcessor(parser)
internal val routerProcessor = if (routerVendor == OnboardingConfigs.RouterVendor.Skip) SkipProcessor(parser) else SquidProcessor(parser)
internal val rewardsProcessor = RewardsProcessor(parser)
internal val launchIncentiveProcessor = LaunchIncentiveProcessor(parser)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ internal class StateManagerAdaptorV2(
Formatter(uiImplementations.formatter),
127,
appConfigs.accountConfigs.subaccountConfigs.useParentSubaccount,
routerVender = appConfigs.onboardingConfigs.routerVender,
)

internal val jsonEncoder = JsonEncoder()
Expand Down

0 comments on commit af7ae33

Please sign in to comment.