hiero-ledger / hiero-ledger/hiero-enterprise-java

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

Open
#308 2 comments 0 reactions 2 assignees Claimed by @manishdait View on GitHub
API-Design Mentorship pending-review smart-contracts
Dominant language
Java
Stars
6
Forks
21
Avg merge
10h 27m
Merged PRs (30d)
37

Description

### 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.

```java
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.