Custom Solidity contracts for the devoter-app, built with Hardhat.
This project follows a standard Hardhat project structure:
contracts/: Contains the Solidity smart contracts.scripts/: Contains scripts for automating tasks and deployments.test/: Includes the test files for the smart contracts.deploy/: Contains deployment configurations.ignition/: Holds the deployment scripts for Hardhat Ignition.hardhat.config.ts: The main Hardhat configuration file.
- Clone the repository:
git clone https://github.com/devoter-xyz/devoter-contracts.git
cd devoter-contracts- Install dependencies:
npm install- Copy environment variables template:
cp .env.example .env- Configure environment variables:
- Edit
.envand fill in yourPRIVATE_KEY,BASE_MAINNET_RPC_URL,BASE_SEPOLIA_RPC_URL, andANKR_API_KEY.
- Test setup:
npm run compile- 🛠️ Compile contracts:
npm run compile
- 🧪 Run tests:
npm test - ⛽ Run tests with gas reporting:
npm run test:gas
- 🚀 Deploy to Base Sepolia testnet:
npm run deploy:sepolia
- 🚀 Deploy to Base Mainnet:
npm run deploy:mainnet
- 🔍 Verify contract on Base Sepolia:
npm run verify
- 🧹 Clean build artifacts:
npm run clean
- 🖧 Start local Hardhat node:
npm run node
- 🌐 Check network connection:
npm run check-connection
- Install dependencies and set up environment variables as described above.
- 🛠️ Compile contracts after making changes:
npm run compile- 🧪 Write and run tests in the
test/directory:
npm test
# or with gas reporting
npm run test:gas- 🚀 Deploy contracts to your desired network:
- For Base Sepolia:
npm run deploy:sepolia
- For Base Mainnet:
npm run deploy:mainnet
- 🔍 Verify contracts (after deployment):
npm run verify- 🖧 Start a local node for local development:
npm run node- 🧹 Clean build artifacts when needed:
npm run cleanNote: This project uses npm as the package manager.
This project utilizes Hardhat Ignition for declarative and robust smart contract deployments.
To deploy a module (e.g., DEVoterEscrowModule), use the following command:
npx hardhat ignition deploy DEVoterEscrowModuleYou can specify network and parameters as needed. Refer to the Hardhat Ignition documentation for advanced usage.