The repository contains smart contracts and deployment scripts that facilitate content creation and voting management systems. It's implemented using Hardhat as the primary development environment.
contracts/: Contains Solidity source files for the contracts.SpaceRoomManager.sol: Manages spaces/rooms where creators can publish content.VotingManager.sol: Manages voting processes related to the content.
node_modules/: Installed Node.js modules required for development.scripts/: JavaScript deployment scripts.deploy.js: Script to deploy SpaceRoomManager and VotingManager contracts.
test/: Tests for the contracts.SpaceRoomManager.js: Testing file for the SpaceRoomManager contract.
ex.env: Example environment variables template.hardhat.config.js: Configuration file for Hardhat.package.json: Project metadata and dependency manager.README.md: Documentation file.
Ensure you have these tools installed before using this project:
- Node.js (v18 or higher)
- NPM (comes with Node.js)
-
Clone the Repository:
Clone the project repository and navigate into its folder.git clone https://github.com/ubiwdotspace/core-contract.git cd core-contract -
Install Dependencies:
Install the required Node.js packages.npm install
-
Configure Environment Variables:
Create a.envfile in the project's root directory usingex.envas a template. Populate it with the necessary variables:INFURA_API_KEY=your-infura-api-key // or another provider PRIVATE_KEY=your-private-key ETHERSCAN_API_KEY=your-etherscan-api-key
-
Configure Network in
hardhat.config.ts:
Set up the network settings to enable deployment to different networks.
-
Compile the Contracts:
Use Hardhat to compile the contracts.npx hardhat compile
-
Deploy Contracts:
Run the deployment script to deploy both SpaceRoomManager and VotingManager contracts. Specify the network by replacingyour_networkwith the desired one.npx hardhat run scripts/deploy.js --network your_network
The deployed contract addresses will be printed to the console and saved in the
deployedContract.txtfile. -
Testing:
Run the test files to validate the functionality of the contracts:npx hardhat test
Addresses of the deployed contracts can be found in deployedContract.txt. Here are their latest links on Etherscan:
-
SpaceRoomManager: (verified) https://sepolia.etherscan.io/address/0x29660d65DF08Fbdcef1a98Da3087d753d7CDc5Bd#code
-
VotingManager: (verified) https://sepolia.etherscan.io/address/0x056fAC3BeF454987DdE764886C11e795F48837B8#code
- Verify that your environment variables are correctly set up.
- Confirm that Node.js, NPM, and Hardhat are correctly installed.
- Ensure the required dependencies are installed using
npm install.
This project is licensed under the MIT License.