---
# System prepended metadata

title: Broker Self-Staking Example Scenario
tags: [Spec-Revenue-Sharing]

---

---
tags: Spec-Revenue-Sharing
---

# Broker Self-Staking Example Scenario

## Parameters

The following parameters are set for the broker pool:

1. <b>initial_margin</b> - what needs to be put in during the beginning: <b>100 DATA / 100 Pool Tokens</b>
2. <b>maintenance_margin</b> - the level that has to be met of % of pool tokens for insurance (soft limit): <b>10%</b>
3. <b>minimum_margin</b> - the lowest percent of pool tokens that a broker can have before new delegation is not allowed: <b>10%</b>
4. <b>broker_share</b> - The share that the broker gets for running the pool regardless of number of tokens: <b>50%</b>
5. <b>broker_share_max_divert</b> - The maximum of the broker share that gets diverted when the maintenance_margin is not met: <b>10%</b>

## Initialization

1. The broker creates the pool and puts in 100 data, to get back 100 pool tokens. 
2. A parameter tracking broker self-stake now has 100.


## Delegator 1 Joins

1. Delegator 1 tries to delegate 900 DATA to the pool. This data would be worth 900 pool tokens.
2. A check happens to see if this new delegation would cause an issue with the hard margin limit. 100 / (100 + 900) so it passes fine.
3. 900 data is transferred to the pool. Pool now has 1000 data, broker has 100 tokens, delegator 1 has 900 tokens.
4. Broker pool delegates to streams with all 1000 data.

## Delegator 2 Rejected

1. A new broker tries to join by adding 100 DATA. This would bring the broker to having 100 / (1000 + 100) < 10% so it is rejected.

## Revenue Earned

1. 2000 DATA is earned with the broker pool.
2. 1000 DATA is owed for the broker share (50% x 2000). This 1000 is sent directly to the broker's account.
3. The rest of the 1000 hits the pool value. Pool value is now 2000, with a total of 1000 pool tokens meaning the exchange rate is 2.
4. The broker's tokens are worth 200 (100 x2) and the delegator's are worth 1800 (900 x 2)
5. All the 1000 data is staked so now a total of 2000 DATA is staked.

## Slashing Occurs

1. A stream slashes for 100 DATA.
2. The broker self-stake takes first loss. 100 DATA -> 50 Pool Tokens. 50 pool tokens are burned from the broker, and the broker self-stake parameter is lowered from 100 to 50.
3. Pool value is 1900 now, but the amount of tokens has lowered to 950, so the exchange rate is still 2.
4. Now the broker is under the required self-stake requirement of 10%, so they will see their revenues be diverted

## Revenue Earned

1. 2000 in revenue is earned
2. First 50% goes to the broker share which is 1000. Then this gets split according to the following:
3. The maximum amount that can get diverted to filling back up the broker self-stake is 10% or 100. In this case that is what needs to be replaced so 100 is taken from this 1000.
4. The 100 DATA exchanges to 50 pool tokens, bringing the broker's tokens back to 100. At the current step, pool value is back to 2000, and total tokens is now back to 1000.
5. The 900 left over is sent directly to the broker account.
6. The other 1000 in revenue hits the pool value and now pool value is 3000. Each token is also now worth 3 in terms of exchange rate.

## Note: Broker Tops Up

A broker can also just top up instead of waiting for revenue

## Note: Broker Withdraws

A broker can only withdraw if it would keep the percent above the required value for ownership or the pool is being terminated

## Note: Soft vs. Hard Margin Percent

In reality, the hard will likely be lower than the soft but it was easier to keep it the same in this case for illustration