Closed code423n4 closed 2 years ago
WatchPug
https://github.com/code-423n4/2021-09-defiProtocol/blob/main/contracts/contracts/Basket.sol#L120-L121
Every call to an external contract costs a decent amount of gas. For optimization of gas usage, external call results should be cached if they are being used for more than one time.
For example:
_mint(publisher, fee * (BASE - factory.ownerSplit()) / BASE); _mint(Ownable(address(factory)).owner(), fee * factory.ownerSplit() / BASE);
Can be changed to:
uint256 ownerSplit = factory.ownerSplit(); _mint(publisher, fee * (BASE - ownerSplit) / BASE); _mint(Ownable(address(factory)).owner(), fee * ownerSplit / BASE);
Duplicate of #43
Handle
WatchPug
Vulnerability details
https://github.com/code-423n4/2021-09-defiProtocol/blob/main/contracts/contracts/Basket.sol#L120-L121
Every call to an external contract costs a decent amount of gas. For optimization of gas usage, external call results should be cached if they are being used for more than one time.
For example:
Can be changed to: