# test staking — Sepolia testAdam buy flow Verified on 2026-11-26. Use the Sepolia v4 Quoter and Universal Router V2 for a single-pool exact-input purchase. The deployment records, router encoding and shared PoolManager were checked. A testAdam quote, fill and receipt can be verified once the token and pool are deployed and funded. ## Sepolia contracts | Role | Address on Ethereum Sepolia (11155111) | | --- | --- | | PoolManager | `0xE03A1074c86CFeDd5C142C4F04F1a1536e203543` | | StateView | `0xe1dd9c3fa50edb962e442f60dfbc432e24537e4c` | | V4Quoter | `0x68aFa8b853cAa7a2D40B0F6AEE5C4DbC147C8244` | | Universal Router V2 | `0x3A9D48AB9751398BbFa63ad67599Bb04e4BdF98b` | Uniswap lists these addresses for Ethereum Sepolia. Its router repository identifies the selected deployment as `UniversalRouterV2`. Read-only `poolManager()` calls to the Router, Quoter and StateView at Sepolia block `12212613` each returned the PoolManager above. Repeat those checks when wiring the site and use the V2 tuple below for this address. [Uniswap v4 deployments][deploy] · [Uniswap router address registry][registry] · [Verified router bytecode][verified] ## Launch handoff and pool verification - Obtain the deployed testAdam address and its `decimals()`, the selected PoolManager address, the complete `PoolKey` and PoolId, and the initialization and initial liquidity transaction hashes (or their block and log references). The on-chain token address, actual initialized key and ID, confirmed event references and tradable liquidity become verifiable at launch. Obtain any hooks' required `hookData` and caller restrictions from the deployer. Use empty bytes `0x` for a hookless pool. [PoolKey][key] · [PoolManager events][manager] · [ERC-20][erc20] - Decode the successful initialization receipt's `Initialize` log from the listed PoolManager. Compare all five fields in order with the handoff: `(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks)`. Compute `keccak256(abi.encode(poolKey))` with that static tuple, using standard ABI encoding, and require it to equal both the event ID and handoff ID. Addresses sort numerically, and a dynamic-fee key retains its initialization flag in `fee`. The current LP fee from `getSlot0` is market state. Check `StateView.getSlot0(poolId).sqrtPriceX96` is nonzero and verify that the funding receipt contains the expected pool's liquidity event. `getLiquidity(poolId)` reports current in-range liquidity. The amount-specific quote and router simulation determine whether this order is executable. [PoolKey][key] · [PoolId][id] · [PoolManager events][manager] · [StateView interface][state] - Require one verified currency to be testAdam. The other is the input. Use the native ETH sentinel `address(0)` if it is in the key. For wrapped ETH, this flow uses the router's configured Sepolia WETH9, `0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14`. Disable this flow if the verified key uses another ERC-20 as its countercurrency. Set `zeroForOne = (input == currency0)` and require the other side to equal the handed-off testAdam address. Native ETH sorts first. WETH9 can sort on either side. [PoolKey][key] · [Uniswap quoting guide][quoting] · [Verified router constructor and immutables][verified] ## Wallet purchase 1. **Amount and chain.** Connect the wallet and require `eth_chainId == 0xaa36a7` before enabling Buy, with the public RPC also on Sepolia. Parse the ETH decimal string to a bigint in wei (18 decimals, also the WETH9 base-unit scale). Reject zero, negative, overprecision and amounts above `2^127 - 1` as an integration input limit. Reserve ETH for gas in addition to the input. Token output and minimum are integers in testAdam base units. Format them with the deployed token's decimals. [Wallet provider API][provider] · [Uniswap quoting guide][quoting] · [ERC-20][erc20] 2. **Quote and confirmation.** Use `eth_call` (for example, ethers v6 `staticCall`) on `quoteExactInputSingle((poolKey, zeroForOne, exactAmount, hookData))`, passing the verified key, input amount as `uint128` and launch hook data. Read `(uint256 amountOut, uint256 gasEstimate)`. Use the router transaction for the wallet fee estimate. Record the quote block and bind the displayed quote to chain, account, key, amount, direction, hook data and slippage. Compute `minOut = floor(amountOut * (10000 - slippageBps) / 10000)` with bigint and validated integer basis points in `[0, 10000)`. Reject zero output, a zero minimum or a minimum outside `uint128`. Show expected output, minimum received and fees. Apply a short site-defined quote expiry and router deadline in Unix seconds. Require renewed confirmation if the quote expires or any bound input changes. [Uniswap quoting guide][quoting] · [Quoter interface][quoter] · [Router V2 swap interface][swapabi] · [Router commands and deadline][commands] 3. **Build the exact transaction.** ABI-encode each parameter entry in the table separately. Pass the same key, direction and hook data used in the quote. `SETTLE` pays the literal input amount from the router. If a low-liquidity fill consumes only part of that amount, the excess input credit leaves a nonzero delta and PoolManager reverts. `TAKE_ALL` checks the minimum and sends the full output credit to the caller. [Router V2 actions][actions] · [Router V2 action handlers][handlers] · [PoolManager swap interface][manager] · [PoolManager unlock accounting][core] | Action | ABI-encoded entry | | --- | --- | | `0x06 SWAP_EXACT_IN_SINGLE` | One tuple `(PoolKey,bool,uint128,uint128,bytes)` with values `(key,zeroForOne,amountIn,minOut,hookData)`. Use the nested five-field PoolKey tuple above. | | `0x0b SETTLE` | `(address,uint256,bool)` with values `(input,amountIn,false)`. | | `0x0f TAKE_ALL` | `(address,uint256)` with values `(testAdam,minOut)`. | Set `v4Input = abi.encode(bytes(0x060b0f), bytes[]([swapParams, settleParams, takeParams]))` (pseudocode for encoding the action bytes and array). Call payable `execute(bytes commands, bytes[] inputs, uint256 deadline)` on Universal Router V2 with `value = amountIn` wei. Use the following command bytes and input arrays. [Router commands][commands] · [Router V2 dispatcher][dispatcher] - **Native ETH key:** `commands = 0x10`, `inputs = [v4Input]`. Use native ETH as the settlement currency. [Quoting guide][quoting] · [Router V2 action handlers][handlers] - **WETH9 key:** `commands = 0x0b10`, `inputs = [abi.encode(routerAddress, uint256(amountIn)), v4Input]`. The first command wraps exactly the submitted ETH to WETH9 held by the router. The v4 settlement pays from that balance. Both branches use the wallet's transaction confirmation and require zero ERC-20 approvals and zero Permit2 signatures. Keep the allow-revert flag clear so a failed swap rolls back the whole call, including wrapping. [Router commands][commands] · [Router V2 dispatcher][dispatcher] · [Wrap payment implementation][payments] · [Router payment source][permit] 4. **Simulate, submit and refresh.** Recheck chain, account and freshness. Simulate and estimate gas on the full `execute` call with the actual wallet as `from` and exact calldata and value. This is particularly important for hooks, which can see different callers in the quote and the swap. Enable wallet submission only after a successful preflight. Track the returned hash on Sepolia, show pending until a receipt, and mark success only for a successful receipt. For launch verification, confirm the receipt has a PoolManager `Swap` log with the expected PoolId and check that the wallet received testAdam. After confirmation, refetch testAdam `balanceOf(wallet)` and the wallet's native balance at the receipt block or later. Refresh the quote and pool reads. [PoolManager swap interface][manager] · [ERC-20][erc20] · [Ethereum JSON-RPC][rpc] ## Failure states - **Pool missing or mismatched.** For absent launch configuration, missing initialization, zero `sqrtPriceX96` or a key/manager mismatch, disable Buy and show that the launch pool is unavailable. [PoolManager interface][manager] · [StateView interface][state] - **Insufficient liquidity.** A zero quote, an unfillable input in a full router simulation or a minimum-output revert can prevent a purchase. Offer a smaller amount when liquidity is the cause. A quote that returns output can still represent a partial fill. If a revert indicates a hook restriction or an RPC call fails, report that separately and leave Buy disabled until simulation succeeds. [PoolManager swap interface][manager] · [Router V2 action handlers][handlers] - **Wrong chain.** Prompt for Ethereum Sepolia, disable submission and discard the quote on chain or account changes. Requote after the wallet reconnects on the expected chain. [Wallet provider API][provider] - **Rejected or stale quote.** A failed quote call leaves no executable quote. If the user dismisses confirmation or the wallet rejects the request (EIP-1193 code `4001`), stop without retrying submission. If the quote expires, price falls below minimum, or the transaction misses its deadline, fetch a fresh quote and ask for confirmation again. Show a mined revert as failed and refresh balances, including ETH spent on gas. [Wallet provider API][provider] · [Router commands][commands] · [Router V2 swap interface][swapabi] · [Ethereum JSON-RPC][rpc] [deploy]: https://developers.uniswap.org/docs/protocols/v4/deployments.md [registry]: https://raw.githubusercontent.com/Uniswap/universal-router/main/deploy-addresses/sepolia.json [verified]: https://sourcify.dev/server/v2/contract/11155111/0x3A9D48AB9751398BbFa63ad67599Bb04e4BdF98b?fields=runtimeBytecode,creationBytecode [key]: https://raw.githubusercontent.com/Uniswap/v4-core/main/src/types/PoolKey.sol [id]: https://raw.githubusercontent.com/Uniswap/v4-core/main/src/types/PoolId.sol [manager]: https://raw.githubusercontent.com/Uniswap/v4-core/main/src/interfaces/IPoolManager.sol [state]: https://raw.githubusercontent.com/Uniswap/v4-periphery/main/src/interfaces/IStateView.sol [quoting]: https://developers.uniswap.org/docs/sdks/v4/guides/swapping/quoting.md [quoter]: https://raw.githubusercontent.com/Uniswap/v4-periphery/main/src/interfaces/IV4Quoter.sol [commands]: https://developers.uniswap.org/docs/protocols/universal-router/concepts/commands.md [swapabi]: https://raw.githubusercontent.com/Uniswap/v4-periphery/444c526b77d804590f0d7bc5a481af5a3277c952/src/interfaces/IV4Router.sol [actions]: https://raw.githubusercontent.com/Uniswap/v4-periphery/444c526b77d804590f0d7bc5a481af5a3277c952/src/libraries/Actions.sol [handlers]: https://raw.githubusercontent.com/Uniswap/v4-periphery/444c526b77d804590f0d7bc5a481af5a3277c952/src/V4Router.sol [core]: https://raw.githubusercontent.com/Uniswap/v4-core/main/src/PoolManager.sol [dispatcher]: https://raw.githubusercontent.com/Uniswap/universal-router/2.0.0/contracts/base/Dispatcher.sol [payments]: https://raw.githubusercontent.com/Uniswap/universal-router/2.0.0/contracts/modules/Payments.sol [permit]: https://raw.githubusercontent.com/Uniswap/universal-router/2.0.0/contracts/modules/Permit2Payments.sol [provider]: https://eips.ethereum.org/EIPS/eip-1193 [erc20]: https://eips.ethereum.org/EIPS/eip-20 [rpc]: https://ethereum.org/en/developers/docs/apis/json-rpc/