DragonSwap
  • Getting Started
    • 👋Welcome to DragonSwap
    • 💰How to Create & Connect a Wallet
    • 🪙Approving Tokens
    • 🔴Sei V2 EVM
  • Guides
    • Trading
      • 💱How to Swap
      • 🎁How to Wrap SEI
      • 🎀How to Unwrap SEI
    • Liqudity Providers
      • 🌊How to Add Liquidity
      • ☔How to Remove Liquidity
      • 🏊How to Deploy New Pools
      • 📉Understanding Impermanent Loss
      • 🫗V2: Concentrated Liquidity Pools
      • 🤖Automated Liquidity Managers (ALM)
    • Farms
      • 🥕Depositing to Farm
      • 🧑‍🌾Withdrawing from Farm
      • 🪙Claiming Rewards
      • 🚀Boosted Farms
    • Predictions
      • 🔮How to use Predictions
      • 🧞How Predictions work?
      • ❓Predictions FAQ
    • Analytics
      • 🏊Pools
      • 🥕Farms
      • 🪙Tokens
  • DragonSwap Token
    • Token & Tokenomics
    • How to Stake
    • DragonSwap Points
    • Protocol Rewards
  • Resources
    • 💻Developer Resources
      • 📄Smart Contracts
        • DragonswapV1
          • Factory
          • Pair
          • Pair(ERC-20)
          • Library
          • Router
          • Audit
        • DragonswapV2
          • Core
            • DragonswapV2Factory
            • DragonswapV2Pool
            • DragonswapV2PoolDeployer
            • Interfaces
              • IERC20Minimal
              • IDragonswapV2Factory
              • IDragonswapV2Pool
              • IDragonswapV2PoolDeployer
              • Callbacks
                • IDragonswapV2FlashCallback
                • IDragonswapV2MintCallback
                • IDragonswapV2SwapCallback
              • Pool
                • IDragonswapV2PoolActions
                • IDragonswapV2PoolDerivedState
                • IDragonswapV2PoolEvents
                • IDragonswapV2PoolImmutables
                • IDragonswapV2PoolOwnerActions
                • IDragonswapV2PoolState
            • Libraries
              • BitMath
              • FixedPoint128
              • FixedPoint96
              • FullMath
              • LiquidityMath
              • LowGasSafeMath
              • Oracle
              • Position
              • SafeCast
              • SecondsOutside
              • SqrtPriceMath
              • SwapMath
              • Tick
              • TickBitmap
              • TickMath
              • TransferHelper
              • UnsafeMath
          • Periphery
            • Base
              • BlockTimestamp
              • ERC721Permit
              • LiquidityManagement
              • Multicall
              • PeripheryImmutableState
              • PeripheryPayments
              • PeripheryPaymentsWithFee
              • PoolInitializer
              • SelfPermit
            • Interfaces
              • IERC20Metadata
              • IERC721Permit
              • IMulticall
              • INonfungiblePositionManager
              • INonfungibleTokenPositionDescriptor
              • IPeripheryImmutableState
              • IPeripheryPayments
              • IPeripheryPaymentsWithFee
              • IPoolInitializer
              • IQuoter
              • IQuoterV2
              • ISelfPermit
              • ISwapRouter
              • ITickLens
              • IV2Migrator
              • External
                • IERC1271
                • IERC20PermitAllowed
                • IWSEI
            • Lens
              • Quoter
              • QuoterV2
              • TickLens
            • Libraries
              • Base64
              • BytesLib
              • CallbackValidation
              • ChainId
              • HexStrings
              • LiquidityAmounts
              • NFTDescriptor
              • NFTSVG
              • OracleLibrary
              • Path
              • PoolAddress
              • PoolTicksCounter
              • PositionKey
              • TransferHelper
            • NonfungiblePositionManager
            • NonfungibleTokenPositionDescriptor
            • SwapRouter
            • V2Migrator
            • Error Codes
          • Staker
            • Overview
            • DragonswapV2Staker
            • Interfaces
              • IDragonswapV2Staker
            • Libraries
              • IncentiveId
              • NFTPositionInfo
              • RewardMath
          • Smart Router
            • Base
              • ApproveAndCall
              • ImmutableState
              • MulticallExtended
              • OracleSlippage
              • PeripheryPaymentsExtended
              • PeripheryPaymentsWithFeeExtended
              • PeripheryValidationExtended
            • Interfaces
              • IApproveAndCall
              • IImmutableState
              • IMixedRouteQuoterV1
              • IMulticallExtended
              • IOracleSlippage
              • IPeripheryPaymentsExtended
              • IPeripheryPaymentsWithFeeExtended
              • IQuoter
              • IQuoterV2
              • ISwapRouter02
              • ITokenValidator
              • IV1SwapRouter
              • IV2SwapRouter
            • Lens
              • MixedRouteQuoterV1
              • Quoter
              • QuoterV2
              • TokenValidator
            • Libraries
              • Constants
              • DragonswapLibrary
              • PoolTicksCounter
            • V1SwapRouter
            • V2SwapRouter
            • SwapRouter02
          • Audit
    • ❣️Marketing Resources
      • 🚩Brand Guidelines
      • 😂Meme Library
      • 🤗DragonSwap Ambassador Program
  • FAQ
    • 📲Official Links
    • 📄Contract Addresses
      • DragonswapV1
      • DragonswapV2
      • Predictions
    • ✨Roadmap
    • 📄 Token Listing Policy
    • 🏛️ToS
