Insurance Model
Each perp market has built-in insurance, which is any surplus of USDC in the smart contract that is not accounted for as collateral deposits of open positions. Sending USDC to the contract is the equivalent of donating to a market's insurance fund.
How Insurance is Used
The only time that insurance funds can be accessed is in the case of bad debt. If a market has any bad debt during the close of a position, any available insurance funds will be used to pay out the position. If the insurance fund is depleted, then the remaining losses will be socialized across all open taker positions by deleveraging their gains, which is the last line of defense against insolvency (see: Solvency).
How Insurance is Replenished
Each market has an insurance fund which acts as its first backstop, and will be depleted by bad debt that emerges. However, insurance is continually replenished by fees. When configuring the fees for a market, the insurance fee determines the percentage of taker fees which are dedicated to insurance. More details in the Fees module section.