> 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`

Fixed-APY tokenized vault. Non-transferable (soulbound) ERC-20 receipt.

**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`

## `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 (10/90 entry/exit fee split on testnet). 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 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://cheomayield.gitbook.io/cheomayield-docs/contracts.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.
