Pre-release — The API surface may change. Unaudited.
Callcium LogoCallcium

PolicyManager

Abstract contract providing EIP-7201 namespaced policy storage.

Functions

_policyStore

Returns the namespaced policy store.

function _policyStore() private pure returns (PolicyRegistry.Store storage $);

_storePolicy

Stores a policy blob via SSTORE2.

Stored policies are trusted at enforcement time without semantic validation. Access to this function is the primary security boundary for enforcement integrity.

function _storePolicy(bytes memory policy) internal returns (bytes32 policyHash, address pointer);

Parameters

NameTypeDescription
policybytesThe encoded policy blob.

Returns

NameTypeDescription
policyHashbytes32The keccak256 hash of the policy.
pointeraddressThe SSTORE2 pointer address.

_bindPolicy

Binds a policy to a (target, selector) pair.

Binding a policy activates it for enforcement on the given target. Restrict access as tightly as policy storage itself.

function _bindPolicy(address target, bytes4 selector, bytes32 policyHash) internal;

Parameters

NameTypeDescription
targetaddressThe contract address to bind the policy to.
selectorbytes4The function selector.
policyHashbytes32The policy hash (must already be stored).

_unbindPolicy

Unbinds a policy from a (target, selector) pair.

function _unbindPolicy(address target, bytes4 selector) internal;

Parameters

NameTypeDescription
targetaddressThe contract address.
selectorbytes4The function selector.

_storeAndBindPolicy

Stores a policy and binds it to targets in one call.

Stored policies are trusted at enforcement time without semantic validation, and binding activates them immediately. Access to this function is the primary security boundary.

function _storeAndBindPolicy(address[] calldata targets, bytes memory policy)
    internal
    returns (bytes32 policyHash);

Parameters

NameTypeDescription
targetsaddress[]Target addresses to bind to. Use address(0) for default.
policybytesThe encoded policy blob.

Returns

NameTypeDescription
policyHashbytes32The policy hash.

_storeAndBindPolicy

Stores a policy and binds it to a single target.

Stored policies are trusted at enforcement time without semantic validation, and binding activates them immediately. Access to this function is the primary security boundary.

function _storeAndBindPolicy(address target, bytes memory policy) internal returns (bytes32 policyHash);

Parameters

NameTypeDescription
targetaddressThe target address. Use address(0) for default.
policybytesThe encoded policy blob.

Returns

NameTypeDescription
policyHashbytes32The policy hash.

_resolvePolicy

Resolves and loads the policy for a (target, selector) pair.

function _resolvePolicy(address target, bytes4 selector) internal view returns (bytes memory);

Parameters

NameTypeDescription
targetaddressThe contract address.
selectorbytes4The function selector.

Returns

NameTypeDescription
<none>bytesThe policy blob, or empty bytes if none bound.

_policyHashFor

Returns the policy hash for a (target, selector) pair.

function _policyHashFor(address target, bytes4 selector) internal view returns (bytes32);

Parameters

NameTypeDescription
targetaddressThe contract address.
selectorbytes4The function selector.

Returns

NameTypeDescription
<none>bytes32The policy hash, or bytes32(0) if none bound.

_loadPolicy

Loads a policy blob by its hash.

function _loadPolicy(bytes32 policyHash) internal view returns (bytes memory);

Parameters

NameTypeDescription
policyHashbytes32The policy hash.

Returns

NameTypeDescription
<none>bytesThe policy blob, or empty bytes if not found.

_policyExists

Checks if a policy exists in storage.

function _policyExists(bytes32 policyHash) internal view returns (bool);

Parameters

NameTypeDescription
policyHashbytes32The policy hash to check.

Returns

NameTypeDescription
<none>boolTrue if the policy exists.

_policyPointerOf

Returns the SSTORE2 pointer for a policy hash.

function _policyPointerOf(bytes32 policyHash) internal view returns (address);

Parameters

NameTypeDescription
policyHashbytes32The policy hash.

Returns

NameTypeDescription
<none>addressThe pointer address, or address(0) if not found.

On this page