Omniscia Beanstalk Audit

Weather Code Style Findings

Weather Code Style Findings

WEA-01C: Deprecated Representation Style

TypeSeverityLocation
Code StyleWeather.sol:L25

Description:

The linked code contains the representation of the maximum value of a uint32 in the 2**32 - 1 format which has been officially deprecated and no longer compiles in recent pragma versions.

Example:

protocol/contracts/farm/facets/SeasonFacet/Weather.sol
25uint32 private constant MAX_UINT32 = 2**32-1;

Recommendation:

We advise the type(uint32).max standardised representational style to be utilised instead.

Alleviation:

All instances of the constant were correctly replaced with type(uint32).max standardizing the codebase.

WEA-02C: Redundant Usage of SafeMath

Description:

The linked SafeMath operations are guaranteed to be performed safely by their surrounding if clauses and general logical constraints.

Example:

protocol/contracts/farm/facets/SeasonFacet/Weather.sol
180if (newBeans <= beansBeanPool) return (0,0);
181uint256 beans = newBeans.sub(beansBeanPool);

Recommendation:

We advise them to be performed without the usage of SafeMath to optimise the code.

Alleviation:

The redundant usage of SafeMath was safely omitted from both linked statements.