Omniscia Nexera Audit

OwnablePausableTransfersUpgradableHelper Code Style Findings

OwnablePausableTransfersUpgradableHelper Code Style Findings

OPT-01C: Improper Contract Type

Description:

The OwnablePausableTransfersUpgradableHelper contract is meant to be an abstract utility contract yet is not declared as such.

Example:

contracts/utils/OwnablePausableTransfersUpgradableHelper.sol
8contract OwnablePausableTransfersUpgradableHelper is OwnableUpgradeable, PausableUpgradeable {

Recommendation:

We advise it to be set as abstract given that it cannot be deployed independently and lacks the necessary security traits (i.e. disable of initializers) to do so.

Alleviation:

The contract has been made abstract, addressing this exhibit.

OPT-02C: Inefficient Restriction Argument

Description:

The OwnablePausableTransfersUpgradableHelper::onlyNotPausedOmnichainTransfers modifier is meant to prevent omni-chain transfers if the system is in a paused state, however, it is not able to validate that the OmnichainAddress recipient is the owner to permit transfers to occur in such a case.

Example:

contracts/utils/OwnablePausableTransfersUpgradableHelper.sol
14modifier onlyNotPausedOmnichainTransfers(OmnichainAddress to) {
15 _verifyTransferNotPaused(to);
16 _;
17}
18
19/**
20 * Pausing contract preventing Fractions transfers except initiated by owner or targeted to owner
21 */
22function pause() external onlyOwner {
23 _pause();
24}
25
26/**
27 * Pausing contract preventing Fractions transfers except initiated by owner or targeted to owner
28 */
29function unpause() external onlyOwner {
30 _unpause();
31}
32
33/**
34 * Verifies transfers are not paused or msg.sender / receiver is owner.
35 * Reverts otherwise.
36 * @param to receiver of the transfer
37 */
38function _verifyTransferNotPaused(address to) internal view {
39 address owner_ = owner();
40 if (paused() && (_msgSender() != owner_) && (to != owner_)) {
41 revert EnforcedPause();
42 }
43}
44
45/**
46 * Verifies transfers are not paused or msg.sender / receiver is owner.
47 * Reverts otherwise.
48 * param to receiver of the transfer
49 */
50function _verifyTransferNotPaused(OmnichainAddress) internal view {
51 address owner_ = owner();
52 if (paused() && (_msgSender() != owner_)) {
53 revert EnforcedPause();
54 }
55}

Recommendation:

We advise the OmnichainAddress argument to be omitted entirely, optimizing the overall modifier function flow.

Alleviation:

The unused function argument has been removed across the modifier and function invocations referenced, optimizing the code's gas cost significantly.

OPT-03C: Redundant Parenthesis Statements

TypeSeverityLocation
Code StyleOwnablePausableTransfersUpgradableHelper.sol:
I-1: L40
I-2: L52

Description:

The referenced statements are redundantly wrapped in parenthesis' (()).

Example:

contracts/utils/OwnablePausableTransfersUpgradableHelper.sol
40if (paused() && (_msgSender() != owner_) && (to != owner_)) {

Recommendation:

We advise them to be safely omitted, increasing the legibility of the codebase.

Alleviation:

The redundant parenthesis in the referenced statements have been safely omitted.