Closed prateek105 closed 1 year ago
I prefer the old implementation. The one-time gas spend on the double iteration is worth saving 115 bytes of space in the contract, and keeping the code in the factory where it belongs.
yes, agree. closing this one.
This suggestion was less about saving on deployment bytecode than on runtime expense, reducing of which would increase the number of token id's that could be practically enabled in a pool. The existing tests generally only run against very small subpools so you'd want to benchmark this against a larger subset to really see the gas savings in action. It may not be enough to warrant this change though.
Note that the Pool contracts can be deployed independently of the factory and without a sort order check but that's probably outside the context of Ajna's business purposes so long as everything is run through the factory, so it looks like the ordering is really only necessary in the factory for generating the hash used for cataloging purposes.
Description of change
High level
ERC721PoolFactory
toERC721Pool
to reduce gas cost for deploying pool.Contract size
Pre Change
ERC721Pool - 24,386B (99.22%)
Post Change
ERC721Pool - 24,501B (99.69%)
Gas usage
Pre Change
Post Change