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
Name | Type | Optional | Description |
---|---|---|---|
hn | u32 | No | The smart contract’s Hname. |
Returns
Name | Type | Description |
---|---|---|
cf | bool | Whether or not the contract exists. |
dt | ContractRecord | The requested contract record (if it exists). |
getContractRecords
Returns the list of all smart contracts deployed on the chain and related records.
Returns
Name | Type | Description |
---|---|---|
records | map[u32][ContractRecord] | A map of Hname to contract records. |