Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/interfaces/IAddressRegistry.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.8.13 <0.9.0;

/// @title TIP-1022 virtual address registry interface
/// @notice Registers master addresses and resolves virtual TIP-20 recipients to their masters
interface IAddressRegistry {
/// @notice Emitted when a new virtual master is registered.
event MasterRegistered(bytes4 indexed masterId, address indexed masterAddress);

/// @notice The derived `masterId` is already registered.
error MasterIdCollision(address master);

/// @notice The caller is not a valid virtual-address master.
error InvalidMasterAddress();

/// @notice The registration hash does not satisfy the required 32-bit proof of work.
error ProofOfWorkFailed();

/// @notice The target address matches the virtual format but its master has not been registered.
error VirtualAddressUnregistered();

/// @notice Registers `msg.sender` as a virtual-address master.
function registerVirtualMaster(bytes32 salt) external returns (bytes4 masterId);

/// @notice Returns the registered master for `masterId`, or `address(0)` if it is unregistered.
function getMaster(bytes4 masterId) external view returns (address);

/// @notice Resolves `to` under TIP-1022 rules.
function resolveRecipient(address to) external view returns (address effectiveRecipient);

/// @notice Resolves a virtual address to its registered master.
function resolveVirtualAddress(address virtualAddr) external view returns (address master);

/// @notice Returns `true` when `addr` matches the TIP-1022 virtual address layout.
function isVirtualAddress(address addr) external pure returns (bool);

/// @notice Decodes a virtual address into its components.
function decodeVirtualAddress(address addr) external pure returns (bool isVirtual, bytes4 masterId, bytes6 userTag);
}
3 changes: 3 additions & 0 deletions src/interfaces/ITIP403Registry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ interface ITIP403Registry {
/// @notice Error when policy has an invalid type
error InvalidPolicyType();

/// @notice TIP-1022 virtual addresses cannot be used as literal policy members
error VirtualAddressNotAllowed();

/// @notice Emitted when a policy's admin is updated
/// @param policyId The ID of the policy that was updated
/// @param updater The address that performed the update
Expand Down