Context
The EVM indexer flags native currency transfers (ETH, MATIC, etc.) above a configurable threshold as "large transfers" for monitoring and analytics. This filter converts wei values to ether and compares against the threshold. It follows the same pattern as the existing Solana LargeTransferFilter — a stateless utility with a static method and a default threshold constant.
Specification
File
prism/src/main/java/com/stablebridge/prism/domain/service/EvmLargeTransferFilter.java
Implementation
public final class EvmLargeTransferFilter {
private EvmLargeTransferFilter() {}
/**
* Default threshold: 1.0 ether (or equivalent native token).
*/
public static final BigDecimal DEFAULT_THRESHOLD = new BigDecimal("1.0");
/**
* Check if a native transfer value (in wei) exceeds the threshold (in ether).
* Uses strictly greater than comparison.
*
* @param valueWei the transfer value in wei
* @param thresholdEther the threshold in ether units
* @return true if the transfer value exceeds the threshold
*/
public static boolean isLargeTransfer(BigDecimal valueWei, BigDecimal thresholdEther) {
var valueEther = EvmHex.weiToEther(valueWei.toBigInteger());
return valueEther.compareTo(thresholdEther) > 0;
}
}
Design decisions
final class with private constructor — stateless utility, same pattern as existing LargeTransferFilter
- Strictly greater than (
> 0) — transfers exactly equal to the threshold are NOT flagged
DEFAULT_THRESHOLD is 1.0 ether, configurable via IndexerConfig.LARGE_TRANSFER_THRESHOLD
- Delegates wei-to-ether conversion to
EvmHex.weiToEther() for consistency
- No framework imports
Test class
prism/src/test/java/com/stablebridge/prism/domain/service/EvmLargeTransferFilterTest.java
Test cases:
- Value above threshold returns
true (e.g., 2.0 ETH with 1.0 threshold)
- Value exactly at threshold returns
false (strictly greater than)
- Value below threshold returns
false (e.g., 0.5 ETH with 1.0 threshold)
- Zero value returns
false
- Very large value (e.g., 1000 ETH) returns
true
- Custom threshold works (e.g., 10.0 ETH threshold)
DEFAULT_THRESHOLD equals new BigDecimal("1.0")
Acceptance Criteria
Dependencies
References
Context
The EVM indexer flags native currency transfers (ETH, MATIC, etc.) above a configurable threshold as "large transfers" for monitoring and analytics. This filter converts wei values to ether and compares against the threshold. It follows the same pattern as the existing Solana
LargeTransferFilter— a stateless utility with a static method and a default threshold constant.Specification
File
prism/src/main/java/com/stablebridge/prism/domain/service/EvmLargeTransferFilter.javaImplementation
Design decisions
final classwith private constructor — stateless utility, same pattern as existingLargeTransferFilter> 0) — transfers exactly equal to the threshold are NOT flaggedDEFAULT_THRESHOLDis1.0ether, configurable viaIndexerConfig.LARGE_TRANSFER_THRESHOLDEvmHex.weiToEther()for consistencyTest class
prism/src/test/java/com/stablebridge/prism/domain/service/EvmLargeTransferFilterTest.javaTest cases:
true(e.g., 2.0 ETH with 1.0 threshold)false(strictly greater than)false(e.g., 0.5 ETH with 1.0 threshold)falsetrueDEFAULT_THRESHOLDequalsnew BigDecimal("1.0")Acceptance Criteria
EvmLargeTransferFilterclass exists at the specified pathisLargeTransfer()correctly compares wei values against ether thresholdsDEFAULT_THRESHOLDis1.0EvmHex.weiToEther()for conversion./gradlew buildpassesDependencies
weiToEther()conversionReferences