Prefabs allow operators to save multiple curves in the contract, allowing them to switch between strategies by only updating a single parameter in the instruction. This allows for switching between vastly different (or similar) quoting functions and risk curves in under 40 CUs. Makers can store upto 10 prefabs for each curve (40 total) on Hadron.Documentation Index
Fetch the complete documentation index at: https://docs.hadron.fi/llms.txt
Use this file to discover all available pages before exploring further.
How Prefabs Work:
Concepts:- Slot (0–9): Which prefab slot to write to (SetCurve / SetRiskCurve) or to activate (SwitchPriceCurve / SwitchRiskCurve).
- Side:
bid(0) orask(1). Price and risk curves have one active slot per side - Active slot: The slot index currently used for quoting. Swap reads the active curve from prefabs by this index.
Example: Switching between multiple price and risk curves
Store two ask curves in different slots (e.g. slot 0 = tight spread, slot 1 = wide spread). Then switch the active ask curve by sending a single SwitchPriceCurve instruction withside: "ask", slot: 0 or 1.
- 1. Set an ask curve into slot 0 with (e.g. tight spread)
- 2. Set a different ask curve into slot 1 (e.g. wide spread)
- 3. Switch the active ask curve to slot 0 or 1 (one parameter, ~38 CUs)*
- No curve data is sent in the switch instruction—only
sideandslot. The program updates the active slot index
- No curve data is sent in the switch instruction—only
.png?fit=max&auto=format&n=pH37fL0GL14scVCH&q=85&s=5749b485c8c5b2386a4cca404e97d6be)