@@ -525,13 +525,25 @@ library IndexingAgreement {
525
525
return wrapper;
526
526
}
527
527
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
+ */
528
533
function _getStorageManager () internal pure returns (StorageManager storage $) {
529
534
// solhint-disable-next-line no-inline-assembly
530
535
assembly {
531
536
$.slot := INDEXING_AGREEMENT_STORAGE_MANAGER_LOCATION
532
537
}
533
538
}
534
539
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
+ */
535
547
function _setTermsV1 (StorageManager storage _manager , bytes16 _agreementId , bytes memory _data ) private {
536
548
IndexingAgreementTermsV1 memory newTerms = Decoder.decodeIndexingAgreementTermsV1 (_data);
537
549
_manager.termsV1[_agreementId].tokensPerSecond = newTerms.tokensPerSecond;
@@ -572,6 +584,17 @@ library IndexingAgreement {
572
584
_directory ().recurringCollector ().cancel (_agreementId, _cancelBy);
573
585
}
574
586
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
+ */
575
598
function _tokensToCollect (
576
599
StorageManager storage _manager ,
577
600
bytes16 _agreementId ,
@@ -600,18 +623,37 @@ library IndexingAgreement {
600
623
wrapper.agreement.allocationId != address (0 );
601
624
}
602
625
626
+ /**
627
+ * @notice Gets the Directory
628
+ * @return The Directory contract
629
+ */
603
630
function _directory () private view returns (Directory) {
604
631
return Directory (address (this ));
605
632
}
606
633
634
+ /**
635
+ * @notice Gets the Graph Directory
636
+ * @return The Graph Directory contract
637
+ */
607
638
function _graphDirectory () private view returns (GraphDirectory) {
608
639
return GraphDirectory (address (this ));
609
640
}
610
641
642
+ /**
643
+ * @notice Gets the Subgraph Service
644
+ * @return The Subgraph Service contract
645
+ */
611
646
function _subgraphService () private view returns (SubgraphService) {
612
647
return SubgraphService (address (this ));
613
648
}
614
649
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
+ */
615
657
function _get (StorageManager storage self , bytes16 agreementId ) private view returns (AgreementWrapper memory ) {
616
658
return
617
659
AgreementWrapper ({
0 commit comments