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
  • Code
  • Events
  • Mintโ€‹
  • Burnโ€‹
  • Swapโ€‹
  • Syncโ€‹
  • Read-Only Functions
  • MINIMUM_LIQUIDITYโ€‹
  • factoryโ€‹
  • token0โ€‹
  • token1โ€‹
  • getReservesโ€‹
  • price0CumulativeLastโ€‹
  • price1CumulativeLastโ€‹
  • kLastโ€‹
  • State-Changing Functions
  • mintโ€‹
  • burnโ€‹
  • swapโ€‹
  • skimโ€‹
  • syncโ€‹
  • Interface
  • ABI
  1. Resources
  2. Developer Resources
  3. Smart Contracts
  4. DragonswapV1

Pair

PreviousFactoryNextPair(ERC-20)

Last updated 9 months ago

This documentation covers Dragonswap-specific functionality. For ERC-20 functionality, see .

Code

Events

Mint

event Mint(address indexed sender, uint amount0, uint amount1);

Emitted each time liquidity tokens are created via .

Burn

event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);

Emitted each time liquidity tokens are destroyed via .

Swap

event Swap(
  address indexed sender,
  uint amount0In,
  uint amount1In,
  uint amount0Out,
  uint amount1Out,
  address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);

Read-Only Functions

function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);

Returns the factory address.

function token0() external view returns (address);

Returns the address of the pair token with the lower sort order.

function token1() external view returns (address);

Returns the address of the pair token with the higher sort order.

function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);

Returns the reserves of token0 and token1 used to price trades and distribute liquidity. Also returns the block.timestamp (mod 2**32) of the last block during which an interaction occured for the pair.

function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);

Returns the product of the reserves as of the most recent liquidity event.

State-Changing Functions

function mint(address to) external returns (uint liquidity);

Creates pool tokens.

function burn(address to) external returns (uint amount0, uint amount1);

Destroys pool tokens.

function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;

Swaps tokens. For regular swaps, data.length must be 0.

function skim(address to) external;
function sync() external;

Interface

import '@dragonswap/contracts/interfaces/IDragonswapPair.sol';
pragma solidity >=0.5.0;

interface IDragonswapPair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

ABI

Emitted each time a swap occurs via .

Sync

Emitted each time reserves are updated via , , , or .

MINIMUM_LIQUIDITY

Returns 1000 for all pairs. See .

factory

token0

token1

getReserves

price0CumulativeLast

price1CumulativeLast

kLast

mint

Emits , , .

burn

Emits , , .

swap

Emits , .

skim

sync

Emits .

๐Ÿ’ป
๐Ÿ“„
โ€‹
โ€‹
โ€‹
โ€‹
โ€‹
โ€‹
โ€‹
โ€‹
โ€‹
โ€‹
โ€‹
โ€‹
โ€‹
โ€‹
https://github.com/dragonswap-app/dragonswap-core/blob/7daf58214605f2bcbb2b06d295acc1d891437fc7/deployments/abis.json#L1195
Pair (ERC-20)
DragonswapPair.sol
โ€‹
โ€‹
โ€‹
mint
burn
swap
mint
burn
swap
sync
Swap
Sync
Sync
Mint
Sync
Burn
Sync
Transfer
Transfer
Minimum Liquidity