This can be refactored to improve precision and gas usage:
_mint(publisher, fee (BASE - factory.ownerSplit()) / BASE);
_mint(Ownable(address(factory)).owner(), fee factory.ownerSplit() / BASE);
Recommended Mitigation Steps
Proposed solution:
uint256 factoryOwnerFee = fee * factory.ownerSplit() / BASE;
uint256 publisherFee = fee - factoryOwnerFee;
_mint(Ownable(address(factory)).owner(), factoryOwnerFee);
_mint(publisher, publisherFee);
This will result in fewer math operations and better precision cuz multiplication and division are replaced with subtraction.
Handle
pauliax
Vulnerability details
Impact
This can be refactored to improve precision and gas usage: _mint(publisher, fee (BASE - factory.ownerSplit()) / BASE); _mint(Ownable(address(factory)).owner(), fee factory.ownerSplit() / BASE);
Recommended Mitigation Steps
Proposed solution: uint256 factoryOwnerFee = fee * factory.ownerSplit() / BASE; uint256 publisherFee = fee - factoryOwnerFee; _mint(Ownable(address(factory)).owner(), factoryOwnerFee); _mint(publisher, publisherFee); This will result in fewer math operations and better precision cuz multiplication and division are replaced with subtraction.