Below are the equations used for the Party-with-tokens proposal. As a brief summary, every party member will be minted an ERC20 token whenever they join the party or deposit more funds to the party. That token represents the member’s share of the party’s pool and their membership. Whenever members wants to withdraw their funds, these tokens will be burned. This scenario assumes that every deposit in DA gets correctly distributed according to the pool asset distribution. Quotes are retrieved from 0x in order to proceed with the swaps on every deposit/withdraw.
The purpose of this formula is to calculate how many tokens should be minted for new deposits on the deposits party member. Since, value of different assets inside the party are constantly changing, the desire approach is to take a snapshot in time for the current party’s fund value in the Denominated Asset (DA from now on) as necessary to get the number of tokens that the user should get.
- n = Total number of party's token holders
- i = Party Token holder (member)
- = Party's token held by member i
- MPT = Party's token to be minted
- = Total party's value in DA for holder i
- = Flow of funds in DA
Denote that is the current supply of the party's Token and that is the total balance expressed in DA for the Party.
In practice, we will need to find what's the exact MPT value. The rest of the variables are already known. Having said that, we can change the formula to the following:
And rearranging it in order to solve for MPT value:
The total quantity of tokens to be minted (MPT) is equal to the current supply of tokens times the ratio between the coming flow in DA () by the total party value in DA (). Take in mind that should be greater than zero for this current solution. When the party gets created, initial token supply is zero.