运行时依赖
安装命令
点击复制技能文档
Tempo Stable + Uniswap Swaps 使用此技能以Foundry(cast)和Uniswap Trade API实现低摩擦的Tempo执行。 单文件模式(Clawhub友好) 仅使用此SKILL.md文件。无需其他文件。如果脚本不可用,请直接在此文件中运行playbooks命令。 网络 + 代币 链:Tempo主网(chainId=4217) RPC:https://rpc.presto.tempo.xyz pathUSD:0x20C0000000000000000000000000000000000000 USDC.e:0x20c000000000000000000000b9537d11c60e8b50 TDOGE:0x20C000000000000000000000d5d5815Ae71124d1 Permit2:0x000000000022D473030F116dDEE9F6B43aC78BA3 Foundry预检(必需) 检查:command -v cast && cast --version 如果缺失,请安装:curl -L https://foundry.paradigm.xyz | bash foundryup pathUSD与USDC.e pathUSD是Tempo原生基础设施稳定币,用于路由/费用。 USDC.e是桥接稳定币流动性。 不要尝试进行精确的全余额pathUSD转账;请留出费用头寸。 所需工具 + 环境 工具:cast、curl、jq 环境:PRIVATE_KEY、UNISWAP_API_KEY 可选:RPC_URL(默认上述) 快速余额检查 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 cast send 0x20C0000000000000000000000000000000000000 \ "transfer(address,uint256)" \ --private-key "$PRIVATE_KEY" --rpc-url "${RPC_URL:-https://rpc.presto.tempo.xyz}" --gas-limit 100000 在Tempo上通过Uniswap(精确输入)交换任何代币 报价:curl -sS https://trade-api.gateway.uniswap.org/v1/quote \ -H 'content-type: application/json' \ -H "x-api-key: $UNISWAP_API_KEY" \ --data '{ "type":"EXACT_INPUT", "amount":"", "tokenInChainId":4217, "tokenOutChainId":4217, "tokenIn":"", "tokenOut":"", "swapper":"", "slippageTolerance":2.5 }' 确保批准: TOKEN_IN -> Permit2:cast send "approve(address,uint256)" \ 0x000000000022D473030F116dDEE9F6B43aC78BA3 \ 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff \ --private-key "$PRIVATE_KEY" --rpc-url "${RPC_URL:-https://rpc.presto.tempo.xyz}" --gas-limit 900000 Permit2 -> spender(spender来自quote permitData.values.spender): EXP=$(( $(date +%s) + 31536000 )) cast send 0x000000000022D473030F116dDEE9F6B43aC78BA3 \ "approve(address,address,uint160,uint48)" \ 1461501637330902918203684832716283019655932542975 "$EXP" \ --private-key "$PRIVATE_KEY" --rpc-url "${RPC_URL:-https://rpc.presto.tempo.xyz}" --gas-limit 900000 从报价对象构建交换交易(POST /v1/swap with { "quote": }),然后模拟: curl -s "${RPC_URL:-https://rpc.presto.tempo.xyz}" -H 'content-type: application/json' --data \ '{"jsonrpc":"2.0","id":1,"method":"eth_call","params":[{"from":"","to":"","data":""},"latest"]}' 广播: cast send "" \ --private-key "$PRIVATE_KEY" \ --rpc-url "${RPC_URL:-https://rpc.presto.tempo.xyz}" \ --gas-limit --gas-price 已知错误 AllowanceExpired(...):为token+spender设置Permit2批准。 InsufficientAllowance:批准token到Permit2。 报价存在但交换回滚:刷新报价并重试。 pathUSD转账失败:留出费用头寸。 可选脚本 如果可用,请使用:scripts/uniswap_exact_input_swap.sh --token-in --token-out --amount-in