Open bilyana-gospodinova opened 2 months ago
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.
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:
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 wasblock.difficulty
so a contract that uses it needs to be placed in the solidity_0_8_8 folder.