PairFactory is the contract that deploys DysonPair. Unlike Uniswap, Dyson allows multiple Pair instances for a trading pair of two tokens. Factory also serves as a beacon providing the current controller address for all pairs.
allPairsLength
Retrieves the total number of created pairs.
functionallPairsLength()externalviewreturns(uint)
Return Values:
Name
Type
Description
None
uint
Total number of created pairs.
getInitCodeHash
Retrieves the keccak256 hash of the creation code for the Pair contract.
Keccak256 hash of the Pair contract creation code.
createPair
Creates a new Pair contract with the specified token addresses and initializes it. This function introduces a mechanism to generate unique Pair contract instances in Solidity. This uniqueness is achieved through the utilization of a cryptographic hash known as salt. The salt is computed by encoding (hashing) a combination of token0, token1, and id. By incorporating salt, the function ensures that each created Pair contract possesses a distinctive identifier, guarding against the duplication of identical configurations.