QELT DEX Skill (Uniswap v4)
QELT Mainnet hosts a fully deployed and verified Uniswap v4 instance. All 7 contracts are verified on QELTScan. Only Uniswap V4 is supported — V2/V3 calls route to UnsupportedProtocol and revert.
Network: QELT Mainnet · Chain ID 770
RPC: INLINECODE2
Safety
- - Never request or handle private keys. Write operations require a pre-signed raw transaction.
- Swaps and liquidity changes are irreversible — confirm parameters with the user first.
- Always apply slippage protection (minimum 1% tolerance on
amountOutMin). - QELT only supports Uniswap V4. V2/V3 calls will revert.
- WQELT is the required ERC-20 wrapper for native QELT when trading on the DEX.
Contract Addresses (Mainnet, Chain ID 770)
| Contract | Address | Role |
|---|
| INLINECODE4 | INLINECODE5 | Core — manages all pools |
| INLINECODE6 |
0x7d5AbaDb17733963a3e14cF8fB256Ee08df9d68A | Swap routing + aggregation |
|
PositionManager |
0x1809116b4230794c823b1b17d46c74076e90d035 | Liquidity positions as NFTs |
|
Permit2 |
0x403cf2852cf448b5de36e865c5736a7fb7b25ea2 | Gasless approvals |
|
WQELT |
0xfebc6f9f0149036006c4f5ac124685e0ef48e8a2 | Wrapped QELT (ERC-20) |
|
PositionDescriptor |
0x9bb9a0bac572ac1740eeadbedb97cddb497c57f0 | NFT metadata |
|
UnsupportedProtocol |
0xe4F095537EB1b0dd9C244e827B3E35171d5c2A6E | V2/V3 stub (reverts) |
Procedure
Query Contract Addresses
Return the table above from memory — no RPC call needed.
Check WQELT Balance
CODEBLOCK0
Divide hex result by 10^18 for WQELT balance.
Query Pool State
Pool state requires two eth_calls to PoolManager using ABI-encoded getSlot0(bytes32) and getLiquidity(bytes32).
Pool ID = INLINECODE22
CODEBLOCK1
Slot0 decode: sqrtPriceX96 (current price), tick (current tick), lpFee (0.3% = 3000).
Wrap QELT → WQELT
⚠️ Write operation — confirm with user. Requires pre-signed tx calling deposit() on WQELT with value = amount_wei.
CODEBLOCK2
WQELT deposit() selector: 0xd0e30db0 · withdraw(uint256) selector: INLINECODE31
Token Swap via UniversalRouter
⚠️ Write operation — confirm with user. Requires pre-signed tx via UniversalRouter.execute(commands, inputs, deadline).
Flow: Approve token → Permit2 → Permit2 approve → UniversalRouter → encode V4_SWAP_EXACT_IN command → call execute.
Pool Key Structure
CODEBLOCK3
Common fee tiers:
| Fee | % | Tick Spacing | Use Case |
|---|
| 100 | 0.01% | 1 | Stablecoin pairs |
| 500 |
0.05% | 10 | Correlated assets |
| 3000 | 0.30% | 60 | Most pairs |
| 10000 | 1.00% | 200 | Volatile/exotic |
WQELT Token
- - Address: INLINECODE35
- Ratio: 1 WQELT = 1 QELT (always, no fee)
- Wrap: Call
deposit() with ETH value = QELT amount - Unwrap: Call
withdraw(uint256 amount) to recover native QELT
UniversalRouter Config
CODEBLOCK4
Common Errors
| Error | Cause | Fix |
|---|
| INLINECODE38 | V2/V3 call attempted | Use V4 path only |
| Slippage exceeded |
Price moved | Increase
amountOutMin tolerance |
| Deadline exceeded | Slow broadcast | Use
now + 1800 seconds |
| Permit2 signature expired | Approval timeout | Re-sign with fresh deadline |
技能名称: QELT DEX
详细描述:
QELT DEX 技能 (Uniswap v4)
QELT 主网已完整部署并验证了一个 Uniswap v4 实例。所有 7 个合约均在 QELTScan 上通过验证。仅支持 Uniswap V4——V2/V3 调用将路由至 UnsupportedProtocol 并回退。
网络: QELT 主网 · 链 ID 770
RPC: https://mainnet.qelt.ai
安全
- - 绝不请求或处理私钥。写操作需要预签名的原始交易。
- 兑换和流动性变更不可逆——请先与用户确认参数。
- 始终应用滑点保护(amountOutMin 至少 1% 容差)。
- QELT 仅支持 Uniswap V4。V2/V3 调用将回退。
- 在 DEX 上交易时,WQELT 是原生 QELT 所需的 ERC-20 封装代币。
合约地址(主网,链 ID 770)
| 合约 | 地址 | 角色 |
|---|
| PoolManager | 0x11c23891d9f723c4f1c6560f892e4581d87b6d8a | 核心——管理所有池 |
| UniversalRouter |
0x7d5AbaDb17733963a3e14cF8fB256Ee08df9d68A | 兑换路由 + 聚合 |
| PositionManager | 0x1809116b4230794c823b1b17d46c74076e90d035 | 流动性头寸作为 NFT |
| Permit2 | 0x403cf2852cf448b5de36e865c5736a7fb7b25ea2 | 无 Gas 授权 |
| WQELT | 0xfebc6f9f0149036006c4f5ac124685e0ef48e8a2 | 封装 QELT (ERC-20) |
| PositionDescriptor | 0x9bb9a0bac572ac1740eeadbedb97cddb497c57f0 | NFT 元数据 |
| UnsupportedProtocol | 0xe4F095537EB1b0dd9C244e827B3E35171d5c2A6E | V2/V3 存根(回退) |
操作流程
查询合约地址
从内存中返回上表——无需 RPC 调用。
检查 WQELT 余额
bash
WQELT=0xfebc6f9f0149036006c4f5ac124685e0ef48e8a2
ADDR 必须为 40 个十六进制字符,不含 0x 前缀,左侧用零填充至 32 字节
示例:地址 0xAbCd...1234 → ADDR=abcd...1234(40 个字符,无 0x)
ADDR=USER
ADDRESS40
HEXCHARS
NO0x_PREFIX
balanceOf(address) 选择器:0x70a08231
curl -fsSL -X POST https://mainnet.qelt.ai \
-H Content-Type: application/json \
-d {\jsonrpc\:\2.0\,\method\:\eth_call\,\params\:[{\to\:\$WQELT\,\data\:\0x70a08231000000000000000000000000$ADDR\},\latest\],\id\:1}
将十六进制结果除以 10^18 得到 WQELT 余额。
查询池状态
池状态需要对 PoolManager 进行两次 eth_call,使用 ABI 编码的 getSlot0(bytes32) 和 getLiquidity(bytes32)。
池 ID = keccak256(abi.encode(currency0, currency1, fee, tickSpacing, hooks))
bash
POOL_MANAGER=0x11c23891d9f723c4f1c6560f892e4581d87b6d8a
getSlot0(bytes32 poolId) — 返回 sqrtPriceX96, tick, protocolFee, lpFee
curl -fsSL -X POST https://mainnet.qelt.ai \
-H Content-Type: application/json \
-d {\jsonrpc\:\2.0\,\method\:\eth
call\,\params\:[{\to\:\$POOLMANAGER\,\data\:\0x
ENCODEDgetSlot0_POOLID>\},\latest\],\id\:1}
Slot0 解码: sqrtPriceX96(当前价格),tick(当前刻度),lpFee(0.3% = 3000)。
封装 QELT → WQELT
⚠️ 写操作——请与用户确认。需要预签名交易,调用 WQELT 上的 deposit(),value = amount_wei。
bash
提交预签名交易
curl -fsSL -X POST https://mainnet.qelt.ai \
-H Content-Type: application/json \
-d {jsonrpc:2.0,method:ethsendRawTransaction,params:[0xSIGNEDTX_HEX],id:1}
WQELT deposit() 选择器:0xd0e30db0 · withdraw(uint256) 选择器:0x2e1a7d4d
通过 UniversalRouter 进行代币兑换
⚠️ 写操作——请与用户确认。需要预签名交易,通过 UniversalRouter.execute(commands, inputs, deadline)。
流程:授权代币 → Permit2 → Permit2 授权 → UniversalRouter → 编码 V4SWAPEXACT_IN 命令 → 调用 execute。
池键结构
PoolKey {
currency0: address // 较低地址(原生 QELT 为 address(0))
currency1: address // 较高地址
fee: uint24 // 3000 = 0.3%, 500 = 0.05%, 10000 = 1%
tickSpacing: int24 // 0.3% 费率层级为 60
hooks: address // 无钩子时为 address(0)
}
常见费率层级:
| 费率 | 百分比 | 刻度间距 | 使用场景 |
|---|
| 100 | 0.01% | 1 | 稳定币对 |
| 500 |
0.05% | 10 | 相关资产 |
| 3000 | 0.30% | 60 | 大多数交易对 |
| 10000 | 1.00% | 200 | 波动/小众资产 |
WQELT 代币
- - 地址: 0xfebc6f9f0149036006c4f5ac124685e0ef48e8a2
- 比率: 1 WQELT = 1 QELT(始终如此,无费用)
- 封装: 调用 deposit(),ETH 值 = QELT 数量
- 解封装: 调用 withdraw(uint256 amount) 以恢复原生 QELT
UniversalRouter 配置
javascript
{
permit2: 0x403cF2852Cf448b5DE36e865c5736A7Fb7B25Ea2,
weth9: 0xfEbC6f9F0149036006C4F5Ac124685E0EF48e8A2, // WQELT
v4PoolManager: 0x11C23891d9F723c4F1c6560f892E4581D87B6d8a,
v4PositionManager: 0x1809116b4230794C823B1b17d46c74076e90D035,
// V2/V3 地址均指向 UnsupportedProtocol:
v2Factory: 0xe4F095537EB1b0dd9C244e827B3E35171d5c2A6E,
v3Factory: 0xe4F095537EB1b0dd9C244e827B3E35171d5c2A6E,
}
常见错误
| 错误 | 原因 | 修复 |
|---|
| UnsupportedProtocol | 尝试 V2/V3 调用 | 仅使用 V4 路径 |
| 滑点超出 |
价格变动 |