# Settlement

Gamma Options are European-style options, meaning that they can only be exercised at expiration.

Settlement is the critical process that facilitates the appropriate distribution of funds to each system participant upon expiration.

## Overview

Settlement is the operation executed on the platform level that affects all markets with the same expiration time and is enabled for execution as soon as that expiration time is reached. Expiration times on the Gamma Options Platform are every day at 8:00 a.m. Greenwich Mean Time (GMT).

Following the true DeFi paradigm, upon expiring, anyone can execute settlement with a simple button click. The app contains a ticker that counts down to the next expiration time, and once the time is reached, the Settlement button is enabled.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXds9RSsBx26JYZRUM8pxWiqKF0S6QIZ4mbdDxxSmiFyxoha82bTw56mB3JwOzZRoZNfkxIdZ14l4Ixo4Yd98eYue6FXyLHtZsvdcWSW2e30gqKRjbQ42kSvlwYqJYQFzL8KmEESC2XF3xUAJiTSBSWV2rs?key=3jb8WcWHRhSVyKeunavGbw" alt=""><figcaption><p>Expiring markets countdown</p></figcaption></figure>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXf6Y_EdT9goDmFjMMkAcJl4mR9rwmcUA39ASsCvY9ognE8oOzo8wOL8Hzwjqyu6aec-QC-TQlMvIjFp5sx9C8h3aXiBowvpxJk-p0UILSdK0PjGkyCSkojFF6DkB6guULQuDX4OPeE-5lAxil43sJiQX_7x?key=3jb8WcWHRhSVyKeunavGbw" alt=""><figcaption><p>There are markets to be expired</p></figcaption></figure>

Actors incentivized to execute settlement:

* Platform admins - 99.9% of the time, a specified bot will call the settlement function. Additionally, the bot is made public and anyone can run it.
* Actors who profit under current conditions - as a failsafe, should the bot fail for some reason, there are always going to be actors on the platform that profit under the circumstances at the expiration time
* Everyone else - once the GAMMA token is set in place, settlement callers will receive rewards for participating in system maintenance

As all of the positions are fully collateralized, on settlement the platform:

* Records the price at expiration, later to be used for position closing
* Tallys all of the outstanding profitable long option positions, as well as long and short futures positions
* Based on the previous step, executes a swap on Uniswap, maintaining each positions worth

Apart from executing the settlement, the aforementioned bot also closes all positions associated with expired markets. In a true DeFi fashion (and as a form of a failsafe), each user can close out his own positions manually.

## Flash Loan Attack Protection

Since settlement heavily relies on Uniswap, it is subject to flash loan attacks. Gamma Options has a proprietary method of combating this by utilizing Uniswaps TWAPs (Time Weighted Average Price) to detect anomalous price behavior when the settlement is executed. Should that kind of price behavior be detected, the settlement attempt will be rejected.

<br>


---

# 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://doc.gammaoptions.com/docs/fundamentals/settlement.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.
