From 89474b69c882c653c37c9a3359bec598a5b9ad37 Mon Sep 17 00:00:00 2001 From: cyl19970726 <15258378443@163.com> Date: Wed, 1 Mar 2023 16:10:45 +0800 Subject: [PATCH] update contracts --- contracts/v3/Hubv3.sol | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/contracts/v3/Hubv3.sol b/contracts/v3/Hubv3.sol index 3f4f919..de35053 100644 --- a/contracts/v3/Hubv3.sol +++ b/contracts/v3/Hubv3.sol @@ -88,7 +88,7 @@ contract Hubv3 is AccessControlEnumerable, Initializable { return false; } - function roleToMembers(bytes32 role) public view returns(address[] memory members){ + function getMembersByRole(bytes32 role) public view returns(address[] memory members){ uint256 count = getRoleMemberCount(role); members = new address[](count); for (uint i = 0; i < count; i++){ @@ -96,6 +96,12 @@ contract Hubv3 is AccessControlEnumerable, Initializable { } } + function getAllMembers() public view returns(address[] memory admins,address[] memory managers,address[] memory cons ){ + admins = getMembersByRole(DEFAULT_ADMIN_ROLE); + managers = getMembersByRole(MANAGER); + cons = getMembersByRole(CONTRIBUTOR); + } + function addManager(address member) public { grantRole(MANAGER, member); } @@ -120,8 +126,11 @@ contract Hubv3 is AccessControlEnumerable, Initializable { // ===== repository operator functions====== - function repoList() public view returns(bytes[] memory rn){ - return repoNames; + function repoList() public view returns(string[] memory rn){ + rn = new string[](repoNames.length); + for (uint i = 0; i