Omniscia Nevermined Audit

AccessCondition Code Style Findings

AccessCondition Code Style Findings

ACN-01C: Usage of Proper APIs

TypeSeverityLocation
Code StyleInformationalAccessCondition.sol:L58, L207

Description:

The DIDRegistry contract exposes the isDIDOwner function which should be favored over a manual retrieval of the DID owner and equality validation.

Example:

contracts/conditions/AccessCondition.sol
48modifier onlyDIDOwnerOrProvider(
49 bytes32 _documentId
50)
51{
52 DIDRegistry didRegistry = DIDRegistry(
53 agreementStoreManager.getDIDRegistryAddress()
54 );
55
56 require(
57 didRegistry.isDIDProvider(_documentId, msg.sender) ||
58 msg.sender == didRegistry.getDIDOwner(_documentId),
59 'Invalid DID owner/provider'
60 );
61 _;
62}

Recommendation:

We advise the linked conditionals to be replaced by the specified invocation.

Alleviation:

The check was correctly replaced by a isDIDOwner invocation.