Skip to content

Commit

Permalink
Merge pull request #340 from OriginTrail/remove-remove-increaseKnowle…
Browse files Browse the repository at this point in the history
…dgeCollectionTokenAmount

Remove remove increase knowledge collection token amount
  • Loading branch information
Mihajlo-Pavlovic authored Feb 26, 2025
2 parents 3d079dd + bf82b47 commit 1044949
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 65 deletions.
28 changes: 0 additions & 28 deletions abi/KnowledgeCollection.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,6 @@
"name": "ZeroAddressHub",
"type": "error"
},
{
"inputs": [],
"name": "ZeroTokenAmount",
"type": "error"
},
{
"inputs": [],
"name": "askStorage",
Expand Down Expand Up @@ -371,29 +366,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"internalType": "uint96",
"name": "tokenAmount",
"type": "uint96"
},
{
"internalType": "address",
"name": "paymaster",
"type": "address"
}
],
"name": "increaseKnowledgeCollectionTokenAmount",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "initialize",
Expand Down
37 changes: 0 additions & 37 deletions contracts/KnowledgeCollection.sol
Original file line number Diff line number Diff line change
Expand Up @@ -242,43 +242,6 @@ contract KnowledgeCollection is INamed, IVersioned, ContractStatus, IInitializab
}
}

function increaseKnowledgeCollectionTokenAmount(uint256 id, uint96 tokenAmount, address paymaster) external {
if (tokenAmount == 0) {
revert TokenLib.ZeroTokenAmount();
}

KnowledgeCollectionStorage kcs = knowledgeCollectionStorage;

(, , , , , uint40 endEpoch, uint96 oldTokenAmount, ) = kcs.getKnowledgeCollectionMetadata(id);

uint256 currentEpoch = chronos.getCurrentEpoch();
if (currentEpoch > endEpoch) {
revert KnowledgeCollectionLib.KnowledgeCollectionExpired(id, currentEpoch, endEpoch);
}

kcs.setTokenAmount(id, oldTokenAmount + tokenAmount);

epochStorage.addTokensToEpochRange(1, currentEpoch, endEpoch, tokenAmount);

_addTokens(tokenAmount, paymaster);

ParanetKnowledgeCollectionsRegistry pkar = paranetKnowledgeCollectionsRegistry;

bytes32 knowledgeCollectionId = pkar.getParanetId(keccak256(abi.encodePacked(address(kcs), id)));
if (pkar.isParanetKnowledgeCollection(knowledgeCollectionId)) {
ParanetKnowledgeMinersRegistry pkmr = paranetKnowledgeMinersRegistry;
bytes32 paranetId = paranetKnowledgeCollectionsRegistry.getParanetId(knowledgeCollectionId);

// Add Knowledge Asset Token Amount Metadata to the ParanetsRegistry
paranetsRegistry.addCumulativeKnowledgeValue(paranetId, tokenAmount);

// Add Knowledge Asset Token Amount Metadata to the KnowledgeMinersRegistry
pkmr.addCumulativeTracSpent(msg.sender, paranetId, tokenAmount);
pkmr.addUnrewardedTracSpent(msg.sender, paranetId, tokenAmount);
pkmr.addTotalTracSpent(msg.sender, tokenAmount);
}
}

function _verifySignatures(
uint72[] calldata identityIds,
bytes32 messageHash,
Expand Down

0 comments on commit 1044949

Please sign in to comment.