> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mystockline.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# EquityOracle

> EquityOracle prices one stock token in USDG and reports the market regime that drives Stockline's action table.

EquityOracle prices one stock token in USDG and reports the market regime that drives Stockline's action table. It is stateless: every output comes from Chainlink feeds, the stock token's corporate-action flags, the HolidayCalendar, and immutable parameters. `regime()` returns LIVE, DARK, HALTED, CA\_WINDOW, or SEQ\_DOWN. `price()` returns a 1e36-scaled price in LIVE, a haircut price in DARK, and reverts in the other regimes.

`EquityOracle` lets you:

* Read the current regime for a stock token
* Read the collateral price in loan units, scaled by 1e36
* Inspect every immutable parameter: staleness, haircut, windows, and feeds

This contract is not deployed on a listed network yet. Watch [Addresses](/resources/addresses).

| Network                 | Address      |
| ----------------------- | ------------ |
| Robinhood Chain testnet | Not deployed |

The source code is [`src/oracles/EquityOracle.sol`](https://github.com/stockline-xyz/contracts/blob/main/src/oracles/EquityOracle.sol) on GitHub. The ABI is [`/abis/EquityOracle.json`](/abis/EquityOracle.json).

## Read methods

### regime

```solidity theme={"system"}
function regime() external view returns (Regime)
```

Returns the current regime. Priority order: SEQ\_DOWN if the sequencer feed reports down or is inside its grace period, CA\_WINDOW if the token's `oraclePaused()` is true or the timestamp is within `caBoundaryWindow` of `effectiveAt`, DARK on weekends, holidays, and their offsets, HALTED if a feed is non-positive or stale, otherwise LIVE.

<Note>
  If `sequencerFeed` is the zero address the oracle never returns SEQ\_DOWN.
</Note>

**Return values**

| Type     | Description                                                       |
| -------- | ----------------------------------------------------------------- |
| `Regime` | Regime enum: 0 LIVE, 1 DARK, 2 HALTED, 3 CA\_WINDOW, 4 SEQ\_DOWN. |

### price

```solidity theme={"system"}
function price() external view returns (uint256)
```

Returns the collateral price in loan-token units scaled by 1e36 (Morpho Blue convention). In LIVE it is `stockAnswer * scale / loanAnswer`. In DARK the same value is reduced by `darkHaircutBps`, and the call reverts with DarkDurationExceeded if the stock feed is older than `maxDarkDuration`. Reverts with PriceUnavailable in HALTED, CA\_WINDOW, and SEQ\_DOWN, and InvalidFeed if either answer is not positive.

<Warning>
  Any view on Stockline or LiquidationModule that values collateral inherits these reverts. Check `regime()` first.
</Warning>

**Return values**

| Type      | Description           |
| --------- | --------------------- |
| `uint256` | Price scaled by 1e36. |

## Errors

### ZeroAddress

```solidity theme={"system"}
error ZeroAddress()
```

A required constructor address was zero. The sequencer feed may be zero.

### InvalidConfig

```solidity theme={"system"}
error InvalidConfig()
```

A staleness or duration was 0, the haircut was 100% or more, an offset was a full day or more, or the scale exponent exceeded 54.

### InvalidDecimals

```solidity theme={"system"}
error InvalidDecimals()
```

A token or feed reports more than 18 decimals.

### InvalidFeed

```solidity theme={"system"}
error InvalidFeed()
```

A feed answer was zero or negative.

### PriceUnavailable

```solidity theme={"system"}
error PriceUnavailable(Regime regime)
```

price() was called in HALTED, CA\_WINDOW, or SEQ\_DOWN.

### DarkDurationExceeded

```solidity theme={"system"}
error DarkDurationExceeded()
```

The stock feed is older than `maxDarkDuration` while DARK.
