返回顶部
t

tempo-stable-uniswap-swapsTempo稳定币交换

Tempo stablecoin and token swap operations for agents. Use when working with pathUSD/USDC.e balances, swapping between USDC.e and pathUSD, or executing any-token swaps via Uniswap on Tempo with quote, Permit2 approvals, simulation, and broadcast.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
151
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

tempo-stable-uniswap-swaps

Tempo Stable + Uniswap 交换

使用此技能通过 Foundry(cast)和 Uniswap Trade API 实现低摩擦的 Tempo 执行。

单文件模式(Clawhub 友好)

仅使用此 SKILL.md 文件,无需其他文件。

如果脚本不可用,请直接运行此文件中的命令操作手册。

网络 + 代币

  • - 链:Tempo 主网(chainId=4217)
  • RPC:https://rpc.presto.tempo.xyz
  • pathUSD:0x20C0000000000000000000000000000000000000
  • USDC.e:0x20c000000000000000000000b9537d11c60e8b50
  • TDOGE:0x20C000000000000000000000d5d5815Ae71124d1
  • Permit2:0x000000000022D473030F116dDEE9F6B43aC78BA3

Foundry 前置检查(必需)

检查:

bash
command -v cast && cast --version

如果缺失则安装:

bash
curl -L https://foundry.paradigm.xyz | bash
foundryup

pathUSD 与 USDC.e

  • - pathUSD 是 Tempo 原生基础设施稳定币,用于路由/费用。
  • USDC.e 是桥接的稳定币流动性。
  • 不要尝试精确的全额 pathUSD 转账;保留费用余量。

所需工具 + 环境变量

  • - 工具:cast、curl、jq
  • 环境变量:
- PRIVATE_KEY - UNISWAPAPIKEY - 可选:RPC_URL(默认为上述地址)

快速余额查询

bash
WALLET=$(cast wallet address --private-key $PRIVATE_KEY)
cast call 0x20C0000000000000000000000000000000000000 \
balanceOf(address)(uint256) $WALLET --rpc-url ${RPC_URL:-https://rpc.presto.tempo.xyz}
cast call 0x20c000000000000000000000b9537d11c60e8b50 \
balanceOf(address)(uint256) $WALLET --rpc-url ${RPC_URL:-https://rpc.presto.tempo.xyz}

转账 pathUSD

bash
cast send 0x20C0000000000000000000000000000000000000 \
transfer(address,uint256) \
--private-key $PRIVATEKEY --rpc-url ${RPCURL:-https://rpc.presto.tempo.xyz} --gas-limit 100000

通过 Uniswap 在 Tempo 上交换任意代币(精确输入)

  1. 1. 报价:

bash
curl -sS https://trade-api.gateway.uniswap.org/v1/quote \
-H content-type: application/json \
-H x-api-key: $UNISWAPAPIKEY \
--data {
type:EXACT_INPUT,
amount:INRAW>,
tokenInChainId:4217,
tokenOutChainId:4217,
tokenIn:,
tokenOut:,
swapper:,
slippageTolerance:2.5
}

  1. 2. 确保授权:
TOKEN_IN -> Permit2:

bash
cast send approve(address,uint256) \
0x000000000022D473030F116dDEE9F6B43aC78BA3 \
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff \
--private-key $PRIVATEKEY --rpc-url ${RPCURL:-https://rpc.presto.tempo.xyz} --gas-limit 900000

Permit2 -> spender(spender 来自报价的 permitData.values.spender):

bash
EXP=$(( $(date +%s) + 31536000 ))
cast send 0x000000000022D473030F116dDEE9F6B43aC78BA3 \
approve(address,address,uint160,uint48) \
1461501637330902918203684832716283019655932542975 $EXP \
--private-key $PRIVATEKEY --rpc-url ${RPCURL:-https://rpc.presto.tempo.xyz} --gas-limit 900000

  1. 3. 从报价对象构建交换交易(POST /v1/swap,参数为 { quote: }),然后模拟:

bash
curl -s ${RPC_URL:-https://rpc.presto.tempo.xyz} -H content-type: application/json --data \
{jsonrpc:2.0,id:1,method:ethcall,params:[{from:,to:TO>,data:},latest]}

  1. 4. 广播:

bash
cast send TO> DATA> \
--private-key $PRIVATE_KEY \
--rpc-url ${RPC_URL:-https://rpc.presto.tempo.xyz} \
--gas-limit LIMIT> --gas-price FEEPERGAS>

已知错误

  • - AllowanceExpired(...):为代币+spender 设置 Permit2 授权。
  • InsufficientAllowance:向 Permit2 授权代币。
  • 报价存在但交换回滚:刷新报价并重试。
  • 全额 pathUSD 转账失败:保留费用余量。

可选脚本

如果可用,请使用:

bash
scripts/uniswapexactinputswap.sh --token-in IN> --token-out OUT> --amount-in AMOUNT>

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 tempo-stable-uniswap-swaps-1776079021 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 tempo-stable-uniswap-swaps-1776079021 技能

通过命令行安装

skillhub install tempo-stable-uniswap-swaps-1776079021

下载

⬇ 下载 tempo-stable-uniswap-swaps v1.0.0(免费)

文件大小: 2.47 KB | 发布时间: 2026-4-17 16:19

v1.0.0 最新 2026-4-17 16:19
- Initial release of tempo-stable-uniswap-swaps.
- Provides step-by-step instructions for swapping tokens (including pathUSD and USDC.e) via Uniswap on Tempo mainnet.
- Includes commands for balance checks, token transfers, Permit2 approvals, quoting, simulation, and broadcasting swaps.
- No external dependencies required beyond standard tools (`cast`, `curl`, `jq`).
- Outlines network and token specifics for Tempo, with caution for fee headroom on pathUSD transfers.
- Documents common error cases and resolutions.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large