Skip to content

Commit 4c9ae69

Browse files
f: more NatSpec
1 parent b3a461a commit 4c9ae69

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

packages/subgraph-service/contracts/libraries/IndexingAgreement.sol

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,13 +525,25 @@ library IndexingAgreement {
525525
return wrapper;
526526
}
527527

528+
/**
529+
* @notice Get the storage manager for indexing agreements.
530+
* @dev This function retrieves the storage manager for indexing agreements.
531+
* @return $ The storage manager for indexing agreements
532+
*/
528533
function _getStorageManager() internal pure returns (StorageManager storage $) {
529534
// solhint-disable-next-line no-inline-assembly
530535
assembly {
531536
$.slot := INDEXING_AGREEMENT_STORAGE_MANAGER_LOCATION
532537
}
533538
}
534539

540+
/**
541+
* @notice Set the terms for an indexing agreement of version V1.
542+
* @dev This function updates the terms of an indexing agreement in the storage manager.
543+
* @param _manager The indexing agreement storage manager
544+
* @param _agreementId The id of the agreement to update
545+
* @param _data The encoded terms data
546+
*/
535547
function _setTermsV1(StorageManager storage _manager, bytes16 _agreementId, bytes memory _data) private {
536548
IndexingAgreementTermsV1 memory newTerms = Decoder.decodeIndexingAgreementTermsV1(_data);
537549
_manager.termsV1[_agreementId].tokensPerSecond = newTerms.tokensPerSecond;
@@ -572,6 +584,17 @@ library IndexingAgreement {
572584
_directory().recurringCollector().cancel(_agreementId, _cancelBy);
573585
}
574586

587+
/**
588+
* @notice Calculate the number of tokens to collect for an indexing agreement.
589+
*
590+
* @dev This function calculates the number of tokens to collect based on the agreement terms and the collection time.
591+
*
592+
* @param _manager The indexing agreement storage manager
593+
* @param _agreementId The id of the agreement
594+
* @param _agreement The collector agreement data
595+
* @param _entities The number of entities indexed
596+
* @return The number of tokens to collect
597+
*/
575598
function _tokensToCollect(
576599
StorageManager storage _manager,
577600
bytes16 _agreementId,
@@ -600,18 +623,37 @@ library IndexingAgreement {
600623
wrapper.agreement.allocationId != address(0);
601624
}
602625

626+
/**
627+
* @notice Gets the Directory
628+
* @return The Directory contract
629+
*/
603630
function _directory() private view returns (Directory) {
604631
return Directory(address(this));
605632
}
606633

634+
/**
635+
* @notice Gets the Graph Directory
636+
* @return The Graph Directory contract
637+
*/
607638
function _graphDirectory() private view returns (GraphDirectory) {
608639
return GraphDirectory(address(this));
609640
}
610641

642+
/**
643+
* @notice Gets the Subgraph Service
644+
* @return The Subgraph Service contract
645+
*/
611646
function _subgraphService() private view returns (SubgraphService) {
612647
return SubgraphService(address(this));
613648
}
614649

650+
/**
651+
* @notice Gets the indexing agreement wrapper for a given agreement ID.
652+
* @dev This function retrieves the indexing agreement wrapper containing the agreement state and collector agreement data.
653+
* @param self The indexing agreement storage manager
654+
* @param agreementId The id of the indexing agreement
655+
* @return The indexing agreement wrapper containing the agreement state and collector agreement data
656+
*/
615657
function _get(StorageManager storage self, bytes16 agreementId) private view returns (AgreementWrapper memory) {
616658
return
617659
AgreementWrapper({

0 commit comments

Comments
 (0)