diff --git a/.github/workflows/core.yaml b/.github/workflows/core.yaml index 7addece4a..aa4cb9048 100644 --- a/.github/workflows/core.yaml +++ b/.github/workflows/core.yaml @@ -35,6 +35,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + submodules: recursive - name: Set up Node uses: actions/setup-node@v4 @@ -46,6 +48,9 @@ jobs: - name: Install Dependencies run: yarn install --prefer-offline --frozen-lockfile + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + - name: Build run: yarn build @@ -74,6 +79,9 @@ jobs: - name: Install Dependencies run: yarn install --prefer-offline --frozen-lockfile + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + - name: Download Build Artifacts uses: actions/download-artifact@v3 with: @@ -83,6 +91,22 @@ jobs: - name: Test run: yarn test --no-compile + core-foundry-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + + - name: Run tests + run: forge test -vvv + + - name: Run snapshot + run: forge snapshot + core-deploy-dry-run: needs: [core-build] runs-on: ubuntu-latest @@ -99,6 +123,9 @@ jobs: - name: Install Dependencies run: yarn install --prefer-offline --frozen-lockfile + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + - name: Download Build Artifacts uses: actions/download-artifact@v3 with: diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..7048255c8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "core/lib/forge-std"] + path = core/lib/forge-std + url = https://github.com/foundry-rs/forge-std +[submodule "core/lib/erc4626"] + path = core/lib/erc4626 + url = https://github.com/thesis/erc4626 +[submodule "core/lib/solmate"] + path = core/lib/solmate + url = https://github.com/Rari-Capital/solmate +[submodule "core/lib/ds-test"] + path = core/lib/ds-test + url = https://github.com/dapphub/ds-test diff --git a/core/.gitignore b/core/.gitignore index a3a59115e..42bf36d7a 100644 --- a/core/.gitignore +++ b/core/.gitignore @@ -1,8 +1,10 @@ build/ cache/ +cache_forge/ export.json export/ node_modules/ +out/ typechain/ yarn-debug.log* yarn-error.log* diff --git a/core/foundry.toml b/core/foundry.toml new file mode 100644 index 000000000..4f3bf9f3f --- /dev/null +++ b/core/foundry.toml @@ -0,0 +1,6 @@ +[profile.default] +src = 'contracts' +out = 'out' +libs = ['node_modules', 'lib'] +test = 'test' +cache_path = 'cache_forge' \ No newline at end of file diff --git a/core/hardhat.config.ts b/core/hardhat.config.ts index 64e14bce6..a4d0a421c 100644 --- a/core/hardhat.config.ts +++ b/core/hardhat.config.ts @@ -1,6 +1,7 @@ import { HardhatUserConfig } from "hardhat/config" import "@nomicfoundation/hardhat-toolbox" +import "@nomicfoundation/hardhat-foundry" import "hardhat-deploy" const config: HardhatUserConfig = { diff --git a/core/lib/ds-test b/core/lib/ds-test new file mode 160000 index 000000000..e282159d5 --- /dev/null +++ b/core/lib/ds-test @@ -0,0 +1 @@ +Subproject commit e282159d5170298eb2455a6c05280ab5a73a4ef0 diff --git a/core/lib/erc4626 b/core/lib/erc4626 new file mode 160000 index 000000000..643cd044f --- /dev/null +++ b/core/lib/erc4626 @@ -0,0 +1 @@ +Subproject commit 643cd044fac34bcbf64e1c3790a5126fec0dbec1 diff --git a/core/lib/forge-std b/core/lib/forge-std new file mode 160000 index 000000000..2f1126975 --- /dev/null +++ b/core/lib/forge-std @@ -0,0 +1 @@ +Subproject commit 2f112697506eab12d433a65fdc31a639548fe365 diff --git a/core/lib/solmate b/core/lib/solmate new file mode 160000 index 000000000..e0e9ff05d --- /dev/null +++ b/core/lib/solmate @@ -0,0 +1 @@ +Subproject commit e0e9ff05d8aa5c7c48465511f85a6efdf5d5c30d diff --git a/core/package.json b/core/package.json index 570eebfbf..b9b6b30b7 100644 --- a/core/package.json +++ b/core/package.json @@ -30,6 +30,7 @@ "devDependencies": { "@nomicfoundation/hardhat-chai-matchers": "^2.0.0", "@nomicfoundation/hardhat-ethers": "^3.0.0", + "@nomicfoundation/hardhat-foundry": "^1.1.1", "@nomicfoundation/hardhat-network-helpers": "^1.0.0", "@nomicfoundation/hardhat-toolbox": "^3.0.0", "@nomicfoundation/hardhat-verify": "^1.0.0", diff --git a/core/remappings.txt b/core/remappings.txt new file mode 100644 index 000000000..c7489c190 --- /dev/null +++ b/core/remappings.txt @@ -0,0 +1,7 @@ +@openzeppelin/=node_modules/@openzeppelin/ +erc4626/=lib/erc4626/src/ +eth-gas-reporter/=node_modules/eth-gas-reporter/ +forge-std/=lib/forge-std/src/ +hardhat-deploy/=node_modules/hardhat-deploy/ +hardhat/=node_modules/hardhat/ +solmate/=lib/solmate/src/ diff --git a/core/yarn.lock b/core/yarn.lock index cf702692a..5b17dd0c9 100644 --- a/core/yarn.lock +++ b/core/yarn.lock @@ -765,6 +765,13 @@ debug "^4.1.1" lodash.isequal "^4.5.0" +"@nomicfoundation/hardhat-foundry@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-foundry/-/hardhat-foundry-1.1.1.tgz#db72b1f33f9cfaecc27e67f69ad436f8710162d6" + integrity sha512-cXGCBHAiXas9Pg9MhMOpBVQCkWRYoRFG7GJJAph+sdQsfd22iRs5U5Vs9XmpGEQd1yEvYISQZMeE68Nxj65iUQ== + dependencies: + chalk "^2.4.2" + "@nomicfoundation/hardhat-network-helpers@^1.0.0": version "1.0.9" resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-network-helpers/-/hardhat-network-helpers-1.0.9.tgz#767449e8a2acda79306ac84626117583d95d25aa"