1

I am trying to compile the code with multiple solidity versions e.g. =0.7.6, =0.8.15 etc in foundry with the configuration of auto_detect_solc but still getting this error

Here's my foundry.toml file

[profile.default]
  auto_detect_solc = true
  block_timestamp = 1_680_220_800
  bytecode_hash = "none"
  cbor_metadata = false

Also, solc_version is not set.

I am getting this error enter image description here

3
  • Your deploy script is probably importing contract with a different version than 0.8.15. Can you double check that? If you cannot update the contracts version, you can create an interface with something like ^0.8.0 to be compatible with the "immutable" contract you need to import.
    – ashhanai
    Commented Jan 26 at 11:22
  • I have imported Algebra V1 interfaces it is compiled in 0.7.6 and my contracts are on 0.8.15 but I want compiler to compile both different versions isn't possible? Commented Jan 26 at 13:54
  • It is possible, but if you have =0.7.6 and =0.8.15, then there is no common version the compiler can use. Try defining an interface with version ^0.7.6 for Algebra V1, that the rest of your codebase can use. Then import the interface into your 0.8.15 code (the interface will be compiled for each version separately).
    – ashhanai
    Commented Jan 30 at 12:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.