Merge pull request #126 from lens-protocol/feat/mirror-metadata-uri

feat: Metadata URI added to Mirror Publications
This commit is contained in:
Alan
2023-09-11 17:50:20 +01:00
committed by GitHub
6 changed files with 10 additions and 1 deletions

View File

@@ -196,6 +196,7 @@ library MetaTxLib {
abi.encode(
Typehash.MIRROR,
mirrorParams.profileId,
_encodeUsingEip712Rules(mirrorParams.metadataURI),
mirrorParams.pointedProfileId,
mirrorParams.pointedPubId,
_encodeUsingEip712Rules(mirrorParams.referrerProfileIds),

View File

@@ -128,6 +128,7 @@ library PublicationLib {
Types.Publication storage _publication = StorageLib.getPublication(mirrorParams.profileId, pubIdAssigned);
_publication.pointedProfileId = mirrorParams.pointedProfileId;
_publication.pointedPubId = mirrorParams.pointedPubId;
_publication.contentURI = mirrorParams.metadataURI;
_publication.pubType = Types.PublicationType.Mirror;
_fillRootOfPublicationInStorage(_publication, mirrorParams.pointedProfileId, mirrorParams.pointedPubId);

View File

@@ -16,7 +16,7 @@ library Typehash {
bytes32 constant FOLLOW = keccak256('Follow(uint256 followerProfileId,uint256[] idsOfProfilesToFollow,uint256[] followTokenIds,bytes[] datas,uint256 nonce,uint256 deadline)');
bytes32 constant MIRROR = keccak256('Mirror(uint256 profileId,uint256 pointedProfileId,uint256 pointedPubId,uint256[] referrerProfileIds,uint256[] referrerPubIds,bytes referenceModuleData,uint256 nonce,uint256 deadline)');
bytes32 constant MIRROR = keccak256('Mirror(uint256 profileId,string metadataURI,uint256 pointedProfileId,uint256 pointedPubId,uint256[] referrerProfileIds,uint256[] referrerPubIds,bytes referenceModuleData,uint256 nonce,uint256 deadline)');
bytes32 constant POST = keccak256('Post(uint256 profileId,string contentURI,address[] actionModules,bytes[] actionModulesInitDatas,address referenceModule,bytes referenceModuleInitData,uint256 nonce,uint256 deadline)');

View File

@@ -283,12 +283,14 @@ library Types {
* @notice A struct containing the parameters required for the `mirror()` function.
*
* @param profileId The token ID of the profile to publish to.
* @param metadataURI the URI containing metadata attributes to attach to this mirror publication.
* @param pointedProfileId The profile token ID to point the mirror to.
* @param pointedPubId The publication ID to point the mirror to.
* @param referenceModuleData The data passed to the reference module.
*/
struct MirrorParams {
uint256 profileId;
string metadataURI;
uint256 pointedProfileId;
uint256 pointedPubId;
uint256[] referrerProfileIds;

View File

@@ -549,6 +549,7 @@ contract TestSetup is Test, ContractAddressesLoaderDeployer, ArrayHelpers {
return
Types.MirrorParams({
profileId: defaultAccount.profileId,
metadataURI: '',
pointedProfileId: defaultPub.profileId,
pointedPubId: defaultPub.pubId,
referrerProfileIds: _emptyUint256Array(),

View File

@@ -515,6 +515,7 @@ contract UpgradeForkTest is BaseTest {
mirror5 = hub.mirror(
Types.MirrorParams({
profileId: profileThree.profileId,
metadataURI: '',
pointedProfileId: profileThree.profileId,
pointedPubId: post3,
referrerProfileIds: _emptyUint256Array(),
@@ -577,6 +578,7 @@ contract UpgradeForkTest is BaseTest {
mirror6 = hub.mirror(
Types.MirrorParams({
profileId: profileFour.profileId,
metadataURI: '',
pointedProfileId: profileFour.profileId,
pointedPubId: post4,
referrerProfileIds: _emptyUint256Array(),
@@ -627,6 +629,7 @@ contract UpgradeForkTest is BaseTest {
mirror7 = hub.mirror(
Types.MirrorParams({
profileId: profileThree.profileId,
metadataURI: '',
pointedProfileId: profileFour.profileId,
pointedPubId: quote2,
referrerProfileIds: _emptyUint256Array(),
@@ -673,6 +676,7 @@ contract UpgradeForkTest is BaseTest {
mirror8 = hub.mirror(
Types.MirrorParams({
profileId: profileThree.profileId,
metadataURI: '',
pointedProfileId: profileOne.profileId,
pointedPubId: post1,
referrerProfileIds: _emptyUint256Array(),