Powered by GitBook
On this page
  • Functions​
  • Events​
  1. Resources
  2. Developer Resources
  3. Smart Contracts
  4. DragonswapV2
  5. Core
  6. Interfaces

IDragonswapV2Factory

PreviousIERC20MinimalNextIDragonswapV2Pool

Last updated 9 months ago

The DragonswapV2Factory facilitates creation of DragonswapV2 pools and control over the protocol fees

Functions

owner

  function owner(
  ) external view returns (address)

Returns the current owner of the factory

Can be changed by the current owner via setOwner

Return Values:

Type
Description

address

address of the factory owner

feeAmountTickSpacing

  function feeAmountTickSpacing(
    uint24 fee
  ) external view returns (int24)

Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled

A fee amount can never be removed, so this value should be hard coded or cached in the calling context

Parameters:

Name
Type
Description

fee

uint24

The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee

Type
Description

int24

tick spacing

  function getPool(
    address tokenA,
    address tokenB,
    uint24 fee
  ) external view returns (address pool)

Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist

tokenA and tokenB may be passed in either token0/token1 or token1/token0 order

Name
Type
Description

tokenA

address

The contract address of either token0 or token1

tokenB

address

The contract address of the other token

fee

uint24

The fee collected upon every swap in the pool, denominated in hundredths of a bip

Name
Type
Description

pool

address

The pool address

  function createPool(
    address tokenA,
    address tokenB,
    uint24 fee
  ) external returns (address pool)

Creates a pool for the given two tokens and fee

tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments are invalid.

Name
Type
Description

tokenA

address

One of the two tokens in the desired pool

tokenB

address

The other of the two tokens in the desired pool

fee

uint24

The desired fee for the pool

Name
Type
Description

pool

address

The address of the newly created pool

  function setOwner(
    address _owner
  ) external

Updates the owner of the factory

Must be called by the current owner

Name
Type
Description

_owner

address

The new owner of the factory

  function enableFeeAmount(
    uint24 fee,
    int24 tickSpacing
  ) external

Enables a fee amount with the given tickSpacing

Fee amounts may never be removed once enabled

Name
Type
Description

fee

uint24

The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)

tickSpacing

int24

The spacing between ticks to be enforced for all pools created with the given fee amount

  event OwnerChanged(
    address oldOwner,
    address newOwner
  )

Emitted when the owner of the factory is changed

Name
Type
Description

oldOwner

address

The owner before the owner was changed

newOwner

address

The owner after the owner was changed

  event PoolCreated(
    address token0,
    address token1,
    uint24 fee,
    int24 tickSpacing,
    address pool
  )

Emitted when a pool is created

Name
Type
Description

token0

address

The first token of the pool by address sort order

token1

address

The second token of the pool by address sort order

fee

uint24

The fee collected upon every swap in the pool, denominated in hundredths of a bip

tickSpacing

int24

The minimum number of ticks between initialized ticks

pool

address

The address of the created pool

  event FeeAmountEnabled(
    uint24 fee,
    int24 tickSpacing
  )

Emitted when a new fee amount is enabled for pool creation via the factory

Name
Type
Description

fee

uint24

The enabled fee, denominated in hundredths of a bip

tickSpacing

int24

The minimum number of ticks between initialized ticks for pools created with the given fee

Return Values:

getPool

Parameters:

Return Values:

createPool

Parameters:

Return Values:

setOwner

Parameters:

enableFeeAmount

Parameters:

Events

OwnerChanged

Parameters:

PoolCreated

Parameters:

FeeAmountEnabled

Parameters:

💻
📄
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​