block-quote On this pagechevron-down
copy Copy chevron-down
Core Contracts VinuSwapFactory The VinuSwapFactory contract deploys VinuSwap pools and serves as the canonical registry for all pools.
Source: contracts/core/VinuSwapFactory.sol
The factory is responsible for:
Deploying new pools with deterministic addresses
Maintaining the pool registry
Managing ownership and access control
State Variables
Copy address public override owner ; The address with administrative privileges. Only the owner can:
Returns the pool address for a given token pair and fee tier.
Note: The mapping works regardless of token order - getPool[A][B][fee] returns the same address as getPool[B][A][fee].
Deploys a new pool for the given token pair.
Access Control: Only callable by owner
Parameters:
Returns:
Requirements:
tokenA != address(0) and tokenB != address(0)
tickSpacing > 0 && tickSpacing < 16384
Pool does not already exist for this pair/fee combination
Example:
Transfers ownership to a new address.
Access Control: Only callable by current owner
Parameters:
Events Emitted:
OwnerChanged(oldOwner, newOwner)
Emitted when a new pool is deployed.
Note: token0 will always be less than token1 (sorted by address).
Emitted when ownership is transferred.
Pool Address Computation
Pool addresses are deterministic and can be computed off-chain:
Creating a Pool
Querying a Pool
Transferring Ownership
Differences from Uniswap V3
Security Considerations
Owner Privilege : The owner has significant control. Consider using a multisig or timelock.
Fee Manager Trust : The fee manager contract is called during every swap. Ensure it's a trusted implementation.
Pool Uniqueness : Each token pair + fee combination can only have one pool.
Last updated 3 months ago