📖
Bella "Tuner" - A Uniswap V3 Simulator
  • Getting Started
    • Overview
    • How "Tuner" Library Works?
    • Installing "Tuner"
    • Quick Start
  • Configuration
    • Configuration
  • Guides
    • (Basic)For anyone who is interested in the Uniswap v3 model
      • Building a client instance
      • About Core Pool Config
      • Getting a Core Pool instance
      • Interacting with Core Pool
    • (Typical)For a quant developer who works on a real pool on mainnet
      • Fetching all the data of a certain pool from Ethereum
      • Getting a pool instance with the data fetched
      • Loading and streaming events into a pool
    • (Advanced)For a better user experience as a state machine
      • PoolState & Transition
      • Post-processor
      • Forking & Retracing
      • Persisting & Recovering
      • SimulatorRoadmapManager
  • Performance
    • Performance
  • Examples
    • Uniswap-v3-Events-Downloader
    • Uniswap-v3-Strategy-Backtest
    • Uniswap-v3-Risk-Analysis(will be available soon)
  • Contributing
    • Contributing
Powered by GitBook
On this page
  1. Guides
  2. (Advanced)For a better user experience as a state machine

SimulatorRoadmapManager

If we take every ConfigurableCorePool as a state machine, then a SimulatorRoadmapManager can be taken as PoolState container as well as ConfigurableCorePool manager. At this point, every state machine can be expanded as a roadmap of states.

First let's get the instance of SimulatorRoadmapManager from SimulatorClient.

let simulatorRoadmapManager: SimulatorRoadmapManager =
  clientInstance.simulatorRoadmapManager;

You can list and check all ConfigurableCorePool created by Tuner within the program.

let pools: ConfigurableCorePool[] = await simulatorRoadmapManager.listRoutes();

With a ConfigurableCorePool id, Tuner can print route from the first pool state to current pool state of the state machine in pretty format.

await simulatorRoadmapManager.printRoute(configurableCorePool.id);

Also you can persist the route for selecting them in the internal database later.

let roadmapId = await simulatorRoadmapManager.persistRoute(
  configurableCorePool.id,
  "description for roadmap"
);

Then load the roadmap and print the route in pretty format.

await simulatorRoadmapManager.loadAndPrintRoute(roadmapId);

Note: As the storage scale of Uniswap V3 CorePool(up to 160,000+ Ticks and unlimited Positions), frequent persistence of route as well as snapshot is not recommended. Please pay attention to space cost.

PreviousPersisting & RecoveringNextPerformance

Last updated 3 years ago