Signature
IB20.sol
Description
Returns the policy ID stored forpolicyScope. If the scope has never been assigned, this returns 0, which is the ALWAYS_ALLOW built-in sentinel, every address is authorized.
An inverted policy ID (bit 63 set) is a valid binding. The token treats the stored value as an opaque uint64 and passes it to the policy registry unchanged. The registry strips bit 63 when checking existence and evaluates the base policy before inverting the result.
Parameters
Returns
Theuint64 policy ID currently bound to the scope. 0 means ALWAYS_ALLOW. Bit 63 may be set, indicating an inverted policy.
Reverts
UnsupportedPolicyType(policyScope): whenpolicyScopeis not a slot this token supports.
Access Control
View function. No role required.Policy Scopes
The following scopes are recognized by a B20 token. Pass one of these aspolicyScope:
An unset scope reads as
0 (ALWAYS_ALLOW). To bind a different policy, the token admin calls updatePolicy(policyScope, newPolicyId). An inverted ID is valid when its base policy exists; policyExists strips bit 63, so the registry resolves it correctly.
Example
Usage Example