foundry-random icon indicating copy to clipboard operation
foundry-random copied to clipboard

Imports not working

Open hammersharkfish opened this issue 7 months ago • 0 comments

My project structure

contractsEscrow/
├── lib/
│   ├── foundry-random/
│   └── foundry-std/   
├── remappings.txt
└── src/
    ├── SimpleEscrow.sol
    └── ISimpleEscrow.sol

My remappings.txt

@prb/test/=lib/foundry-random/lib/prb-test/src/
CramBit/=lib/foundry-random/lib/CramBit/
crambit/=lib/foundry-random/lib/CramBit/src/
ds-test/=lib/foundry-random/lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/
foundry-random/=lib/foundry-random/src/
prb-test/=lib/foundry-random/lib/prb-test/src/
solidity-bytes-utils/=lib/foundry-random/lib/solidity-bytes-utils/contracts/

When I run forge test -vvvvv --via-ir I run into -

Compiler run failed:
Error (6275): Source "lib/foundry-random/src/ISimpleEscrow.sol" not found: File not found. Searched the following locations: "/home/ubuntu/Work Folder/Escrow/EscrowSimple/contractsEscrow".
ParserError: Source "lib/foundry-random/src/ISimpleEscrow.sol" not found: File not found. Searched the following locations: "/home/ubuntu/Work Folder/Escrow/EscrowSimple/contractsEscrow".
 --> src/SimpleEscrow.sol:4:1:
  |
4 | import './ISimpleEscrow.sol';
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Error (6275): Source "lib/foundry-random/src/SimpleEscrow.sol" not found: File not found. Searched the following locations: "/home/ubuntu/Work Folder/Escrow/EscrowSimple/contractsEscrow".
ParserError: Source "lib/foundry-random/src/SimpleEscrow.sol" not found: File not found. Searched the following locations: "/home/ubuntu/Work Folder/Escrow/EscrowSimple/contractsEscrow".
 --> test/SimpleEscrow.t.sol:7:1:
  |
7 | import "../src/SimpleEscrow.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Error: 
Compilation failed

My foundry.toml

[profile.default]
src = "src"
out = "out"
libs = ["lib"]
solc_version = '0.8.26'
[fuzz]
runs = 10000

Edited to include correct project structure and foundry.toml

hammersharkfish avatar Jul 08 '24 15:07 hammersharkfish