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

# architecture

GetRekt is designed as a Sui perpetuals protocol with USDC collateral and on-chain settlement. Its intended website is [getrekt.trade](https://getrekt.trade/); this address is a brand destination, not evidence that a deployment or domain connection is complete.

The requested GetRekt design has a **2000× maximum leverage**, a new $REKT issuance schedule, and a referral allocation. The repository still contains the earlier 2100× limit, earlier reward curve, and no referral settlement. See [implementation status](broken://pages/c7eabe8af8c3f2ae7c1c1dce69dad717e5d1ac7a) before using any deployment artifact.

## Assets and settlement

```
Ethereum / Base native USDC
  → CCTP V2 burn → Circle attestation → official Sui receive
  → native USDC in the user's Sui wallet
  → separately signed cash position → shared Vault

Lighter BBO → OracleCap relay → price-quality checks
Pyth BTC PriceInfo → independent reference checks
  → open / close / liquidation on Sui

Available LP cash → unpaid profits in FIFO order
Cash or debt-position losses → reward accounting
```

GetRekt does not route user positions into Lighter orders. Lighter supplies bid/ask market data; collateral, positions, claims, and settlement belong to the Sui protocol. Lighter's own leverage limits do not define GetRekt's synthetic leverage.

The LP starts without seed liquidity. Profits that cannot be paid become FIFO claims. A trader may consume an eligible claim to open another position, but the claim is not new USDC. Cash and debt losses remain eligible for loss-based rewards under the chosen economic model.

The new referral design deducts a 2% fee from an actual-USDC loss, then allocates 30% of the remainder to an eligible referrer and 70% to LP. A referred 100 USDC loss therefore allocates 2 USDC to fees, 29.4 USDC to the referrer, and 68.6 USDC to LP. With no valid referrer, all 98 USDC remaining after the fee goes to LP. These reserves are allocated before LP cash pays FIFO claims, replacing the legacy cash-loss fee waiver while claims are queued. Debt losses still generate eligible rewards but no referral payment; their legacy conditional fee rules remain separate. This allocation is not implemented; see [referral fees](broken://pages/4ae98f6aa1e3c0a457110b4f9eefb1d3448a99a6).

## Price-data trust

“On-chain” describes Sui state transitions and settlement. It does not mean that Sui independently proves the truth of Lighter prices. An OracleCap holder relays Lighter BBO; there is no Lighter light client in the contract. The relay can withhold updates or choose prices within accepted bounds.

Pyth supplies an independent reference with feed, timestamp, confidence, and deviation checks. Reading an old PriceInfo object does not make its price fresh. Lighter's USDC quotation and Pyth's USD quotation can diverge, particularly during a USDC depeg. The protocol rejects unsuitable data rather than silently treating those units as interchangeable.

RPC and wallet checks reduce configuration errors. They are not substitutes for trusted infrastructure, event reconciliation, or independent contract review.

## Repository modules

| Path                                                 | Responsibility                                                        |
| ---------------------------------------------------- | --------------------------------------------------------------------- |
| `contracts/21x`                                      | Sui market, price guards, and reward ledger; internal namespace `x21` |
| `contracts/21x/governance`                           | UpgradeCap wrapper with a 48-hour delay                               |
| `packages/core`                                      | BigInt economic reference model and CCTP state machine                |
| `packages/sdk`                                       | Unsigned market and bridge transaction builders                       |
| `packages/client`                                    | On-chain reads, wallet execution, and public multisig setup           |
| `services/oracle`, `services/keeper`, `services/ops` | Price updates, maintenance, journals, and monitoring                  |
| `deployment`                                         | Deployment records and checks that refuse incomplete configurations   |

Legacy identifiers remain unchanged in code. The JS model uses simulated balances; Move positions consume real USDC Coins, and payable settlements return Coins. An integration must not present simulated balances as wallet assets.


---

# 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://docs.getrekt.trade/docs/architecture.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.
