-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/rd 1193 add openzeppelin foundry upgrades to the repo #51
Changes from all commits
ae29651
f883436
6065ced
7d9e84d
f4e49ea
c7b85ba
e5e832c
0988488
ec18ada
de71bbc
836dc78
dc6fbf8
cd4ef26
70c3555
050b895
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,111 @@ | ||
name: CI | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'develop' | ||
- 'deploy/**' | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
env: | ||
FOUNDRY_PROFILE: ci | ||
|
||
jobs: | ||
check: | ||
test-upgrades: | ||
strategy: | ||
fail-fast: true | ||
name: Test upgrades | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- uses: oven-sh/setup-bun@v2 | ||
|
||
- name: foundry-toolchain | ||
uses: foundry-rs/[email protected] | ||
|
||
name: Foundry project | ||
- name: Show Forge version | ||
run: forge --version | ||
|
||
- name: Build | ||
run: bun run build-all | ||
|
||
- name: Run tests | ||
run: bun run test-upgrades | ||
test-fork: | ||
strategy: | ||
fail-fast: true | ||
name: Test fork | ||
runs-on: ubuntu-latest | ||
env: | ||
NETWORK: "sepolia" | ||
FORK_TEST_MODE: "new-factory" | ||
DEPLOY_AS_PRODUCTION: false | ||
TOKEN_TEST_WHALE: "0x" | ||
FACTORY_ADDRESS: "0x" | ||
MULTISIG_MEMBERS_JSON_FILE_NAME: "/script/multisig-members.json" | ||
MIN_APPROVALS: 1 | ||
MULTISIG_PROPOSAL_EXPIRATION_PERIOD: "864000" | ||
MINT_TEST_TOKENS: true | ||
TOKEN1_ADDRESS: "0x0000000000000000000000000000000000000000" | ||
VE_TOKEN1_NAME: "Voting Escrow Token 1" | ||
VE_TOKEN1_SYMBOL: "veTK1" | ||
TOKEN2_ADDRESS: "0x0000000000000000000000000000000000000000" | ||
VE_TOKEN2_NAME: "Voting Escrow Token 2" | ||
VE_TOKEN2_SYMBOL: "veTK2" | ||
FEE_PERCENT: "0" # 10_000 = 100% | ||
WARMUP_PERIOD: "259200" # 3 days | ||
COOLDOWN_PERIOD: "259200" # 3 days | ||
MIN_LOCK_DURATION: "1" | ||
VOTING_PAUSED: true | ||
MIN_DEPOSIT: "10000000000000000" # 0.01 ETH | ||
MULTISIG_PLUGIN_REPO_ADDRESS: "0x9e7956C8758470dE159481e5DD0d08F8B59217A2" | ||
MULTISIG_PLUGIN_RELEASE: "1" | ||
MULTISIG_PLUGIN_BUILD: "2" | ||
SIMPLE_GAUGE_VOTER_REPO_ENS_SUBDOMAIN: "gauge-voter-${{ vars.GITHUB_RUN_ID }}" | ||
DAO_FACTORY: "0x7a62da7B56fB3bfCdF70E900787010Bc4c9Ca42e" | ||
PLUGIN_SETUP_PROCESSOR: "0xC24188a73dc09aA7C721f96Ad8857B469C01dC9f" | ||
PLUGIN_REPO_FACTORY: "0x07f49c49Ce2A99CF7C28F66673d406386BDD8Ff4" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
submodules: true | ||
- uses: oven-sh/setup-bun@v2 | ||
|
||
- name: foundry-toolchain | ||
uses: foundry-rs/[email protected] | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
- name: Show Forge version | ||
run: forge --version | ||
|
||
- name: Build | ||
run: bun run build | ||
|
||
- name: Run tests | ||
run: bun run test-fork | ||
test-unit: | ||
strategy: | ||
fail-fast: true | ||
name: Test unit | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
version: nightly | ||
submodules: true | ||
- uses: oven-sh/setup-bun@v2 | ||
|
||
- name: foundry-toolchain | ||
uses: foundry-rs/[email protected] | ||
|
||
- name: Show Forge version | ||
run: | | ||
forge --version | ||
|
||
- name: Run Forge build | ||
run: | | ||
forge build --sizes | ||
id: build | ||
|
||
- name: Run Forge tests | ||
run: | | ||
forge test --no-match-path "test/fork/**/*.sol" -vvv | ||
id: test | ||
run: forge --version | ||
|
||
- name: Build | ||
run: bun run build | ||
|
||
- name: Run tests | ||
run: bun run test-unit | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
# Foundry | ||
cache/ | ||
out/ | ||
ref_builds/ | ||
broadcast/ | ||
|
||
# JS | ||
|
+193 −0 | CONTRIBUTING.md | |
+18 −2 | README.md | |
+2 −0 | foundry.toml | |
+1 −1 | package.json | |
+12 −1 | scripts/vm.py | |
+28 −0 | src/StdChains.sol | |
+17 −5 | src/StdCheats.sol | |
+104 −0 | src/StdJson.sol | |
+104 −0 | src/StdToml.sol | |
+0 −17 | src/StdUtils.sol | |
+408 −26 | src/Vm.sol | |
+471 −463 | src/console.sol | |
+2 −2 | src/interfaces/IERC4626.sol | |
+0 −234 | src/mocks/MockERC20.sol | |
+0 −231 | src/mocks/MockERC721.sol | |
+1 −5 | test/StdAssertions.t.sol | |
+19 −18 | test/StdChains.t.sol | |
+10 −10 | test/StdCheats.t.sol | |
+12 −12 | test/StdError.t.sol | |
+1 −1 | test/StdJson.t.sol | |
+4 −14 | test/StdMath.t.sol | |
+25 −8 | test/StdStorage.t.sol | |
+1 −1 | test/StdStyle.t.sol | |
+1 −1 | test/StdToml.t.sol | |
+12 −12 | test/StdUtils.t.sol | |
+9 −6 | test/Vm.t.sol | |
+0 −441 | test/mocks/MockERC20.t.sol | |
+0 −721 | test/mocks/MockERC721.t.sol |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
{ | ||
"name": "ve-governance", | ||
"version": "1.0.0", | ||
"devDependencies": { | ||
"prettier": "^3.3.3", | ||
"prettier-plugin-solidity": "^1.4.1" | ||
}, | ||
"scripts": { | ||
"build": "forge build", | ||
"build-clean": "forge build --force", | ||
"build-refs": "bash script/build-reference-builds.sh", | ||
"build-all": "bun run build-refs && bun run build-clean", | ||
"test-unit": "forge test --no-match-path \"{test/fork/*.sol,test/upgrades/*.sol}\" -vvv", | ||
"test-fork": "forge test --match-path \"test/fork/**/*.sol\" --rpc-url https://sepolia.drpc.org -vvv", | ||
"test-upgrades": "forge test --build-info --match-path \"test/upgrades/**/*.sol\" -vvv", | ||
"test": "forge test -vvv" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
rm -rf ref_builds | ||
mkdir -p ref_builds | ||
|
||
for file in lib/ve-governance/*; | ||
do | ||
echo "Processing $file" | ||
filename=$(echo $file | sed 's/\//-/g') | ||
filename=$(echo $filename | sed 's/lib-ve-governance-//g') | ||
mkdir -p ref_builds/build-info-$filename | ||
forge build --force --root=$file | ||
mv $file/out/build-info/*.json ref_builds/build-info-$filename | ||
done |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ contract Clock is IClock, DaoAuthorizable, UUPSUpgradeable { | |
Initialization | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
/// @custom:oz-upgrades-unsafe-allow constructor | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This annotation is needed in all the contracts with a constructor (also in the old ones) |
||
constructor() { | ||
_disableInitializers(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
pragma solidity ^0.8.17; | ||
|
||
import "forge-std/Test.sol"; | ||
import {MockERC20} from "@solmate/test/utils/mocks/MockERC20.sol"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why are we using the solmate erc20?: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forge-std deprecated the ERC20Mock |
||
import {GaugesDaoFactory, Deployment, DeploymentParameters, TokenParameters} from "../../src/factory/GaugesDaoFactory.sol"; | ||
import {MockPluginSetupProcessor} from "@mocks/osx/MockPSP.sol"; | ||
import {MockPluginSetupProcessorMulti} from "@mocks/osx/MockPSPMulti.sol"; | ||
|
@@ -382,12 +383,12 @@ contract GaugesDaoFactoryTest is Test { | |
|
||
TokenParameters[] memory tokenParameters = new TokenParameters[](2); | ||
tokenParameters[0] = TokenParameters({ | ||
token: address(deployMockERC20("T1", "T1", 18)), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
token: address(new MockERC20("T1", "T1", 18)), | ||
veTokenName: "Name 1", | ||
veTokenSymbol: "TK1" | ||
}); | ||
tokenParameters[1] = TokenParameters({ | ||
token: address(deployMockERC20("T2", "T2", 18)), | ||
token: address(new MockERC20("T2", "T2", 18)), | ||
veTokenName: "Name 2", | ||
veTokenSymbol: "TK2" | ||
}); | ||
|
@@ -767,17 +768,17 @@ contract GaugesDaoFactoryTest is Test { | |
|
||
TokenParameters[] memory tokenParameters = new TokenParameters[](3); | ||
tokenParameters[0] = TokenParameters({ | ||
token: address(deployMockERC20("T3", "T3", 18)), | ||
token: address(new MockERC20("T3", "T3", 18)), | ||
veTokenName: "Name 3", | ||
veTokenSymbol: "TK3" | ||
}); | ||
tokenParameters[1] = TokenParameters({ | ||
token: address(deployMockERC20("T4", "T4", 18)), | ||
token: address(new MockERC20("T4", "T4", 18)), | ||
veTokenName: "Name 4", | ||
veTokenSymbol: "TK4" | ||
}); | ||
tokenParameters[2] = TokenParameters({ | ||
token: address(deployMockERC20("T5", "T5", 18)), | ||
token: address(new MockERC20("T5", "T5", 18)), | ||
veTokenName: "Name 5", | ||
veTokenSymbol: "TK5" | ||
}); | ||
|
@@ -1261,17 +1262,17 @@ contract GaugesDaoFactoryTest is Test { | |
|
||
TokenParameters[] memory tokenParameters = new TokenParameters[](3); | ||
tokenParameters[0] = TokenParameters({ | ||
token: address(deployMockERC20("T3", "T3", 18)), | ||
token: address(new MockERC20("T3", "T3", 18)), | ||
veTokenName: "Name 3", | ||
veTokenSymbol: "TK3" | ||
}); | ||
tokenParameters[1] = TokenParameters({ | ||
token: address(deployMockERC20("T4", "T4", 18)), | ||
token: address(new MockERC20("T4", "T4", 18)), | ||
veTokenName: "Name 4", | ||
veTokenSymbol: "TK4" | ||
}); | ||
tokenParameters[2] = TokenParameters({ | ||
token: address(deployMockERC20("T5", "T5", 18)), | ||
token: address(new MockERC20("T5", "T5", 18)), | ||
veTokenName: "Name 5", | ||
veTokenSymbol: "TK5" | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should be added to the makefile or we replace the makefile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100%, better all together. And make is easier to use in CI