Open no2chem opened 2 years ago
The UniswapV3 protocol is immutable, so the pool code will never change. We don't want to make any uncertainty around that, so it makes sense to have a constant, hardcoded, well-known pool hash. It is exported from this library, so can be used in downstream projects as far as I can tell: https://github.com/Uniswap/v3-sdk/blob/000fccfbbebadabadfa6d689ebc85a50489d25d4/src/constants.ts#L5
Currently,
POOL_INIT_CODE_HASH
is hardcoded in src/constants.ts.This might work fine if you never touch the pool code, but it make for surprises if you make any changes to the pool code.
Perhaps it would be a good idea to support passing in an alternate pool init code hash? (since you can always query the factory for it?)
Or, alternatively, the v3-core code could export the hash so it could be used in downstream projects.