An upgrade to a "Bravo" compatible Governor for the GitcoinDAO, built using the OpenZeppelin implementation and Flexible Voting.
This project uses Foundry. Follow these instructions to install it.
Clone the repo
git clone git@github.com:gitcoinco/2022-Governor-upgrade.git
cd 2022-Governor-upgrade
Copy the .env.template
file and populate it with values
cp .env.template .env
# Open the .env file and add your values
forge install
forge build
forge test
Formatting is done via scopelint. To install scopelint, run:
cargo install scopelint
scopelint fmt
scopelint check
script/Deploy.s.sol
- Deploys the GitcoinGovernor contractscript/Propose.s.sol
- Submits a proposal to the existing Gitcoin Governor Alpha proposing migration to the GitcoinGovernor. Must be executed by someone with sufficient GTC delegation.
To test these scripts locally, start a local fork with anvil:
anvil --fork-url YOUR_RPC_URL --fork-block-number 15980096
Then execute the deploy script.
NOTE: You must populate the DEPLOYER_PRIVATE_KEY
in your .env
file for this to work.
forge script script/Deploy.s.sol --tc DeployScript --rpc-url http://localhost:8545 --broadcast
Pull the contract address for the new Governor from the deploy script address, then execute the Proposal script.
NOTE: You must populate the PROPOSER_PRIVATE_KEY
in your .env
file for this to work. Additionally, the
private key must correspond to the proposer
address defined in the Proposal.s.sol
script. You can update this
variable to an address you control, however the proposal itself will still revert in this case, unless you provide
the private key of an address that has sufficient GTC Token delegation to have the right to submit a proposal.
forge script script/Propose.s.sol --sig "run(address)" NEW_GOVERNOR_ADDRESS --rpc-url http://localhost:8545 --broadcast
The Gitcoin Bravo governor inherits from GovernorCountingFractional
, which is
defined in the Flexible Voting
project. This is done to enable:
- partial voting (voting with less than full weight)
- rolling voting (voting multiple times on the same proposal with partial weight)
- split voting (splitting vote weight across against/for/abstain options)
We use the v1.0.0
tag of Flexible Voting because this was the version audited by
Open Zeppelin.
Additionally, this project depends on Open Zeppelin's contracts library. However, because of an open issue in foundry, we are currently sourcing the OZ library from within the Flexible Voting dependency. Flexible Voting uses OZ tagged at v4.8.0. (Note that an alternative solution would be to install OZ in this repo like normal, and just reference it with relative paths instead of absolute paths).
At the time of writing (March 28 2023) there are no changes to any of the OZ contracts used by this repository between v4.8.0 and the latest release, v4.8.2.
The code in this repository is licensed under the GNU Affero General Public License unless otherwise indicated.
Copyright (C) 2023 Gitcoin Core