Indexedex balancer se router

From cyotee/indexedex · View interactive version

Indexedex balancer se router is an AI agent skill from the GitHub repository cyotee/indexedex. Use IndexedEx Balancer V3 Standard Exchange Router for exact-in swaps with optional SE vault intermediation and Permit2. Cast runbooks with safety.

How to use this skill

Skill file

IndexedEx Balancer SE Router (cast)

Goal

Swap via balancerV3StandardExchangeRouter with optional SE vault legs.

Addresses (Base Sepolia public snapshot)

export ROUTER=0x0FEF2ebbD2Dd7B677F750740BA12623D4cC77344
export PERMIT2=0x000000000022D473030F116dDEE9F6B43aC78BA3

Signature (exact-in)

From IBalancerV3StandardExchangeRouterExactInSwap:

swapSingleTokenExactIn(
  address pool,
  address tokenIn,
  address tokenInVault,   # IStandardExchangeProxy; address(0) if none
  address tokenOut,
  address tokenOutVault,
  uint256 exactAmountIn,
  uint256 minAmountOut,
  uint256 deadline,
  bool wethIsEth,
  bytes userData
) payable returns (uint256)

Safety

Inspect

cast codesize $ROUTER --rpc-url $ETH_RPC_URL
cast call $TOKEN_IN "balanceOf(address)(uint256)" $USER --rpc-url $ETH_RPC_URL

Approve path

# ERC20 approve router
cast send $TOKEN_IN "approve(address,uint256)" $ROUTER $AMOUNT \
  --rpc-url $ETH_RPC_URL --private-key $PRIVATE_KEY
# or use permit2-ops against ROUTER as spender

Execute

DEADLINE=$(( $(date +%s) + 600 ))
cast send $ROUTER \
  "swapSingleTokenExactIn(address,address,address,address,address,uint256,uint256,uint256,bool,bytes)" \
  $POOL $TOKEN_IN $TOKEN_IN_VAULT $TOKEN_OUT $TOKEN_OUT_VAULT \
  $AMOUNT $MIN_OUT $DEADLINE false 0x \
  --rpc-url $ETH_RPC_URL --private-key $PRIVATE_KEY

Use address(0) for unused vault params: 0x0000000000000000000000000000000000000000.

Verify

cast call $TOKEN_OUT "balanceOf(address)(uint256)" $USER --rpc-url $ETH_RPC_URL
cast receipt $TX --rpc-url $ETH_RPC_URL

Common failures

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.