File tree Expand file tree Collapse file tree 9 files changed +63
-0
lines changed
Expand file tree Collapse file tree 9 files changed +63
-0
lines changed Original file line number Diff line number Diff line change 1+ [submodule "contracts/lib/forge-std "]
2+ path = contracts/lib/forge-std
3+ url = https://github.com/foundry-rs/forge-std
4+ [submodule "contracts/lib/solmate "]
5+ path = contracts/lib/solmate
6+ url = https://github.com/rari-capital/solmate
Original file line number Diff line number Diff line change 1+
2+ [profile .default ]
3+ src = ' src'
4+ out = ' out'
5+ libs = [' ../node_modules' , ' lib' ]
6+
7+ # See more config options https://book.getfoundry.sh/reference/config.html
Original file line number Diff line number Diff line change 11import * as dotenv from "dotenv" ;
2+ import fs from "fs" ;
23
34import { HardhatUserConfig , task } from "hardhat/config" ;
45import "@nomiclabs/hardhat-waffle" ;
@@ -12,9 +13,18 @@ import "hardhat-watcher";
1213import "hardhat-docgen" ;
1314import "hardhat-contract-sizer" ;
1415import "hardhat-tracer" ;
16+ import "hardhat-preprocessor" ;
1517
1618dotenv . config ( ) ;
1719
20+ function getRemappings ( ) {
21+ return fs
22+ . readFileSync ( "remappings.txt" , "utf8" )
23+ . split ( "\n" )
24+ . filter ( Boolean )
25+ . map ( ( line ) => line . trim ( ) . split ( "=" ) ) ;
26+ }
27+
1828const config : HardhatUserConfig = {
1929 solidity : {
2030 version : "0.8.9" ,
@@ -27,6 +37,7 @@ const config: HardhatUserConfig = {
2737 } ,
2838 paths : {
2939 sources : "./src" ,
40+ cache : "./cache_hardhat" ,
3041 } ,
3142 networks : {
3243 hardhat : {
@@ -185,6 +196,21 @@ const config: HardhatUserConfig = {
185196 } ,
186197 ] ,
187198 } ,
199+ // This fully resolves paths for imports in the ./lib directory for Hardhat
200+ preprocess : {
201+ eachLine : ( hre ) => ( {
202+ transform : ( line : string ) => {
203+ if ( line . match ( / ^ \s * i m p o r t / i) ) {
204+ getRemappings ( ) . forEach ( ( [ find , replace ] ) => {
205+ if ( line . match ( find ) ) {
206+ line = line . replace ( find , replace ) ;
207+ }
208+ } ) ;
209+ }
210+ return line ;
211+ } ,
212+ } ) ,
213+ } ,
188214} ;
189215
190216export default config ;
Original file line number Diff line number Diff line change 5353 "hardhat-deploy-tenderly" : " ^0.2.0" ,
5454 "hardhat-docgen" : " ^1.3.0" ,
5555 "hardhat-gas-reporter" : " ^1.0.9" ,
56+ "hardhat-preprocessor" : " ^0.1.5" ,
5657 "hardhat-tracer" : " ^1.1.1" ,
5758 "hardhat-watcher" : " ^2.5.0" ,
5859 "json-schema" : " ^0.4.0" ,
Original file line number Diff line number Diff line change 1+ @ensdomains/=../node_modules/@ensdomains/
2+ @openzeppelin/=../node_modules/@openzeppelin/
3+ @kleros/=../node_modules/@kleros/
4+ ds-test/=lib/forge-std/lib/ds-test/src/
5+ eth-gas-reporter/=../node_modules/eth-gas-reporter/
6+ forge-std/=lib/forge-std/src/
7+ hardhat-deploy/=../node_modules/hardhat-deploy/
8+ hardhat/=../node_modules/hardhat/
9+ solmate/=lib/solmate/src/
Original file line number Diff line number Diff line change @@ -2282,6 +2282,7 @@ __metadata:
22822282 hardhat-deploy-tenderly: ^0.2.0
22832283 hardhat-docgen: ^1.3.0
22842284 hardhat-gas-reporter: ^1.0.9
2285+ hardhat-preprocessor: ^0.1.5
22852286 hardhat-tracer: ^1.1.1
22862287 hardhat-watcher: ^2.5.0
22872288 json-schema: ^0.4.0
@@ -12748,6 +12749,17 @@ __metadata:
1274812749 languageName: node
1274912750 linkType: hard
1275012751
12752+ "hardhat-preprocessor@npm:^0.1.5":
12753+ version: 0.1.5
12754+ resolution: "hardhat-preprocessor@npm:0.1.5"
12755+ dependencies:
12756+ murmur-128: ^0.2.1
12757+ peerDependencies:
12758+ hardhat: ^2.0.5
12759+ checksum: 7d543c2965828441741950b153d584ff096d7a006975f06af9870e05a928e56122b463c4a1b3b346f9a3baccaa6ee2dec1dfd026a434ac714ebf127bbe842fef
12760+ languageName: node
12761+ linkType: hard
12762+
1275112763"hardhat-tracer@npm:^1.1.1":
1275212764 version: 1.1.1
1275312765 resolution: "hardhat-tracer@npm:1.1.1"
You can’t perform that action at this time.
0 commit comments