In the contract we are storing the following variables:
mapping(uint256 => address) private idToCreator;
mapping(uint256 => address) internal idToOwner;
mapping(uint256 => uint256) public idToCreatorNft;
mapping(uint256 => uint256) public creatorNftMints;
mapping(uint256 => address) internal idToApproval;
mapping(address => mapping(address => bool)) internal ownerToOperators;
mapping(address => uint256[]) internal ownerToIds;
mapping(uint256 => uint256) internal idToOwnerIndex;Most of these variables could be store using a struct instead of multiple mappings. Using stuct over mapping offers better storage optimizations. Here you have more information: https://medium.com/@novablitz/storing-structs-is-costing-you-gas-774da988895e
Also, creatorNftMints is only used in mintWithAlphaOrBeta.
In this method, we validate that is only minted or not. For this purpose, we could use mapping(uint256 => bool) instead mapping(uint256 => uint256).
function mintWithAlphaOrBeta(uint256 _createVia)
external
reentrancyGuard
returns (uint256)
{
...
require(
creatorNftMints[_createVia] == 0,
"Already minted with this alpha/beta"
);
...
creatorNftMints[_createVia]++;
}