Finalizing the payout
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
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":

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.
Copy link