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

# Contracts

Source: `contracts/` in the CheomaYield repo.

## `CheomaPreDeposit.sol` — **legacy**

Fixed-APY tokenized vault. Non-transferable (soulbound) ERC-20 receipt. Deployed on Base (USDC, Wave 1). The Wave 1 Base and Robinhood Chain partner deployments are **legacy — deposits closed**. The current pre-deposit vaults are `BasePreDeposit.sol` (Base) and `SonicPreDeposit.sol` (Sonic) below.

**Immutables**

* `usdc` — deposit asset
* `apyBps` — fixed APY in basis points (e.g. 5200 = 52.00%)
* `admin` — config-only (cap + toggles)
* `treasury` — sole funds mover

**State**

* `cap` — max principal (`totalSupply`)
* `totalAssets`, `totalPrincipal`, `lastUpdate`

**Write**

* `deposit(uint256 amount)` — approve USDC first; mints receipt, records FIFO 90-day lot
* `redeem(uint256 shares)` — burn receipt → pro-rata USDC (requires lot maturity + `withdrawalsOpen`)
* `withdraw(uint256 amount, address to)` — `onlyTreasury`
* `setCap(uint256)`, `setDepositsOpen(bool)`, `setWithdrawalsOpen(bool)` — `onlyAdmin`
* `emergencyWithdrawAll(address to)` — `onlyTreasury`

**Read**

* `lotCount(address)`, `getLot(...)`, `firstUnconsumedLot(address)`

**Events**

* `Deposit(depositor, amount, shares, timestamp, maturity)`
* `Redeem(redeemer, shares, worth, timestamp)`
* `Withdrawal`, `CapUpdated`, `DepositsOpenUpdated`, `WithdrawalsOpenUpdated`, `EmergencyWithdrawAll`

## `BasePreDeposit.sol`

Base-native pre-deposit vault (chainId 8453), the Base sibling of `SonicPreDeposit` with one delta: a single deposit asset (native Base USDC, 6 dec). Transferable 6-dec ERC-20 receipt (`prechUSDCb`); 13% simple APR (`apyBps = 1300`), $30M cap. No per-deposit lock and **no on-chain user redeem** — `withdrawalsOpen` is permanently false and exit runs through a future phase-2 gate on GIWA mainnet. Only the cold `treasury` key can move funds out.

## `SonicPreDeposit.sol`

Sonic-native fork of `CheomaPreDeposit` (chainId 146). Two deltas vs Base: **transferable** receipt (DeFi composability + gate-migration forward-compat) and **two deposit assets** — native Sonic USDC (6 dec) + canonical bnUSD (18 dec, credited at fixed 1:1, held raw). 13% simple APR (`apyBps = 1300`), $30M cap, receipt `prechUSDCs`. No per-deposit lock; withdrawals gated until GIWA mainnet (phase 2).

**Write**

* `deposit(uint256 amount)` — USDC
* `depositBnUSD(uint256 amount)` — bnUSD, 1:1 credit
* `withdraw(uint256, address)` / `withdrawBnUSD(uint256, address)` — `onlyTreasury`
* `emergencyWithdrawAll(address)` — drains BOTH USDC + bnUSD

## `PartnerPreDeposit.sol`

Bond-gated variant of `CheomaPreDeposit`.

**Immutables**

* `usdg` — deposit asset
* `partnerToken` — bond token (escrowed)
* `poolGiwaWeth`, `poolWethUsdg` — two-leg Uniswap V3 TWAP
* `apyBps`, `admin`, `treasury`

**Write**

* `deposit(uint256 amount)` — requires `partnerToken.balanceOf(msg.sender) >= minGateUsd`; escrows the bond
* `redeem(uint256 shares)` — bond released in-kind on full exit
* `setMinGateUsd(uint256)`, `setCap`, `setDepositsOpen`, `setWithdrawalsOpen` — `onlyAdmin`
* `forceReleaseBond(address user)` — `onlyTreasury`

**Events**

* `Deposit`, `Redeem`, `Withdrawal`, `BondPosted`, `BondReleased`, `PartnerGateUpdated`, `CapUpdated`, …

## `CheomaVault.sol`

Shares-based combined vault (testnet). Deposits mint internal shares; no transferable token; operator-managed yield.

## `CheomaReferralNFT.sol`

ERC-721 referral code NFT. The reward is **0.5% of every deposit** made by a referred wallet ($5 per $1,000), paid from protocol revenue — not from a fee. Note: **not** ERC-721 Enumerable — `tokenOfOwnerByIndex` is not implemented; per-wallet lookup must use `Transfer` logs.

## `CheomaFaucet.sol` / `MockUSDC.sol`

Testnet-only: free USDC faucet and open-mint mock stablecoin.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cheomayield.gitbook.io/cheomayield-docs/contracts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
