System Contracts
System contracts are the Energy Web Chain's smart contracts that implement OpenEthereum's protocols for Aura Proof-of-Authority consensus mechanism.
System contracts are the Energy Web Chain’s smart contracts that implement OpenEthereum’s permissioning protocols. These protocols determine what actions can be taken on the network.
In order to adhere to the expected protocol, the Energy Web Chain’s system contracts must implement the interfaces that are expected by the AuRa consensus engine, so that it can conform to the client’s protocols.
The OpenEthereum documentation specifies that “A simple validator contract has to have the following interface”
[
{
"constant": false,
"inputs": [],
"name": "finalizeChange",
"outputs": [],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getValidators",
"outputs": [
{
"name": "_validators",
"type": "address[]"
}
],
"payable": false,
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_parent_hash",
"type": "bytes32"
},
{
"indexed": false,
"name": "_new_set",
"type": "address[]"
}
],
"name": "InitiateChange",
"type": "event"
}
]
You can see that this smart contract implements all of the functions of the Validator-Set protocol interface that was specified above.
pragma solidity 0.5.8;
import "../misc/Ownable.sol";
import "../interfaces/IValidatorSetRelay.sol";
import "../interfaces/IValidatorSet.sol";
import "../interfaces/IValidatorSetRelayed.sol";
/// @title Validator Set Relay contract
/// @notice This owned contract is present in the chainspec file. The Relay contract
/// relays the function calls to a logic contract called Relayed for upgradeability
contract ValidatorSetRelay is IValidatorSet, IValidatorSetRelay, Ownable {