|
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