feat: BatchMetadataUpdate added to trigger collection token URI refresh

This commit is contained in:
donosonaumczuk
2023-11-24 14:44:02 -03:00
parent 7a716a8d71
commit caea690fc5
4 changed files with 19 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import {GovernanceLib} from 'contracts/libraries/GovernanceLib.sol';
import {ValidationLib} from 'contracts/libraries/ValidationLib.sol';
import {StorageLib} from 'contracts/libraries/StorageLib.sol';
import {Types} from 'contracts/libraries/constants/Types.sol';
import {Events} from 'contracts/libraries/constants/Events.sol';
abstract contract LensGovernable is ILensGovernable {
/**
@@ -54,6 +55,7 @@ abstract contract LensGovernable is ILensGovernable {
function setProfileTokenURIContract(address profileTokenURIContract) external override onlyGov {
GovernanceLib.setProfileTokenURIContract(profileTokenURIContract);
emit Events.BatchMetadataUpdate({fromTokenId: 0, toTokenId: type(uint256).max});
}
function setFollowTokenURIContract(address followTokenURIContract) external override onlyGov {

View File

@@ -398,4 +398,12 @@ library Events {
* @param timestamp The UNIX timestamp of the nonce being used.
*/
event NonceUpdated(address indexed signer, uint256 nonce, uint256 timestamp);
/**
* @dev Emitted when a collection's token URI is updated.
* @param fromTokenId The ID of the smallest token that requires its token URI to be refreshed.
* @param toTokenId The ID of the biggest token that requires its token URI to be refreshed. Max uint256 to refresh
* all of them.
*/
event BatchMetadataUpdate(uint256 fromTokenId, uint256 toTokenId);
}

View File

@@ -89,6 +89,7 @@ contract LensHandles is ERC721, ERC2981CollectionRoyalties, ImmutableOwnable, IL
function setHandleTokenURIContract(address handleTokenURIContract) external override onlyOwner {
_handleTokenURIContract = handleTokenURIContract;
emit HandlesEvents.BatchMetadataUpdate({fromTokenId: 0, toTokenId: type(uint256).max});
}
function getHandleTokenURIContract() external view override returns (address) {

View File

@@ -22,6 +22,14 @@ library HandlesEvents {
uint256 tokenGuardianDisablingTimestamp,
uint256 timestamp
);
/**
* @dev Emitted when a collection's token URI is updated.
* @param fromTokenId The ID of the smallest token that requires its token URI to be refreshed.
* @param toTokenId The ID of the biggest token that requires its token URI to be refreshed. Max uint256 to refresh
* all of them.
*/
event BatchMetadataUpdate(uint256 fromTokenId, uint256 toTokenId);
}
library RegistryEvents {