@@ -775,7 +775,15 @@ contract SubgraphService is
775775 })
776776 );
777777
778- _releaseAndLockStake (indexer, tokensCollected);
778+ _releaseStake (indexer, 0 );
779+ if (tokensCollected > 0 ) {
780+ // lock stake as economic security for fees
781+ _lockStake (
782+ indexer,
783+ tokensCollected * stakeToFeesRatio,
784+ block .timestamp + _disputeManager ().getDisputePeriod ()
785+ );
786+ }
779787
780788 return tokensCollected;
781789 }
@@ -790,25 +798,6 @@ contract SubgraphService is
790798 emit StakeToFeesRatioSet (_stakeToFeesRatio);
791799 }
792800
793- /**
794- * @notice Release stake claims and lock new stake as economic security for fees
795- * @dev This function releases all expired stake claims and locks new stake as economic security for fees.
796- * It is called after collecting query fees or indexing fees.
797- * @param _indexer The address of the indexer
798- * @param _tokensCollected The amount of tokens collected from fees
799- */
800- function _releaseAndLockStake (address _indexer , uint256 _tokensCollected ) private {
801- _releaseStake (_indexer, 0 );
802- if (_tokensCollected > 0 ) {
803- // lock stake as economic security for fees
804- _lockStake (
805- _indexer,
806- _tokensCollected * stakeToFeesRatio,
807- block .timestamp + _disputeManager ().getDisputePeriod ()
808- );
809- }
810- }
811-
812801 /**
813802 * @notice Encodes the data for the GraphTallyCollector
814803 * @dev The purpose of this function is just to avoid stack too deep errors
0 commit comments