Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions blockchain/.gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
node_modules
.env

# Hardhat files
/cache
/artifacts
# Foundry
out
cache
cache_forge
broadcast
lib
artifacts

# TypeChain files
/typechain
/typechain-types
# Environment
.env

# solidity-coverage files
/coverage
/coverage.json
# Dependencies
node_modules
forge_std

# Hardhat Ignition default folder for deployments against a local node
ignition/deployments/chain-31337
# Misc
.DS_Store
24 changes: 8 additions & 16 deletions blockchain/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
FROM node:20-slim
FROM ghcr.io/foundry-rs/foundry:latest

WORKDIR /app/blockchain

# Install Python and build dependencies
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
build-essential \
&& rm -rf /var/lib/apt/lists/*

# Set Python path for node-gyp
ENV PYTHON=/usr/bin/python3

COPY package*.json ./
RUN npm install
WORKDIR /app

# Copy our source code
COPY . .

CMD ["npx", "hardhat", "node"]
# Build the project
RUN forge build

# Set the entrypoint to anvil (local testnet) or forge
CMD ["anvil", "--host", "0.0.0.0"]
77 changes: 52 additions & 25 deletions blockchain/README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,71 @@
# Sample Hardhat Project
# Agora Blockchain Project

This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a Hardhat Ignition module that deploys that contract.
This project contains the smart contracts for Agora Blockchain, built using **Foundry**.

Try running some of the following tasks:
## Getting Started

### Prerequisites

- [Foundry](https://book.getfoundry.sh/getting-started/installation)

### Build

```shell
forge build
```

### Test

```shell
forge test
```

### Format

```shell
forge fmt
```

### Local Node

Start a local testnet:

```shell
anvil
```

### Deploy

To deploy contracts, use `forge create` or `forge script`.

```shell
npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat ignition deploy ./ignition/modules/Lock.js
forge script script/MyScript.s.sol --rpc-url <your_rpc_url> --private-key <your_private_key>
```

Live Code at
## Live Code

- Election Factory - https://sepolia.etherscan.io/address/0x64c720eBD5227bba57a5E8282893e71087cCcBb8#code
- CCIP Sender :-
- Fuji - https://testnet.snowtrace.io//address/0xf267f0603672E791779E52B153BD9A39C9928767#code

Gas Comparision :
## Gas Comparison (Historical)

Create Election :
**Create Election:**

0.011334162446332343 - Before
0.002298823499424792 - After
- 0.011334162446332343 - Before
- 0.002298823499424792 - After

Add Candidate:
**Add Candidate:**

0.000716409329167840 - Before
0.000256279986480672 - After
- 0.000716409329167840 - Before
- 0.000256279986480672 - After

Vote:
0.00027771 - Before
0.00050715 - After
**Vote:**

Before IPFS
- 0.00027771 - Before
- 0.00050715 - After

Medium Description : 0.00197243 SepoliaETH
Large Description : 0.00537738 SepoliaETH
**IPFS Optimization:**

After IPFS
Medium Description : 0.00035482 SepoliaETH
Large Description : 0.00035595 SepoliaETH
- Medium Description: 0.00197243 -> 0.00035482 SepoliaETH
- Large Description: 0.00537738 -> 0.00035595 SepoliaETH
17 changes: 17 additions & 0 deletions blockchain/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[profile.default]
src = "contracts"
out = "out"
libs = ["node_modules", "lib"]
test = "test"
cache = true
cache_path = "cache_forge"
force = false
evm_version = "paris"
gas_reports = ["*"]

[rpc_endpoints]
sepolia = "${RPC_URL_SEPOLIA}"
amoy = "${RPC_URL_AMOY}"

[etherscan]
sepolia = { key = "${ETHERSCAN_KEY}" }
53 changes: 0 additions & 53 deletions blockchain/hardhat.config.js

This file was deleted.

This file was deleted.

Loading