code-423n4 / 2021-10-defiprotocol-findings

0 stars 0 forks source link

`Factory.sol#constructor` Remove redundant code can save gas #66

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

WatchPug

Vulnerability details

As per the Solidity documenation:

Before the constructor code is executed, state variables are initialised to their specified value if you initialise them inline, or their default value if you do not.

Setting ownerSplit to 0 in the constructor is redundant.

Removing ownerSplit = 0; can make the code simpler and save some gas.

https://github.com/code-423n4/2021-10-defiprotocol/blob/7ca848f2779e2e64ed0b4756c02f0137ecd73e50/contracts/contracts/Factory.sol#L18-L22

constructor (IAuction _auctionImpl, IBasket _basketImpl) {
        auctionImpl = _auctionImpl;
        basketImpl = _basketImpl;
        ownerSplit = 0; //TODO: needed?
    }

Recommendation

Remove the redundant code.

GalloDaSballo commented 2 years ago

Duplicate of #70