Skip to content

Issue 2 — EventParam: Web3j TypeReference wrapper with indexed-parameter factories #308

Description

@aceppaluni

Context

Per the design doc, EventParam wraps a Web3j TypeReference<?> and additionally tracks whether the parameter is indexed, since that's needed to correctly split event data between topics and data when Web3j decodes a log.

public abstract class EventParam {
  private EventParam(TypeReference<?> typeReference) {
    Objects.requireNonNull(typeReference, "typeReference must not be null");
  }
}

Scope

  • Implement EventParam with Objects.requireNonNull validation on the wrapped TypeReference<?> as shown in the doc.
  • Static factory methods for the initial supported type set:
    • EventParam.address(boolean indexed)
    • EventParam.string(boolean indexed)
    • EventParam.bool(boolean indexed)
    • EventParam.bytes(boolean indexed)
    • EventParam.uint256(boolean indexed)
    • EventParam.int256(boolean indexed)
  • Each factory must construct its TypeReference<?> with the indexed flag preserved (Web3j's TypeReference supports an indexed constructor argument) — this is called out explicitly in the doc as something that must not be dropped.
  • Structure the class so additional Solidity ABI types (e.g. uint8/int8 through uint256/int256 variants, fixed-size bytesN, arrays) can be added later without breaking the public factory-method API.

Acceptance Criteria

  • All six listed factory methods implemented and unit tested, asserting both the resolved Solidity type and the indexed flag on the resulting TypeReference.
  • null TypeReference rejected via Objects.requireNonNull (as specified).
  • Javadoc on the class and each factory noting it's part of the public API.

Open Questions

  • Confirm whether EventParam should be a sealed/abstract class with concrete per-type subclasses, or a single class with a type-name field the snippet shows public abstract class EventParam(...), implying compact/record-like subclassing; confirm intended structure with mentors before implementing.

Metadata

Metadata

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions