Skip to content

vechain/vevote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

VeVote Mono Repo codecov

VeVote is a decentralized governance platform. This repository serves as the monorepo for the VeVote project, containing all relevant components such as the frontend, smart contracts, and utilities.

Requirements

Ensure your development environment is set up with the following:

Project Structure

The main project is the apps/frontend folder. Everytime we start the frontend it will also compile the contracts (under the packages/contracts folder) and deploy them if they are not deployed yet. This will allow to have up to date ABIs, addresses and types in the frontend

Frontend (apps/frontend) 🌐

A React-based application using Vite to provide a fast and efficient UI for interacting with VeVote.

  • VeChain-kit: Used to manage wallet connections and blockchain interactions. Learn more

Contracts (packages/contracts) πŸ“œ

Smart contracts written in Solidity, managed with Hardhat for deployment on the VeChain Thor network.

Packages πŸ“¦

Shared configurations and utility functions to streamline development.

Getting Started

Clone the repository and install dependencies:

yarn

Copy the example environment file and configure it:

cp .env.example .env

Running Locally with Solo Network (Requires Docker) πŸ”§

Start the Solo Network in a Docker container:

yarn solo-up

Run the frontend and deploy contracts (if not already deployed):

yarn dev

This command will:

  • Start the frontend
  • Deploy contracts if they are not already deployed
  • Output logs for frontend and contract deployment

Redeploy Contracts:

yarn contracts:deploy

Alternatively, clear the contract address in packages/config/local.ts and run yarn dev again.

Stop the Solo Network:

yarn solo-down

Clean Solo Network State:

yarn solo-clean

Running on Testnet 🌐

Deploy contracts to Testnet:

yarn contracts:deploy:testnet

Run the frontend connected to Testnet:

yarn dev:testnet

Running on Mainnet 🌐

Deploy contracts to Mainnet:

yarn contracts:deploy:mainnet

Run the frontend connected to Mainnet:

yarn dev:mainnet

πŸ§ͺ Smart Contract Development

The VeVote smart contracts are located in packages/contracts and use Hardhat for compilation, deployment, testing, and documentation. These commands must be run from the root of the repository.


πŸ“¦ Compile Contracts

Compile all Solidity contracts:

yarn contracts:compile

βœ… This must be run from the root directory. It compiles contracts using Hardhat and generates:

  • ABI files (for the frontend)
  • TypeChain TypeScript bindings
  • Bytecode and metadata artifacts

πŸ§ͺ Run Contract Tests

To run local unit tests:

yarn contracts:test

To run tests against a Solo Thor network in Docker:

yarn contracts:test:thor-solo

Tests are located in packages/contracts/test/ and use Mocha + Chai.


πŸ“Š Test Coverage

Generate a Solidity test coverage report:

yarn test:coverage:solidity

πŸ“ Coverage reports are written to packages/contracts/coverage/.


πŸ“– Generate Documentation

Automatically generate Markdown docs from your contract NatSpec comments:

yarn contracts:generate-docs

Useful for syncing with developer portals, GitBook, or Notion.

πŸ“ Contract documentation is written to packages/contracts/docs/.


πŸ“€ Deploy Contracts

To deploy contracts to the local Solo network:

yarn contracts:deploy

To deploy to other networks:

yarn contracts:deploy:testnet
yarn contracts:deploy:mainnet

πŸ’‘ If you need to force a redeploy locally, clear the addresses in packages/config/local.ts and re-run yarn dev.


Verify contracts (Optional)

Optionally verify your smart contracts on Sourcify. This allows 3rd parties to view and independently verify all of the following:

  • Source code
  • Metadata
  • Contract ABI
  • Contract Bytecode
  • Contract transaction ID

After deploying SimpleStorage, the console will print the address of the deployed contract. You can verify the contract on sourcify.eth:

yarn contracts:verify:mainnet <contract-address> <contract-name>

Read more about the verification process in the packages/contracts/scripts/verify/README.md file.