Skip to main content

PolicyEngine

The PolicyEngine is the central contract that stores policy configurations and coordinates rule evaluation. It serves as the registry for all account policies and the dispatcher for rule evaluation.

Overview

Policy Set Structure

Functions

setPolicySet

Register or update the caller’s policy set.

removePolicySet

Remove the caller’s policy set and stop enforcement.

evaluate

Evaluate a transaction against the caller’s registered policy. Called by PolicyGuard or PolicyKit7579Module.
Returns: bool — Whether the transaction is allowed.

getPolicySet

Read the policy set for an account.

Events

Encoding Format

On-chain rules are encoded using the PolicyCodec library into a compact binary format:
The SDK’s PolicyEncoder handles encoding and decoding automatically.