You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The declaration order of state variables affects storage slot packing and gas impact from reads/writes of shared slots. By declaring locked var (bool) next to feeTo (address) can save 1 slot.
Change to:
uint256 public last_offer_id;
/// @dev The mapping that makes up the core orderbook of the exchange
mapping(uint256 => OfferInfo) public offers;
/// @dev This parameter is in basis points
uint256 internal feeBPS;
/// @dev This parameter provides the address to which fees are sent
address internal feeTo;
bool locked; //@audit-info: Place here
##GAS
Title: Storage slot packing for gas optimization
https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconMarket.sol#L191
The declaration order of state variables affects storage slot packing and gas impact from reads/writes of shared slots. By declaring
locked
var (bool) next tofeeTo
(address) can save 1 slot.Change to:
Title: Using storage instead of memory for struct
https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconMarket.sol#L279
https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconMarket.sol#L250
By reading directly to storage instead of caching in memory can save execution gas
Change to:
Title: Using != instead >
https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconMarket.sol#L233
https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconMarket.sol#L400
Using != operator is more efficient than > for validating that var is not zero
The text was updated successfully, but these errors were encountered: