diff --git a/contracts/v2/paranets/Paranet.sol b/contracts/v2/paranets/Paranet.sol index 6907879e..80d7aaef 100644 --- a/contracts/v2/paranets/Paranet.sol +++ b/contracts/v2/paranets/Paranet.sol @@ -264,7 +264,7 @@ contract Paranet is Named, Versioned, ContractStatusV2, Initializable { revert ParanetErrors.ParanetCuratedNodeHasAlreadyBeenAdded(paranetId, identityIds[i]); } - pr.addCuratedNode(paranetId, identityIds[i]); + pr.addCuratedNode(paranetId, identityIds[i], ps.getNodeId(identityIds[i])); emit ParanetCuratedNodeAdded(paranetKAStorageContract, paranetKATokenId, identityIds[i]); @@ -410,7 +410,7 @@ contract Paranet is Named, Versioned, ContractStatusV2, Initializable { paranetNodeJoinRequests.length - 1, ParanetStructs.RequestStatus.APPROVED ); - pr.addCuratedNode(paranetId, identityId); + pr.addCuratedNode(paranetId, identityId, profileStorage.getNodeId(identityId)); emit ParanetCuratedNodeJoinRequestAccepted(paranetKAStorageContract, paranetKATokenId, identityId); emit ParanetCuratedNodeAdded(paranetKAStorageContract, paranetKATokenId, identityId); diff --git a/contracts/v2/storage/paranets/ParanetsRegistry.sol b/contracts/v2/storage/paranets/ParanetsRegistry.sol index 522cc7b3..ef044d3f 100644 --- a/contracts/v2/storage/paranets/ParanetsRegistry.sol +++ b/contracts/v2/storage/paranets/ParanetsRegistry.sol @@ -193,23 +193,23 @@ contract ParanetsRegistry is Named, Versioned, HubDependentV2 { return paranets[paranetId].paranetNodeJoinRequests[identityId].length; } - function addCuratedNode(bytes32 paranetId, uint72 identityId) external onlyContracts { + function addCuratedNode(bytes32 paranetId, uint72 identityId, bytes calldata nodeId) external onlyContracts { paranets[paranetId].curatedNodesIndexes[identityId] = paranets[paranetId].curatedNodes.length; - paranets[paranetId].curatedNodes.push(identityId); + paranets[paranetId].curatedNodes.push(ParanetStructs.Node({identityId: identityId, nodeId: nodeId})); } function removeCuratedNode(bytes32 paranetId, uint72 identityId) external onlyContracts { paranets[paranetId].curatedNodes[paranets[paranetId].curatedNodesIndexes[identityId]] = paranets[paranetId] .curatedNodes[paranets[paranetId].curatedNodes.length - 1]; paranets[paranetId].curatedNodesIndexes[ - paranets[paranetId].curatedNodes[paranets[paranetId].curatedNodes.length - 1] + paranets[paranetId].curatedNodes[paranets[paranetId].curatedNodes.length - 1].identityId ] = paranets[paranetId].curatedNodesIndexes[identityId]; delete paranets[paranetId].curatedNodesIndexes[identityId]; paranets[paranetId].curatedNodes.pop(); } - function getCuratedNodes(bytes32 paranetId) external view returns (uint72[] memory) { + function getCuratedNodes(bytes32 paranetId) external view returns (ParanetStructs.Node[] memory) { return paranets[paranetId].curatedNodes; } @@ -219,7 +219,8 @@ contract ParanetsRegistry is Named, Versioned, HubDependentV2 { function isCuratedNode(bytes32 paranetId, uint72 identityId) external view returns (bool) { return (paranets[paranetId].curatedNodes.length != 0 && - paranets[paranetId].curatedNodes[paranets[paranetId].curatedNodesIndexes[identityId]] == identityId); + paranets[paranetId].curatedNodes[paranets[paranetId].curatedNodesIndexes[identityId]].identityId == + identityId); } function getIncentivesPoolAddress( diff --git a/contracts/v2/structs/paranets/ParanetStructs.sol b/contracts/v2/structs/paranets/ParanetStructs.sol index c1f8a550..21d500c5 100644 --- a/contracts/v2/structs/paranets/ParanetStructs.sol +++ b/contracts/v2/structs/paranets/ParanetStructs.sol @@ -24,6 +24,11 @@ library ParanetStructs { OPEN } + struct Node { + uint72 identityId; + bytes nodeId; + } + enum RequestStatus { NONE, PENDING, @@ -55,7 +60,7 @@ library ParanetStructs { KnowledgeAssetsAccessPolicy knowledgeAssetsAccessPolicy; uint96 cumulativeKnowledgeValue; UnorderedNamedContractDynamicSetStructs.Set incentivesPools; - uint72[] curatedNodes; + Node[] curatedNodes; // Identity ID => Index in the array mapping(uint72 => uint256) curatedNodesIndexes; // Identity ID => Requests Array