
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
hardhat-resolc
Advanced tools
Plugin for compiling Solidity Smart Contracts to PolkaVM.
NOTE: resolc
is compatible with solidity versions higher than 0.8.0
.
This plugin allows for seamless transition between EVM and PolkaVM environments, by enabling compilation of Solidity Smart Contracts to PolkaVM compatible hardhat artifacts, in order to facilitate deployment or testing.
This plugin overrides the compile
tasks in order to replace compiler from solc
to pallet revive's resolc
. At the same
time it allows for selecting either remix
as the compilation backend or the
resolc
binary, with full support for their respective optional commands.
In order to use the plugin, it must be imported at the top of the hardhat.config
file, in order to override the relevant hardhat
tasks.
When using the resolc
binary, it's required to state the path to the binary and
fullfiling all other requirements as described by the installation section
of the pallet revive
repo. If you need to compile to a solidity version different
from the solc
you have installed, the corresponding version's binary must be
present and the path specified in the configuration.
NOTE Usage of absolute paths are recommended.
When using the remix
backend for compilation, the solidity version of the project
must be >= 0.8.0, since the backend is hardcoded for that compiler version.
Please refer to the ResolcConfig type
to see the available configuration options, as well as the resolc
compiler's
--help
section for more detailed information on each.
When using the remix
backend for compilation, the only available configuration
options are within the optimization
field, and are enabling or disabling the
optimization through the enable
option and defining the number of runs
for the
optimizer under the option with the same name.
When using the resolc
binary, the same configuration options as when using the
binary on its own are available.
Inside of the hardhat configuration file, you must define both that the VM is polkavm
inside the hardhat
network and the resolc
options, such as the following:
const config: HardhatUserConfig = {
solidity: "0.8.28",
networks: {
hardhat: {
polkavm: true
}
},
resolc: {
compilerSource: 'remix',
settings: {
optimizer: {
enabled: true,
runs: 400
},
evmVersion: "istanbul"
},
},
};
You must also import the plugin at the top of the configuration file in order to override the compiler.
This configuration will have hardhat interact with the chain as if with a live chain,
since the forking
capability is not yet integrated. As a workaround, you can
fork the Asset Hub mainnet with a tool such as @acala-network/chopsticks
and then use the eth-rpc-adapter
in order to provide the fork with the required ethereum-compatible calls.
This plugin shares the same compatibility requirements as the resolc
compiler,
such as:
solc
binary installed.compiler-rt
Regarding hardhat
compatibility, even though it's set as part of the hardhat
type in the NetworksConfig
type, it is not compatible with hardhat-only helpers,
such as time
and loadFixture
from @nomicfoundation/hardhat-toolbox/network-helpers
,
due to the node missing some rpc calls necessary for these calls to work.
When running against a local node, or against a fork of the live chain, you must
make sure that the binaries employed are compatible with eachother. In order to
do this, you can check inside pallet revive's Cargo.toml
in order to see which commit of the polkadot-sdk you should use to build the
substrate-node
and eth-rpc-adapter
binaries. If there is a missmatch betwween
these versions, deployment will fail with CodeRejected
or Metadata error: The generated code is not compatible with the node
.
FAQs
Plugin for compiling Solidity Smart Contracts to PolkaVM.
The npm package hardhat-resolc receives a total of 389 weekly downloads. As such, hardhat-resolc popularity was classified as not popular.
We found that hardhat-resolc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.