Skip to content

Commit 5a273a3

Browse files
authored
Merge pull request #189 from filecoin-project/feature/voting-contract
feat:optimize voting contracts and replace foundry with hardhat
2 parents fc85a6e + 76ac546 commit 5a273a3

35 files changed

+17905
-881
lines changed

.gitmodules

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,3 @@
1313
[submodule "power-oracle-contracts/lib/filecoin-solidity"]
1414
path = power-oracle-contracts/lib/filecoin-solidity
1515
url = https://github.com/filecoin-project/filecoin-solidity
16-
17-
[submodule "powervoting-contracts/lib/openzeppelin-contracts"]
18-
path = powervoting-contracts/lib/openzeppelin-contracts
19-
url = https://github.com/OpenZeppelin/openzeppelin-contracts
20-
[submodule "powervoting-contracts/lib/openzeppelin-contracts-upgradeable"]
21-
path = powervoting-contracts/lib/openzeppelin-contracts-upgradeable
22-
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
23-
[submodule "powervoting-contracts/lib/solidity-cborutils"]
24-
path = powervoting-contracts/lib/solidity-cborutils
25-
url = https://github.com/smartcontractkit/solidity-cborutils
26-
[submodule "powervoting-contracts/lib/forge-std"]
27-
path = powervoting-contracts/lib/forge-std
28-
url = https://github.com/foundry-rs/forge-std

powervoting-contracts/.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
PRIVATE_KEY_TESTNET=//the key of the filecoin testnet
3+
4+
PRIVATE_KEY_MAINNET=//the key of the filecoin mainnet

powervoting-contracts/Install.md

Lines changed: 0 additions & 50 deletions
This file was deleted.

powervoting-contracts/README.md

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +0,0 @@
1-
# PowerVoting Contract
2-
3-
## Overview
4-
5-
PowerVoting is a smart contract written in Solidity for managing voting activities within the PowerVoting project. It provides functionalities for creating proposals, voting on proposals, adding miner IDs, and delegating UCAN CIDs to the Oracle.
6-
7-
## Features
8-
- **Proposal Creation:** Users can create proposals by specifying the CID, start time, expiration time, and type of proposal.
9-
- **Voting:** Users can vote on proposals. The contract ensures that checks if the proposal is within the valid voting period.
10-
- **Miner ID Management:** Users can add miner IDs to the Oracle contract.
11-
- **F4 Task Addition:** The contract automatically adds an F4 task for the caller if necessary.
12-
- **UCAN CID Delegation:** Users can delegate UCAN CIDs to the Oracle for processing.
13-
14-
15-
## Implementation Details
16-
- The contract is implemented using the OpenZeppelin library for upgradeability and access control.
17-
18-
- It utilizes Counters for managing proposal IDs.
19-
20-
- Function selectors are used to interact with the Oracle contract.
21-
22-
- Various modifiers are used to ensure the validity of inputs and permissions.
23-
24-
## Deploy
25-
For deployment instructions, please refer to this document: [Deployment Guide](Install.md)
26-
27-
## Foundry Testing
28-
29-
Foundry is a fast, portable, and modular toolkit for Ethereum application development. The Oracle contract can be tested using Foundry to ensure its functionality and reliability.
30-
31-
### Prerequisites
32-
33-
Ensure you have Foundry installed. If not, you can install it using:
34-
35-
```
36-
curl -L https://foundry.paradigm.xyz | bash
37-
foundryup
38-
```
39-
40-
### Setting Up the Test Environment
41-
42-
1. **Clone the Repository:**
43-
44-
```
45-
git clone https://github.com/filecoin-project/on-chain-voting.git
46-
cd powervoting-contracts
47-
```
48-
49-
2. **Install Dependencies:**
50-
51-
Foundry uses a dependency management tool called `forge`. Install the dependencies with:
52-
53-
```
54-
forge install
55-
```
56-
57-
3. **Compile the Contract:**
58-
59-
Before running the tests, compile the contract to ensure there are no syntax errors:
60-
61-
```
62-
forge build
63-
```
64-
65-
### Running Tests
66-
67-
Execute the tests using the following command:
68-
69-
```
70-
forge test
71-
```
72-
73-
This will run all the test cases present in the `test` directory and provide you with a detailed output of the test results.
74-
75-
## Author
76-
PowerVoting Contract is developed by StorSwift Inc.
77-
78-
## Version
79-
This contract version is compatible with Solidity version ^0.8.19.

0 commit comments

Comments
 (0)