# MoCSettlement

* Referenced by: MoC, MoCState
* References/uses: Math, SafeMath, MoCBase, DocToken, MoCState, MoCExchange, MoCBProxManager, MoC
* Inherits from: MoCBase

This contract handles settlement logic and stores redeem request collection. It uses both `lastProcessedBlock` and `blockSpan` to periodically allow one execution.

* State:
  * Last Processed Block: Block Number of the last successful execution `uint256 internal lastProcessedBlock;`
  * Block Span: Set by configuration, min number of blocks settlement should be re-evaluated on, this should be adjusted according network mining rate to hit the target time `uint256 internal blockSpan;`
  * Redeem request collection: tracks accounts with active redeem request for next settlement

```
struct RedeemRequest {
  address who;
  uint256 amount;
}
RedeemRequest[] private redeemQueue;
uint256 private numElements = 0;
```


---

# Agent Instructions: 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:

```
GET https://docs.moneyonchain.com/main-rbtc-contract/money-on-chain-platform/contracts-architecture/mocsettlement.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
