IPcl.setAddressListStatus
setAddressListStatus(uint64 listId, AddressListStatus status) external 공유 주소 리스트를 Active와 Disabled 사이에서 전환합니다. 이 리스트를 참조하는 어떤 PolicySet도 다시 작성할 필요가 없습니다. 현재 리스트 관리자만 호출할 수 있으며, 그 외 발신자는 Unauthorized로 revert됩니다. 센티넬 값 Unspecified는 InvalidAddressListConfig로 거절됩니다. 비활성화된 리스트는 addressList, addressListMembers, isAddressListed로 계속 조회할 수 있지만, 이 리스트를 참조하는 ALLOW_LIST_POLICY 또는 DENY_LIST_POLICY는 평가 시점에 AddressListDisabled(listId)로 revert됩니다. 그 정책들은 평가하는 모든 호출을 거절하므로(전역 DENY_LIST_POLICY라면 체인의 모든 트랜잭션), 비활성화는 리스트 적용을 멈추는 방법이 아닙니다. 현재 상태를 다시 지정하면 아무 일도 일어나지 않고 이벤트도 발행되지 않으며, 실제로 전환될 때는 AddressListStatusChanged(listId, oldStatus, newStatus)가 발행됩니다.
파라미터
| 이름 | 타입 | 필수 | 설명 |
|---|---|---|---|
listId | uint64 | ✓ | 대상 리스트의 0이 아닌 ID입니다. 존재하지 않는 ID는 AddressListNotFound(listId)로, ID 0은 InvalidAddressListConfig(0)으로 revert됩니다. |
status | uint8 | ✓ | 새 AddressListStatus 열거형 값입니다. 허용 값은 Active(1)와 Disabled(2)입니다. Unspecified(0)는 InvalidAddressListConfig로 거절됩니다. Disabled 리스트는 정책 트리의 어디에 있든 거절 쪽으로 닫힙니다. 체인은 평가 전에 정책이 참조하는 모든 리스트를 다시 검사하므로, OR 안의 Disabled 리스트도 앞의 자식이 통과하는지와 관계없이 호출을 거절합니다. |
반환값
void 반환값은 없습니다. 전환 결과는 AddressListStatusChanged 이벤트로 확인합니다.
에러
| 코드 | 이름 | 설명 |
|---|---|---|
Unauthorized | Unauthorized | msg.sender가 listId의 현재 관리자가 아닐 때 revert됩니다. |
AddressListNotFound | AddressListNotFound | 해당 ID의 리스트가 존재하지 않을 때 revert됩니다(ID 0은 대신 InvalidAddressListConfig로 revert됩니다). AddressListNotFound(uint64 listId) 형태로 인코딩됩니다. |
InvalidAddressListConfig | InvalidAddressListConfig | status가 Unspecified이거나 열거형 범위를 벗어났을 때, 또는 레지스트리에 저장된 메타데이터가 무결성 검사를 통과하지 못할 때 revert됩니다. InvalidAddressListConfig(uint64 listId) 형태로 인코딩됩니다. |
AddressListStorageError | AddressListStorageError | 하부 레지스트리 저장소를 읽거나 쓸 수 없을 때 revert됩니다. AddressListStorageError(uint64 listId) 형태로 인코딩됩니다. |
ABISetupFailed | ABISetupFailed | IPrecompile에서 상속됩니다. calldata를 프리컴파일 ABI로 디코딩할 수 없을 때 revert됩니다. |
예제
리스트 비활성화(참조 정책은 모든 호출을 거절)
실제 전환이 일어난 경우에만 AddressListStatusChanged가 발행되며, 현재 상태를 다시 보내면 아무 일도 일어나지 않습니다. 다운스트림에 변경을 알리기 전에 addressList로 새 상태를 확인하는 것과 함께 사용합니다.
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],
}); Solidity에서 저수준 호출
AddressListStatus 열거형은 IPcl.sol에서 가져옵니다. 숫자 값은 Unspecified = 0, Active = 1, Disabled = 2이며, 열거형 순서는 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)) }
}
}
}