# Settle

After a piggy is "cleared," the settlement process can be completed by "settling" a piggy. If any funds are owed to the holder of a piggy, this phase will distribute funds between counterparties. If the piggy expires out-of-the-money (no payment is owed to the holder), the writer of the piggy can "settle" the piggy to get back the collateral locked inside.

This phase distributes the collateral, and must be complete by some agent $$^1$$ for the collateral to be assigned from the SmartPiggies smart contract to either the holder of the piggy, the writer of the piggy, or a split between counterparties.

In order to **Settle** a piggy, the piggy must be have previously be "cleared." Once the piggy is cleared, and the piggy has received the clearing price from an oracle, the piggy can calculate the payout and disburse the collateral among the counterparties. When the piggy has been "cleared" the piggy will be available to "settle":

![](/files/-McG8B4qtOLRp9E9tpSW)

&#x20;

## Footnotes

1 After a piggy has been cleared, anyone can "settle" it. The party could be a good Samaritan if they are not privy to benefit from the payout, or the agent can be the holder or writer of the piggy.&#x20;


---

# 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.smartpiggies.com/lifecycle-of-a-piggy/settle.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.
