# Credit default protection

Bob has provided an undercollateralized loan to a DAO using a DeFi protocol. He is concerned that the DAO may not repay the loan in full and he will lose money. Bob would like to protect himself against a (partial) default by purchasing a position whose payout increases as the repayment amount decreases.

### :gear: Pool configuration

Bob uses the DIVA App to create a credit insurance product with the following configuration:

![Example configuration for a credit default insurance product in the DIVA App using a linear payoff profile.](https://1305042189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHZJ0AbZj1fc1i5a58eEE%2Fuploads%2F5tB83317E7ktWG1oLBsc%2Fimage.png?alt=media\&token=4f621a30-0d35-4271-a994-356f71b825f9)

Notes:

1. The Reference Asset is the on-chain bond address.
2. The Expiry Time is equal to the maturity/grace period end of the bond.
3. Given the on-chain nature of the loan, the repayment amount information is stored on-chain providing a fully trustless oracle for settlement.

### :handshake: Sell long position tokens

After creating the pool, Bob puts all long position tokens for sale (1'000'000 in total in our example), for a price of USDC 0.95 each. Alice purchases all long position tokens for a total of USDC 950'000. After the trade, the two parties end up with the following positions:

![Payoff profiles for Bob and Alice.](https://1305042189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHZJ0AbZj1fc1i5a58eEE%2Fuploads%2F2RrtgA49Id1PMKaTj2oQ%2Fimage.png?alt=media\&token=289cf0f3-7641-41ca-bf2c-d954512fca77)

Bob's net contribution / premium paid for the credit default insurance (short position) after the sale is USDC 1'000'000 - 950'000 = USDC 50'000.

### 💵 Payoff scenarios

1\) DAO has repaid the full loan amount (USDC 1'000'000):

* Bob paid a premium of USDC 50'000 but doesn't receive any payout from the short position as the loan was fully repaid: \
  -> <mark style="color:orange;">**net loss for Bob: USDC 50'000**</mark>\
  -> <mark style="color:green;">**net gain for Alice: USDC 50'000**</mark> (5.26% on USDC 950'000)

2\) DAO has repaid 50% of the loan (USDC 500'000):

* Bob paid a premium of USDC 50'000 and receives USDC 500'000 as payout due to partial repayment of the loan:\
  -> <mark style="color:green;">**net gain for Bob: USDC 450'000**</mark>\
  -> <mark style="color:orange;">**net loss for Alice: USDC 450'000**</mark>

3\) DAO doesn't repay the loan (USDC 0):

* Bob paid a premium of USDC 50'000 and receives USDC 1'000'000 as payout due to a full default:\
  -> <mark style="color:green;">**net gain for Bob: USDC 950'000**</mark>\
  -> <mark style="color:orange;">**net loss for Alice: USDC 950'000**</mark>
