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

# Native Token Handling

> How KAS and WKAS work in the DEX

# Native Token Handling

**KAS** is the native currency of the Kasplex blockchain (similar to ETH on Ethereum). Since AMM smart contracts operate exclusively with ERC-20 tokens, KAS is wrapped as **WKAS** (Wrapped KAS) for on-chain operations.

## KAS vs WKAS

|                   | KAS                     | WKAS                    |
| ----------------- | ----------------------- | ----------------------- |
| Type              | Native currency         | ERC-20 token            |
| Used for          | Gas fees, transfers     | DEX operations          |
| Address (display) | `0x0000...0000`         | Contract address        |
| Decimals          | 18                      | 18                      |
| Conversion        | 1 KAS = 1 WKAS (always) | 1 WKAS = 1 KAS (always) |

## WKAS Contract Addresses

| Network | WKAS Address                                 |
| ------- | -------------------------------------------- |
| Mainnet | `0x2c2Ae87Ba178F48637acAe54B87c3924F544a83e` |
| Testnet | `0xC065C62a10fB363fD31CA394D632C4Df106566df` |

## How Wrapping Works

WKAS is a simple deposit/withdraw contract:

* **Wrap**: Send KAS to the WKAS contract → receive equal WKAS
* **Unwrap**: Call `withdraw()` on WKAS → receive equal KAS

The Universal Router handles this automatically during swaps. Users never need to wrap or unwrap manually.

## Token Representation

In the Kroko DEX system, tokens have two address fields:

| Field        | KAS Value       | ERC-20 Value           | Used For                                                 |
| ------------ | --------------- | ---------------------- | -------------------------------------------------------- |
| `address`    | `0x0000...0000` | Token contract address | Display, storage keys, balance queries                   |
| `dexAddress` | WKAS address    | Same as `address`      | All DEX operations (swaps, quotes, liquidity, approvals) |

### When Calling APIs

Always use the **WKAS address** (not the zero address) when calling the Quote or Swap APIs with KAS as input or output:

```typescript theme={null}
// Correct: use WKAS address for KAS
const WKAS = "0x2c2Ae87Ba178F48637acAe54B87c3924F544a83e";
fetch(`/api/v1/quote?tokenIn=${WKAS}&tokenOut=${USDC}&amountIn=1000000000000000000`);

// Wrong: zero address will not work
fetch(`/api/v1/quote?tokenIn=0x0000000000000000000000000000000000000000&...`);
```

### Sending Native KAS in Swaps

When KAS is the input token, include the amount as the transaction `value`:

```typescript theme={null}
const tx = await signer.sendTransaction({
  to: swapData.to,
  data: swapData.data,
  value: swapData.value  // Non-zero when selling KAS
});
```

The Swap API automatically sets the `value` field when it detects WKAS as the input token.
