Skip to content

devoter-xyz/devoter-contracts

Devoter Contracts 🗳️

Custom Solidity contracts for the devoter-app, built with Hardhat.

📁 Project Structure

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.

Setup Instructions

🛠️ Prerequisites

📦 Installation

  1. Clone the repository:
git clone https://github.com/devoter-xyz/devoter-contracts.git
cd devoter-contracts
  1. Install dependencies:
npm install
  1. Copy environment variables template:
cp .env.example .env
  1. Configure environment variables:
  • Edit .env and fill in your PRIVATE_KEY, BASE_MAINNET_RPC_URL, BASE_SEPOLIA_RPC_URL, and ANKR_API_KEY.
  1. Test setup:
npm run compile

📝 Available Commands

  • 🛠️ 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

🔄 Development Workflow

  1. Install dependencies and set up environment variables as described above.
  2. 🛠️ Compile contracts after making changes:
npm run compile
  1. 🧪 Write and run tests in the test/ directory:
npm test
# or with gas reporting
npm run test:gas
  1. 🚀 Deploy contracts to your desired network:
  • For Base Sepolia:
    npm run deploy:sepolia
  • For Base Mainnet:
    npm run deploy:mainnet
  1. 🔍 Verify contracts (after deployment):
npm run verify
  1. 🖧 Start a local node for local development:
npm run node
  1. 🧹 Clean build artifacts when needed:
npm run clean

Note: This project uses npm as the package manager.

Hardhat Ignition Usage

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 DEVoterEscrowModule

You can specify network and parameters as needed. Refer to the Hardhat Ignition documentation for advanced usage.

About

Custom solidity voting contracts for devoter-app

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Contributors 9