github.com/klaytn/klaytn@v1.12.1/contracts/system_contracts/kip113/IAddressBook.sol (about) 1 // Copyright 2022 The klaytn Authors 2 // This file is part of the klaytn library. 3 // 4 // The klaytn library is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Lesser General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // The klaytn library is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Lesser General Public License for more details. 13 // 14 // You should have received a copy of the GNU Lesser General Public License 15 // along with the klaytn library. If not, see <http://www.gnu.org/licenses/>. 16 17 // SPDX-License-Identifier: LGPL-3.0-only 18 pragma solidity ^0.8.0; 19 20 interface IAddressBook { 21 enum RequestState { 22 Unknown, 23 NotConfirmed, 24 Executed, 25 ExecutionFailed, 26 Expired 27 } 28 enum Functions { 29 Unknown, 30 AddAdmin, 31 DeleteAdmin, 32 UpdateRequirement, 33 ClearRequest, 34 ActivateAddressBook, 35 UpdatePocContract, 36 UpdateKirContract, 37 RegisterCnStakingContract, 38 UnregisterCnStakingContract, 39 UpdateSpareContract 40 } 41 42 struct Request { 43 Functions functionId; 44 bytes32 firstArg; 45 bytes32 secondArg; 46 bytes32 thirdArg; 47 address[] confirmers; 48 uint256 initialProposedTime; 49 RequestState state; 50 } 51 52 function pocContractAddress() external view returns (address); 53 54 function kirContractAddress() external view returns (address); 55 56 function spareContractAddress() external view returns (address); 57 58 function isActivated() external view returns (bool); 59 60 function isConstructed() external view returns (bool); 61 62 function reviseRewardAddress(address _rewardAddress) external; 63 64 function constructContract(address[] memory _adminList, uint256 _requirement) external; 65 66 function submitAddAdmin(address _admin) external; 67 68 function submitDeleteAdmin(address _admin) external; 69 70 function submitUpdateRequirement(uint256 _requirement) external; 71 72 function submitClearRequest() external; 73 74 function submitActivateAddressBook() external; 75 76 function submitUpdatePocContract(address _pocContractAddress, uint256 _version) external; 77 78 function submitUpdateKirContract(address _kirContractAddress, uint256 _version) external; 79 80 function submitRegisterCnStakingContract( 81 address _cnNodeId, 82 address _cnStakingContractAddress, 83 address _cnRewardAddress 84 ) external; 85 86 function submitUnregisterCnStakingContract(address _cnNodeId) external; 87 88 function submitUpdateSpareContract(address _spareContractAddress) external; 89 90 function revokeRequest(Functions _functionId, bytes32 _firstArg, bytes32 _secondArg, bytes32 _thirdArg) external; 91 92 function getState() external view returns (address[] memory adminList, uint256 requirement); 93 94 function getPendingRequestList() external view returns (bytes32[] memory pendingRequestList); 95 96 function getRequestInfo( 97 bytes32 _id 98 ) 99 external 100 view 101 returns ( 102 Functions functionId, 103 bytes32 firstArg, 104 bytes32 secondArg, 105 bytes32 thirdArg, 106 address[] memory confirmers, 107 uint256 initialProposedTime, 108 RequestState state 109 ); 110 111 function getRequestInfoByArgs( 112 Functions _functionId, 113 bytes32 _firstArg, 114 bytes32 _secondArg, 115 bytes32 _thirdArg 116 ) external view returns (bytes32 id, address[] memory confirmers, uint256 initialProposedTime, RequestState state); 117 118 function getAllAddress() external view returns (uint8[] memory typeList, address[] memory addressList); 119 120 function getAllAddressInfo() 121 external 122 view 123 returns ( 124 address[] memory cnNodeIdList, 125 address[] memory cnStakingContractList, 126 address[] memory cnRewardAddressList, 127 address pocContractAddress, 128 address kirContractAddress 129 ); 130 131 function getCnInfo( 132 address _cnNodeId 133 ) external view returns (address cnNodeId, address cnStakingcontract, address cnRewardAddress); 134 }