# verification

Every basefun contract is verified on BaseScan. The team also auto-verifies every per-token contract within \~30 seconds of deploy.

## Manual verification

The factories, LTFactory, and template token implementations have their source published on BaseScan. Anyone can:

{% stepper %}
{% step %}
Open the contract on BaseScan.
{% endstep %}

{% step %}
Switch to the "Contract" tab.
{% endstep %}

{% step %}
Confirm "Contract Source Code Verified ✓".
{% endstep %}

{% step %}
Read the source, compile locally with Foundry, and diff against on-chain bytecode.
{% endstep %}
{% endstepper %}

The same Solidity files live in the public repo under `packages/contracts/src/`. Build commands:

```bash
pnpm contracts:build       # forge build
pnpm contracts:test        # forge test
```

There are 21 Foundry tests across V1 + V2 token + curve + factory paths. All pass on each commit.

## Per-token auto-verify

When the indexer sees a `TokenCreated` event:

{% stepper %}
{% step %}
Reads `name`, `symbol`, `imageURI`, `description`, `socials` from the event args.
{% endstep %}

{% step %}
For V2 tokens (FactoryV3), reads the two extra immutables `treasury` and `creatorFeeRecipient` from the deployed bytecode.
{% endstep %}

{% step %}
POSTs a `standard-json` verification payload to BaseScan's verify endpoint.
{% endstep %}

{% step %}
Polls for completion; persists `verified = "verified"` on the `Token` row when BaseScan confirms.
{% endstep %}
{% endstepper %}

The "✓ VERIFIED" badge shown on each token page is driven by that DB column.

## What you can verify yourself

* **Supply** — total supply == 1,000,000,000 × 1e18. Sent to the curve at deploy.
* **Curve constants** — `GRADUATION_USDC`, `LP_SUPPLY`, `SWAP_FEE_BPS`, etc., on the `BondingCurveV2` source.
* **Treasury and creator addresses** — on V2 tokens, `treasury()` and `creatorFeeRecipient()` are public view immutables.
* **Pair registered** — post-grad, `BasefunTokenV2.isPair(uniV2PairAddr) == true`.
* **LP burned** — Uni V2 pair's `balanceOf(0x000…dEaD)` == roughly `pair.totalSupply()`.
* **Factory ownership / migrators** — `factory.owner()`, `factory.migrators(addr)`.

## Verifying a single trade's fee split (pre-bond)

On the trade tx, look at the USDC token's Transfer events:

```
Transfer(curve, treasury, X)        ← 0.5% of usdcIn
Transfer(curve, creator,  X)        ← 0.5% of usdcIn
```

Both should equal `usdcIn × 50 / 10000`.

## Verifying a fee swap (post-bond, V2 tokens)

On any keeper sweep tx:

{% stepper %}
{% step %}
Multiple Transfer events on the token contract from keeper to the Uni V2 pair (the swap input legs).
{% endstep %}

{% step %}
Transfer events on USDC from the pair to the keeper (the swap output).
{% endstep %}

{% step %}
Two Transfer events on USDC from the keeper:

* To `treasury` (50% of received).
* To `creator` (50% of received).
  {% endstep %}
  {% endstepper %}

All four numbers should reconcile: gross token swept × spot price ≈ USDC received ≈ treasury + creator transfers.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://basefun.gitbook.io/basefun-docs/verification.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
