citizen: implement Implement: Defines the interface for the Greeter contract
This commit is contained in:
parent
1849d781fc
commit
761de2bb06
45
contracts/interfaces/IGreeter.sol
Normal file
45
contracts/interfaces/IGreeter.sol
Normal file
@ -0,0 +1,45 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.19;
|
||||
|
||||
/**
|
||||
* @title IGreeter
|
||||
* @dev Interface for the Greeter contract defining core interaction methods
|
||||
*/
|
||||
interface IGreeter {
|
||||
/// @notice Emitted when a greeting is updated
|
||||
event GreetingChanged(address indexed updater, string newGreeting);
|
||||
|
||||
/// @notice Thrown when an unauthorized address attempts to modify the greeting
|
||||
error UnauthorizedGreetingModification(address caller);
|
||||
|
||||
/**
|
||||
* @notice Retrieves the current stored greeting
|
||||
* @return The current greeting string
|
||||
*/
|
||||
function getGreeting() external view returns (string memory);
|
||||
|
||||
/**
|
||||
* @notice Updates the greeting with optional authorization checks
|
||||
* @param newGreeting The new greeting message to set
|
||||
* @param nonce A unique transaction identifier to prevent replay attacks
|
||||
* @param signature Optional cryptographic signature for advanced authorization
|
||||
*/
|
||||
function updateGreeting(
|
||||
string calldata newGreeting,
|
||||
uint256 nonce,
|
||||
bytes calldata signature
|
||||
) external;
|
||||
|
||||
/**
|
||||
* @notice Checks if an address has greeting modification permissions
|
||||
* @param account The address to check for authorization
|
||||
* @return Boolean indicating whether the address can modify greetings
|
||||
*/
|
||||
function isAuthorizedGreeter(address account) external view returns (bool);
|
||||
|
||||
/**
|
||||
* @notice Retrieves the contract's creation timestamp
|
||||
* @return The block timestamp when the contract was deployed
|
||||
*/
|
||||
function getDeploymentTimestamp() external view returns (uint256);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user