tempo_contracts/precompiles/nonce.rs
1pub use INonce::{INonceErrors as NonceError, INonceEvents as NonceEvent};
2
3crate::sol! {
4 /// Nonce interface for managing 2D nonces as per the Account Abstraction spec.
5 ///
6 /// This precompile manages user nonce keys (1-N) while protocol nonces (key 0)
7 /// are handled directly by account state. Each account can have multiple
8 /// independent nonce sequences identified by a nonce key.
9 #[derive(Debug, PartialEq, Eq)]
10 #[sol(abi)]
11 interface INonce {
12 /// Get the current nonce for a specific account and nonce key
13 /// @param account The account address
14 /// @param nonceKey The nonce key (must be > 0, protocol nonce key 0 not supported)
15 /// @return nonce The current nonce value
16 function getNonce(address account, uint256 nonceKey) external view returns (uint64 nonce);
17
18 // Events
19 event NonceIncremented(address indexed account, uint256 indexed nonceKey, uint64 newNonce);
20
21 // Errors
22 error ProtocolNonceNotSupported();
23 error InvalidNonceKey();
24 error NonceOverflow();
25
26 // Expiring nonce errors
27 /// Returned when an expiring nonce tx hash has already been seen
28 error ExpiringNonceReplay();
29 /// Returned when the expiring nonce seen set is at capacity
30 error ExpiringNonceSetFull();
31 /// Returned when valid_before is not within the allowed window
32 error InvalidExpiringNonceExpiry();
33 }
34}