mirror of
https://github.com/lens-protocol/core.git
synced 2026-04-22 03:02:03 -04:00
feat: Initial basic implementation of current collect tracking events in limited collect modules.
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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`.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user