Talos Launch App

04 · Developers

Developer guide

How the contracts fit together, and the order of calls that produces a live pool.

A pool stores one hook address. That address is either one launch hook, or TalosHook. The hub forwards each callback to an ordered list of modules. Modules are the launch hooks, or a later contract with the same interface.

The pieces

Lifecycle of a stacked pool

  1. Deploy the hub, the modules, and TraderRouter against the same PoolManager. Mine each hook address so its flags match getHookPermissions(). The constructor argument is the PoolManager.
  2. attachHub, once, from the wallet that deployed that module. After this, module.hub() equals the hub. createMarket reverts if it does not.
  3. createLaunch on every module, from the launch controller. The pool key's hooks field is the hub, not the module. This stores the router, the launch token, and that hook's parameters. There is no setter later.
  4. createMarket on the hub, from that same controller, with one to eight module addresses in run order. No duplicates.
  5. initialize the pool from that same controller. beforeInitialize reverts if the sender is not the controller, or if the market was never registered.
  6. Add liquidity through the position manager, or call seed on the floor hook if that module is in the stack. The floor hook is the only address allowed to change liquidity until graduation.

Do steps 3 through 5 in one transaction. Registration is first-come for a pool id. Anyone who sees your key can register it if you leave a gap.

A single hook, no hub

Put the module address in key.hooks. Do not call attachHub. Call createLaunch, then initialize, from the same wallet. The module's own callbacks run, because it is the pool's hook. _take calls poolManager.take directly. _relayFee calls updateDynamicLPFee directly.

What runs on a swap

  1. The PoolManager calls the pool's hook beforeSwap. Exact output reverts here. The amount specified must be negative.
  2. On the hub, each module whose flags include beforeSwap is called. A non-zero BeforeSwapDelta reverts. Fee overrides are compared and the highest clean fee is returned with the override flag.
  3. The pool executes the swap.
  4. The PoolManager calls afterSwap. The hub sets a transient pull lock, calls each afterSwap module, and returns the sum of pulls as its unspecified delta. Modules must not call poolManager.take themselves while the hub is the caller. LaunchHook._take routes that through hub.pull.

Parameters do not move

Nothing in these contracts has an owner, a proxy, or a function that changes a live pool's numbers. attachHub can be called once, by the deployer, before the pool exists. After createLaunch, the cap, the fee, the sink, and the router are fixed. If you need different numbers, that is a new pool.

Unaudited

The tests cover the rules these contracts claim. They are not a formal audit, and nothing here is a mainnet deployment. Read Limits and the parameters you actually pass before you point a launch at them.