Smart Contracts
Last updated
Last updated
Smart contracts implement and enforce the ICN’s economic model, managing resource allocation, and implementing the logic for performance validation. Smart contracts automate and regulate transactions and interactions within the ICN ecosystem, to automatically execute actions like distributing rewards, processing payments, or verifying performance based on predefined conditions. This automation removes the need for intermediaries and minimizes the potential for human error or manipulation, contributing to a transparent and trustworthy system.
ICN smart contracts uses a multi-implementation proxy. This has the following benefits:
Unlimited size for code deployment: Breaking down large and complex logic into smaller, more manageable pieces, effectively bypassing gas limit constraint on contract sizes.
Modularity: The logic of related functionalities lives in a separated contract and can be upgraded independent of any other module. This design allows for the separation of concerns, making it easier to update or modify specific components without affecting other parts of the system. For example, if one component is updated, it won't break dependent components that use older versions.
Extensibility: modules can be added as the requirements for new functionality are received. New features and functionalities can be seamlessly integrated into the existing system by deploying additional contracts, allowing for incremental growth and evolution of the smart contract ecosystem.
Structured organization of the storage: Data storage is organized in a hierarchical manner, making it easier to manage and maintain complex state transitions.
Improved security through compartmentalization: With each contract responsible for a specific aspect of the system's functionality, potential vulnerabilities are isolated and contained within their respective contracts, reducing the attack surface and making it harder for hackers to exploit weaknesses.
Enhanced maintainability and debugging capabilities: As each component is separate and self-contained, developers can focus on specific parts of the system without being overwhelmed by complex interactions between multiple components. This leads to faster development cycles, improved code quality, and more efficient debugging processes.
ICN smart contracts modules are divided into:
Access Control: Management and regulation of who has permission to interact with various parts of ICN. Main functions within this module include granting and revoking roles from a specific account.
ICN Registry: Includes all functions related to registration and removal of entities in ICN (i.e. regions, clusters, HPs, ScalerNodes, SPs, HyperNodes, etc.) and the related update functions for their parameters such as updating reservation price of a ScalerNode.
Booking Manager: Controls all the operations related to booking resources within ICN and related parameters.
Era Manager: Responsible for tracking eras within ICN, this module also allows for updating the era duration in number of blocks.
HP Delegation: All functions related to collateralization of ScalerNodes and delegation of ICNT for network collateral, including locking, claiming and withdrawal of accrued rewards.
HP Rewards: It includes all required functions for the calculation of capacity and utilization rewards of ScalerNodes, as well as delegator rewards generated from the reward share.
Link Rewards: Controls all operations related to ICN Link rewards such as claiming and withdrawal of accrued rewards.
Link Staking: Includes functions related to staking and unstaking of ICN Links and updating functions for related parameters such as minimum staking periods or maximum number of ICN Links that can be staked on a single HyperNode.
Slashing: It includes functions for slashing ScalerNodes in case of misbehavior.