tempo_contracts/precompiles/tip_account_registrar.rs
1pub use ITipAccountRegistrar::ITipAccountRegistrarErrors as TIPAccountRegistrarError;
2use alloy::sol;
3
4sol! {
5 #[derive(Debug, PartialEq, Eq)]
6 #[sol(rpc, abi)]
7 interface ITipAccountRegistrar {
8 /// Pre-Moderato: accepts arbitrary hash (vulnerable to signature forgery)
9 /// Only works pre-Moderato. Returns UnknownSelector post-Moderato.
10 function delegateToDefault(bytes32 hash, bytes calldata signature) external returns (address authority);
11
12 /// Post-Moderato: accepts arbitrary message bytes, computes keccak256(bytes) internally
13 /// Only works post-Moderato. Returns UnknownSelector pre-Moderato.
14 function delegateToDefault(bytes calldata message, bytes calldata signature) external returns (address authority);
15
16 // Errors
17 error InvalidSignature();
18 error CodeNotEmpty();
19 error NonceNotZero();
20 }
21}
22
23impl TIPAccountRegistrarError {
24 /// Creates an error for invalid cryptographic signature.
25 pub const fn invalid_signature() -> Self {
26 Self::InvalidSignature(ITipAccountRegistrar::InvalidSignature {})
27 }
28
29 /// Creates an error when account code is not empty.
30 pub const fn code_not_empty() -> Self {
31 Self::CodeNotEmpty(ITipAccountRegistrar::CodeNotEmpty {})
32 }
33
34 /// Creates an error when nonce is not zero.
35 pub const fn nonce_not_zero() -> Self {
36 Self::NonceNotZero(ITipAccountRegistrar::NonceNotZero {})
37 }
38}