Skip to content

Auto-generated EventHandlers.ts has incorrect property casing for StopRampA event #786

@moose-code

Description

@moose-code

Description

When using envio init to auto-generate an indexer, the generated EventHandlers.ts file contains incorrect property casing for the StopRampA event handler, causing TypeScript compilation errors.

Error Details

Compilation Error:

src/EventHandlers.ts(123,21): error TS2551: Property 'a' does not exist on type 'Vyper_contract_StopRampA_eventArgs'. Did you mean 'A'?

Root Cause:
The auto-generated code incorrectly maps event parameters with inconsistent casing:

  • Event parameter: event.params.A (uppercase)
  • Entity field: a (lowercase)
  • Generated code incorrectly uses: a: event.params.a

Reproduction Steps

  1. Run envio init to create a new indexer
  2. Use the following contract configuration
  • 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7

On eth mainnet

  1. Run pnpm tsc --noEmit to see the compilation error

Expected Behavior

The auto-generated code should correctly map the uppercase event parameter A to the lowercase entity field a:

Vyper_contract.StopRampA.handler(async ({ event, context }) => {
  const entity: Vyper_contract_StopRampA = {
    id: `${event.chainId}_${event.block.number}_${event.logIndex}`,
    a: event.params.A,  // ✅ Correct: uppercase param -> lowercase field
    t: event.params.t,
  };
  context.Vyper_contract_StopRampA.set(entity);
});

Actual Behavior

The auto-generated code incorrectly uses lowercase for both:

Vyper_contract.StopRampA.handler(async ({ event, context }) => {
  const entity: Vyper_contract_StopRampA = {
    id: `${event.chainId}_${event.block.number}_${event.logIndex}`,
    a: event.params.a,  // ❌ Error: lowercase param doesn't exist
    t: event.params.t,
  };
  context.Vyper_contract_StopRampA.set(entity);
});

Environment

  • Contract Address: 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7 (Curve 3pool)
  • Event: StopRampA(uint256 A, uint256 t)
  • Generated Types:
    • Event args: { readonly A: bigint; readonly t: bigint }
    • Entity: { readonly a: bigint; readonly id: id; readonly t: bigint }

Workaround

Manually fix the generated code by changing event.params.a to event.params.A in the StopRampA handler.

Impact

This prevents the indexer from compiling and running, requiring manual intervention to fix auto-generated code.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions