Omniscia Sovryn Audit
SideTokenFactory Code Style Findings
SideTokenFactory Code Style Findings
STF-01C: State Access Optimization
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | Informational | SideTokenFactory.sol:L10 |
Description:
The createSideToken function invokes the onlyPrimary modifier guaranteeing that msg.sender will be equivalent to primary().
Example:
sovryn-token-bridge/bridge/contracts/SideTokenFactory.sol
9function createSideToken(string calldata name, string calldata symbol, uint256 granularity) external onlyPrimary returns(address) {10 address sideToken = address(new SideToken(name, symbol, primary(), granularity));11 emit SideTokenCreated(sideToken, symbol, granularity);12 return sideToken;13}Recommendation:
We advise the primary() state read to be replaced by msg.sender greatly optimizing the gas cost of the function.
Alleviation:
The development team has acknowledged this exhibit but decided to not apply its remediation in the current version of the codebase.