Skip to main content
Helpful?

Factory

Code

DonaswapFactory.sol

Donaswap v2 Factory Addresses

NetworkChainIdContract AddressExplorer
Firechain5290x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Rinia9170x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Arbtitrum421610x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Arbtitrum Goerli4216130x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Astar5920x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Aurora13131615540x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Aurora Testnet13131615550x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Avalanche431140x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Avalanche Fuji431130x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Base84530x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Base Goerli845310x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
BitTorrent Chain Testnet10280x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
BNB Smart Chain560x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
BNB Smart Chain Testnet970x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
CadduceusChain2562560x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
CadduceusChain Testnet5125120x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Celo422200x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Celo Alfajores447870x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
CoinEx530x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Conflux eSpace10300x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Conflux eSpace Testnet710x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Core11160x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Core Sepolia11150x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Cronos Testnet3380x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Dogechain20000x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Dogechain Testnet5680x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Ethereum10x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Fantom Opera2500x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Fantom Testnet40020x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Flare140x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Flare Testnet1140x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Fuse1220x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Fuse Sparknet1230x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Fusion326590x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Fusion Testnet466880x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Gnosis Chiado102000x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Goerli50x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Harmony16666000000x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Harmony Testnet16667000000x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Heco1280x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Holesky170000x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Kardiachain240x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Kava22220x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Kava Testnet22210x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Kcc3210x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Klaytn8217 0x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Klaytn Baobab10010x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Linea591440x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Linea Goerli591400x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Metis10880x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Metis Goerli5990x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Moonbase1287 0x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Moonbeam1284 0x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Moonriver12850x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
OkxChain650x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Optimism100x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Optimism Goerli4200x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Palm112971081090x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Palm Testnet112971080990x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Polygon1370x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Polygon Mumbai800010x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Polygon ZkEvm11010x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Polygon ZkEvm Testnet14420x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Pulsechain3690x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Pulsechain Testnet9430x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Rootstock Testnet310x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Scroll Sepolia5343510x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Sepolia111551110x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Shibarium1090x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Sibarium Testnet7190x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Shibunya810x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Telos400x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Telos Testnet410x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
ThunderCore1080x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
ThunderCore Testnet180x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
TomoChain Testnet890x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code
Ultron Testnet12300x8e5dff1c121F661971d02950698f8c5EFc3DfA78Code

Events

PairCreated

event PairCreated(address indexed token0, address indexed token1, address pair, uint);

Emitted each time a pair is created via createPair.

  • token0 is guaranteed to be strictly less than token1 by sort order.
  • The final uint log value will be 1 for the first pair created, 2 for the second, etc. (see allPairs/getPair).

Read-Only Functions

getPair

function getPair(address tokenA, address tokenB) external view returns (address pair);

Returns the address of the pair for tokenA and tokenB, if it has been created, else address(0) (0x0000000000000000000000000000000000000000).

  • tokenA and tokenB are interchangeable.
  • Pair addresses can also be calculated deterministically via the SDK.

allPairs

function allPairs(uint) external view returns (address pair);

Returns the address of the nth pair (0-indexed) created through the factory, or address(0) (0x0000000000000000000000000000000000000000) if not enough pairs have been created yet.

  • Pass 0 for the address of the first pair created, 1 for the second, etc.

allPairsLength

function allPairsLength() external view returns (uint);

Returns the total number of pairs created through the factory so far.

feeTo

function feeTo() external view returns (address);

See Exchange Charge Calculation.

feeToSetter

function feeToSetter() external view returns (address);

The address allowed to change feeTo.

State-Changing Functions

createPair

function createPair(address tokenA, address tokenB) external returns (address pair);

Creates a pair for tokenA and tokenB if one doesn't exist already.

  • tokenA and tokenB are interchangeable.
  • Emits PairCreated.

Interface

import '@donaswap/core/contracts/interfaces/IDonaswapFactory.sol';
pragma solidity =0.5.16;

interface IDonaswapFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);

function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function migrator() external view returns (address);

function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);

function createPair(address tokenA, address tokenB) external returns (address pair);

function setFeeTo(address) external;
function setFeeToSetter(address) external;
function setMigrator(address) external;
}

ABI

import IDonaswapFactory from '@donaswap/core/build/IDonaswapFactory.json'

https://unpkg.com/@donaswap/core@1.0.1-alpha/build/IDonaswapFactory.json

Helpful?