fix: add profile owner check - now all tests passing

This commit is contained in:
vicnaum
2023-01-11 19:06:39 +01:00
parent 1d5683e593
commit c898f9d5e1
2 changed files with 14 additions and 0 deletions

View File

@@ -196,6 +196,15 @@ library GeneralHelpers {
}
}
function validateAddressIsOwnerOrDelegatedExecutor(
address transactionExecutor,
address profileOwner
) internal view {
if (transactionExecutor != profileOwner) {
validateDelegatedExecutor(profileOwner, transactionExecutor);
}
}
function validateDelegatedExecutor(address onBehalfOf, address executor) internal view {
if (!isExecutorApproved(onBehalfOf, executor)) {
revert Errors.ExecutorInvalid();

View File

@@ -184,6 +184,11 @@ library InteractionHelpers {
address collectorProfileOwnerCached = collectorProfileOwner;
address transactionExecutorCached = transactionExecutor;
GeneralHelpers.validateAddressIsOwnerOrDelegatedExecutor({
transactionExecutor: transactionExecutor,
profileOwner: collectorProfileOwner
});
(uint256 rootProfileId, uint256 rootPubId, address rootCollectModule) = GeneralHelpers
.getPointedIfMirrorWithCollectModule(publisherProfileIdCached, pubIdCached);