Can save gas by packing variable into less storage slots, for example:
--- a/contracts/contracts/Auction.sol
+++ b/contracts/contracts/Auction.sol
@@ -13,13 +13,14 @@ contract Auction is IAuction, ReentrancyGuard {
uint256 private constant BASE = 1e18;
uint256 private constant ONE_DAY = 1 days;
- bool public override auctionOngoing;
uint256 public override auctionStart;
- bool public override hasBonded;
uint256 public override bondAmount;
uint256 public override bondTimestamp;
uint256 public override bondBlock;
+ bool public override auctionOngoing;
+ bool public override hasBonded;
+
IBasket public override basket;
IFactory public override factory;
address public override auctionBonder;
--- a/contracts/contracts/Basket.sol
+++ b/contracts/contracts/Basket.sol
@@ -21,14 +21,16 @@ contract Basket is IBasket, ERC20Upgradeable, ReentrancyGuard {
uint256 public maxSupply;
- address public publisher;
uint256 public licenseFee;
+ uint256 public override ibRatio;
+
+ uint256 public override lastFee;
+
+ address public publisher;
IFactory public override factory;
IAuction public override auction;
- uint256 public override ibRatio;
-
PendingPublisher public pendingPublisher;
PendingLicenseFee public pendingLicenseFee;
PendingWeights public pendingWeights;
Note that this probably isn't the most efficient ordering, for best result variables that will be used together should be put into the same slot if possible.
Handle
gzeon
Vulnerability details
Impact
Can save gas by packing variable into less storage slots, for example:
Note that this probably isn't the most efficient ordering, for best result variables that will be used together should be put into the same slot if possible.