feat: Initial basic implementation of current collect tracking events in limited collect modules.

This commit is contained in:
Peter Michael
2022-04-07 15:27:26 -04:00
parent a20d294986
commit e6caa36cfb
3 changed files with 27 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ pragma solidity 0.8.10;
import {ICollectModule} from '../../../interfaces/ICollectModule.sol';
import {Errors} from '../../../libraries/Errors.sol';
import {Events} from '../../../libraries/Events.sol';
import {FeeModuleBase} from '../FeeModuleBase.sol';
import {ModuleBase} from '../ModuleBase.sol';
import {FollowValidationModuleBase} from '../FollowValidationModuleBase.sol';
@@ -116,12 +117,17 @@ contract LimitedFeeCollectModule is FeeModuleBase, FollowValidationModuleBase, I
) {
revert Errors.MintLimitExceeded();
} else {
++_dataByPublicationByProfile[profileId][pubId].currentCollects;
if (referrerProfileId == profileId) {
_processCollect(collector, profileId, pubId, data);
} else {
_processCollectWithReferral(referrerProfileId, collector, profileId, pubId, data);
}
// We can increment the currentCollects here since there are no external calls in the above processing functions
emit Events.LimitedPubCollected(
profileId,
pubId,
++_dataByPublicationByProfile[profileId][pubId].currentCollects
);
}
}

View File

@@ -4,6 +4,7 @@ pragma solidity 0.8.10;
import {ICollectModule} from '../../../interfaces/ICollectModule.sol';
import {Errors} from '../../../libraries/Errors.sol';
import {Events} from '../../../libraries/Events.sol';
import {FeeModuleBase} from '../FeeModuleBase.sol';
import {ModuleBase} from '../ModuleBase.sol';
import {FollowValidationModuleBase} from '../FollowValidationModuleBase.sol';
@@ -139,12 +140,17 @@ contract LimitedTimedFeeCollectModule is FeeModuleBase, FollowValidationModuleBa
) {
revert Errors.MintLimitExceeded();
} else {
++_dataByPublicationByProfile[profileId][pubId].currentCollects;
if (referrerProfileId == profileId) {
_processCollect(collector, profileId, pubId, data);
} else {
_processCollectWithReferral(referrerProfileId, collector, profileId, pubId, data);
}
// We can increment the currentCollects here since there are no external calls in the above processing functions
emit Events.LimitedPubCollected(
profileId,
pubId,
++_dataByPublicationByProfile[profileId][pubId].currentCollects
);
}
}

View File

@@ -476,6 +476,19 @@ library Events {
uint256 timestamp
);
/**
* @notice Emitted when a collect is successfully processed in a limited collect module.
*
* @param profileId The profile ID of the collected publication.
* @param pubId The publication ID of the collected publication.
* @param remainingCollects The remaining collects for the collected publication.
*/
event LimitedPubCollected(
uint256 indexed profileId,
uint256 indexed pubId,
uint256 remainingCollects
);
/**
* @dev Emitted when the user wants to enable or disable follows in the `LensPeripheryDataProvider`.
*