Verified contractPartialMIT
AllowlistRegistry
Address0xe81161fe6a64e52dd1f19b53abf6530012604d2f
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.26
- Same code
Only this contract
Details
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- cancun
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,323,034
- Creation transaction
- 0x4d503a13fd…1732873c08
src/AllowlistRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
/// @title AllowlistRegistry — the PPM whitelist
/// @notice Every transfer of the product token is checked here. Immutable code, mutable state:
/// the operations Safe adds, removes and freezes addresses; the governance timelock sets
/// the transfer mode and the redemption sink. No owner, no upgrade path.
/// @dev `canTransfer(from, to)` has the ERC-3643 shape so institutional custodians recognise it.
contract AllowlistRegistry {
enum Status {
None,
Allowed,
Frozen
}
/// @notice RedemptionOnly — holders may only send to the redemption sink (SA §7.1); the sink may send
/// back (a cancelled request) or on to operations (a settled one).
/// WithinAllowlist — holders may send to any allowed address (PPM whitelist transfers).
enum TransferMode {
RedemptionOnly,
WithinAllowlist
}
/// @notice The Operations Safe. day-to-day registry changes.
address public immutable ops;
/// @notice Governance (the Governance Safe behind a 48 h timelock): rule changes.
address public immutable governance;
mapping(address => Status) private _status;
/// @notice Every address that has ever been the redemption sink: a replaced queue is still no place for a
/// holder's units (review of 28.09.2026, L-12).
mapping(address => bool) public wasRedemptionSink;
TransferMode public transferMode;
/// @notice The address holders send tokens to when redeeming (the operations Safe on launch).
address public redemptionSink;
event Allowed(address indexed account, bytes32 reason);
event Removed(address indexed account, bytes32 reason);
event Frozen(address indexed account, bytes32 reason);
event Unfrozen(address indexed account, bytes32 reason);
event TransferModeSet(TransferMode mode);
event RedemptionSinkSet(address indexed sink);
error NotOps();
error NotGovernance();
error ZeroAddress();
error SinkNotAllowed(address sink);
error SinkBusy(address sink, uint256 openUnits);
error SinkOwes(address sink, uint256 feesDue);
error SinkUnreadable(address sink);
error Protected(address account);
error NotFrozen(address account);
modifier onlyOps() {
if (msg.sender != ops) revert NotOps();
_;
}
modifier onlyGovernance() {
if (msg.sender != governance) revert NotGovernance();
_;
}
/// @param initialMode the transfer mode the series starts in; afterwards only governance changes it.
constructor(address ops_, address governance_, address redemptionSink_, TransferMode initialMode) {
if (ops_ == address(0) || governance_ == address(0) || redemptionSink_ == address(0)) revert ZeroAddress();
ops = ops_;
governance = governance_;
redemptionSink = redemptionSink_;
wasRedemptionSink[redemptionSink_] = true;
// The sink receives redemptions; operations receives the units a settlement retires.
_status[redemptionSink_] = Status.Allowed;
_status[ops_] = Status.Allowed;
transferMode = initialMode;
emit Allowed(redemptionSink_, "REDEMPTION_SINK");
emit Allowed(ops_, "OPERATIONS");
emit RedemptionSinkSet(redemptionSink_);
emit TransferModeSet(initialMode);
}
// ── Operations ──────────────────────────────────────────────────────────────────────────
function allow(address[] calldata accounts, bytes32 reason) external onlyOps {
for (uint256 i = 0; i < accounts.length; i++) {
if (accounts[i] == address(0)) revert ZeroAddress();
// a replaced queue never comes back as a holder: units sent to it could not be moved again (B-07)
if (wasRedemptionSink[accounts[i]] && accounts[i] != redemptionSink) revert Protected(accounts[i]);
_status[accounts[i]] = Status.Allowed;
emit Allowed(accounts[i], reason);
}
}
function remove(address[] calldata accounts, bytes32 reason) external onlyOps {
for (uint256 i = 0; i < accounts.length; i++) {
if (accounts[i] == ops || accounts[i] == redemptionSink) revert Protected(accounts[i]);
_status[accounts[i]] = Status.None;
emit Removed(accounts[i], reason);
}
}
/// @notice A frozen address stays in the registry but its tokens do not move in either direction —
/// the shape of a sanctions freeze.
function freeze(address[] calldata accounts, bytes32 reason) external onlyOps {
for (uint256 i = 0; i < accounts.length; i++) {
// the passage and the operations Safe stay open, or every holder's pending units are locked
if (accounts[i] == ops || accounts[i] == redemptionSink) revert Protected(accounts[i]);
_status[accounts[i]] = Status.Frozen;
emit Frozen(accounts[i], reason);
}
}
function unfreeze(address[] calldata accounts, bytes32 reason) external onlyOps {
for (uint256 i = 0; i < accounts.length; i++) {
if (_status[accounts[i]] != Status.Frozen) revert NotFrozen(accounts[i]); // never an admission by the back door
_status[accounts[i]] = Status.Allowed;
emit Unfrozen(accounts[i], reason);
}
}
// ── Governance (through the timelock) ───────────────────────────────────────────────────
function setTransferMode(TransferMode mode) external onlyGovernance {
transferMode = mode;
emit TransferModeSet(mode);
}
/// @notice The new sink is admitted here, in the same act, and must not have been admitted before: an
/// address that is Allowed but not yet the sink could be sent units nothing can move again
/// (review of 03.10.2026, B-07). The sink it replaces leaves the registry for the same reason.
/// It must owe nothing: no open request (`openUnits`, M-03) and no fee deferred for the treasury
/// (`totalFeesDue`): a deferred fee is paid from a custody's approval of the old queue, which the
/// rotation withdraws, and would otherwise be stranded in the custody (audit of 13.10.2026, E-3).
function setRedemptionSink(address sink) external onlyGovernance {
if (sink == address(0)) revert ZeroAddress();
if (_status[sink] != Status.None || wasRedemptionSink[sink] || sink == ops) revert SinkNotAllowed(sink);
// the queue being replaced must owe nothing: every request settled or cancelled first (M-03), every
// deferred fee paid (E-3)
address old = redemptionSink;
if (old != address(0) && old.code.length != 0) {
// a deployed sink is a queue and says what it owes; one that cannot is not replaced blindly
uint256 open = _owed(old, "openUnits()");
if (open != 0) revert SinkBusy(old, open);
uint256 fees = _owed(old, "totalFeesDue()");
if (fees != 0) revert SinkOwes(old, fees);
}
_status[old] = Status.None;
emit Removed(old, "REDEMPTION_SINK_REPLACED");
_status[sink] = Status.Allowed;
emit Allowed(sink, "REDEMPTION_SINK");
redemptionSink = sink;
wasRedemptionSink[sink] = true;
emit RedemptionSinkSet(sink);
}
/// @dev One figure the old sink owes, by the name of its view; a sink that cannot answer is not replaced.
function _owed(address sink, string memory view_) private view returns (uint256) {
(bool ok, bytes memory ret) = sink.staticcall(abi.encodeWithSignature(view_));
if (!ok || ret.length != 32) revert SinkUnreadable(sink);
return abi.decode(ret, (uint256));
}
// ── Views ───────────────────────────────────────────────────────────────────────────────
function statusOf(address account) external view returns (Status) {
return _status[account];
}
function isAllowed(address account) public view returns (bool) {
return _status[account] == Status.Allowed;
}
/// @notice May `from` send to `to` right now? Both must be Allowed (not Frozen); in
/// RedemptionOnly mode one side must be the redemption sink.
function canTransfer(address from, address to) external view returns (bool) {
if (!isAllowed(from) || !isAllowed(to)) return false;
if (transferMode == TransferMode.RedemptionOnly) return to == redemptionSink || from == redemptionSink;
return true;
}
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": false,
"bytecodeHash": "none",
"useLiteralContent": false
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"@openzeppelin/=lib/openzeppelin-contracts/",
"forge-std/=lib/forge-std/src/",
"ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.