Tempo 稳定币及代币兑换操作。用于处理 pathUSD/USDC.e 余额、在 USDC.e 和 pathUSD 之间进行兑换,或执行任意兑换操作。
Use this skill for low-friction Tempo execution with Foundry ( cast) and Uniswap Trade API.
Use this SKILL.md alone. No other files are required.
If scripts are unavailable, run the command playbooks in this file directly.
chainId=4217)https://rpc.presto.tempo.xyzpathUSD: 0x20C0000000000000000000000000000000000000USDC.e: 0x20c000000000000000000000b9537d11c60e8b50TDOGE: 0x20C000000000000000000000d5d5815Ae71124d10x000000000022D473030F116dDEE9F6B43aC78BA3Check:
bash
command -v cast && cast --version
Install if missing:
bash
curl -L https://foundry.paradigm.xyz | bash
foundryup
pathUSD is Tempo-native infrastructure stablecoin used in routing/fees.USDC.e is bridged stablecoin liquidity.pathUSD transfers; leave fee headroom.cast, curl, jqPRIVATE_KEYUNISWAP_API_KEYRPC_URL (default above)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}"
bash
cast send 0x20C0000000000000000000000000000000000000 \
"transfer(address,uint256)" <TO> <AMOUNT_RAW> \
--private-key "$PRIVATE_KEY" --rpc-url "${RPC_URL:-https://rpc.presto.tempo.xyz}" --gas-limit 100000
bash
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":"<AMOUNT_IN_RAW>",
"tokenInChainId":4217,
"tokenOutChainId":4217,
"tokenIn":"<TOKEN_IN>",
"tokenOut":"<TOKEN_OUT>",
"swapper":"<WALLET>",
"slippageTolerance":2.5
}'
TOKEN_IN -> Permit2:bash
cast send <TOKEN_IN> "approve(address,uint256)" \
0x000000000022D473030F116dDEE9F6B43aC78BA3 \
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff \
--private-key "$PRIVATE_KEY" --rpc-url "${RPC_URL:-https://rpc.presto.tempo.xyz}" --gas-limit 900000
Permit2 -> spender (spender from quote permitData.values.spender):
bash
EXP=$(( $(date +%s) + 31536000 ))
cast send 0x000000000022D473030F116dDEE9F6B43aC78BA3 \
"approve(address,address,uint160,uint48)" \
<TOKEN_IN> <SPENDER> 1461501637330902918203684832716283019655932542975 "$EXP" \
--private-key "$PRIVATE_KEY" --rpc-url "${RPC_URL:-https://rpc.presto.tempo.xyz}" --gas-limit 900000
POST /v1/swap with { "quote": <quote_object> }), then simulate:bash
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":"<WALLET>","to":"<SWAP_TO>","data":"<SWAP_DATA>"},"latest"]}'
bash
cast send <SWAP_TO> "<SWAP_DATA>" \
--private-key "$PRIVATE_KEY" \
--rpc-url "${RPC_URL:-https://rpc.presto.tempo.xyz}" \
--gas-limit <GAS_LIMIT> --gas-price <MAX_FEE_PER_GAS>
AllowanceExpired(...): set Permit2 allowance for token+spender.InsufficientAllowance: approve token to Permit2.pathUSD transfer fails: leave fee headroom.If available, use:
bash
scripts/uniswap_exact_input_swap.sh --token-in <TOKEN_IN> --token-out <TOKEN_OUT> --amount-in <RAW_AMOUNT>