diff --git a/.env.example b/.env.example
index 5b6781a..1730836 100644
--- a/.env.example
+++ b/.env.example
@@ -4,6 +4,10 @@ MAINNET_DEPLOYER_PK=
GOERLI_RPC=
GOERLI_DEPLOYER_PK=
-ETHERSCAN_API_KEY=
+OPTIMISM_RPC=
+OPTIMISM_DEPLOYER_PK=
+
+LOCAL_RPC=
+LOCAL_DEPLOYER_PK=
-OPTIMISM_RPC=
\ No newline at end of file
+ETHERSCAN_API_KEY=
diff --git a/README.md b/README.md
index 4aeda6c..2c46fa8 100644
--- a/README.md
+++ b/README.md
@@ -1,146 +1,62 @@
-
-
+# Wonderland Governor
-
Start your next Solidity project with Foundry in seconds
-A highly scalable foundation focused on DX and best practices
+⚠️ The code has not been audited yet, tread with caution.
-
+## Overview
-## Features
+Wonderland Governor is a DAO governance solution designed to address the current limitations in delegation within governance protocols. Unlike old systems where users give all their voting power to one delegate, it offers a flexible solution, introducing innovative features to empower users and enhance governance processes in decentralized organizations.
-
- - Sample contracts
- - Basic Greeter contract with an external interface.
+Key Features:
- - Foundry setup
- - Foundry configuration with multiple custom profiles and remappings.
+Proposal Types:
- - Deployment scripts
- - Sample scripts to deploy contracts on both mainnet and testnet.
+Wonderland Governor lets organizations set different types of proposals for specific needs like legal or technical matters.
+Every proposal now has a required type, making it clear which category it falls into.
- - Sample e2e & unit tests
- - Example tests showcasing mocking, assertions and configuration for mainnet forking. As well it includes everything needed in order to check code coverage.
+Better Delegation:
- - Linter
- - Simple and fast solidity linting thanks to forge fmt.
+Users can now spread their voting power across different categories.
+Users can choose multiple delegates for each proposal type, assigning a percentage of their voting power to each.
+Users can still delegate 100% of their voting power to one person if they prefer.
- - Github workflows CI
- - Run all tests and see the coverage as you push your changes.
- - Export your Solidity interfaces and contracts as packages, and publish them to NPM.
-
+Wonderland Governor is founded on the OpenZeppelin contracts and enhances their functionalities to achieve the described features.
## Setup
-1. Install Foundry by following the instructions from [their repository](https://github.com/foundry-rs/foundry#installation).
-2. Copy the `.env.example` file to `.env` and fill in the variables.
-3. Install the dependencies by running: `yarn install`. In case there is an error with the commands, run `foundryup` and try them again.
+This project uses [Foundry](https://book.getfoundry.sh/). To build it locally, run:
-## Build
-
-The default way to build the code is suboptimal but fast, you can run it via:
-
-```bash
+```sh
+git clone git@github.com:defi-wonderland/wonderland-governooor-poc.git
+cd wonderland-governooor-poc
+yarn install
yarn build
```
-In order to build a more optimized code ([via IR](https://docs.soliditylang.org/en/v0.8.15/ir-breaking-changes.html#solidity-ir-based-codegen-changes)), run:
-
-```bash
-yarn build:optimized
-```
-
-## Running tests
-
-Unit tests should be isolated from any externalities, while E2E usually run in a fork of the blockchain. In this boilerplate you will find example of both.
-
-In order to run both unit and E2E tests, run:
-
-```bash
-yarn test
-```
-
-In order to just run unit tests, run:
-
-```bash
-yarn test:unit
-```
-
-In order to run unit tests and run way more fuzzing than usual (5x), run:
-
-```bash
-yarn test:unit:deep
-```
-
-In order to just run e2e tests, run:
-
-```bash
-yarn test:e2e
-```
-
-In order to check your current code coverage, run:
+### Available Commands
-```bash
-yarn coverage
-```
-
-
-
-## Deploy & verify
-
-### Setup
-
-Configure the `.env` variables.
+Make sure to set `OPTIMISM_RPC` environment variable before running end-to-end tests.
-### Goerli
-
-```bash
-yarn deploy:goerli
-```
-
-### Mainnet
-
-```bash
-yarn deploy:mainnet
-```
+| Yarn Command | Description |
+| ----------------------- | ---------------------------------------------------------- |
+| `yarn build` | Compile all contracts. |
+| `yarn coverage` | See `forge coverage` report. |
+| `yarn deploy:local` | Deploy the contracts to a local fork. |
+| `yarn deploy:goerli` | Deploy the contracts to Goerli testnet. |
+| `yarn deploy:optimism` | Deploy the contracts to Optimism mainnet. |
+| `yarn deploy:mainnet` | Deploy the contracts to Ethereum mainnet. |
+| `yarn test` | Run all unit and integration tests. |
+| `yarn test:unit` | Run unit tests. |
+| `yarn test:integration` | Run integration tests. |
+| `yarn test:gas` | Run all unit and integration tests, and make a gas report. |
-The deployments are stored in ./broadcast
+## Licensing
-See the [Foundry Book for available options](https://book.getfoundry.sh/reference/forge/forge-create.html).
+The primary license for Wonderland Governor contracts is MIT, see [`LICENSE`](./LICENSE).
-## Export And Publish
+## Contributors
-Export TypeScript interfaces from Solidity contracts and interfaces providing compatibility with TypeChain. Publish the exported packages to NPM.
+Wonderland Governor was built with ❤️ by [Wonderland](https://defi.sucks).
-To enable this feature, make sure you've set the `NPM_TOKEN` on your org's secrets. Then set the job's conditional to `true`:
-
-```yaml
-solidity-exporter.yml
-
-jobs:
- export:
- name: Generate Interfaces And Contracts
- # Remove the following line if you wish to export your Solidity contracts and interfaces and publish them to NPM
- if: true
- ...
-```
-
-Also, remember to update the `package_name` param to your package name:
-
-```yaml
-solidity-exporter.yml
-
-- name: Export Solidity - ${{ matrix.export_type }}
- uses: defi-wonderland/solidity-exporter-action@1dbf5371c260add4a354e7a8d3467e5d3b9580b8
- with:
- # Update package_name with your package name
- package_name: "my-cool-project"
- ...
-
-
-- name: Publish to NPM - ${{ matrix.export_type }}
- # Update `my-cool-project` with your package name
- run: cd export/my-cool-project-${{ matrix.export_type }} && npm publish --access public
- ...
-```
+Wonderland is a team of top Web3 researchers, developers, and operators who believe that the future needs to be open-source, permissionless, and decentralized.
-You can take a look at our [solidity-exporter-action](https://github.com/defi-wonderland/solidity-exporter-action) repository more information and usage examples.
+[DeFi sucks](https://defi.sucks), but Wonderland is here to make it better.
\ No newline at end of file
diff --git a/package.json b/package.json
index 01ed179..4ecc32f 100644
--- a/package.json
+++ b/package.json
@@ -14,8 +14,10 @@
"build": "forge build",
"build:optimized": "FOUNDRY_PROFILE=optimized forge build",
"coverage": "forge coverage --match-contract Unit",
- "deploy:goerli": "bash -c 'source .env && forge script DeployGoerli --rpc-url $GOERLI_RPC --broadcast --private-key $GOERLI_DEPLOYER_PK --verify --etherscan-api-key $ETHERSCAN_API_KEY'",
- "deploy:mainnet": "bash -c 'source .env && forge script DeployMainnet --rpc-url $MAINNET_RPC --broadcast --private-key $MAINNET_DEPLOYER_PK --verify --etherscan-api-key $ETHERSCAN_API_KEY'",
+ "deploy:goerli": "dotenv -- bash -c 'forge script DeployGoerli -vv --slow --broadcast --rpc-url $GOERLI_RPC'",
+ "deploy:local": "dotenv -- bash -c 'forge script DeployLocal -vv --slow --broadcast --rpc-url $LOCAL_RPC'",
+ "deploy:mainnet": "dotenv -- bash -c 'forge script DeployMainnet -vv --slow --broadcast --rpc-url $MAINNET_RPC'",
+ "deploy:optimism": "dotenv -- bash -c 'forge script DeployOptimism -vv --slow --broadcast --rpc-url $OPTIMISM_RPC'",
"lint:check": "yarn lint:sol-tests && yarn lint:sol-logic && forge fmt --check",
"lint:fix": "sort-package-json && forge fmt && yarn lint:sol-tests --fix && yarn lint:sol-logic --fix",
"lint:sol-logic": "solhint -c .solhint.json 'solidity/contracts/**/*.sol' 'solidity/interfaces/**/*.sol'",
@@ -23,6 +25,8 @@
"prepare": "husky install",
"test": "forge test -vvv",
"test:e2e": "forge test --match-contract E2E -vvv",
+ "test:gas": "forge test --match-contract Integration -vvv --gas-report",
+ "test:integration": "forge test --match-contract Integration -vvv",
"test:unit": "forge test --match-contract Unit -vvv",
"test:unit:deep": "FOUNDRY_FUZZ_RUNS=5000 yarn test:unit"
},
@@ -39,6 +43,7 @@
"devDependencies": {
"@commitlint/cli": "17.0.3",
"@commitlint/config-conventional": "17.0.3",
+ "dotenv-cli": "7.2.1",
"ds-test": "github:dapphub/ds-test#e282159",
"forge-std": "github:foundry-rs/forge-std#v1.7.3",
"husky": ">=8",
diff --git a/solidity/scripts/Deploy.sol b/solidity/scripts/Deploy.sol
index 21e875f..574a1e8 100644
--- a/solidity/scripts/Deploy.sol
+++ b/solidity/scripts/Deploy.sol
@@ -1,24 +1,56 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
-import {Script} from 'forge-std/Script.sol';
+import {IWonderGovernor} from 'interfaces/governance/IWonderGovernor.sol';
+import {IWonderVotes} from 'interfaces/governance/utils/IWonderVotes.sol';
+import {AliceGovernor} from 'examples/AliceGovernor.sol';
+import {RabbitToken} from 'examples/RabbitToken.sol';
+
+import {Script, console} from 'forge-std/Script.sol';
abstract contract Deploy is Script {
- function _deploy() internal {
- vm.startBroadcast();
- // Deploy the contract
+ function _deploy(address _deployer) internal {
+ vm.startBroadcast(_deployer);
+
+ // Deploy the contracts
+ address tokenAddress = vm.computeCreateAddress(_deployer, vm.getNonce(_deployer) + 1);
+ AliceGovernor governor = new AliceGovernor(tokenAddress);
+ console.log('WonderGovernor:', address(governor));
+ RabbitToken rabbitToken = new RabbitToken(AliceGovernor(payable(address(governor))));
+ console.log('WonderVotes:', address(rabbitToken));
+
vm.stopBroadcast();
}
}
contract DeployMainnet is Deploy {
function run() external {
- _deploy();
+ address _deployer = vm.rememberKey(vm.envUint('MAINNET_DEPLOYER_PK'));
+
+ _deploy(_deployer);
}
}
contract DeployGoerli is Deploy {
function run() external {
- _deploy();
+ address _deployer = vm.rememberKey(vm.envUint('GOERLI_DEPLOYER_PK'));
+
+ _deploy(_deployer);
+ }
+}
+
+contract DeployLocal is Deploy {
+ function run() external {
+ address _deployer = vm.rememberKey(vm.envUint('LOCAL_DEPLOYER_PK'));
+
+ _deploy(_deployer);
+ }
+}
+
+contract DeployOptimism is Deploy {
+ function run() external {
+ address _deployer = vm.rememberKey(vm.envUint('OPTIMISM_DEPLOYER_PK'));
+
+ _deploy(_deployer);
}
}
diff --git a/yarn.lock b/yarn.lock
index 6d6371a..fafabe9 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -801,6 +801,26 @@ dot-prop@^5.1.0:
dependencies:
is-obj "^2.0.0"
+dotenv-cli@7.2.1:
+ version "7.2.1"
+ resolved "https://registry.yarnpkg.com/dotenv-cli/-/dotenv-cli-7.2.1.tgz#e595afd9ebfb721df9da809a435b9aa966c92062"
+ integrity sha512-ODHbGTskqRtXAzZapDPvgNuDVQApu4oKX8lZW7Y0+9hKA6le1ZJlyRS687oU9FXjOVEDU/VFV6zI125HzhM1UQ==
+ dependencies:
+ cross-spawn "^7.0.3"
+ dotenv "^16.0.0"
+ dotenv-expand "^10.0.0"
+ minimist "^1.2.6"
+
+dotenv-expand@^10.0.0:
+ version "10.0.0"
+ resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-10.0.0.tgz#12605d00fb0af6d0a592e6558585784032e4ef37"
+ integrity sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==
+
+dotenv@^16.0.0:
+ version "16.3.1"
+ resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e"
+ integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==
+
"ds-test@github:dapphub/ds-test#e282159":
version "1.0.0"
resolved "https://codeload.github.com/dapphub/ds-test/tar.gz/e282159d5170298eb2455a6c05280ab5a73a4ef0"