kleros/foresight/indexer-factory

Claude Code and agent skill by kleros/foresight

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when indexing contracts deployed by factory contracts at runtime. contractRegister API, dynamic contract config (no address), async registration, and same-block event coverage.

Install

npx vskill@latest install kleros/foresight/indexer-factory

SKILL.md

Factory / Dynamic Contracts

For contracts created at runtime by factory contracts (e.g., Uniswap Pair creation).

Config

Dynamic contracts have no address — they're registered by contractRegister:

yaml
contracts:
- name: Factory
events:
- event: PairCreated(indexed address token0, indexed address token1, address pair, uint256)
- name: Pair
# No address — registered dynamically
events:
- event: Swap(indexed address sender, uint256 amount0In, ...)
- event: Sync(uint112 reserve0, uint112 reserve1)
chains:
- id: 1
contracts:
- name: Factory
address:
- 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f
- name: Pair
# No address here — will be registered by contractRegister

contractRegister

Must be defined BEFORE the handler. Registers new contract addresses for indexing:

ts
Factory.PairCreated.contractRegister(({ event, context }) => {
context.addPair(event.params.pair);
});
Factory.PairCreated.handler(async ({ event, context }) => {
const pair: Pair = {
id: `${event.chainId}-${event.params.pair}`,
token0_id: `${event.chainId}-${event.params.token0}`,
token1_id: `${event.chainId}-${event.params.token1}`,
};
context.Pair.set(pair);
});

The context.add<ContractName>() methods are auto-generated based on contracts in config that have no address.

Async Contract Register

Perform external calls to decide which contract to register:

ts
NftFactory.SimpleNftCreated.contractRegister(async ({ event, context }) => {
const version = await getContractVersion(event.params.contractAddress);
if (version === "v2") {
context.addSimpleNftV2(event.params.contractAddress);
} else {
context.addSimpleNft(event.params.contractAddress);
}
});

Same-Block Coverage

When a dynamic contract is registered, the Envio Indexer indexes all events from that contract in the same block where it was created — even events from earlier transactions in that block.

If something is unclear, use the envio-docs skill to search and read the latest documentation.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/kleros/foresight/indexer-factory/badge)](https://verified-skill.com/skills/kleros/foresight/indexer-factory)

Something wrong with this skill or its page? Tell us.