I'm building a dapp and I need some help with creating the formula for a "distribution coefficient/index" (my math is rusted). The idea behind it is:

  1. There's a total balance. Let's call it "X".
  2. There are users with different shares at stake on "X": A, B, C and D (users).
  3. Each user has a % allocation depending on how much they have at stake on "X". Let's say:
  • A --> 10 units --> 10%
  • B --> 20 units --> 20%
  • C --> 30 units --> 30%
  • D --> 40 units --> 40%
  • X = 100 units ---> 100%

I need a coefficient (let's call it "Y") capable of determining the new allocation % of each user once any of them has added more units to "X" (and to their share), and the formula to calculate this coefficient. It would be something like:

  • A --> 30 (10 [oldUnits] + 20 [newUnits]) --> Y --> 25%
  • B --> 20 --> Y --> 16.66%
  • C --> 30 --> Y --> 25%
  • D --> 40 --> Y --> 33.33%

The limitations/constraints/requirements are:

  1. The only parameter that I (my app) can freely modify is "Y".
  2. The users are in charge of modifying their own stake of "units".
  3. The % allocation is the result of the interaction of "units" with "Y" -and perhaps "X" (?)- and it must return 100% when adding up the % allocation of all users.

I don't have a high-level math background (mine it's business), so go easy on me please.

I know Maker and Aave have their own implementation of these principles, but theirs are more complex since more variables are involved, and my level of math doesn't allow me to understand the complexity behind their formulas. Hence, the reason of this post. :)

Thanks a lot!

1 Answer 1


Set Y to be (1/X). X being the sum of all units staked (100 in your first example, 120 in second example).

If you divide each user's stake by the total amount staked, you get the user's percentage of the bag.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.