swap_gblin_to_usdc_jit
Generate ready-to-broadcast calldata to convert GBLIN treasury into exact USDC needed for x402 invoices, using staged approvals, redemptions, and a WETH-to-USDC swap.
Instructions
When an x402 invoice (or any USDC obligation) arrives and your treasury sits in GBLIN, call this to get ready-to-broadcast calldata that redeems exactly the USDC you need, just in time. Three sequential transactions: (1) approve the shares to the GBLIN Zap, (2) GBLINZap.sellGBLINForEth, which redeems in kind and sells every leg for ETH, all or nothing, (3) a Uniswap WETH->USDC swap that spends only the guaranteed ETH minimum and still returns at least the requested USDC. EOAs sign three times; ERC-4337 / EIP-7702 wallets can batch them into one operation. Every step carries a non-zero minimum; ETH above the minimum stays in the wallet. Free to call. A redemption carries no protocol fee; the costs are the Zap's swaps and gas.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| usdc_needed | Yes | USDC amount, decimal string. | |
| wallet_address | Yes | Agent's 0x address (for cooldown check). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| steps | Yes | Transactions to send in order. | |
| action | Yes | Always sequential_txs: send the steps one after the other. | |
| params | No | ||
| expected | Yes | Shares spent, ETH and USDC expected, and the minimums applied. | |
| gas_hint | Yes | Gas limit to set on the Zap step. | |
| compatibility | No | ||
| gas_hint_note | No |