# Integrations

**Building a trading bot?** Follow the [buy/sell bot guide](/docs/bot-trading/) for exact approvals, live quotes and transactions through the Rearctor pool before and after graduation.

Use the index API for discovery and historical displays. Use verified contract addresses, current ABIs and fresh chain state when preparing transactions. Arc Testnet has a connected deployment; Mainnet remains in Preview. Use the [network-specific addresses](/docs/network/) and `/api/testnet` for testnet data. Mainnet sample records are not trading addresses.

## Read public market data

The API requires no wallet or API key for public reads. Its values include decimal strings for on-chain quantities. Convert these strings to `BigInt`, not floating-point numbers, when precision matters.

```js
const base = 'https://api.rearctor.io/api';
const response = await fetch(`${base}/tokens?q=rearc&limit=10`, {
  headers: { Accept: 'application/json' },
  credentials: 'omit',
  redirect: 'error',
  signal: AbortSignal.timeout(15000),
});
if (!response.ok) throw new Error(`Index returned ${response.status}`);
const result = await response.json();
if (result.status.mode !== 'live') {
  console.log('Sample catalogue: do not treat these as live contracts.');
}
for (const token of result.items) {
  const reserveBaseUnits = BigInt(token.reserve);
  console.log(token.name, token.token, reserveBaseUnits);
}
```

Check `status.state`, `status.updatedAt`, `status.indexedBlock` and the configured chain/factory identity before using a response. Display an unavailable or stale state rather than substituting zero. A third-party browser origin is not currently allowed by API CORS; server-side integrations can make public reads. CORS is not an API credential system.

Download the [OpenAPI 3.1 specification](/docs/openapi.json) or read the [endpoint reference](/docs/api-reference/). There are no API endpoints for signing, approvals, swaps or admin writes.

## Current ABI downloads

| Contract | ABI |
| --- | --- |
| Launchpad factory | [RearctorLaunchpad.json](/docs/abi/RearctorLaunchpad.json) |
| Per-token pool | [RearctorPool.json](/docs/abi/RearctorPool.json) |
| ERC-20 token | [RearctorToken.json](/docs/abi/RearctorToken.json) |
| Per-token fee vault | [RearctorFeeVault.json](/docs/abi/RearctorFeeVault.json) |
| V4 hook | [RearctorHook.json](/docs/abi/RearctorHook.json) |
| Protocol treasury | [RearctorTreasury.json](/docs/abi/RearctorTreasury.json) |
| V4 quoter interface | [V4Quoter.json](/docs/abi/V4Quoter.json) |

The [documentation build manifest](/docs/build.json) records content, ABI and contract-source SHA-256 hashes. These identify the documented source snapshot; they do not prove that any address contains that bytecode. Verify deployment records and runtime configuration separately.

## Prepare a trade

1. Verify the RPC chain ID and the configured factory. Resolve the launch from that factory rather than by token name.
2. Check factory registration and the pool's factory, token, quote asset, vault, manager and hook.
3. Read `graduated` and `getPoolKey` at a fresh block. Curve quotes return zero after graduation; use a V4 exact-input quote with the canonical key once graduated.
4. Check that the V4 quoter points to the same PoolManager. Preserve the exact key; do not substitute another fee tier or hook.
5. Calculate a positive minimum output in integer base units. Approve only the intended input asset and amount to the canonical pool.
6. Refresh the quote after approvals. Never lower the user's original absolute minimum without another user decision.
7. Simulate `buy` or `sell` with the minimum output and deadline, estimate gas, then ask the wallet to review the transaction.
8. Confirm inclusion. Update wallet state from the chain and wait for the confirmed index to catch up.

The application uses a two-minute transaction deadline. Its gas estimate includes migration headroom for curve buys that may reach the threshold and storage-write headroom for other trades. These estimates are not fixed network fees or execution guarantees.

## Units and fee assets

Use 6 decimals for ERC-20 USDC and 18 for launched tokens. A curve buy and curve sell report fees in USDC. A V4 buy charges the input USDC; a V4 sell charges the input token. V4 fee amounts shown with quotes are estimates subject to base-unit rounding and the execution state.

Arc's native USDC interface uses 18 decimals for gas while its ERC-20 interface uses 6. These represent the same underlying balance, not two separate assets. See [Arc's stablecoin model](https://docs.arc.io/arc/concepts/stablecoin-native-model).

## Index your own events

Use the canonical pool ID when consuming V4 swaps. A trade through the Rearctor pool can produce both a pool `Trade` event and a V4 `Swap` event; do not count them as two executions. Different swaps in one transaction or block can still be distinct. Preserve transaction hash, log index and block identity.

Use vault and treasury counters for their defined totals and account for the input asset. Token amounts from different projects must not be added together as a dollar total. Read [Indexing](/docs/indexing/) for the production index's scope and limits.
