1inch
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese1inch DEX Aggregator
1inch DEX聚合器
Swap tokens on EVM networks using the 1inch DEX aggregator. 1inch finds the best swap route across DEXes (Uniswap, SushiSwap, Curve, Balancer, etc.) to get the best price. This is Classic Swap mode where the user pays gas directly.
Supported Networks: Ethereum, Arbitrum, Base, Optimism, Polygon, BSC, Avalanche, Gnosis.
IMPORTANT: All tools require a parameter. Always ask the user which network they want to use before proceeding. Do not assume a default chain.
chainDefault for spot token swaps. Use 1inch for buying/selling/swapping tokens. 1inch aggregates liquidity across all major DEXes to get the best price. Hyperliquid spot is only for tokens listed on Hyperliquid's own orderbook — for general spot trading across chains.
在EVM网络上使用1inch DEX聚合器进行代币兑换。1inch会在各DEX(Uniswap、SushiSwap、Curve、Balancer等)中寻找最优兑换路径,以获取最优惠价格。这是经典兑换模式,用户需要直接支付gas费用。
**支持的网络:**Ethereum、Arbitrum、Base、Optimism、Polygon、BSC、Avalanche、Gnosis。
**重要提示:**所有工具都需要参数。在操作前务必询问用户要使用的网络,不要默认任何网络。
chain现货代币兑换的默认选择。使用1inch进行代币的买入/卖出/兑换。1inch聚合了所有主流DEX的流动性以获取最优价格。Hyperliquid现货仅适用于Hyperliquid自有订单簿上列出的代币——若要在多链间进行通用现货交易,请使用1inch。
Prerequisites — Wallet Policy
前置条件——钱包策略
Before executing any swap, the wallet policy must be active. Load the wallet-policy skill and propose the standard wildcard policy (deny key export + allow ). This covers all 1inch operations — swap transactions, token approvals, and signing — across all chains.
*在执行任何兑换操作前,钱包策略必须处于激活状态。加载wallet-policy技能并提议标准通配符策略(禁止密钥导出 + 允许)。该策略适用于所有1inch操作——跨所有网络的兑换交易、代币授权和签名。
*Available Tools (8)
可用工具(8个)
Same-Chain Read-Only Tools
同链只读工具
| Tool | Description |
|---|---|
| Get swap price quote (estimated output, gas, route). Requires |
| Search supported tokens on a network (address, symbol, decimals). Requires |
| Check if a token needs approval before swapping. Requires |
| 工具 | 描述 |
|---|---|
| 获取兑换价格报价(预估输出金额、gas费用、路径)。需要 |
| 搜索某一网络上支持的代币(地址、符号、小数位数)。需要 |
| 检查代币在兑换前是否需要授权。需要 |
Same-Chain Write Tools (require wallet)
同链写入工具(需要钱包)
| Tool | Description |
|---|---|
| Approve ERC-20 token for 1inch router spending. Requires |
| Execute a token swap via 1inch. Requires |
| 工具 | 描述 |
|---|---|
| 授权ERC-20代币给1inch路由合约使用。需要 |
| 通过1inch执行代币兑换。需要 |
Cross-Chain Tools (Fusion+)
跨链工具(Fusion+)
Fusion+ enables gasless cross-chain swaps using intent-based atomic swaps. Resolvers handle gas on both chains.
| Tool | Description |
|---|---|
| Get a cross-chain swap quote. Requires |
| Execute a cross-chain swap (long-running). Requires |
| Check status of a cross-chain swap order. Requires |
Fusion+通过基于意图的原子兑换实现无gas跨链兑换。Resolver会处理两条链上的gas费用。
| 工具 | 描述 |
|---|---|
| 获取跨链兑换报价。需要 |
| 执行跨链兑换(耗时较长)。需要 |
| 检查跨链兑换订单的状态。需要 |
Tool Usage Examples
工具使用示例
Get a quote (price check only)
获取报价(仅价格查询)
oneinch_quote(
chain="arbitrum",
src="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", # ETH
dst="<USDC_ADDRESS>", # use oneinch_tokens to find
amount="1000000000000000000" # 1 ETH in wei
)oneinch_quote(
chain="arbitrum",
src="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", # ETH
dst="<USDC_ADDRESS>", # 使用oneinch_tokens查找
amount="1000000000000000000" # 1 ETH(以wei为单位)
)Search for a token
搜索代币
oneinch_tokens(chain="ethereum", search="USDC")oneinch_tokens(chain="ethereum", search="USDC")Check if approval is needed
检查是否需要授权
oneinch_check_allowance(chain="arbitrum", token_address="<TOKEN_ADDRESS>")oneinch_check_allowance(chain="arbitrum", token_address="<TOKEN_ADDRESS>")Approve a token
授权代币
oneinch_approve(chain="arbitrum", token_address="<TOKEN_ADDRESS>")oneinch_approve(chain="arbitrum", token_address="<TOKEN_ADDRESS>")Execute a swap
执行兑换
oneinch_swap(
chain="arbitrum",
src="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", # ETH
dst="<USDC_ADDRESS>", # use oneinch_tokens to find
amount="1000000000000000000", # 1 ETH
slippage=1.0 # 1% slippage
)oneinch_swap(
chain="arbitrum",
src="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", # ETH
dst="<USDC_ADDRESS>", # 使用oneinch_tokens查找
amount="1000000000000000000", # 1 ETH
slippage=1.0 # 1%滑点
)Cross-Chain: Get a quote
跨链操作:获取报价
oneinch_cross_chain_quote(
src_chain="ethereum",
dst_chain="arbitrum",
src_token="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", # ETH on Ethereum
dst_token="<USDC_ADDRESS>", # USDC on Arbitrum
amount="1000000000000000000" # 1 ETH in wei
)oneinch_cross_chain_quote(
src_chain="ethereum",
dst_chain="arbitrum",
src_token="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", # Ethereum上的ETH
dst_token="<USDC_ADDRESS>", # Arbitrum上的USDC
amount="1000000000000000000" # 1 ETH(以wei为单位)
)Cross-Chain: Execute a swap (recommend background task)
跨链操作:执行兑换(建议后台任务运行)
sessions_spawn(
message="Execute cross-chain swap: oneinch_cross_chain_swap(src_chain='ethereum', dst_chain='arbitrum', src_token='0xEeee...EEeE', dst_token='<USDC_ADDR>', amount='1000000000000000000', preset='medium')"
)sessions_spawn(
message="Execute cross-chain swap: oneinch_cross_chain_swap(src_chain='ethereum', dst_chain='arbitrum', src_token='0xEeee...EEeE', dst_token='<USDC_ADDR>', amount='1000000000000000000', preset='medium')"
)Cross-Chain: Check order status
跨链操作:检查订单状态
oneinch_cross_chain_status(order_hash="<ORDER_HASH>")oneinch_cross_chain_status(order_hash="<ORDER_HASH>")Common Workflows
常见工作流
Step 0 for all workflows: If the wallet policy is not yet active, load the wallet-policy skill and propose the standard wildcard policy before proceeding.
**所有工作流的第0步:**如果钱包策略尚未激活,请先加载wallet-policy技能并提议标准通配符策略,然后再进行后续操作。
Swap native ETH for USDC (no approval needed)
用原生ETH兑换USDC(无需授权)
- Find token address: — get the USDC address on Arbitrum
oneinch_tokens(chain="arbitrum", search="USDC") - Quote:
oneinch_quote(chain="arbitrum", src="0xEeee...EEeE", dst="<USDC_ADDR>", amount="1000000000000000000") - Swap:
oneinch_swap(chain="arbitrum", src="0xEeee...EEeE", dst="<USDC_ADDR>", amount="1000000000000000000")
Native ETH does not require token approval.
- 查找代币地址:——获取Arbitrum上的USDC地址
oneinch_tokens(chain="arbitrum", search="USDC") - 获取报价:
oneinch_quote(chain="arbitrum", src="0xEeee...EEeE", dst="<USDC_ADDR>", amount="1000000000000000000") - 执行兑换:
oneinch_swap(chain="arbitrum", src="0xEeee...EEeE", dst="<USDC_ADDR>", amount="1000000000000000000")
原生ETH无需代币授权。
Swap USDC for WETH (approval required)
用USDC兑换WETH(需要授权)
- Find token addresses: and
oneinch_tokens(chain="arbitrum", search="USDC")oneinch_tokens(chain="arbitrum", search="WETH") - Check allowance:
oneinch_check_allowance(chain="arbitrum", token_address="<USDC_ADDR>") - If needs_approval:
oneinch_approve(chain="arbitrum", token_address="<USDC_ADDR>") - Swap:
oneinch_swap(chain="arbitrum", src="<USDC_ADDR>", dst="<WETH_ADDR>", amount="1000000", slippage=1.0)
- 查找代币地址:和
oneinch_tokens(chain="arbitrum", search="USDC")oneinch_tokens(chain="arbitrum", search="WETH") - 检查授权额度:
oneinch_check_allowance(chain="arbitrum", token_address="<USDC_ADDR>") - 若需要授权:
oneinch_approve(chain="arbitrum", token_address="<USDC_ADDR>") - 执行兑换:
oneinch_swap(chain="arbitrum", src="<USDC_ADDR>", dst="<WETH_ADDR>", amount="1000000", slippage=1.0)
Price check only (no execution)
仅价格查询(不执行兑换)
Use to compare prices without executing. This does not require a wallet.
oneinch_quote使用比较价格,无需执行兑换操作,此操作不需要钱包。
oneinch_quoteToken Addresses
代币地址
Token addresses differ between networks. Always use to discover the correct address for a token on a specific chain.
oneinch_tokens(chain="<network>", search="<symbol>")The native gas token address is the same on all EVM chains:
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE不同网络上的代币地址不同。请始终使用来查找特定链上代币的正确地址。
oneinch_tokens(chain="<network>", search="<symbol>")原生gas代币的地址在所有EVM链上都是相同的:
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeEAmount Formatting (Wei Conversion)
金额格式(Wei转换)
All amounts must be in wei (the smallest unit of the token):
| Token | 1 Token in Wei | Formula |
|---|---|---|
| ETH (18 decimals) | | amount × 10^18 |
| USDC (6 decimals) | | amount × 10^6 |
| USDT (6 decimals) | | amount × 10^6 |
Always check token decimals with before calculating amounts.
oneinch_tokens所有金额必须以wei为单位(代币的最小单位):
| 代币 | 1个代币对应的Wei值 | 计算公式 |
|---|---|---|
| ETH(18位小数) | | 金额 × 10^18 |
| USDC(6位小数) | | 金额 × 10^6 |
| USDT(6位小数) | | 金额 × 10^6 |
在计算金额前,请务必使用检查代币的小数位数。
oneinch_tokensError Handling
错误处理
| Error | Cause | Solution |
|---|---|---|
| Invalid chain name | Use one of: ethereum, arbitrum, base, optimism, polygon, bsc, avalanche, gnosis |
| Token not approved for 1inch router | Use |
| Not enough tokens in wallet | Check balance with |
| Route not found or amount too small | Try a different amount or token pair |
| Wallet policy blocks the transaction | Load the wallet-policy skill and propose the standard wildcard policy (deny key export + allow |
| Too many API calls (1 RPS free tier) | Wait a moment and retry |
| 错误 | 原因 | 解决方案 |
|---|---|---|
| 无效的网络名称 | 使用以下网络之一:ethereum、arbitrum、base、optimism、polygon、bsc、avalanche、gnosis |
| 代币未授权给1inch路由合约 | 先使用 |
| 钱包中的代币余额不足 | 使用 |
| 未找到兑换路径或金额过小 | 尝试更换金额或代币对 |
| 钱包策略阻止了交易 | 加载wallet-policy技能并提议标准通配符策略(禁止密钥导出 + 允许 |
| API调用过于频繁(免费 tier 限制为1次/秒) | 稍等片刻后重试 |
Wallet Policy
钱包策略
For 1inch swaps to work, the wallet policy must be active. Use the standard wildcard policy (deny key export + allow ) — see Prerequisites section above.
*要使1inch兑换正常工作,钱包策略必须处于激活状态。请使用标准通配符策略(禁止密钥导出 + 允许)——详见上方的前置条件部分。
*