> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inkyswap.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quotes

> Preview direct curve trades and route post-bond quotes through the exact launch pool.

An execution quote answers “how many tokens or quote units will this call return?” USD valuation is a separate display layer and must not block a direct on-chain quote.

## Pre-bond buy

On current deployments, call the launch's own hook:

```solidity theme={null}
function previewBuy(uint256 launchId, uint256 quoteIn)
    external view returns (
        uint256 tokensOut,
        uint256 cost,
        uint256 refund,
        uint256 tokensRemaining
    );
```

For a native launch, `quoteIn`, `cost`, and `refund` are native wei. For an xStocks launch, they are wrapper units.

```ts theme={null}
const [tokensOut, cost, refund, tokensRemaining] =
  await publicClient.readContract({
    address: token.hook_address,
    abi: HOOK_READ_ABI,
    functionName: "previewBuy",
    args: [BigInt(token.launch_id), quoteIn],
  })

const minTokensOut = (tokensOut * 9_900n) / 10_000n // 1% slippage
```

If `refund` is nonzero, execution consumes only `cost` and returns the rest. A buy can sell the final curve inventory and finalize in the same transaction.

## Pre-bond sell

```solidity theme={null}
function previewSell(uint256 launchId, uint128 tokenAmount)
    external view returns (
        uint256 netPayout,
        uint256 protocolFee,
        uint256 creatorFee,
        uint256 buybackFee
    );
```

The return amounts use the launch's quote denomination. The `buybackFee` field name is historical; the current Ink deployment routes that share to holders.

## Full-fill preview

Current hooks expose `previewFill(launchId)` for the exact external input needed to sell the remaining curve supply. It returns fee, user, buyback/holder-allocation, and refund fields in one struct.

Use it only after resolving a compatible `hookAbi`. Older deployment families do not expose every current view selector.

## Sale split before launch

```solidity theme={null}
function previewSaleSplit(uint96 targetRaise, uint32 gainBps)
    external view returns (
        uint128 saleSupply,
        uint128 liquiditySupply,
        uint16 salePortionBps,
        uint256 marginalPrice,
        uint256 poolPrice
    );
```

Call this on the active hook or its configured viewer path. For xStocks, both price outputs use wrapper units.

## Historical Ink previews

The deprecated Ink hook has a separate legacy viewer path. Resolve the token's deployment first and use an ABI/viewer compatible with that deployment. Do not call the current Ink viewer with old state merely because both contracts are on chain.

## Post-bond quote

Once `getLaunchState(launchId).finalized` is true, curve previews no longer describe the executable market. Corrected native hooks and current xStocks hooks expose the exact pool key:

```solidity theme={null}
function getLaunchPoolKey(uint256 launchId)
    external view returns (PoolKey memory key);
```

Then quote through the `canonicalV4.quoter` from that deployment's capabilities.

The deprecated Ink deployment marked `hookAbi: "ink-legacy"` does not expose this getter. For those tokens, require all immutable indexed pool fields from `GET /api/token`, validate them, and derive the pool ID. See [Post-Bond Pool](https://docs.inkyswap.com/trading/post-bond-pool.md). Never guess missing legacy values.

> [!WARNING]
>
> Do not assume the pool is token/WETH. Current native Ink launches use native ETH as the zero-address currency. xStocks pools use their wrapper.

## Quote checks before signing

For every trade:

1. Confirm chain, hook, launch ID, and lifecycle.
2. Confirm the input asset and its decimals.
3. Read or build the quote at a recent block.
4. Compute the minimum output with integer math.
5. Simulate the exact call with the current account and allowance.
6. Requote after an account, chain, block, amount, or route change.

## External asset conversions

ETH-to-wrapper, stablecoin-to-wrapper, and reverse paths need executable liquidity outside the launch curve. An indicative stock price or USD mark is not an executable route.

Keep direct native or wrapper quotes available when an external provider fails. InkyPump's market-route endpoint is currently a first-party service; third parties should not depend on it without an agreed origin and service policy.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.