Skip to main content

Policy

Policies are application logic and external interface for the kernel and installed modules.

Policies are activated and deactivated in the kernel by the executor.Module dependencies and function permissions must be defined in appropriate functions.

Methods

changeKernel

function changeKernel(contract Kernel newKernel_) external nonpayable

Function used by kernel when migrating to a new kernel.

Parameters

NameTypeDescription
newKernel_contract Kernelundefined

configureDependencies

function configureDependencies() external nonpayable returns (Keycode[] dependencies)

Define module dependencies for this policy.

Returns

NameTypeDescription
dependenciesKeycode[]- Keycode array of module dependencies.

isActive

function isActive() external view returns (bool)

Easily accessible indicator for if a policy is activated or not.

Returns

NameTypeDescription
_0boolundefined

kernel

function kernel() external view returns (contract Kernel)

Returns

NameTypeDescription
_0contract Kernelundefined

requestPermissions

function requestPermissions() external view returns (struct Permissions[] requests)

Function called by kernel to set module function permissions.

Returns

NameTypeDescription
requestsPermissions[]- Array of keycodes and function selectors for requested permissions.

Errors

KernelAdapter_OnlyKernel

error KernelAdapter_OnlyKernel(address caller_)

Parameters

NameTypeDescription
caller_addressundefined

Policy_ModuleDoesNotExist

error Policy_ModuleDoesNotExist(Keycode keycode_)

Parameters

NameTypeDescription
keycode_Keycodeundefined