IPcl.getParams

getParams() external view returns (PclParams memory)

Returns the PCL module parameters — the chain-wide policy admin address and the list of approved regulated-path entrypoint contracts. The return struct is named PclParams (the un-namespaced Params name was renamed so multiple precompile interfaces can be imported together without struct-name collisions).

Parameters

This method has no parameters.

Returns

Type: PclParams

A PclParams tuple with two fields: address policyAdmin (the chain-wide policy admin authorized to register policy templates and change the global policy config) and address[] entrypoints (contracts approved as regulated-path entrypoints for runOnPcl).

Examples

Read the policy admin and entrypoints from Solidity

Import the PclParams struct from the interface alongside IPcl and PCL_CONTRACT. The constant binds to the precompile at 0x1000000000000000000000000000000000000005.

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.18;

import { IPcl, PclParams, PCL_CONTRACT } from "@maroo-chain/contracts/precompiles/pcl/IPcl.sol";

contract PclConfigReader {
    function readConfig() external view returns (address admin, address[] memory entrypoints) {
        PclParams memory p = PCL_CONTRACT.getParams();
        return (p.policyAdmin, p.entrypoints);
    }
}

Read PCL params with viem

Client-side ABI describes the return as an anonymous tuple, so the rename is invisible from TypeScript. Use this to verify the entrypoints list before routing a transaction through the regulated path.

import { createPublicClient, http } from "viem";

const PCL = "0x1000000000000000000000000000000000000005";
const pclParamsAbi = [{
  name: "getParams",
  type: "function",
  stateMutability: "view",
  inputs: [],
  outputs: [{
    type: "tuple",
    components: [
      { name: "policyAdmin", type: "address" },
      { name: "entrypoints", type: "address[]" },
    ],
  }],
}] as const;

const client = createPublicClient({ transport: http("https://rpc-testnet.maroo.io") });
const params = await client.readContract({
  address: PCL,
  abi: pclParamsAbi,
  functionName: "getParams",
});
console.log("policyAdmin:", params.policyAdmin);
console.log("entrypoints:", params.entrypoints);
ESC
Type to search