Pendulum Docs
  • Learn
    • Welcome to Pendulum
    • Our Journey
    • Litepaper
    • Tokenomics
      • Token Utility
      • Unlocking Vesting Tokens
    • Roadmap
    • Grants Received
  • Build
    • Introduction
    • Network Parameters
    • Build Environment
      • Local relay chain setup
      • Local Pendulum chain setup
      • Pre-Configured Pendulum
        • Install
        • Configure
        • Launch
        • Sub-commands
          • export-genesis
          • generate-specs
          • generate-docker
      • Foucoco (testnet)
      • Troubleshooting
    • Developing dApps
      • ink!
    • Node Operators
      • Collators
        • Collators List
        • Set up Collator
          • Hardware Requirements
          • Ubuntu Installation
          • Docker Installation
          • Keys Management
          • Become a Collator
          • Node upgrade instructions
      • Spacewalk Vaults
    • Integrations
      • Indexers
      • Oracles
      • Wallets
    • Spacewalk (Stellar bridge)
      • User
        • Spacewalk Step-by-step guide
          • Asset Redemption Post-Vault Liquidation
      • Operating a Vault client
        • Getting Started
          • Testing it locally
            • Building pallets and testchain
            • Creating test accounts
            • Testing the vault client
        • Usage
          • Issue assets
          • Redeem assets
        • Collateral and Liquidation
          • Recovering a vault after liquidation
        • Fees, Costs and Incentives
        • Vault rewards
          • Claiming Vault rewards
        • Troubleshooting
          • Generating metadata
    • Forex AMM
      • Architecture
      • Swap User Guide
      • LP User Guide
        • Swap Pools
        • Backstop Pool
        • Cross Interaction
      • Coverage Ratio and Slippage
      • Deployment Parameters
      • Security and Audits
    • Technical FAQ
    • Status reports
      • 22-10-11 Foucoco stopped after runtime upgrade
  • Community
    • Crowdloan
      • Sign T&Cs for rewards
    • Staking
      • Choosing a Collator to Stake with for $PEN Staking Rewards
      • Delegation
      • Rewards
      • Further Operations on Delegators
    • Testnet Faucet
    • On chain identity guide
    • Cross-chain transfer KSM
    • Using Ledger
    • Governance
    • PEN and AMPE Wallets
    • Add PEN/DOT Liquidity to StellaSwap
    • Pendulum Grant Program
    • Amplitude Grants Program
    • Ambassador Program
    • Ambassador Bounties
  • Resources
    • FAQ
    • Links
      • Website
      • Github
      • Social Media
    • Audits
Powered by GitBook
On this page
  • What is ink!?
  • Convert Solidity to ink! smart contracts
  • Setup
  • Add Contract and update JSON
  • Deploy
  • Known Issues

Was this helpful?

Edit on GitHub
  1. Build
  2. Developing dApps

ink!

PreviousDeveloping dAppsNextNode Operators

Last updated 1 year ago

Was this helpful?

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

You can learn more about ink! on their and on their

Convert Solidity to ink! smart contracts

You can find more about Swanky

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:

npm install -g @astar-network/swanky-cli

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.

swanky init myproject

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:

"networks":{
// any other networks
// ...
"foucoco": {
      "url": "wss://pencol-roc-02.pendulumchain.tech:443"
    },
// ...
}

You will need a swanky account to deploy the contract

swanky account create

You can also test with a dev account and see the mnemonic being added to the JSON

{
      "mnemonic": "foobarbaz",
      "isDev": true,
      "alias": "foobar",
      "address": "//anAddress"
    }

Add precompiled contracts to artifacts

If you have already compiled your contract using Solidity:

/artifacts/mycontract/timestamp/mycontract.contract
/artifacts/mycontract/timestamp/mycontract.json

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:

  "contracts": {
    "mycontract": {
      "name": "mycontract",
      "deployments": [],
      "language": "ink",
      "build": {
        "timestamp": 1677065947958,
        "artifactsPath": "/Users/hugo/Code/myproject/artifacts/mycontract/1677065947958"
      }
    }
  },

Deploy

Change the --network argument with the network you want to use, or use local for testing

swanky contract deploy <yourContract> --account <yourAccount> --gas <Initial Gas> --args true --network local

Known Issues

  • Facing error:

✖ Error Getting WASM

check your path in the JSON is correct!

If you are facing issues with cargo, you might need to first cargo contract

alternatively, verify the , it might not be a swanky issue

Substrate Contracts Pallet
homepage
blog
here
install
logs