Skip to content
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

Bug, or clarification needed around forge install, and the lib folder #275

Open
positonic opened this issue Apr 21, 2024 · 2 comments
Open

Comments

@positonic
Copy link

I'm using forge with create-eth, and when I run forge install it installs in the lib folder in the root of my project.

I appear to be having an issue with paths though. My packages/foundry/remappings.txt file has the line:
oz-upgradeable=/lib/hypercerts/contracts/contracts/lib/openzeppelin-contracts-upgradeable/contracts/

It's throwing an error:

hyperstaker-mono git:(feat-basic-staking) ✗ yarn test                   
[⠊] Compiling...
Error: 
Failed to resolve file: "/Users/james/code/hyperstaker-mono/packages/foundry/lib/hypercerts/contracts/contracts/lib/openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol": No such file or directory (os error 2).
 Check configured remappings..
    --> "/Users/james/code/hyperstaker-mono/lib/hypercerts/contracts/contracts/HypercertMinter.sol"
        "oz-upgradeable/security/PausableUpgradeable.sol"

Which basically shows that it's looking for the lib folder relative to the foundry folder:
packages/foundry

I'm stuck on how to get around this.

I've tried:

  • passing in a flag - yarn test --lib-paths ./lib
  • adding the flag to packages/foundry/package.json ---> "test": "forge test",

The only way I have been been able to get it working is to hard code the path to the folder like this:
oz-upgradeable=/Users/me/code/hyperstaker-mono/lib/hypercerts/contracts/lib/openzeppelin-contracts-upgradeable/contracts/

This is problematic as it's a shared repo which others work on, and I'm a bit confused by this behaviour altogether, and wonder if I'm doing something wrong, or if it's a bug?

@positonic positonic changed the title Clarification around forge install, and the lib folder Bug, or clarification needed around forge install, and the lib folder Apr 21, 2024
@PaulRBerg
Copy link
Collaborator

This project is not meant to be used with Forge. It's a front-end development environment.

For smart contract development, check out my Foundry template:

https://github.com/PaulRBerg/foundry-template

@PaulRBerg
Copy link
Collaborator

Also, I recommend against using git submodules:

https://twitter.com/PaulRBerg/status/1736694426578137247

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants