ink!
What is ink!?
Parity's ink! is an extension of the popular Rust programming language, in this, it is an embedded domain-specific language (eDSL). It is an opinionated language developed with the focus on Smart Contracts for the Substrate framework
The smart contracts developed through ink! are compatible with the Substrate Contracts Pallet
You can learn more about ink! on their homepage and on their blog
Convert Solidity to ink! smart contracts
You can find more about Swanky here
Swanky Suite is based on existing tools like cargo contract CLI
and polkadot.js
but extends their functionality with many additional features such as smart contract templates which reduces the contract development lifecycle.
You can use Swanky to convert your pre-built solidity contracts to ink!-compatible
Setup
To begin with, install the swanky CLI tool:
With this done you can navigate to your project or start a new one. It is not needed to install swanky node for this process.
Add Contract and update JSON
At this step you can update your code or simply use one of the preconfigured template. Once you are donem add the network you will be deploying to in swanky.config.json:
You will need a swanky account to deploy the contract
You can also test with a dev account and see the mnemonic being added to the JSON
Add precompiled contracts to artifacts
If you have already compiled your contract using Solidity:
The main annoyance in this process is mycontract.json
which needs to be created manually for precompiled contracts. However, it appears it is expected to contain the exact same thing as the mycontract.contract
minus the wasm key.
Add contract to JSON
This would also be done automatically normally, but we have to manually supply this with precompiled contracts:
Deploy
Change the --network argument with the network you want to use, or use local for testing
Known Issues
If you are facing issues with cargo, you might need to first install
cargo contract
Facing error:
check your path in the JSON is correct!
alternatively, verify the logs, it might not be a swanky issue
Last updated