StoryHuntV3Factory
Variables
address ownerDescription: The current owner of the factory contract. The owner has exclusive privileges to perform certain administrative actions, such as transferring ownership and enabling new fee amounts.
mapping(uint24 => int24) feeAmountTickSpacingDescription: Maps each fee amount to its corresponding tick spacing.
Key:
fee(uint24)Value:
tickSpacing(int24)
This mapping determines the granularity at which ticks can be initialized for different fee tiers.
mapping(address => mapping(address => mapping(uint24 => address))) getPoolDescription: Retrieves the address of a deployed pool based on the pair of tokens and the fee tier.
Parameters:
token0(address): The first token in the pair, sorted by address.token1(address): The second token in the pair, sorted by address.fee(uint24): The fee tier for the pool.
Returns:
address: The address of the deployedStoryHuntV3Poolcorresponding to the provided tokens and fee. Returnsaddress(0)if the pool does not exist.
Functions
Description:
Deploys a new StoryHuntV3Pool for the given pair of tokens and fee tier. Ensures that only unique pools are created for each token pair and fee combination.
Parameters
tokenA
address
The first token of the pair to create the pool for.
tokenB
address
The second token of the pair to create the pool for.
fee
uint24
The fee tier for the pool (e.g., 500, 3000, 10000).
Return Values
pool
address
The address of the newly created StoryHuntV3Pool.
Description:
Initiates a two-step ownership transfer process. Only the current owner can call this function. Emits the OwnershipTransferStarted event upon invocation.
Parameters
newOwner
address
The address of the new intended owner.
Description:
Completes the ownership transfer process. The pending owner must call this function to finalize the transfer. Emits the OwnerChanged event upon successful transfer.
Description:
Enables a new fee tier with its corresponding tick spacing. Only the current owner can call this function. Emits the FeeAmountEnabled event upon successful enabling.
Parameters
fee
uint24
The fee tier to enable (e.g., 500, 3000, 10000).
tickSpacing
int24
The tick spacing associated with the fee tier. Must be > 0 and < 16384.
Modifiers
Description: Prevents functions from being called through a delegatecall. This is a security measure to ensure that certain functions cannot be exploited via proxy contracts or delegatecalls.
Events
Description: Emitted when ownership of the factory is transferred from one address to another.
Parameters
oldOwner
address
The address of the previous owner.
newOwner
address
The address of the new owner.
Description: Emitted when the ownership transfer process is initiated by the current owner.
Parameters
oldOwner
address
The address of the current owner.
newOwner
address
The address of the intended new owner.
Description: Emitted when a new fee tier is enabled along with its associated tick spacing.
Parameters
fee
uint24
The fee tier that was enabled.
tickSpacing
int24
The tick spacing associated with the fee.
Description:
Emitted when a new StoryHuntV3Pool is created for a specific token pair and fee tier.
Parameters
token0
address
The first token of the pool, sorted by address.
token1
address
The second token of the pool, sorted by address.
fee
uint24
The fee tier of the pool.
tickSpacing
int24
The tick spacing of the pool.
pool
address
The address of the newly created pool.
Usage Notes
Creating Pools
Deploying a New Pool:
Call
createPool(tokenA, tokenB, fee)with the desired token pair and fee tier.Ensure that the fee tier has been enabled via
enableFeeAmountbefore attempting to create a pool.The function will emit a
PoolCreatedevent upon successful deployment.
Retrieving Pool Addresses
Fetching a Pool:
Use the
getPool(token0, token1, fee)mapping to retrieve the address of an existing pool for a given token pair and fee tier.If the pool does not exist, the mapping returns
address(0).