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

Support of multiple solidity versions #90

Open
bilyana-gospodinova opened this issue Sep 3, 2024 · 1 comment
Open

Support of multiple solidity versions #90

bilyana-gospodinova opened this issue Sep 3, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@bilyana-gospodinova
Copy link

Support of multiple solidity versions

Hi team! In our company we use your plugin and it is great. However, we have a suggestion how it can be enhanced and this would improve our experience - currently we need to generate java files of smart contracts with multiple solidity versions (for test purposes) but in the plugin we can only specify one solidity version. It would be great if there is an option to configure multiple folders of contracts and each folder to be configured with different solidity version.

Example:
Folder structure:

  • solidity_0_8_8
    • Contract1
  • solidity_0_8_24
    • Contract2

As a result Contract1 will be generated with solidity 0.8.8 under some package with configurable name and Contract2 will be generated with solidity 0.8.24 under another package with configurable name.

This will be useful in cases when there are some breaking changes between the different solidity versions. For example, block.prevrandao in solidity is introduced in 0.8.18 version and on older versions the contract will not be compiled so in the example above it needs to be placed in the solidity_0_8_24 folder. Before solidity 0.8.18 its equivalent was block.difficulty so a contract that uses it needs to be placed in the solidity_0_8_8 folder.

@NickSneo
Copy link
Contributor

with solidity gradle plugin version 0.4.2, you can set different solidity versions, evmVersions, optimize flag, optimizeRuns and ignoreMissing flag values for different sourceSets -

sourceSets {
    main {
        solidity {
            srcDir {
                "my/custom/path/to/solidity"
            }
            output.resourcesDir = file('out/bin/compiledSol')
            setEvmVersion('ISTANBUL')
            setOptimize(true)
            setOptimizeRuns(200)
            setVersion('0.8.12')
        }
    }
}

Checkout this blog post - https://medium.com/web3labs/how-to-compile-smart-contracts-against-different-evm-versions-using-web3j-ac2075733e4d
Let us know if you face any issue.

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

No branches or pull requests

2 participants