Skip to main content

IRevealPolicy Interface

The interface that all reveal policy contracts must implement.

Interface

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

interface IRevealPolicy {
function validate(
bytes32 commitment,
bytes32 nullifier,
address recipient,
uint256 amount,
address token,
bytes calldata policyParams
) external view returns (bool);
}

Parameters

ParameterTypeDescription
commitmentbytes32The commitment being revealed
nullifierbytes32The derived nullifier
recipientaddressAddress that will receive the minted tokens
amountuint256Amount being revealed (in base units)
tokenaddressToken contract address (address(0) for native GHOST)
policyParamsbytesABI-encoded policy-specific parameters

Return value

  • true — reveal is allowed
  • false — reveal is rejected (transaction reverts with PolicyValidationFailed)

Execution context

  • Called via staticcall — your contract cannot modify state
  • Gas limit: 100,000 — keep validation logic efficient
  • The function must be view or pure

Policy params hash

The policyParamsHash stored in the commitment must match the hash of the policyParams provided during reveal. This is verified inside the ZK circuit, preventing parameter tampering.

The hash is computed as:

policyParamsHash = Poseidon(decodedParamFields...)

The exact encoding depends on the policy implementation.