Schains
Contains functions to manage Schains such as Schain creation, deletion, and rotation.
addSchain addSchain(address from, uint256 deposit, bytes data)
external
Allows SkaleManager contract to create an Schain.
Emits an SchainCreated
event.
Requirements:
-
Schain type is valid.
-
There is sufficient deposit to create type of schain.
addSchainByFoundation addSchainByFoundation(uint256 lifetime, uint8 typeOfSchain, uint16 nonce, string name, address schainOwner)
external
Allows the foundation to create an Schain without tokens.
Emits an SchainCreated
event.
Requirements:
-
sender is granted with SCHAIN_CREATOR_ROLE
-
Schain type is valid.
deleteSchain deleteSchain(address from, string name)
external
Allows SkaleManager to remove an schain from the network. Upon removal, the space availability of each node is updated.
Emits an SchainDeleted
event.
Requirements:
-
Executed by schain owner.
deleteSchainByRoot deleteSchainByRoot(string name)
external
Allows SkaleManager to delete any Schain. Upon removal, the space availability of each node is updated.
Emits an SchainDeleted
event.
Requirements:
-
Schain exists.
restartSchainCreation restartSchainCreation(string name)
external
Allows SkaleManager contract to restart schain creation by forming a new schain group. Executed when DKG procedure fails and becomes stuck.
Emits a NodeAdded
event.
Requirements:
-
Previous DKG procedure must have failed.
-
DKG failure got stuck because there were no free nodes to rotate in.
-
A free node must be released in the network.
addSpace addSpace(uint256 nodeIndex, uint8 partOfNode)
external
addSpace - return occupied space to Node nodeIndex - index of Node at common array of Nodes partOfNode - divisor of given type of Schain
verifySchainSignature verifySchainSignature(uint256 signatureA, uint256 signatureB, bytes32 hash, uint256 counter, uint256 hashA, uint256 hashB, string schainName) → bool
external
Checks whether schain group signature is valid.
initialize initialize(address newContractsAddress)
public
getSchainPrice getSchainPrice(uint256 typeOfSchain, uint256 lifetime) → uint256
public
Returns the current price in SKL tokens for given Schain type and lifetime.
SchainCreated SchainCreated(string name, address owner, uint256 partOfNode, uint256 lifetime, uint256 numberOfNodes, uint256 deposit, uint16 nonce, bytes32 schainHash, uint256 time, uint256 gasSpend)
event
Emitted when an schain is created.
SchainDeleted SchainDeleted(address owner, string name, bytes32 schainHash)
event
Emitted when an schain is deleted.
NodeRotated NodeRotated(bytes32 schainHash, uint256 oldNode, uint256 newNode)
event
Emitted when a node in an schain is rotated.
NodeAdded NodeAdded(bytes32 schainHash, uint256 newNode)
event
Emitted when a node is added to an schain.
SchainNodes SchainNodes(string name, bytes32 schainHash, uint256[] nodesInGroup, uint256 time, uint256 gasSpend)
event
Emitted when a group of nodes is created for an schain.