> ## Documentation index
> Fetch the complete documentation index at: https://docs.predictefy.com/llms.txt
> Use it to discover every available page before exploring further.

# Rain

> The build request schema, signing scheme, and bounds for Rain.

## Step zero — from nothing to your first trade

1. **Create the account.** Start at the venue's site and connect an Arbitrum EOA. The repository
   sources do not establish whether Rain registration is required or what identity check applies,
   so verify that prerequisite with the venue.
2. **Set up signing.** A fresh user must first create an EVM wallet and secure the seed phrase
   offline. Rain needs no caller API credential: the wallet signs and broadcasts locally, and
   Predictefy never sees its private key.
3. **Fund it.** Hold USDT on Arbitrum and a little ETH for gas. Start with at least 1 USDT for a limit
   buy; a sell must also meet 1 USDT of notional. Approve only the operator-armed per-market Diamond
   with a finite allowance. If your funds are on another chain, use `GET /v1/bridge/quote` as the
   assisted LI.FI route.
4. **Allow time.** Budget about 1–2 hours for a first wallet, bridge, and approval; an already-funded
   Arbitrum wallet is faster. The allowed sources list no Rain-specific geo gate, so confirm venue
   eligibility before funding.

## What you need first

- **Production status:** Armed for build, submit, and cancel as verified on 2026-08-15. Hosted
  submit verifies the signed transaction and records `signed`; broadcasting remains client-owned.
- **Wallet and chain:** An EOA on Arbitrum (`42161`) signs and broadcasts the raw transaction.
- **Venue account:** The lane uses no account credential. Repository evidence does not establish
  whether Rain registration is required, so verify that prerequisite with the venue.
- **Credentials:** No caller venue credential enters the lane. The EOA private key and selected RPC
  remain in the caller's process.
- **Funding:** Arbitrum USDT in the EOA, with a finite approval to the operator-armed per-market
  Diamond. The LI.FI helper can fund the wallet.

:::note[Production update — 2026-08-15]
Rain's earlier code-ready/default-off phase is superseded for production arming. The client-owned
broadcast boundary and per-market safety checks below are unchanged.
:::

Rain's standard hosted order path is a source-verified **LIMIT** build. Omit `action` or set it to
`"limit"`; choose `orderSide: "BUY"` or `"SELL"`. The opt-in `action: "market"` path requires
explicit slippage and deadline protection. `action: "approve"` remains available for the pool's
USDT allowance.

Every build resolves the pool Diamond from the Core catalog. Caller-supplied pool fields cannot
replace it. At one pinned Arbitrum block, the server verifies that the pool's `FACTORY()` is the
official RainDeployer, its UUPS implementation, `createdPools(pool)`, Arbitrum USDT with a `1e6`
scale, and every required
`facetAddress(selector)` route on that pool. A mismatch returns
`RAIN_POOL_SAFETY_CHECK_FAILED` and no calldata.

:::danger[Rain's public option-side documentation is wrong]
Verified V2 Solidity maps `1 = YES` and `2 = NO`; `0` reverts `InvalidSide()`. The API accepts
`YES`/`NO` or `1`/`2` and rejects every other value. Option ids are 1-indexed, so option `0` is
invalid.
:::

For LIMIT builds:

| Field    | BUY                                                    | SELL                                                    |
| -------- | ------------------------------------------------------ | ------------------------------------------------------- |
| Quantity | `amount`: base-token atoms (Arbitrum USDT, 6dp)        | `shares`: share atoms (6dp)                             |
| ABI      | `placeBuyOrder(option, side, price, amount, postOnly)` | `placeSellOrder(option, side, price, shares, postOnly)` |
| Minimum  | `amount >= 1_000_000` (1 USDT)                         | `shares * price / 1e18 >= 1_000_000`                    |
| Phase    | Order-book phase only                                  | Order-book phase only                                   |

`price` is an integer string scaled by `1e18`: `0.01e18` through `0.99e18`, in exact `0.01e18`
one-cent ticks. BUY's fourth ABI argument is base-token `amount`; SELL's same-position, same-type
argument is `shares`. Swapping those units is rejected before calldata is built.

For protected market builds, provide `slippageBps` from 1 through 9999 and
`deadlineSecondsFromNow` from 1 through 3600. Zero slippage is rejected because a zero minimum
disables protection. The server reads the live block timestamp, uses `getEntryShares` for BUY or
`getSellProceeds` for SELL, derives a nonzero `minSharesOut`/`minAmountOut`, and encodes an
**absolute Unix-seconds deadline**. The duration itself is never encoded as the deadline.
`enterOption` can execute in a live AMM phase or an order-book phase. Verified `sellOption` requires
the order-book phase and is rejected during an AMM pool's live window. The AMM-only
`getCurrentPrice`, `getImpactedPrice`, and target-price-first `getAmountRequired` views are not used
for order-book quotes.

Rain permits fewer than 50 active BUY orders and fewer than 50 active SELL orders per option/user.
The source counters are per order direction, not keyed by YES/NO. A partial remainder below $0.10
does not rest: BUY dust is refunded and SELL dust remains available. These limits and the 1 USDT
minimum surface as typed errors before signing.

Cancel one stored limit build through the standard cancel route and provide its emitted positive
uint256 `orderId`. The server inherits option, side, price, owner, and BUY/SELL direction from the
stored build and encodes `cancelBuyOrders` or `cancelSellOrders` as one scalar option plus three
parallel one-element arrays. Cancel has no phase gate in the verified source.

Predictefy returns only unsigned `{to,data,value}`. The client signs and broadcasts on Arbitrum.
Submit recovers the owner, pins chain `42161`, byte-compares all three fields, and records `signed`;
it never relays or claims a broadcast. The lane was introduced default-off and still requires
`RAIN_ENVIRONMENT`, a read-only `RAIN_RPC_URL`, and explicit `RAIN_MARKET_ADDRESSES`; production's
2026-08-15 arming supersedes only that earlier deployment state.
