Skip to content

Commit

Permalink
Added IncentivesPool deployment during Paranet registration
Browse files Browse the repository at this point in the history
  • Loading branch information
br-41n committed Apr 4, 2024
1 parent 52fc3bb commit d1e2a17
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion contracts/v1/paranets/Paranet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.8.16;

import {ContentAsset} from "../assets/ContentAsset.sol";
import {ParanetsRegistry} from "../storage/paranets/ParanetsRegistry.sol";
import {ParanetIncentivesPool} from "./ParanetIncentivesPool.sol";
import {ContractStatus} from "../abstract/ContractStatus.sol";
import {Initializable} from "../interface/Initializable.sol";
import {Named} from "../interface/Named.sol";
Expand Down Expand Up @@ -56,13 +57,16 @@ contract Paranet is Named, Versioned, ContractStatus, Initializable {
revert ParanetErrors.ParanetHasAlreadyBeenRegistered(knowledgeAssetStorageContract, tokenId);
}

ParanetIncentivesPool incentivesPool = new ParanetIncentivesPool(address(hub));

pr.register(
knowledgeAssetStorageContract,
tokenId,
ParanetStructs.AccessPolicy.OPEN,
ParanetStructs.AccessPolicy.OPEN,
paranetName,
paranetDescription
paranetDescription,
address(incentivesPool)
);
}

Expand Down
12 changes: 11 additions & 1 deletion contracts/v1/storage/paranets/ParanetsRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ contract ParanetsRegistry is Named, Versioned, HubDependent {
ParanetStructs.AccessPolicy minersAccessPolicy,
ParanetStructs.AccessPolicy knowledgeAssetsInclusionPolicy,
string calldata paranetName,
string calldata paranetDescription
string calldata paranetDescription,
address incentivesPool
) external onlyContracts returns (bytes32) {
bytes32 paranetId = keccak256(abi.encodePacked(knowledgeAssetStorageContract, tokenId));

Expand All @@ -44,6 +45,7 @@ contract ParanetsRegistry is Named, Versioned, HubDependent {
paranet.knowledgeAssetsInclusionPolicy = knowledgeAssetsInclusionPolicy;
paranet.name = paranetName;
paranet.description = paranetDescription;
paranet.incentivesPool = incentivesPool;

return paranetId;
}
Expand Down Expand Up @@ -135,6 +137,14 @@ contract ParanetsRegistry is Named, Versioned, HubDependent {
paranets[paranetId].description = description;
}

function getIncentivesPool(bytes32 paranetId) external view returns (address) {
return paranets[paranetId].incentivesPool;
}

function setIncentivesPool(bytes32 paranetId, address incentivesPool) external onlyContracts {
paranets[paranetId].incentivesPool = incentivesPool;
}

function getCumulativeKnowledgeValue(bytes32 paranetId) external view returns (uint256) {
return paranets[paranetId].cumulativeKnowledgeValue;
}
Expand Down
1 change: 1 addition & 0 deletions contracts/v1/structs/paranets/ParanetStructs.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ library ParanetStructs {
AccessPolicy knowledgeAssetsInclusionPolicy;
string name;
string description;
address incentivesPool;
uint256 cumulativeKnowledgeValue;
bytes32[] services;
// Service ID => Index in the array
Expand Down

0 comments on commit d1e2a17

Please sign in to comment.