Skip to content

Latest commit

 

History

History
151 lines (104 loc) · 3.77 KB

File metadata and controls

151 lines (104 loc) · 3.77 KB

Interact with the Chain

All examples use Foundry cast. Install the Tempo fork for full feature support:

foundryup -n tempo

Standard Foundry works for basic queries and transfers. The Tempo fork adds batch-send, --tempo.fee-token, expiring nonces, and fee sponsorship.

Endpoints

Service URL
RPC (load-balanced) http://localhost (Traefik, port 80)
RPC (direct rpc-0) http://localhost:8545
Faucet http://localhost:8546
export RPC=http://localhost:8545
export FAUCET=http://localhost:8546
export PATHUSD=0x20c0000000000000000000000000000000000000

1. Create test wallets

cast wallet new   # → Alice
cast wallet new   # → Bob
export ALICE=0x...
export ALICE_PK=0x...
export BOB=0x...

2. Fund via faucet

The faucet mints pathUSD (6 decimals) to any address:

cast rpc tempo_fundAddress $ALICE --rpc-url $FAUCET

Or with curl:

curl -s -X POST $FAUCET \
  -H "Content-Type: application/json" \
  -d "{\"jsonrpc\":\"2.0\",\"method\":\"tempo_fundAddress\",\"params\":[\"$ALICE\"],\"id\":1}"

3. Check balance

On Tempo there is no native gas token — eth_getBalance returns a sentinel value. Read real balances via the TIP-20 contract:

cast call $PATHUSD "balanceOf(address)(uint256)" $ALICE --rpc-url $RPC

4. Send a payment

Transfer 1 pathUSD (= 1,000,000 units at 6 decimals):

cast send $PATHUSD \
  "transfer(address,uint256)" $BOB 1000000 \
  --rpc-url $RPC --private-key $ALICE_PK

Fees are paid in pathUSD automatically.

With memo

Attach a 32-byte memo for reconciliation:

MEMO=$(cast --format-bytes32-string "INV-001")

cast send $PATHUSD \
  "transferWithMemo(address,uint256,bytes32)" $BOB 500000 "$MEMO" \
  --rpc-url $RPC --private-key $ALICE_PK

Emits both Transfer and TransferWithMemo events.

5. Batch transactions

Requires the Tempo Foundry fork.

Send multiple calls in a single atomic transaction:

cast batch-send \
  --call "$PATHUSD::transfer(address,uint256):$BOB,100000" \
  --call "$PATHUSD::transfer(address,uint256):$BOB,200000" \
  --rpc-url $RPC --private-key $ALICE_PK

All calls succeed or all revert together. One signature, lower gas.

6. Query chain state

cast block-number --rpc-url $RPC              # current height
cast chain-id --rpc-url $RPC                  # 1337 local, 42431 testnet moderato
cast block latest --rpc-url $RPC              # latest block details

cast call $PATHUSD "name()(string)" --rpc-url $RPC          # "pathUSD"
cast call $PATHUSD "decimals()(uint8)" --rpc-url $RPC       # 6
cast call $PATHUSD "totalSupply()(uint256)" --rpc-url $RPC

7. Inspect a transaction

cast receipt <TX_HASH> --rpc-url $RPC

Tempo-specific receipt fields:

Field Description
feeToken TIP-20 token that paid the fee
feePayer Address that paid the fee (can differ from from with sponsorship)

Tokens

Token Address Decimals Availability
pathUSD 0x20c0...0000 6 local + testnet

Other tokens are available on the official testnet

Tempo Foundry cheatsheet

These require foundryup -n tempo:

Next steps