IPcl.addressList
addressList(uint64 listId) external view returns (AddressList memory) Reads metadata for a single shared address list from the PCL precompile's registry. Returns an AddressList tuple of { id, admin, status } — membership is NOT included here, use addressListMembers to page through the entries. The status field reports whether the list is Active (policies may evaluate it) or Disabled (policies that reference it revert with AddressListDisabled(listId) at evaluation time, though reads still succeed). The underlying registry backs both ALLOW_LIST_POLICY and DENY_LIST_POLICY.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
listId | uint64 | ✓ | The non-zero registry ID of the list to look up. IDs are assigned sequentially by createAddressList starting at 1. Passing 0 reverts with InvalidAddressListConfig(listId). |
Returns
AddressList A tuple (uint64 id, address admin, uint8 status). status is the AddressListStatus enum: 1 = Active, 2 = Disabled. The admin is the account currently authorized to mutate the list (members, admin, status).
Errors
| Code | Name | Description |
|---|---|---|
AddressListNotFound | AddressListNotFound | Reverts with AddressListNotFound(uint64 listId) when no list is registered under listId. |
InvalidAddressListConfig | InvalidAddressListConfig | Reverts with InvalidAddressListConfig(uint64 listId) when listId is 0 or when the stored metadata is internally inconsistent. |
AddressListStorageError | AddressListStorageError | Reverts with AddressListStorageError(uint64 listId) when the chain-layer registry read fails for a reason other than the two above. The underlying cause is kept off the wire. |
ABISetupFailed | ABISetupFailed | Inherited from IPrecompile. Reverts with ABISetupFailed(string reason) when the calldata cannot be decoded against the precompile ABI (for example, a stale or mismatched ABI fragment). |
Examples
Read list metadata with viem
Reads the metadata tuple for list ID 1. The returned struct carries no members; call addressListMembers to page through them.
import { createPublicClient, http } from "viem";
import { iPclAbi, iPclAddress } from "@maroo-chain/contracts/abi/precompiles/pcl/IPcl";
const publicClient = createPublicClient({
transport: http("https://rpc-testnet.maroo.io"),
});
const list = await publicClient.readContract({
address: iPclAddress,
abi: iPclAbi,
functionName: "addressList",
args: [1n],
});
// list.status is the AddressListStatus enum: 1 = Active, 2 = Disabled.
console.log(`list ${list.id} admin=${list.admin} status=${list.status}`); Decode AddressListNotFound in Solidity
Uses try/catch plus the 4-byte selector to recognise AddressListNotFound while letting other reverts propagate. AddressList is zero-valued only when swallowed; callers should check the returned id.
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.28;
import {IPcl, AddressList, PCL_CONTRACT} from "@maroo-chain/contracts/precompiles/pcl/IPcl.sol";
contract AddressListReader {
event Missing(uint64 listId);
function tryRead(uint64 listId) external returns (AddressList memory list) {
try PCL_CONTRACT.addressList(listId) returns (AddressList memory got) {
return got;
} catch (bytes memory raw) {
bytes4 sel;
assembly { sel := mload(add(raw, 32)) }
if (sel == IPcl.AddressListNotFound.selector) {
emit Missing(listId);
return list; // zero-valued tuple
}
// Unknown revert — bubble it up.
assembly { revert(add(raw, 32), mload(raw)) }
}
}
}