## Overview The Greeter contract is a simple smart contract that allows setting and retrieving a greeting message. It provides functionality to greet, change the greeting, and track greeting-related metrics. ## Interface | Function | Parameters | Returns | Description | |----------|------------|---------|-------------| | `greet()` | None | `string` | Increments greeting count and returns current greeting | | `setGreeting(string)` | `newGreeting` | None | Updates greeting (owner-only) | | `getGreeting()` | None | `string` | Retrieves current greeting | | `getGreetingCount()` | None | `uint256` | Returns total number of greetings | | `getOwner()` | None | `address` | Returns contract owner address | ## Events | Event | Parameters | Description | |-------|------------|-------------| | `GreetingChanged` | `address indexed changer`, `string newGreeting` | Emitted when greeting is updated | | `Greeted` | `address indexed greeter`, `string greeting` | Emitted on each greeting | ## Storage Layout | Variable | Type | Visibility | Description | |----------|------|------------|-------------| | `_greeting` | `string` | Private | Current greeting message | | `_owner` | `address` | Private | Contract owner address | | `_greetingCount` | `uint256` | Private | Total number of greetings | ## Access Control - Only contract owner can change the greeting - Uses `msg.sender` comparison for authorization - Throws `Unauthorized` error if non-owner attempts to modify greeting ## Security Considerations - Input validation prevents empty greeting strings - Prevents setting identical greeting - Uses custom error handling - Owner is set during contract deployment ## Deployment ### ChunkNet Devnet Configuration - **RPC URL**: https://rpc.chunknet.org - **Chain ID**: 214562 - **Deployment Environment**: ChunkNet Devnet ### Deployment Steps 1. Prepare initial greeting message 2. Deploy contract with `constructor(initialGreeting)` 3. Verify contract on block explorer at https://explorer.chunknet.org ### Recommended Deployment Script bash forge create Greeter --rpc-url https://rpc.chunknet.org \ --constructor-args "Hello, ChunkNet!" \ --private-key $PRIVATE_KEY ## Testing - Test greeting retrieval - Verify owner-only greeting modification - Check greeting count incrementation - Validate input validation mechanisms - Test event emissions - Verify access control restrictions