Skip to main content

ink! contracts support

This section describes additional options available for indexing ink!-based WASM contracts, supported by chains with a Contracts pallet. At the moment of writing, AlephZero, Shibuya (Astar testnet), Shiden (Kusama parachain) and Astar (Polkadot parachain) are the most popular chains for deploying ink! contracts.

Generate an ink! indexing squid automatically, follow the WASM squid tutorial for a step-by-step instruction or check out the squid-wasm-template reference project.

Processor configuration

Request events by the contract address as described on the SubstrateBatchProcessor reference page, e.g.

import * as ss58 from '@subsquid/ss58'
import {toHex} from '@subsquid/util-internal-hex'

const ADDRESS = toHex(ss58.decode('XnrLUQucQvzp5kaaWLG9Q3LbZw5DPwpGn69B5YcywSWVr5w').bytes)

const processor = new SubstrateBatchProcessor()
.setGateway('https://v2.archive.subsquid.io/network/shibuya-substrate')
.setRpcEndpoint('https://shibuya.public.blastapi.io')
.addContractsContractEmitted({
contractAddress: [ADDRESS],
extrinsic: true
})
.setFields({
event: {
phase: true
}
})

Generate and use the facade classes for decoding ink! smart contract data as described in the typegens reference. You can also make direct contract state queries using the Contract class generated by squid-ink-typegen.