Here is a question of mine. I've seen this many times: a hash is created at the beginning of a contract and clearly does not get used anywhere in the contract. Wondering what pattern this is.
May 3, 2021, 6:00 AM
For example, the pancakefactory contract, the first line is: bytes32 public constant INIT_CODE_PAIR_HASH = keccak256(abi.encodePacked(type(PancakePair).creationCode));
Wondering what this is for and why it is put there.
May 3, 2021, 6:00 AM
This is super important for AMM
Its not used in factory, its used in the router
May 3, 2021, 6:42 AM
Then why is it inserted in the factory contract?
why not put it in the router contract?
May 3, 2021, 6:44 AM
For easy access. Its a little hard to compute externally
This code is for calculation, and calculated value is used inside router
May 3, 2021, 6:45 AM
Let me digest it for a while. I'll come back later. Many thanks, though.
May 3, 2021, 6:49 AM