Skip to main content

The root Contract

The root contract is one of the core contracts on each IOTA Smart Contracts chain.

This contract is responsible for the initialization of the chain. It is the first smart contract deployed on the chain and, upon receiving the init request, bootstraps the state of the chain. Deploying all of the other core contracts is a part of the state initialization.

The root contract also functions as a smart contract factory for the chain: upon request, it deploys other smart contracts and maintains an on-chain registry of smart contracts in its state. The contract registry keeps a list of contract records containing their respective name, hname, description, and creator.

Views

findContract

Returns the record for a given smart contract with Hname hn (if it exists).

Parameters

NameTypeOptionalDescription
hnu32NoThe smart contract’s Hname.

Returns

NameTypeDescription
cfboolWhether or not the contract exists.
dtContractRecordThe requested contract record (if it exists).

getContractRecords

Returns the list of all smart contracts deployed on the chain and related records.

Returns

NameTypeDescription
recordsmap[u32][ContractRecord]A map of Hname to contract records.