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
  • Parameter Structsโ€‹
  • Functionsโ€‹
  1. Resources
  2. Developer Resources
  3. Smart Contracts
  4. DragonswapV2
  5. Periphery
  6. Base

LiquidityManagement

PreviousERC721PermitNextMulticall

Last updated 8 months ago

Internal functions for safely managing liquidity in DragonswapV2

Parameter Structs

AddLiquidityParams

    struct AddLiquidityParams {
        address token0;
        address token1;
        uint24 fee;
        address recipient;
        int24 tickLower;
        int24 tickUpper;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
    }

Functions

dragonswapV2MintCallback

  function dragonswapV2MintCallback(
    uint256 amount0Owed,
    uint256 amount1Owed,
    bytes data
  ) external

Called to msg.sender after minting liquidity to a position from IDragonswapV2Pool#mint.

In the implementation you must pay the pool tokens owed for the minted liquidity. The caller of this method must be checked to be a DragonswapV2Pool deployed by the canonical DragonswapV2Factory.

Name
Type
Description

amount0Owed

uint256

The amount of token0 due to the pool for the minted liquidity

amount1Owed

uint256

The amount of token1 due to the pool for the minted liquidity

data

bytes

Any data passed through by the caller via the IDragonswapV2PoolActions#mint call

  function addLiquidity(
    AddLiquidityParams memory params
  ) internal returns (uint128 liquidity, uint256 amount0, uint256 amount1, contract IDragonswapV2Pool pool)

Add liquidity to an initialized pool

Parameters:

addLiquidity

๐Ÿ’ป
๐Ÿ“„
โ€‹
โ€‹
โ€‹
โ€‹
โ€‹
โ€‹