Omniscia Morpho Audit

Token Code Style Findings

Token Code Style Findings

TOK-01C: Sub-Optimal Self-Reference

TypeSeverityLocation
Gas OptimizationToken.sol:L19

Description:

The Token function will set the authority for validating calls as itself in the RolesAuthority contract. This is highly inefficient as the contract will now perform an external call to itself redundantly.

Example:

src/Token.sol
19) ERC20(_name, _symbol, _decimals) RolesAuthority(_owner, Authority(this)) {}

Recommendation:

We advise the codebase to be adjusted to rely on itself for validating calls as this is the desired business use case and the most optimal one.

Alleviation:

The Morpho team heeded our recommendation and revamped the original Solmate codebase to instead no longer require a reference to self for performing authorization validation calls, significantly optimizing the gas cost of the contract.