Uniswap / v3-sdk

🛠 An SDK for building applications on top of Uniswap V3
MIT License
547 stars 425 forks source link

Add ability to pass in a custom POOL_INIT_CODE_HASH #113

Open no2chem opened 2 years ago

no2chem commented 2 years ago

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.

marktoda commented 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