π Welcome to PartyFinance documentation!
Funding Mechanism

# Funding Mechanism

## Introduction

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.

## PartyTokens

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.

$\frac{\sum_{i=0}^{n} T_i}{(\sum_{i=0}^{n} T_i) + MPT} = \frac{\sum_{i=0}^{n} DA_i}{(\sum_{i=0}^{n} DA_i) + I_{DA}}$

where:

• n = Total number of party's token holders
• i = Party Token holder (member)
• $T_i$ = Party's token held by member i
• MPT = Party's token to be minted
• $DA_i$ = Total party's value in DA for holder i
• $I_{DA}$ = Flow of funds in DA

Denote that $\sum_{i=0}^{n} T_i$ is the current supply of the party's Token and that $\sum_{i=0}^{n} DA_i$ 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:

$\frac{T_{supply}}{T_{supply} + MPT}= \frac{PV_{DA}}{PV_{DA} + I}$

And rearranging it in order to solve for MPT value:

$\frac{T_{supply} * (PV_{DA} + I)}{PV_{DA}} = T_{supply} + MPT$

$MPT = T_{supply} * \frac{I_{DA}}{PV_{DA}}$

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 ($I_{DA}$) by the total party value in DA ($PV_{DA}$). Take in mind that $T_{supply}$ should be greater than zero for this current solution. When the party gets created, initial token supply is zero.