Skip to main content

Signature

IB20.sol

Description

Binds newPolicyId to policyScope. Takes effect immediately: the next operation that consults that scope calls isAuthorized(newPolicyId, account) on the Policy Registry. Emits PolicyUpdated. Until a scope is updated it holds 0 (ALWAYS_ALLOW), so the check passes for every address.

Parameters

Reverts

Access Control

DEFAULT_ADMIN_ROLE gates this call. During token creation, initCalls may bind policies in the same transaction; those calls bypass the role gate.

Policy Scopes

The recognized scopes and the accounts they check are: Transfer scopes are skipped on factory initCalls transfers. MINT_RECEIVER_POLICY is always checked, including factory initCalls mints. SEIZE_EXEMPT_POLICY unset (ALWAYS_ALLOW) means no account is seizable.

Inverted Policy IDs

Bit 63 of a uint64 policy ID is the invert (NOT) flag. Passing an inverted ID to updatePolicy is valid as long as the base policy (the ID with bit 63 cleared) exists in the registry. The token stores and passes the full uint64 — including the invert bit — to isAuthorized, which returns the opposite of the base policy’s decision. If the base does not exist at evaluation time, isAuthorized returns false (fail-closed). Use invertedPolicyId(policyId) on the Policy Registry to toggle the bit rather than computing it manually.

Example

Usage Example
Inverted Policy Example
The same policy ID can be bound to more than one scope and to more than one token. Updating membership in the registry policy is visible immediately on every scope and token that references it; no second updatePolicy call is needed.