Skip to content

[runtime/simplex]]: add phantom order support for passive price and liquidity indexing#983

Draft
dharjeezy wants to merge 1 commit into
mainfrom
dami/phantom-order
Draft

[runtime/simplex]]: add phantom order support for passive price and liquidity indexing#983
dharjeezy wants to merge 1 commit into
mainfrom
dami/phantom-order

Conversation

@dharjeezy

Copy link
Copy Markdown
Contributor

Adds phantom order price and liquidity indexing to the intent coprocessor. The pallet gains two new extrinsics — register_phantom_order (permissionless) and set_phantom_bid_window (governance) — along with the CurrentPhantomOrder and PhantomBidWindow storage items and a phantom_bid_window() helper that mirrors the existing storage_deposit_fee() fallback pattern.

The SubQuery indexer is extended with handlePhantomOrderRegistered and handlePhantomBidPlaced handlers that decode each filler's user operation, extract proposed output amounts, and run a lightweight ERC-20 transfer simulation via state overrides to produce a simulationSuccess signal indexed alongside each bid.

closes #977

/// registered phantom order. Called by the intent coprocessor service.
#[pallet::call_index(7)]
#[pallet::weight(T::WeightInfo::register_phantom_order())]
pub fn register_phantom_order(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct, the phantom order should be generated by the runtime in the pallet hooks


Ok(())
}

@Wizdave97 Wizdave97 Jun 22, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no extrinsic to setup the phantom order details, like token pairs, chain for the order?

import { timestampToDate } from "@/utils/date.helpers"
import { PhantomOrder } from "@/configs/src/types"

export const handlePhantomOrderRegistered = wrap(async (event: SubstrateEvent): Promise<void> => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to index the phantom order

* one reverts, and `null` when the simulation could not be run (e.g. RPC error,
* unsupported node).
*/
async function simulateTokenTransfers(

@Wizdave97 Wizdave97 Jun 22, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct, simulate the bid as is, don't change the solver's balance, only state override needed is the block number so the order is not expired when simulating

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[runtime/simplex]: Intent Coprocessor Price and Liquidity indexing

2 participants