The Engagement Contract is a blockchain-based solution for communities to manage reputation and engagement through token issuance and scoring mechanisms. It allows communities to:
- Issue unique tokens for their ecosystem.
- Mint tokens for individual users based on their activities.
- Calculate and retrieve reputation scores for community members using the OCI (On-Chain Identity) platform.
- Manage token metadata dynamically with customizable URIs.
This project is built with Solidity, Hardhat, and OpenZeppelin libraries, ensuring secure and efficient smart contract development.
Address | Network |
---|---|
N/A | Sepolia |
https://sepolia-optimism.etherscan.io/address/0xd826769f1844cc83a16923d2aef8a479e62da732 | Optimisim Sepolia |
https://sepolia.basescan.org/address/0xCc80586fd99f6804013eA2D43169fc60e466D354 | Base Sepolia |
https://arbiscan.io/address/0x89aDc2E7561914884c47a2F5447ac5052e6770b1#code | Arbitrum One |
- Token Management:
- Issue new tokens unique to the community.
- Mint tokens for users with checks to prevent duplicate mints.
- Burn tokens for revocation or updates.
- Reputation Scoring:
- Calculate and retrieve scores for users based on token data and identifiers.
- Attest reputation scores to users' wallets for on-chain verification.
- Dynamic Metadata:
- Supports customizable token URIs for dynamic metadata management.
- Admin Controls:
- Update base URIs.
- Manage token issuance securely with access control.
- Smart Contracts:
- Solidity: Core language for smart contract development.
- OpenZeppelin: Secure and reusable contract components.
- Development Framework:
- Hardhat: Ethereum development environment.
- Hardhat Ignition: Advanced deployment and parameter management.
- Testing and Analysis:
- Chai: For contract testing.
- Solidity Coverage: Analyze code coverage for Solidity tests.
- Linting and Formatting:
- Biome: Code quality and formatting tools.
-
Clone the Repository:
git clone https://github.com/your-username/engagement.git cd engagement
-
Install Dependencies:
npm install
-
Set Environment Variables: Create a
.env
file in the root directory and set the following:TOKEN_URI=http://127.0.0.1:8545/
Run the following command to compile the contracts:
npm run compile
Execute the test suite to ensure everything is working as expected:
npm run test
Before deploying, ensure that previous deployment files are removed to prevent conflicts:
- Remove the directory:
ignition/deployments/chain-{chainId}
(replace{chainId}
with the ID of the chain you're deploying to).
- Start the Hardhat local node:
-
npx hardhat node
-
Deploy contracts to localhost:
npx hardhat run ./scripts/deploys/deploy.ts --network localhost
-
Set up environment variables:
- Private Key: Set your wallet's private key as
PRIVATE_KEY
. - Block Explorer API Key: Set your block explorer API key (e.g., Etherscan API key) for contract verification.
Use Hardhat's
vars
command to set and get environment variables: - Private Key: Set your wallet's private key as
-
npx hardhat vars set PRIVATE_KEY npx hardhat vars get PRIVATE_KEY
-
Update Hardhat configuration:
- In your
hardhat.config.js
orhardhat.config.ts
file:- Add network configuration under
networks
with the appropriate settings (e.g., RPC URL, accounts). - Configure Etherscan for contract verification by adding your API key under
etherscan
.
- Add network configuration under
- In your
-
Create a deployment script:
- Place your deployment script in the
scripts/deploys/
directory.
- Place your deployment script in the
-
Deploy contracts to the network:
npx hardhat run ./scripts/deploys/{scriptname}.ts --network {networkname}
- Replace
{scriptname}
with your deployment script name. - Replace
{networkname}
with the network name as defined in yourhardhat.config
.
Analyze the test coverage for your contracts:
npm run coverage
Lint the project for issues:
npm run lint
Format the project files:
npm run format
.
├── contracts/ # Solidity contracts
│ ├── Engagement.sol # Core engagement contract
│ ├── IEngagement.sol # Interface for engagement contract
├── ignition/
│ └── modules/ # Deployment modules for Hardhat Ignition
│ └── Engagement.ts # Engagement contract deployment module
├── scripts/ # Deployment scripts
│ └── deploy.ts # Hardhat deployment script
├── test/ # Test files for the contracts
├── hardhat.config.ts # Hardhat configuration file
├── package.json # Project metadata and scripts
├── .env # Environment variables
└── README.md # Project documentation
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-name
). - Commit your changes (
git commit -m "Add feature-name"
). - Push to your branch (
git push origin feature-name
). - Submit a pull request.
- OpenZeppelin: For providing secure and reusable smart contract components.
- Hardhat Team: For building a robust Ethereum development environment.
- OCI Platform: For enabling seamless identity and reputation management.
- TogetherCrew: For driving innovation in community engagement and blockchain-based solutions.