tempo_contracts/precompiles/address_registry.rs
1pub use IAddressRegistry::{
2 IAddressRegistryErrors as AddrRegistryError, IAddressRegistryEvents as AddrRegistryEvent,
3};
4
5crate::sol! {
6 /// [TIP-1022] virtual address registry interface.
7 ///
8 /// Allows EOAs and contracts to register as virtual-address masters via a
9 /// 32-bit proof-of-work and provides resolution of virtual addresses back to
10 /// their registered master.
11 ///
12 /// [TIP-1022]: <https://docs.tempo.xyz/protocol/tip1022>
13 #[derive(Debug, PartialEq, Eq)]
14 #[sol(abi)]
15 interface IAddressRegistry {
16 // Registration
17 function registerVirtualMaster(bytes32 salt) external returns (bytes4 masterId);
18
19 // View functions
20 function getMaster(bytes4 masterId) external view returns (address);
21 function resolveRecipient(address to) external view returns (address effectiveRecipient);
22 function resolveVirtualAddress(address virtualAddr) external view returns (address master);
23
24 // Pure functions
25 function isVirtualAddress(address addr) external pure returns (bool);
26 function decodeVirtualAddress(address addr) external pure returns (bool isVirtual, bytes4 masterId, bytes6 userTag);
27 function isImplicitlyApproved(address addr) external view returns (bool);
28
29 // Events
30 event MasterRegistered(bytes4 indexed masterId, address indexed masterAddress);
31
32 // Errors
33 error MasterIdCollision(address master);
34 error InvalidMasterAddress();
35 error ProofOfWorkFailed();
36 error VirtualAddressUnregistered();
37 }
38}