IPcl.getParams
getParams() external view returns (PclParams memory) PCL 모듈의 런타임 파라미터를 PclParams struct로 반환합니다. 필드는 두 개입니다. policyAdmin은 정책 템플릿을 등록/제거하고 전역 GlobalPolicyConfig를 설정할 수 있는 주소이며, entrypoints는 PCL 평가기가 정당한 최상위 호출자로 인식하는 주소들입니다. 정책 인식 프리컴파일 집합은 더 이상 이 파라미터에 포함되지 않습니다. 체인 바이너리에 고정되어 있으며 내부적으로 types.IsSupportedPolicyAwarePrecompile로 조회되므로, 모듈 파라미터로 재구성할 수 없습니다.
파라미터
이 메서드는 파라미터가 없습니다.
반환값
타입:
PclParams address policyAdmin과 address[] entrypoints 두 필드를 가진 struct입니다. 이전에 있던 address[] policyAwarePrecompiles 필드는 제거되었으며, 이 필드를 여전히 선언하고 있는 클라이언트 ABI는 디코딩에 실패합니다.
예제
viem으로 PCL 파라미터 조회
튜플은 정확히 두 필드입니다. 이전 ABI 조각에서 policyAwarePrecompiles를 아직 선언하고 있다면, 온체인 반환값과 형태가 일치하지 않아 readContract가 예외를 발생시킵니다.
import { createPublicClient, http } from "viem";
const PCL = "0x1000000000000000000000000000000000000005" as const;
const pclAbi = [{
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: pclAbi,
functionName: "getParams",
});
console.log("policyAdmin:", params.policyAdmin);
console.log("entrypoints:", params.entrypoints); Solidity에서 PCL 파라미터 조회
PclParams는 이제 두 필드 struct입니다. 세 번째 policyAwarePrecompiles 배열을 가정하던 컨트랙트는 현재 IPcl.sol에 맞추어 다시 컴파일해야 합니다.
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.28;
import "@maroo-chain/contracts/precompiles/pcl/IPcl.sol";
contract PclParamsReader {
IPcl constant pcl = IPcl(0x1000000000000000000000000000000000000005);
function currentPolicyAdmin() external view returns (address) {
PclParams memory p = pcl.getParams();
return p.policyAdmin;
}
function currentEntrypoints() external view returns (address[] memory) {
return pcl.getParams().entrypoints;
}
}