EticaHub

EticaSwap Factorycontract Verified

0xfc8dE5A5087c8825AA54E2C57B3FFe0e23784bc3

EGAZ balance
0 EGAZ
ETX balance
0 ETX
ETI balance
0 ETI
EGAZ balance (wrapped ERC-20)
0 EGAZ
Type
Contract
Code size
15078 bytes
Verified

EticaSwapFactory

Compiled with solc 0.8.26+commit.8a97fa7a · optimizer on (1,000,000 runs) · evm paris

bytecode match
match (immutables masked)
Source code · 9 files
src/swap/EticaSwapERC20.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.26;

/// @title EticaSwap LP token (base ERC20 with EIP-2612 permit).
/// @notice Uniswap V2–compatible LP token. Inherited by EticaSwapPair.
contract EticaSwapERC20 {
    string public constant name = "EticaSwap V2";
    string public constant symbol = "ETICA-V2";
    uint8 public constant decimals = 18;

    uint256 public totalSupply;
    mapping(address => uint256) public balanceOf;
    mapping(address => mapping(address => uint256)) public allowance;

    bytes32 public DOMAIN_SEPARATOR;
    // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)")
    bytes32 public constant PERMIT_TYPEHASH =
        0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
    mapping(address => uint256) public nonces;

    event Approval(address indexed owner, address indexed spender, uint256 value);
    event Transfer(address indexed from, address indexed to, uint256 value);

    constructor() {
        uint256 chainId = block.chainid;
        DOMAIN_SEPARATOR = keccak256(
            abi.encode(
                keccak256(
                    "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
                ),
                keccak256(bytes(name)),
                keccak256(bytes("1")),
                chainId,
                address(this)
            )
        );
    }

    function _mint(address to, uint256 value) internal {
        totalSupply += value;
        unchecked {
            balanceOf[to] += value;
        }
        emit Transfer(address(0), to, value);
    }

    function _burn(address from, uint256 value) internal {
        balanceOf[from] -= value;
        unchecked {
            totalSupply -= value;
        }
        emit Transfer(from, address(0), value);
    }

    function _approve(address owner, address spender, uint256 value) private {
        allowance[owner][spender] = value;
        emit Approval(owner, spender, value);
    }

    function _transfer(address from, address to, uint256 value) private {
        balanceOf[from] -= value;
        unchecked {
            balanceOf[to] += value;
        }
        emit Transfer(from, to, value);
    }

    function approve(address spender, uint256 value) external returns (bool) {
        _approve(msg.sender, spender, value);
        return true;
    }

    function transfer(address to, uint256 value) external returns (bool) {
        _transfer(msg.sender, to, value);
        return true;
    }

    function transferFrom(address from, address to, uint256 value) external returns (bool) {
        uint256 allowed = allowance[from][msg.sender];
        if (allowed != type(uint256).max) {
            allowance[from][msg.sender] = allowed - value;
        }
        _transfer(from, to, value);
        return true;
    }

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external {
        require(deadline >= block.timestamp, "ESwap: EXPIRED");
        bytes32 digest = keccak256(
            abi.encodePacked(
                "\x19\x01",
                DOMAIN_SEPARATOR,
                keccak256(
                    abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)
                )
            )
        );
        address recovered = ecrecover(digest, v, r, s);
        require(recovered != address(0) && recovered == owner, "ESwap: INVALID_SIGNATURE");
        _approve(owner, spender, value);
    }
}
src/swap/EticaSwapFactory.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.26;

import {EticaSwapPair} from "./EticaSwapPair.sol";
import {IEticaSwapFactory} from "./interfaces/IEticaSwapFactory.sol";
import {TransferHelper} from "./libraries/TransferHelper.sol";

