IPcl.setAddressListStatus
setAddressListStatus(uint64 listId, AddressListStatus status) external Flips a shared address list between Active and Disabled without rewriting any PolicySet that references it. Only the current list admin may call this; any other sender reverts with Unauthorized. The sentinel Unspecified value is rejected with InvalidAddressListConfig. A disabled list stays readable through addressList, addressListMembers, and isAddressListed, but any ALLOW_LIST_POLICY or DENY_LIST_POLICY that references it reverts at evaluation time with AddressListDisabled(listId) — it fails CLOSED: those policies reject every call they evaluate (a global DENY_LIST_POLICY over a disabled list rejects every transaction on the chain), so disabling is not a way to stop enforcing a list. Setting the status to its current value is a no-op and emits no event; a real transition emits AddressListStatusChanged(listId, oldStatus, newStatus).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
listId | uint64 | ✓ | The target list's nonzero ID. An unknown ID reverts with AddressListNotFound(listId); ID 0 with InvalidAddressListConfig(0). |
status | uint8 | ✓ | The new AddressListStatus enum value. Allowed values are Active (1) and Disabled (2). Unspecified (0) is rejected with InvalidAddressListConfig. A Disabled list fails closed wherever it sits in the policy tree: before evaluating, the chain re-checks every list the policy references, so a Disabled list inside an OR rejects the call even when an earlier child would pass. |
Returns
void No return value. Observe AddressListStatusChanged to confirm the transition.
Errors
| Code | Name | Description |
|---|---|---|
Unauthorized | Unauthorized | Reverts when msg.sender is not the current admin of listId. |
AddressListNotFound | AddressListNotFound | Reverts when no list with that ID exists (ID 0 reverts with InvalidAddressListConfig instead). Encoded as AddressListNotFound(uint64 listId). |
InvalidAddressListConfig | InvalidAddressListConfig | Reverts when status is Unspecified or outside the enum range, or when the registry's stored metadata fails integrity checks. Encoded as InvalidAddressListConfig(uint64 listId). |
AddressListStorageError | AddressListStorageError | Reverts when the underlying registry store cannot be read or written. Encoded as AddressListStorageError(uint64 listId). |
ABISetupFailed | ABISetupFailed | Inherited from IPrecompile. Reverts when calldata cannot be decoded against the precompile ABI. |
Examples
Disable a list (its policies then reject every call)
Only transitions emit AddressListStatusChanged; re-sending the current status is a no-op. Combine this with addressList to confirm the new status before announcing the change downstream.
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { iPclAbi } from "@maroo-chain/contracts/abi/precompiles/pcl/IPcl";
const PCL = "0x1000000000000000000000000000000000000005" as const;
// AddressListStatus: Unspecified = 0, Active = 1, Disabled = 2.
const ACTIVE = 1 as const;
const DISABLED = 2 as const;
const admin = privateKeyToAccount(process.env.LIST_ADMIN_KEY as `0x${string}`);
const wallet = createWalletClient({
account: admin,
transport: http(process.env.MAROO_RPC_URL),
});
// TODO: replace with the real list id before production.
const listId = 12n;
// Every policy referencing the list now rejects the calls it evaluates. Members remain readable;
// any ALLOW_LIST_POLICY or DENY_LIST_POLICY that points at this list
// now reverts with AddressListDisabled(listId) on evaluation.
await wallet.writeContract({
address: PCL,
abi: iPclAbi,
functionName: "setAddressListStatus",
args: [listId, DISABLED],
});
// Later, re-enable the list in one call:
await wallet.writeContract({
address: PCL,
abi: iPclAbi,
functionName: "setAddressListStatus",
args: [listId, ACTIVE],
}); Call low-level from Solidity
The AddressListStatus enum is imported from IPcl.sol; its numeric values are Unspecified = 0, Active = 1, Disabled = 2, and the enum order is part of the ABI.
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.28;
import { IPcl, AddressListStatus } from "@maroo-chain/contracts/precompiles/pcl/IPcl.sol";
contract ListStatusAdmin {
address constant PCL = 0x1000000000000000000000000000000000000005;
address public immutable owner;
error NotOwner();
constructor() { owner = msg.sender; }
/// @dev This contract is the list's admin, so PCL checks THIS contract, not its caller —
/// without the owner check anyone could change the list through it.
modifier onlyOwner() {
if (msg.sender != owner) revert NotOwner();
_;
}
/// @notice setAddressListStatus returns nothing, so a high-level call on the
/// bytecode-less precompile reverts with empty data. Call it
/// low-level and bubble revert data on failure. Takes either status:
/// this contract is the list admin, so a disable-only wrapper would
/// leave nobody able to re-activate the list.
function setStatus(uint64 listId, AddressListStatus status) external onlyOwner {
(bool ok, bytes memory ret) = PCL.call(
abi.encodeCall(IPcl.setAddressListStatus, (listId, status))
);
if (!ok) {
assembly { revert(add(ret, 32), mload(ret)) }
}
}
}