---
# System prepended metadata

title: King Protocol Weight Calculation

---

# King Protocol

## Weight Calculation Problem

As part of a multi-protocol governance process, each protocol needs to be assigned a *weight* relative to other protocols. This *Weight* will be used to allocate resources such as governance power. 

### Overview of Process

![protocol-weight-calculation](https://hackmd.io/_uploads/Hk-Kj3jPJe.png)

* Inputs: Onchain Data
* Parameter: $p$, a *power* parameter
* Output: Final 

To determine the weight for the $k$th Protocol, the current process design is:

1. **(Grade)** Bawed on *Onchain Data*, determine a *Grade_k* for the protocol. Convert *Grade* to a predefined *GradeWeight_k*, (e.g. "A" = 1.0, etc.) 
2. **(Expected Revenue)** Based on *Onchain Data*, calculate *Expected Revenue (ExpectedValue)_{k}* for the protocol.
3. **(Initial Weight)** Calculate the initial weight for Project $k$ as  ${InitWeight}_k = {GradeWeight}_k * (ExpRev)_{k}^p.$
4. **(Total Weight)** Add up all the initial weights for all protocols.
$TotalWeight = Sum(InitWeights)$ or 
$TotalWeight = \displaystyle\sum_{k=1}^{N} {InitWeight}_k$
5. **(Final Weight)** To calculate the final weight of the protocol, divide its InitialWeight by TotalWeight. $Weight_k = \displaystyle\frac{InitialWeight_k}{TotalWeight}.$

### Subproblem 1: Grading Weights

**Need:** 
A *grading function* that can take onchain data and convert it to a letter grade, e.g. "A", "B", etc.  

**Need:** A *grade point function* - a way to convert letter grades to numerical values, e.g. "A" = 1.0, "B" = 0.7, etc. 

### Subproblem 2: Expected Revenue

**Need:** Given onchain data, need a way to calculate Expected Revenue for the protocol. 

## Initial Exploration of Allocation Mechanism

We can start with an initial exploration of the allocation mechanism with some simplified assumptions:
* there are no protocol grades (all weights are 1.0)
* there are only two partners, so one protocol has $p \in [0,1]$ for the $ExpectedValue$, and the other has $(1-p)$

Exploring the effect of $p$ on the overall shape:

<iframe src="https://www.desmos.com/calculator/mfbrlnyysj?embed" width="500" height="500" style="border: 1px solid #ccc" frameborder=0></iframe>

Some reasonable initial heuristics:
* **Gain:** $G(x) = \displaystyle\frac{f(x)}{x}$. This is like a "volume measurement" that represents how much amplification the protocol gets in terms of rewards. Protocols with lower ExpectedValue get more gain, which is expected behavior. Optimizing this function is a proxy for gaming the system. 
* **Percentage Gain:** $H(x) = \displaystyle\frac{f(x) - x}{x}$. This is akin to an error formula in the physical sciences. It measures how much gain the protocol gets (in terms of allocation), as a percentage of its ExpectedValue. Useful for measuring "bang for your buck" in terms of gaming the system. 

## Key Questions, Edge Cases, and Scenarios

1. **Mob Rule Problem.** Suppose there is one strong protocol, and many weaker ones. Is it possible for the weaker ones to collude and overwhelm the stronger one? 

2. **Dictatorship Problem.** Under what circumstances is it possible for a single protocol to exert influence sufficient to make others irrelevant? 

3. **Grade Error.** No grading system is perfect. What are the consequences of mis-assigning one or several grades? 

## Test Cases

1. **One exceptionally strong protocol.** 

There is one "A" protocol which is expected to generate far more revenue than the others. 

What should its weight be? 

2. **Mismatch between grade and expected revenue.** 

The process has a mismatch between the grades and expected revenue, e.g. there is an "A" protocol that isn't expected to have much revenue, and a "C" one that is. 

What would the ideal resolution be? 


