Skip to content

peaqnetwork/peaq-liquidity-pools-swap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

MachineX Swap (JavaScript / ethers.js)

Perform a single-pool swap on MachineX (peaq EVM) using the SwapRouter exactInputSingle flow in JavaScript with ethers.js v6.

This README includes:

  • Pool discovery via Factory getPool()
  • TickSpacing handling (required by router)
  • Basic output estimate + slippage-based amountOutMinimum
  • ERC-20 approval
  • Executing the swap

⚠️ Important: The slot0-based estimate is a rough quote (does not account for price impact, fees, or tick crossings). For production quoting, use an official Quoter/SDK if available.


Requirements

  • Node.js 18+
  • ethers v6
  • An EVM private key funded with the input token (e.g., WPEAQ, USDC, USDT, etc.)
  • Native PEAQ for gas

Install deps:

npm i ethers dotenv

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors