IPcl.contractPolicies
contractPolicies(address contractAddress) external view returns (ContractPolicyConfig memory) View call. Returns the contract-scoped ContractPolicyConfig currently active for the target address — its admin and the full PolicySet[]. If no contract-scoped config has been registered, the call returns a zero-valued struct (empty policies array, zero admin); the chain-wide GlobalPolicyConfig still applies regardless. Used for policy inspector UIs and the read-modify-write loop in changeContractPolicies.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
contractAddress | address | ✓ | The address of the contract to query. |
Returns
Type:
ContractPolicyConfig The configuration struct containing admin details and applied policies.
Examples
Reading the contract policy config
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.18;
import { IPcl, ContractPolicyConfig } from "@maroo-chain/contracts/IPcl.sol";
IPcl constant PCL = IPcl(0x1000000000000000000000000000000000000005);
function inspect(address targetContract) external view returns (uint256 policyCount, address admin) {
ContractPolicyConfig memory cfg = PCL.contractPolicies(targetContract);
return (cfg.policies.length, cfg.admin);
// cfg.policies.length == 0 means no contract-scoped config — only the
// chain-wide GlobalPolicyConfig applies to this contract.
}