---
tags: Spec-Revenue-Sharing
---
# Operator Self-Delegating Proposal V3/Final
TODO: add changes to main text. This is how it works now conceptually:
* when operator withdraws earnings (or receives earnings as part of unstaking):
* the incoming DATA are added to the Operator contract's balance
* this would cause DATA/pooltoken rate go up
* operator's share (given fraction) is "self-delegated"
* as if e.g. 10% of that DATA had been sent in by the operator themselves, even though it did come from withdraw action
* the remaining e.g. 90% just lands to the contract balance
* DATA/pooltoken rate still goes up but a bit less
* there is still a minimum margin (operator's self-delegated share) but as of 2023-05-04 it's only checked when a new delegator joins (so un-self-delegating everything just prevents new delegators from joining) but ETH-511 adds check for when operator un-selfdelegates
## Summary
This current version is the latest iteration coming from this [prior version](https://hackmd.io/KS09LdnCS7OPn5xZlRNH0Q). There is also the worked out [example scenario](https://hackmd.io/M6gfCQFXSMOy1aDEUAGNaA). The current update adds some smaller changes.
## Parameters
| Name | Description | Type |
| -------- | -------- | -------- |
| initial_margin | The initial margin requirement that is needed from the broker to create the pool | Pool Tokens |
| maintenance_margin | The level that has to be met of % of pool tokens for insurance (soft limit) | Percentage (of pool tokens) |
| minimum_margin | The lowest percent of pool tokens that a broker can have before new delegation is not allowed | Percentage (of pool tokens) |
| broker_share | The share that the broker gets for running the pool regardless of number of tokens | Percentage (of income) |
| broker_share_max_divert | The maximum of the broker share that gets diverted when the maintenance_margin is not met | Percentage (of broker_share) |
## Behavioral Actions/Prior Actions
### Broker Pool Initialization
- On initialization of the broker pool there is an <code>initial_margin</code> of tokens that the broker must be buying in to. The broker transfers the necessary DATA to pay for the tokens and receives them in their account.
- This whole flow can follow through the same format as a normal buying operation for a delegator except we track the variable of broker stake separately
### Broker Stake Withdraw
- A behavioral action where a broker sends a message to opt to withdraw stake.
- The flow is Check Withdraw Ability -> IF TRUE -> Withdraw Self-Stake
### Broker Stake Slashing
- In the event of slashing for bad behavior, poor stream performance, or other reasons, there can be slashing that occurs on the broker end
- This will trigger stream slashing policy
### Revenue Modification
- Revenue is first split into two categories:
- $PoolShareRev = (1-BrokerShare) \cdot revenue$
- $BrokerShareRev = (BrokerShare) \cdot revenue$
- PoolShareRev hits the pool value and the tokens that the broker has appreciates in value the same way as the non-broker tokens appreciate
- There is then two cases for the BrokerShareRev
- IF (Check Not Under Funded)
- 100% of the BrokerShareRev sent to the broker
- ELSE
- Define DivertedRev = $Minimum(\text{Amount needed to be funded}, BrokerShareMaxDivert \cdot BrokerShareRev)$
- BrokerShareRev - DivertedRev is sent directly to the broker
- DivertedRev is used to mint new pool tokens for the broker self-stake
### Broker Stake Top Up
- This is the event where a broker tops up their self-stake
### Delegation
- A behavioral action where outside delegators want to delegate to the broker pool
- The flow is Check Not Under Funded -> IF TRUE -> Allow Delegation
## Policies
### Check Withdraw Ability
- A policy which checks the ability of a broker to withdraw their own self-stake based on conditions
- Currently it will return the value of:
$$\frac{BrokerSelfStake}{TotalTokens} > MaintenanceMargin$$
### Check Not Under Funded
- A policy which checks if the current stake that a broker has is less than the <code>maintenance_margin</code>
- This will divert revenue until the stake is back to variation margin
- It will return the value of:
$$\frac{BrokerSelfStake}{TotalTokens} > MinimumMargin$$
### Stream Slashing Policy
- We are given an amount of DATA that was slashed SlashAmount
- Start with $ExchangeRate = \frac{PoolValue}{TotalTokens}$
- Determine DATA value of the self-stake, $SelfStakeValue = BrokerStake \cdot ExchangeRate$
- The amount paid out of insurance can be found as: $InsurancePayment = MIN(SelfStakeValue, SlashAmount)$
- Pool value decreases by InsurancePayment
- The equivalent tokens are burned from the broker's tokens, i.e. we burn $InsurancePayment / ExchangeRate$ worth of tokens that the broker owns
- Not that the exchange rate stays constant and the token value of delegators does not decrease at this point!
- If there is any leftover payment, i.e. InsurancePayment < SlashAmount, then it is just taken out of the pool value as done prior which decreases the exchange rate/value of the tokens
## Mechanisms
### Withdraw Self-Stake
- A mechanism which decreases the pool tokens of the broker and swaps DATA to them
### Top Up Mechanism
- A mechanism which takes care of setting any flags, transferring for pool tokens, etc.
## System Guarantees
1. Brokers will only earn revenue if they have enough stake.
2. Brokers will be the first line of defense for slashing