2.7 KiB
2.7 KiB
Overview
The RepositoryExplorer contract serves as a centralized management system for creating, tracking, and interacting with multiple repository instances on the ChunkNet blockchain. It provides a comprehensive interface for repository lifecycle management, offering functionality to create, remove, and explore repositories with robust access controls.
Interface
| Function | Parameters | Returns | Description |
|---|---|---|---|
createRepository |
name (string), description (string), initialContributors (address[]) |
address |
Creates a new repository with specified parameters |
removeRepository |
repositoryId (uint256) |
void |
Removes a repository by its ID (owner-only) |
getRepositoryDetails |
repositoryId (uint256) |
name, description, owner, contributorCount |
Retrieves detailed information about a specific repository |
listRepositories |
None | Repository[] |
Returns all registered repositories |
searchRepositoriesByName |
searchTerm (string) |
Repository[] |
Searches repositories matching a given name |
Events
| Event | Parameters | Description |
|---|---|---|
RepositoryAdded |
repositoryAddress (address), repositoryId (uint256) |
Emitted when a new repository is created |
RepositoryRemoved |
repositoryAddress (address), repositoryId (uint256) |
Emitted when a repository is removed |
Storage Layout
repositories: Dynamic array storing all Repository instancesregisteredRepositories: Mapping to track registered repository addressestotalRepositories: Counter for total number of repositories
Access Control
- Contract owner (deployer) has exclusive rights to remove repositories
- Repository creation is permissionless
- Individual repository management follows Repository contract's access rules
Security Considerations
- Uses OpenZeppelin's
ReentrancyGuardto prevent recursive calls - Input validation for repository name and description
- Repository removal uses safe array manipulation techniques
- Only registered repositories can be managed
Deployment
ChunkNet Deployment Parameters
- RPC URL: https://rpc.chunknet.org
- Chain ID: 214562
- Recommended Deployment Environment: ChunkNet Devnet
- Deployment Command:
bash
forge create RepositoryExplorer
--rpc-url https://rpc.chunknet.org
--private-key $PRIVATE_KEY
Testing
- Unit test repository creation with valid/invalid parameters
- Verify access control for repository removal
- Test repository search and listing functionality
- Validate event emissions during repository lifecycle
- Ensure gas efficiency and prevent potential DoS vectors
- Comprehensive fuzzing for input validation