/// @title EticaSwap V2 factory (ETX hub-and-spoke)
/// @notice Deploys deterministic pair contracts via CREATE2. Every pair MUST
///         include ETX on one side: routes all liquidity through the ETX hub,
///         making ETX the reserve asset of the DEX. 0.05% protocol fee (1/6 of
///         the 0.30% swap fee) can be enabled by setting `feeTo`.
/// @dev    The `trustedCreators` allow-list is the one and only exception to
///         the ETX-only rule: addresses in the set may create pairs that do
///         not include ETX. It exists so the proposal-token launchpad can
///         open `token/ETI` pools alongside `token/ETX`. Everyone else stays
///         forced onto the ETX hub.
contract EticaSwapFactory is IEticaSwapFactory {
    /// @notice Default pair-creation fee, denominated in ETX (18 dp). Callers
    ///         not in `trustedCreators` must pay this in ETX on `createPair`.
    ///         Fee is skipped when `feeTo == 0x0` so a freshly-deployed
    ///         factory can bootstrap before treasury wiring.
    uint256 public constant DEFAULT_PAIR_CREATION_FEE = 10_000 ether;

    address public immutable etx;
    address public feeTo;
    address public feeToSetter;

    mapping(address => mapping(address => address)) public getPair;
    address[] public allPairs;
    mapping(address => bool) public trustedCreators;
    uint256 public pairCreationFee;

    constructor(address _feeToSetter, address _etx) {
        require(_etx != address(0), "ESwap: ETX_ZERO_ADDRESS");
        feeToSetter = _feeToSetter;
        etx = _etx;
        pairCreationFee = DEFAULT_PAIR_CREATION_FEE;
    }

    function allPairsLength() external view returns (uint256) {
        return allPairs.length;
    }

    function createPair(address tokenA, address tokenB) external returns (address pair) {
        require(tokenA != tokenB, "ESwap: IDENTICAL_ADDRESSES");
        require(
            tokenA == etx || tokenB == etx || trustedCreators[msg.sender],
            "ESwap: MUST_PAIR_WITH_ETX"
        );
        (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), "ESwap: ZERO_ADDRESS");
        require(getPair[token0][token1] == address(0), "ESwap: PAIR_EXISTS");

        // Collect the pair-creation fee in ETX. Trusted creators (e.g. the
        // proposal-token launchpad, which already pays its own 250 ETX +
        // 250 ETI per launch) are exempt. The fee is also skipped while
        // `feeTo` is unset so a freshly-deployed factory can bootstrap.
        address recipient = feeTo;
        uint256 fee = pairCreationFee;
        if (!trustedCreators[msg.sender] && fee > 0 && recipient != address(0)) {
            TransferHelper.safeTransferFrom(etx, msg.sender, recipient, fee);
        }

        bytes32 salt = keccak256(abi.encodePacked(token0, token1));
        pair = address(new EticaSwapPair{salt: salt}());
        EticaSwapPair(pair).initialize(token0, token1);

        getPair[token0][token1] = pair;
        getPair[token1][token0] = pair;
        allPairs.push(pair);
        emit PairCreated(token0, token1, pair, allPairs.length);
    }

    function setFeeTo(address _feeTo) external {
        require(msg.sender == feeToSetter, "ESwap: FORBIDDEN");
        feeTo = _feeTo;
    }

    function setFeeToSetter(address _feeToSetter) external {
        require(msg.sender == feeToSetter, "ESwap: FORBIDDEN");
        feeToSetter = _feeToSetter;
    }

    /// @notice Grant or revoke a creator's permission to open non-ETX pairs.
    /// @dev    Only the fee-to setter (i.e. governance / admin) can flip this.
    ///         Intended use: whitelist the proposal-token launchpad so it can
    ///         open `token/ETI` pools. Any address not in the set is still
    ///         subject to the ETX-only rule.
    function setTrustedCreator(address creator, bool trusted) external {
        require(msg.sender == feeToSetter, "ESwap: FORBIDDEN");
        require(creator != address(0), "ESwap: ZERO_ADDRESS");
        trustedCreators[creator] = trusted;
        emit TrustedCreatorSet(creator, trusted);
    }

    /// @notice Update the ETX fee charged on `createPair` to non-trusted
    ///         callers. Set to zero to disable the fee entirely.
    function setPairCreationFee(uint256 fee) external {
        require(msg.sender == feeToSetter, "ESwap: FORBIDDEN");
        pairCreationFee = fee;
        emit PairCreationFeeSet(fee);
    }

    /// @notice Init code hash for pairs — useful for off-chain CREATE2 address prediction.
    function pairCodeHash() external pure returns (bytes32) {
        return keccak256(type(EticaSwapPair).creationCode);
    }
}
src/swap/EticaSwapPair.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.26;

import {EticaSwapERC20} from "./EticaSwapERC20.sol";
import {Math} from "./libraries/Math.sol";
import {UQ112x112} from "./libraries/UQ112x112.sol";
import {IERC20Minimal} from "./interfaces/IERC20Minimal.sol";
import {IEticaSwapFactory} from "./interfaces/IEticaSwapFactory.sol";
import {IEticaSwapCallee} from "./interfaces/IEticaSwapCallee.sol";

/// @title EticaSwap V2 pair
/// @notice Constant-product AMM pair (x*y=k), 0.30% swap fee.
/// @dev Port of UniswapV2Pair to Solidity 0.8.x. Invariants and math are
///      equivalent to the audited V2 contract.
contract EticaSwapPair is EticaSwapERC20 {
    using UQ112x112 for uint224;

    uint256 public constant MINIMUM_LIQUIDITY = 10 ** 3;
    bytes4 private constant SELECTOR_TRANSFER =
        bytes4(keccak256(bytes("transfer(address,uint256)")));

    address public factory;
    address public token0;
    address public token1;

    uint112 private reserve0;
    uint112 private reserve1;
    uint32 private blockTimestampLast;

    uint256 public price0CumulativeLast;
    uint256 public price1CumulativeLast;
    // reserve0 * reserve1 immediately after the most recent liquidity event
    uint256 public kLast;

    uint256 private unlocked = 1;

    modifier lock() {
        require(unlocked == 1, "ESwap: LOCKED");
        unlocked = 0;
        _;
        unlocked = 1;
    }

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

    constructor() {
        factory = msg.sender;
    }

    /// @notice Called once by the factory at deploy time.
    function initialize(address _token0, address _token1) external {
        require(msg.sender == factory, "ESwap: FORBIDDEN");
        token0 = _token0;
        token1 = _token1;
    }

    function getReserves()
        public
        view
        returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)
    {
        _reserve0 = reserve0;
        _reserve1 = reserve1;
        _blockTimestampLast = blockTimestampLast;
    }

    function _safeTransfer(address token, address to, uint256 value) private {
        (bool ok, bytes memory data) =
            token.call(abi.encodeWithSelector(SELECTOR_TRANSFER, to, value));
        require(ok && (data.length == 0 || abi.decode(data, (bool))), "ESwap: TRANSFER_FAILED");
    }

    function _update(uint256 balance0, uint256 balance1, uint112 _reserve0, uint112 _reserve1)
        private
    {
        require(balance0 <= type(uint112).max && balance1 <= type(uint112).max, "ESwap: OVERFLOW");
        uint32 blockTimestamp = uint32(block.timestamp % 2 ** 32);
        unchecked {
            uint32 timeElapsed = blockTimestamp - blockTimestampLast;
            if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
                price0CumulativeLast += uint256(UQ112x112.encode(_reserve1).uqdiv(_reserve0))
                * timeElapsed;
                price1CumulativeLast += uint256(UQ112x112.encode(_reserve0).uqdiv(_reserve1))
                * timeElapsed;
            }
        }
        reserve0 = uint112(balance0);
        reserve1 = uint112(balance1);
        blockTimestampLast = blockTimestamp;
        emit Sync(reserve0, reserve1);
    }

    /// @dev Mints fee equivalent to 1/6 of the growth in sqrt(k) to `feeTo`.
    function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
        address feeTo = IEticaSwapFactory(factory).feeTo();
        feeOn = feeTo != address(0);
        uint256 _kLast = kLast;
        if (feeOn) {
            if (_kLast != 0) {
                uint256 rootK = Math.sqrt(uint256(_reserve0) * _reserve1);
                uint256 rootKLast = Math.sqrt(_kLast);
                if (rootK > rootKLast) {
                    uint256 numerator = totalSupply * (rootK - rootKLast);
                    uint256 denominator = rootK * 5 + rootKLast;
                    uint256 liquidity = numerator / denominator;
                    if (liquidity > 0) _mint(feeTo, liquidity);
                }
            }
        } else if (_kLast != 0) {
            kLast = 0;
        }
    }

    /// @notice Mints LP tokens for the caller based on amounts transferred in beforehand.
    function mint(address to) external lock returns (uint256 liquidity) {
        (uint112 _reserve0, uint112 _reserve1,) = getReserves();
        uint256 balance0 = IERC20Minimal(token0).balanceOf(address(this));
        uint256 balance1 = IERC20Minimal(token1).balanceOf(address(this));
        uint256 amount0 = balance0 - _reserve0;
        uint256 amount1 = balance1 - _reserve1;

        bool feeOn = _mintFee(_reserve0, _reserve1);
        uint256 _totalSupply = totalSupply;
        if (_totalSupply == 0) {
            liquidity = Math.sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY;
            _mint(address(0), MINIMUM_LIQUIDITY);
        } else {
            liquidity = Math.min(
                (amount0 * _totalSupply) / _reserve0, (amount1 * _totalSupply) / _reserve1
            );
        }
        require(liquidity > 0, "ESwap: INSUFFICIENT_LIQUIDITY_MINTED");
        _mint(to, liquidity);

        _update(balance0, balance1, _reserve0, _reserve1);
        if (feeOn) kLast = uint256(reserve0) * reserve1;
        emit Mint(msg.sender, amount0, amount1);
    }

    /// @notice Burns LP tokens from this contract and sends the underlyings to `to`.
    function burn(address to) external lock returns (uint256 amount0, uint256 amount1) {
        (uint112 _reserve0, uint112 _reserve1,) = getReserves();
        address _token0 = token0;
        address _token1 = token1;
        uint256 balance0 = IERC20Minimal(_token0).balanceOf(address(this));
        uint256 balance1 = IERC20Minimal(_token1).balanceOf(address(this));
        uint256 liquidity = balanceOf[address(this)];

        bool feeOn = _mintFee(_reserve0, _reserve1);
        uint256 _totalSupply = totalSupply;
        amount0 = (liquidity * balance0) / _totalSupply;
        amount1 = (liquidity * balance1) / _totalSupply;
        require(amount0 > 0 && amount1 > 0, "ESwap: INSUFFICIENT_LIQUIDITY_BURNED");
        _burn(address(this), liquidity);
        _safeTransfer(_token0, to, amount0);
        _safeTransfer(_token1, to, amount1);
        balance0 = IERC20Minimal(_token0).balanceOf(address(this));
        balance1 = IERC20Minimal(_token1).balanceOf(address(this));

        _update(balance0, balance1, _reserve0, _reserve1);
        if (feeOn) kLast = uint256(reserve0) * reserve1;
        emit Burn(msg.sender, amount0, amount1, to);
    }

    /// @notice Swap: the caller must have pre-paid `amount{0,1}In` (constant-product check).
    ///         Supports flash swaps via the `data` callback to `IEticaSwapCallee.eticaSwapCall`.
    function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data)
        external
        lock
    {
        require(amount0Out > 0 || amount1Out > 0, "ESwap: INSUFFICIENT_OUTPUT_AMOUNT");
        (uint112 _reserve0, uint112 _reserve1,) = getReserves();
        require(amount0Out < _reserve0 && amount1Out < _reserve1, "ESwap: INSUFFICIENT_LIQUIDITY");

        uint256 balance0;
        uint256 balance1;
        {
            address _token0 = token0;
            address _token1 = token1;
            require(to != _token0 && to != _token1, "ESwap: INVALID_TO");
            if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out);
            if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out);
            if (data.length > 0) {
                IEticaSwapCallee(to).eticaSwapCall(msg.sender, amount0Out, amount1Out, data);
            }
            balance0 = IERC20Minimal(_token0).balanceOf(address(this));
            balance1 = IERC20Minimal(_token1).balanceOf(address(this));
        }
        uint256 amount0In =
            balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
        uint256 amount1In =
            balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
        require(amount0In > 0 || amount1In > 0, "ESwap: INSUFFICIENT_INPUT_AMOUNT");
        {
            uint256 balance0Adjusted = balance0 * 1000 - amount0In * 3;
            uint256 balance1Adjusted = balance1 * 1000 - amount1In * 3;
            require(
                balance0Adjusted * balance1Adjusted >= uint256(_reserve0) * _reserve1 * (1000 ** 2),
                "ESwap: K"
            );
        }

        _update(balance0, balance1, _reserve0, _reserve1);
        emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
    }

    /// @notice Force balances to match reserves (sends excess to `to`).
    function skim(address to) external lock {
        address _token0 = token0;
        address _token1 = token1;
        _safeTransfer(_token0, to, IERC20Minimal(_token0).balanceOf(address(this)) - reserve0);
        _safeTransfer(_token1, to, IERC20Minimal(_token1).balanceOf(address(this)) - reserve1);
    }

    /// @notice Force reserves to match balances.
    function sync() external lock {
        _update(
            IERC20Minimal(token0).balanceOf(address(this)),
            IERC20Minimal(token1).balanceOf(address(this)),
            reserve0,
            reserve1
        );
    }
}
src/swap/interfaces/IERC20Minimal.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

interface IERC20Minimal {
    function balanceOf(address owner) external view returns (uint256);
    function totalSupply() external view returns (uint256);
    function transfer(address to, uint256 value) external returns (bool);
    function transferFrom(address from, address to, uint256 value) external returns (bool);
    function approve(address spender, uint256 value) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint256);
    function decimals() external view returns (uint8);
    function symbol() external view returns (string memory);
    function name() external view returns (string memory);
}
src/swap/interfaces/IEticaSwapCallee.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

/// @title Flash-swap callback.
/// @notice Contracts receiving flash swaps from a pair must implement this.
interface IEticaSwapCallee {
    function eticaSwapCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data)
        external;
}
src/swap/interfaces/IEticaSwapFactory.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

/// @title EticaSwap V2 factory interface
/// @notice Uniswap V2–compatible factory deploying CREATE2 pair contracts.
interface IEticaSwapFactory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint256);
    event TrustedCreatorSet(address indexed creator, bool trusted);
    event PairCreationFeeSet(uint256 fee);

    function etx() external view returns (address);
    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);
    function trustedCreators(address creator) external view returns (bool);
    function pairCreationFee() external view returns (uint256);

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

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

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
    function setTrustedCreator(address creator, bool trusted) external;
    function setPairCreationFee(uint256 fee) external;
}
src/swap/libraries/Math.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

library Math {
    function min(uint256 x, uint256 y) internal pure returns (uint256 z) {
        z = x < y ? x : y;
    }

    /// @notice Babylonian square root.
    function sqrt(uint256 y) internal pure returns (uint256 z) {
        if (y > 3) {
            z = y;
            uint256 x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }
}
src/swap/libraries/TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

/// @notice Safe transfer helpers that tolerate ERC20s that don't return a boolean.
library TransferHelper {
    function safeApprove(address token, address to, uint256 value) internal {
        (bool ok, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(ok && (data.length == 0 || abi.decode(data, (bool))), "TH: APPROVE_FAILED");
    }

    function safeTransfer(address token, address to, uint256 value) internal {
        (bool ok, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(ok && (data.length == 0 || abi.decode(data, (bool))), "TH: TRANSFER_FAILED");
    }

    function safeTransferFrom(address token, address from, address to, uint256 value) internal {
        (bool ok, bytes memory data) =
            token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(ok && (data.length == 0 || abi.decode(data, (bool))), "TH: TRANSFER_FROM_FAILED");
    }

    function safeTransferEGAZ(address to, uint256 value) internal {
        (bool ok,) = to.call{value: value}(new bytes(0));
        require(ok, "TH: EGAZ_TRANSFER_FAILED");
    }
}
src/swap/libraries/UQ112x112.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

/// @title UQ112x112 fixed-point
/// @notice Represents a range [0, 2^112 - 1] with a resolution of 1 / 2^112.
/// @dev Ported from Uniswap V2 core. Range-safe for reserves stored as uint112.
library UQ112x112 {
    uint224 internal constant Q112 = 2 ** 112;

    function encode(uint112 y) internal pure returns (uint224 z) {
        z = uint224(y) * Q112;
    }

    function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
        z = x / uint224(y);
    }
}
Contract ABI · 19 entries
[
  {
    "type": "constructor",
    "inputs": [
      {
        "name": "_feeToSetter",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "_etx",
        "type": "address",
        "internalType": "address"
      }
    ],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "DEFAULT_PAIR_CREATION_FEE",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "allPairs",
    "inputs": [
      {
        "name": "",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "outputs": [
      {
        "name": "",
        "type": "address",
        "internalType": "address"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "allPairsLength",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "createPair",
    "inputs": [
      {
        "name": "tokenA",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "tokenB",
        "type": "address",
        "internalType": "address"
      }
    ],
    "outputs": [
      {
        "name": "pair",
        "type": "address",
        "internalType": "address"
      }
    ],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "etx",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "address",
        "internalType": "address"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "feeTo",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "address",
        "internalType": "address"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "feeToSetter",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "address",
        "internalType": "address"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "getPair",
    "inputs": [
      {
        "name": "",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "",
        "type": "address",
        "internalType": "address"
      }
    ],
    "outputs": [
      {
        "name": "",
        "type": "address",
        "internalType": "address"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "pairCodeHash",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "bytes32",
        "internalType": "bytes32"
      }
    ],
    "stateMutability": "pure"
  },
  {
    "type": "function",
    "name": "pairCreationFee",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "setFeeTo",
    "inputs": [
      {
        "name": "_feeTo",
        "type": "address",
        "internalType": "address"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "setFeeToSetter",
    "inputs": [
      {
        "name": "_feeToSetter",
        "type": "address",
        "internalType": "address"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "setPairCreationFee",
    "inputs": [
      {
        "name": "fee",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "setTrustedCreator",
    "inputs": [
      {
        "name": "creator",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "trusted",
        "type": "bool",
        "internalType": "bool"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "trustedCreators",
    "inputs": [
      {
        "name": "",
        "type": "address",
        "internalType": "address"
      }
    ],
    "outputs": [
      {
        "name": "",
        "type": "bool",
        "internalType": "bool"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "event",
    "name": "PairCreated",
    "inputs": [
      {
        "name": "token0",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      },
      {
        "name": "token1",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      },
      {
        "name": "pair",
        "type": "address",
        "indexed": false,
        "internalType": "address"
      },
      {
        "name": "",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      }
    ],
    "anonymous": false
  },
  {
    "type": "event",
    "name": "PairCreationFeeSet",
    "inputs": [
      {
        "name": "fee",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      }
    ],
    "anonymous": false
  },
  {
    "type": "event",
    "name": "TrustedCreatorSet",
    "inputs": [
      {
        "name": "creator",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      },
      {
        "name": "trusted",
        "type": "bool",
        "indexed": false,
        "internalType": "bool"
      }
    ],
    "anonymous": false
  }
]

Verified 2026-04-22 against on-chain runtime bytecode. Cross-verify manifest on GitHub ↗

Contract

  • DEFAULT_PAIR_CREATION_FEE()

    No arguments.

    → uint256
  • allPairs(uint256)
    → address
  • allPairsLength()

    No arguments.

    → uint256
  • etx()

    No arguments.

    → address
  • feeTo()

    No arguments.

    → address
  • feeToSetter()

    No arguments.

    → address
  • getPair(address, address)
    → address
  • pairCodeHash()

    No arguments.

    → bytes32
  • pairCreationFee()

    No arguments.

    → uint256
  • trustedCreators(address)
    → bool

Calls go directly to the configured RPC (Etica Mainnet). Writes require a connected wallet on Etica Mainnet (chain ID 61803).

Recent transactions

last 200 blocks

No transactions involving this address in the last 200 blocks. Older activity lives in the public tx-log indexer and can be pulled from the on-chain archive.

Token transfers

recent

No ERC-20 Transfer events involving this address in the indexed window.