BaseEvaluationEngine

Base class for evaluation engines that provides hash calculation.

Extend this class to create custom evaluation engines. The implementation hash is computed automatically from the class file bytecode.

Example:

class MyEngine : BaseEvaluationEngine() {
override val engineId = "my-engine"
override val version = "1.0.0"
override val supportedConditionTypes = setOf(ConditionType.THRESHOLD)

override suspend fun evaluateCondition(
condition: ContractCondition,
inputData: JsonElement,
context: EvaluationContext
): Boolean {
// Your implementation
}
}

Inheritors

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
abstract val engineId: String

Unique identifier for this evaluation engine. Must match the evaluationEngine value in ExecutionModel. Examples: "parametric-insurance", "rule-engine", "smart-contract-vm"

Link copied to clipboard

Lazy initialization of hash to avoid computation during object construction.

Link copied to clipboard

Supported condition types for this engine.

Link copied to clipboard
abstract val version: String

Version of the engine implementation. Used for tamper detection and compatibility checks.

Functions

Link copied to clipboard
abstract suspend fun evaluateCondition(condition: ContractCondition, inputData: JsonElement, context: EvaluationContext): Boolean

Evaluate a single contract condition.

Link copied to clipboard
open suspend override fun evaluateConditions(conditions: List<ContractCondition>, inputData: JsonElement, context: EvaluationContext): Map<String, Boolean>

Default implementation of evaluateConditions that evaluates each condition individually. Override if you need custom batch evaluation logic.