Skip to main content

Signature

Description

Updates the policy ID assigned to policyScope. Takes effect immediately for the next operation that consults this slot. Emits PolicyUpdated.

Parameters

Reverts

  • AccessControlUnauthorizedAccount when the caller does not hold DEFAULT_ADMIN_ROLE.
  • UnsupportedPolicyType when policyScope is not recognized by this token.
  • PolicyNotFound when newPolicyId is not a built-in sentinel and does not exist in the registry.

Access control

DEFAULT_ADMIN_ROLE gates this call. Factory initCalls bypass the role gate during creation.

Policy interaction

Reads or writes a token policy-scope pointer into the PolicyRegistry. The newPolicyId may reference a simple policy (ALLOWLIST or BLOCKLIST) or a composite policy (UNION or INTERSECT). B20 treats the value as an opaque uint64 and delegates all authorization logic to the PolicyRegistry.
Before storing a composite policy ID, call policyExists(policyId) on the PolicyRegistry. An invalid INTERSECT ID with no children returns true for every account, behaving like ALWAYS_ALLOW.

Example