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

# Stock Dividends

> Stock Dividends — Dark Matter Protocol on Robinhood Chain.

# Stock Dividend Vault

`StockDividendVault` turns 1% of every reactor deposit into a **daily pro-rata dividend
paid in ETH or tokenized stocks** (AAPL, NVDA, MSTR, TSLA, SpaceX — canonical Robinhood
Stock Tokens).

## Intake

```solidity theme={null}
function deposit(address user) external payable onlyProtocol returns (bool);
```

* Only the wired `protocol` (the reactor) may call it — 1% of every `injectMass` lands
  here with the depositor's address attached.
* Funds pool **per UTC day** (`day = block.timestamp / DAY`, `DAY = 86400`).
* The depositor's weight for that day is their **gross deposit** (not the 1% cut):

```solidity theme={null}
dayPool[day] += msg.value;
dayWeight[day][user] += msg.value;
dayTotalWeight[day] += msg.value;
```

## Claiming — closed days only

A day's pool becomes claimable the moment the next UTC day starts. The claim formula:

```solidity theme={null}
claimable = (dayPool[day] * dayWeight[day][user]) / dayTotalWeight[day];
```

Claims **never expire** — a day you missed stays claimable forever. Two claim paths:

| Path | Call | Behavior |
| - | - | - |
| ETH | `claim(day, address(0), 0)` | Pays the slice in native ETH |
| Stock | `claim(day, stockToken, minStockOut)` | Swaps the slice into a whitelisted stock token |

The stock path routes through a `swapper` adapter:

```solidity theme={null}
uint256 received = swapper.swapEthToStock{value: amount}(stockToken, msg.sender);
if (received == 0) revert SwapReturnedZero();
if (received < minStockOut) revert Slippage(received, minStockOut);
```

`minStockOut` is a **slippage guard**: the claim reverts atomically if the swap
delivers less than expected, so sandwiching the swap is unprofitable.

## Worked example

Day 20123 sees 10 ETH of reactor deposits, from 4 depositors:

| Depositor | Gross deposit | Day weight | Slice of 0.10 ETH pool |
| - | - | - | - |
| A | 5 ETH | 50% | **0.050 ETH** |
| B | 3 ETH | 30% | **0.030 ETH** |
| C | 1.5 ETH | 15% | **0.015 ETH** |
| D | 0.5 ETH | 5% | **0.005 ETH** |

Depositor B claims day 20123 choosing **NVDA** with `minStockOut = 0.029 ETH`-worth:
the vault swaps 0.03 ETH into NVDA stock tokens and sends them straight to B's wallet.
Had the swap returned less than the guard, B's claim reverts — the day stays claimable
and B can retry later (admin can fix/replace a broken swapper; claims never expire).

## Safety model

| Concern | Answer |
| - | - |
| Broken swapper bricks claims? | No — claims are permanent; the ETH path always works |
| Owner steals the pool? | No withdraw-to-owner exists; only per-day pro-rata claims |
| Owner redirects flow? | `setProtocol` can point elsewhere, but the current day's pool is untouched |
| Slippage attack on stock path | `minStockOut` reverts atomically; retry costs nothing |
| Reentrancy | `claimed` flag set **before** any external call (checks-effects-interactions) |

## View helpers

```solidity theme={null}
claimableFor(user, day)                    // exact slice for one day
claimableNow(user) → (total, oldestDay)    // scans the last 7 closed days (UX helper)
currentDay(), dayClosesAt(day)
```

Next: [Founder Pass Fee Share](pools/founder-pass.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.