> For the complete documentation index, see [llms.txt](https://trench-today.gitbook.io/trench-today/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trench-today.gitbook.io/trench-today/for-developers/abi-files.md).

# ABI Files

Download the JSON ABI files to use with ethers.js, viem, wagmi, or any other Ethereum library.

Admin-only functions (`pause`, `unpause`, `withdraw`, `configFactory`, `configVault`, etc.) are excluded from these files.

{% tabs %}
{% tab title="Robinhood Mainnet" %}
{% hint style="info" %}
Updated for the **V4 upgrade (2026-07-13)**: the Manager ABI is now `TrenchManagerV4Migrator` (adds `migrateToV4`), and two new contracts ship — `TrenchV4FeeHook` (post-graduation swap fee) and `TrenchPositionLocker` (locked LP NFT). `ILPFeeSplitter` is retained for **legacy V3 graduates** only.
{% endhint %}

{% file src="/files/dakRsAlnxRPhPMzONfHk" %}
ITrenchManager (V4Migrator) — Core trading functions (buy, sell, createCurve, previewBuy/Sell, tokenInfo, migrateToV4, V4 config reads)
{% endfile %}

{% file src="/files/aGEslLB3RBCiCx292gyS" %}
IBondingCurve (Robinhood) — Read-only curve state queries (quote-denominated reserves)
{% endfile %}

{% file src="/files/de1PDq862NcYBaq28MfB" %}
IBondingCurveFactory (Robinhood) — Factory configuration (getConfig by quote)
{% endfile %}

{% file src="/files/vRgU3yjnuoqmpBsDQZmq" %}
IFeeVault (Robinhood) — On-curve fee vault (devClaim, protocolClaim, creditsDev, minClaimAmount)
{% endfile %}

{% file src="/files/Zm9xfTRNHUmIaQtC8H64" %}
IToken (Robinhood) — ERC-20 with two-state transfer mode control
{% endfile %}

{% file src="/files/W8IYEPyAgGMHAp0Rdaxz" %}
ITrenchV4FeeHook (Robinhood) — Post-graduation Uniswap V4 swap fee (1% quote-side, instant dev/treasury split; poolConfigs, poolOfToken, devShareRate)
{% endfile %}

{% file src="/files/32F2X5Pp5HKRkHQs2Vtt" %}
ITrenchPositionLocker (Robinhood) — Locked graduation LP position NFT (positionIds, lockedPosition, 1-year timelock)
{% endfile %}

{% file src="/files/QWhc79zRhJpkIPhmXVld" %}
ILPFeeSplitter (Robinhood) — **Legacy V3 graduates only** — post-graduation Uniswap V3 swap-fee split (claim, creatorCredits, devShareBps)
{% endfile %}

## Usage

```javascript
import { ethers } from "ethers";
import ITrenchManager from "./ITrenchManagerRobinhood.json";

const MANAGER_ADDRESS = "0x77dC6f6361b7b99456FC3761ce5b7ddA80d83f9d";
const provider = new ethers.JsonRpcProvider(RPC_URL); // request RPC from the team
const manager = new ethers.Contract(MANAGER_ADDRESS, ITrenchManager, provider);

// Quote a buy (Robinhood uses previewBuy, not quoteBuyWithFee)
const [amountOut, fee] = await manager.previewBuy(tokenAddress, ethers.parseEther("0.1"));
console.log("Expected tokens:", ethers.formatEther(amountOut));
console.log("Protocol fee:", ethers.formatEther(fee));

// Get all token state in one call — note the quote field and Quote-named reserves
const info = await manager.tokenInfo(tokenAddress);
console.log("Quote token:", info.quoteAddr); // address(0) = ETH
console.log("Real quote in curve:", info.realQuoteReserves);
console.log("Migrating:", info.isMigrating_, "Migrated:", info.isMigrated_);
```

```javascript
import { createPublicClient, http, defineChain } from "viem";
import ITrenchManager from "./ITrenchManagerRobinhood.json";

const robinhood = defineChain({
    id: 4663,
    name: "Robinhood Mainnet",
    nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
    rpcUrls: { default: { http: [RPC_URL] } }, // request RPC from the team
});

const client = createPublicClient({ chain: robinhood, transport: http() });

const [amountOut, fee] = await client.readContract({
    address: "0x77dC6f6361b7b99456FC3761ce5b7ddA80d83f9d",
    abi: ITrenchManager,
    functionName: "previewBuy",
    args: [tokenAddress, parseEther("0.1")],
});
```

Post-graduation dev fees now settle **per swap** through the V4 fee hook — there is **no claim step** for new tokens. The hook pays the dev share (default 60%) directly to the creator on every V4 swap. You can read config and monitor `SwapFeeCharged` for accounting:

```javascript
import { ethers } from "ethers";
import ITrenchV4FeeHook from "./ITrenchV4FeeHookRobinhood.json";

const HOOK = "0x31200554eCA1EFf6d130dbeC7975aFA1234b60CC";
const hook = new ethers.Contract(HOOK, ITrenchV4FeeHook, provider);

const poolId = await hook.poolOfToken(tokenAddress);
const cfg = await hook.poolConfigs(poolId);
console.log("dev (creator):", cfg.dev, "swaps enabled:", cfg.swapEnabled);
console.log("dev share (bps):", await hook.devShareRate()); // 6000 = 60%
```

{% hint style="info" %}
**Legacy V3 graduates only:** tokens that graduated before the V4 upgrade still read and claim on the **LPFeeSplitter** (`0x74a40b65320c717F0ECF74f68CcB910edCd08e22`) via `creatorCredits(creator, ETH)` + `claim(creator)`. New tokens do not use it.
{% endhint %}
{% endtab %}

{% tab title="Ethereum Mainnet" %}
{% file src="/files/iqNscIURcPTKLmFnxfKE" %}
ITrenchManagerV2 — Core trading functions (buy, sell, createCurve, quote)
{% endfile %}

{% file src="/files/IfeuvQGx6fptirtp6ya1" %}
IBondingCurve — Read-only curve state queries
{% endfile %}

{% file src="/files/9EgFXwaZUMgkHeniEF4W" %}
IBondingCurveFactory — Factory configuration
{% endfile %}

{% file src="/files/psuqlFjQewds1zuh1iwU" %}
IERC20 — Standard ERC-20 interface
{% endfile %}

## Usage

```javascript
import { ethers } from "ethers";
import ITrenchManagerV2 from "./ITrenchManagerV2.json";

const MANAGER_ADDRESS = "0x974B2d86d6353c62f19110127aF1A5df4c6370f0";
const provider = new ethers.JsonRpcProvider(RPC_URL);
const manager = new ethers.Contract(MANAGER_ADDRESS, ITrenchManagerV2, provider);

// Quote a buy
const [amountOut] = await manager.quoteBuyWithFee(
    ethers.parseEther("0.1"),
    tokenAddress,
    0 // no platform fee
);

console.log("Expected tokens:", ethers.formatEther(amountOut));
```

```javascript
import { createPublicClient, http } from "viem";
import { mainnet } from "viem/chains";
import ITrenchManagerV2 from "./ITrenchManagerV2.json";

const client = createPublicClient({ chain: mainnet, transport: http() });

const amountOut = await client.readContract({
    address: "0x974B2d86d6353c62f19110127aF1A5df4c6370f0",
    abi: ITrenchManagerV2,
    functionName: "quoteBuyWithFee",
    args: [parseEther("0.1"), tokenAddress, 0n],
});
```

{% endtab %}

{% tab title="MegaETH Mainnet" %}
{% file src="/files/u81vSHPKbqo0jQcIr9AB" %}
ITrenchManagerV3 — Core trading functions (buy, sell, createCurve, quote, tokenInfo, migrateToV3)
{% endfile %}

{% file src="/files/IfeuvQGx6fptirtp6ya1" %}
IBondingCurve (MegaETH) — Read-only curve state queries
{% endfile %}

{% file src="/files/5M1C741sueO8VD52eqjf" %}
IBondingCurveFactory (MegaETH) — Factory configuration
{% endfile %}

{% file src="/files/Jd5gpKR74fq8E57mnecX" %}
IFeeVault — Fee vault (devClaim, protocolClaim, creditsDev)
{% endfile %}

{% file src="/files/s0ZtiIQY4pPAFt95bYm3" %}
IToken — ERC-20 with transfer mode control
{% endfile %}

## Usage

```javascript
import { ethers } from "ethers";
import ITrenchManagerV3 from "./ITrenchManagerV3.json";

const MANAGER_ADDRESS = "0x2978E15501C792152602eC85c299083aa61b1bd4";
const RPC_URL = "https://mainnet.megaeth.com/rpc";
const provider = new ethers.JsonRpcProvider(RPC_URL);
const manager = new ethers.Contract(MANAGER_ADDRESS, ITrenchManagerV3, provider);

// Quote a buy
const [amountOut] = await manager.quoteBuyWithFee(
    ethers.parseEther("0.1"),
    tokenAddress,
    0 // no platform fee
);

console.log("Expected tokens:", ethers.formatEther(amountOut));

// Get all token state in one call
const info = await manager.tokenInfo(tokenAddress);
console.log("Real ETH in curve:", ethers.formatEther(info.realNativeReserves));
console.log("Migrating:", info.isMigrating);
console.log("Migrated:", info.isMigrated);
```

```javascript
import { createPublicClient, http, defineChain } from "viem";
import ITrenchManagerV3 from "./ITrenchManagerV3.json";

const megaeth = defineChain({
    id: 4326,
    name: "MegaETH Mainnet",
    nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
    rpcUrls: { default: { http: ["https://mainnet.megaeth.com/rpc"] } },
    blockExplorers: { default: { name: "MegaExplorer", url: "https://megaexplorer.xyz" } },
});

const client = createPublicClient({ chain: megaeth, transport: http() });

const [amountOut] = await client.readContract({
    address: "0x2978E15501C792152602eC85c299083aa61b1bd4",
    abi: ITrenchManagerV3,
    functionName: "quoteBuyWithFee",
    args: [parseEther("0.1"), tokenAddress, 0n],
});
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://trench-today.gitbook.io/trench-today/for-developers/abi-files.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
