Skip to content

Specify compilation restriction in getCode #12821

@adhusson

Description

@adhusson

Component

Forge

Describe the feature you would like

It is possible to do vm.getCode("Contract.sol:0.8.18") and vm.getCode("Contract.sol:0.8.28") to choose between multiple compilations of the same contract.

This only works if the compilations use a different solidity version.

It would be useful to generalize to any compilation restriction listed in the current config. So you could do vm.getCode("Contract.sol:v1") and vm.getCode("Contract.sol:v2") if foundry.toml contains

[[profile.default.additional_compiler_profiles]]
name = "v1"
via_ir = false

[[profile.default.additional_compiler_profiles]]
name = "v2"
via_ir = true

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-featureType: featureT-needs-triageType: this issue needs to be labelled

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions