Skip to content

Paxeer Network

The SwapFacet executes token swaps using the sigmoid bonding curve with progressive fee calculation.

Functions

swap

Execute a swap against a pool.

solidity
function swap(SwapParams calldata params) external returns (SwapResult memory result)

Parameters (SwapParams):

NameTypeDescription
poolIdbytes32The pool to swap against
zeroForOnebooltrue = sell token0 for token1, false = reverse
amountSpecifiedint256Positive = exact input, negative = exact output
sqrtPriceLimitX96uint160Price limit (0 = no limit)
recipientaddressAddress to receive output tokens
deadlineuint256Transaction deadline (unix timestamp)

Returns (SwapResult):

FieldTypeDescription
amount0int256Token0 delta (negative = sent to user)
amount1int256Token1 delta (negative = sent to user)
sqrtPriceX96Afteruint160Price after swap
tickAfterint24Tick after swap
liquidityAfteruint128Active liquidity after swap
feeAmountuint256Total fee charged

Events: Swap, SwapExecuted (via EventEmitter)

Reverts:

  • "SwapFacet: expired" - block.timestamp > deadline
  • "SwapFacet: pool not initialized"
  • "SwapFacet: zero amount"
  • "SwapFacet: price limit reached"

Swap Mechanics

  1. The swap engine iterates through ticks, computing output amounts using the sigmoid curve
  2. At each step, the progressive fee is calculated: fee = baseFee + impactFee * (stepSize/liquidity)^2
  3. Fees are split: 70% LP, 20% protocol, 10% trader rebate pool
  4. Oracle observations are recorded for TWAP
  5. EventEmitter is notified with full before/after state

License

Licensed under the GNU General Public License v3.0--see LICENSE for terms.

Copyright (C) 2026 PaxLabs Inc.
SPDX-License-Identifier: GPL-3.0-only

Contact & Resources

ResourceLink
Protocol Documentationdocs.hyperpaxeer.com
Block Explorerpaxscan.paxeer.app
Sidiora Exchangeapp.hyperpaxeer.com
Websitepaxeer.app
Twitter/X@paxeer_app
General Inquiriesinfopaxeer@paxeer.app
Security Reportssecurity@paxeer.app

Released under the GPL-3.0 License.