IPcl.isAddressListed
isAddressListed(
uint64 listId,
address account
) external view returns (bool) Checks whether account is currently a member of the shared address list listId. This is the constant-time membership probe — use it on the hot path when addressListMembers paging would be wasteful. The read succeeds whether the list is Active or Disabled; only policy evaluation gates on status. A missing list reverts with AddressListNotFound(listId).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
listId | uint64 | ✓ | The non-zero registry ID of the list to query. Passing 0 reverts with InvalidAddressListConfig(listId). |
account | address | ✓ | The account to check for membership. The zero address is treated as a normal subject — if explicitly added to the list, membership returns true. |
Returns
bool true when account is stored in the list, false otherwise. The return value does NOT depend on the list's status — a Disabled list still answers truthfully, but any policy referencing it reverts with AddressListDisabled(listId) at evaluation time.
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 list metadata is internally inconsistent. |
AddressListStorageError | AddressListStorageError | Reverts with AddressListStorageError(uint64 listId) when the registry read fails for a reason other than the two above. |
ABISetupFailed | ABISetupFailed | Inherited from IPrecompile. Reverts with ABISetupFailed(string reason) when calldata cannot be decoded against the precompile ABI. |
Examples
Pre-flight a transfer with viem
Checks a recipient against a sanctions deny list before signing a transfer. The on-chain DENY_LIST_POLICY would catch it too, but a pre-flight avoids a failed, gas-charged transaction.
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"),
});
// A sanctions deny list. In production, discover the listId through your
// policy admin or a governance-published registry rather than hard-coding it.
const SANCTIONS_LIST_ID = 1n;
// TODO: replace with the real recipient before production.
const recipient = "0x5ab7c1e40b8da46f9c7e29d3fa614e97b8f0ac21";
const blocked = await publicClient.readContract({
address: iPclAddress,
abi: iPclAbi,
functionName: "isAddressListed",
args: [SANCTIONS_LIST_ID, recipient],
});
if (blocked) {
throw new Error(`recipient ${recipient} is on the sanctions list`);
} Guard a Solidity entrypoint
Uses the precompile check inside a modifier so the contract gates its own entrypoint on allow-list membership. Once its template is registered, a proxy-level ALLOW_LIST_POLICY can enforce the same rule for every call through a PCL-registered proxy (it is not registered on the testnet yet); until then, or when the contract is not behind such a proxy, an inline check like this one gates the contract on a list.
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.28;
import {IPcl, PCL_CONTRACT} from "@maroo-chain/contracts/precompiles/pcl/IPcl.sol";
contract AllowListGate {
uint64 public immutable listId;
error NotAllowed(address account);
constructor(uint64 _listId) {
listId = _listId;
}
modifier onlyListed(address account) {
if (!PCL_CONTRACT.isAddressListed(listId, account)) {
revert NotAllowed(account);
}
_;
}
function doPrivilegedWork() external onlyListed(msg.sender) {
// ... privileged action ...
}
}