# Equations

## Staking

$deposit = withdrawal$
Swaps between Pals and Pals during staking and unstaking are always honored 1:1. The amount of Pal deposited into the staking contract will always result in the same amount of Pals. And the amount of Pals withdrawn from the staking contract will always result in the same amount of Pal.
$rebase = 1 - ( PDDeposits / PDs Outstanding )$
The treasury deposits Pal into the distributor. The distributor then deposits PD into the staking contract, creating an imbalance between Pal and PDs. Pals are rebased to correct this imbalance between PD deposited and Pals outstanding. The rebase brings Pals outstanding back up to parity so that 1 Pals equals 1 staked PD.

## Minting

Minting happens by allowing users to purchase a bond. This bond price is the Mint price.
$bond Price = 1 + Premium$
PD has an intrinsic value of 1 BUSD, which is roughly equivalent to \$1. In order to make a profit from minting, Paladin DAO charges a premium for each minting action.
$Premium = debt Ratio * BCV$
The premium is derived from the debt ratio of the system and a scaling variable called BCV. BCV allows us to control the rate at which bond prices increase.
The premium determines profit due to the protocol and in turn, stakers. This is because new Pal is minted from the profit and subsequently distributed among all stakers.
$debt Ratio = bondsOutstanding/PDSupply$
The debt ratio is the total of all Pal promised to bonders divided by the total supply of PD. This allows us to measure the debt of the system.
$bondPayout_{reserveBond} = marketValue_{asset}\ /\ bondPrice$
Bond payout determines the number of Pal sold to a minter. For reserve mints, the market value of the assets supplied by the minter is used to determine the bond payout. For example, if a user supplies 1000 BUSD and the mint price is 250 BUSD, the user will be entitled 4 PD.
$bondPayout_{lpBond} = marketValue_{lpToken}\ /\ bondPrice$
For liquidity mints, the market value of the LP tokens supplied by the minter is used to determine the bond payout. For example, if a user supplies 0.001 PD-BUSD LP token which is valued at 1000 USDT at the time of bonding, and the bond price is 250 BUSD, the user will be entitled 4 Pal.

## PD Supply

$PD_{supplyGrowth} = PD_{stakers} + PDE-_{bonders} + PD_ {DAO}$
Pal supply does not have a hard cap. Its supply increases when:
• Pal is minted and distributed to the stakers.
• Pal is minted for the bonder. This happens whenever someone purchases a bond.
• Pal is minted for the DAO. This happens whenever someone purchases a bond. The DAO gets the same number of Pal as the bonder.
$Pal_{stakers} = Pal_{totalSupply} * rewardRate$
At the end of each epoch, the treasury mints PD at a set reward rate. These PD will be distributed to all the stakers in the protocol.
$Pal_{bonders} = bondPayout$
Whenever someone purchases a bond, a set number of PD is minted. These PD will not be released to the minter all at once - they are vested to the bonder linearly over time. The bond payout uses a different formula for different types of bonds. Check the Minting section above to see how it is calculated.
$Pal_{DAO} = Pal_{bonders}$
The DAO receives the same amount of PD as the minter. This represents the DAO profit.

## Backing per PD

$PD_{backing} = treasuryBalance_{stablecoin} + treasuryBalance_{otherAssets}$
Every PD in circulation is backed by the Paladin DAO treasury. The assets in the treasury can be divided into two categories: stablecoin and non-stablecoin.
$treasuryBalance_{stablecoin} = BackingPerPD_{reserveBond} + BackingPerPD_{lpBond}$
The stablecoin balance in the treasury grows when bonds are sold. Backing per PD is calculated differently for different mints types.
$BackingPerPD_{reserveBond} = assetSupplied$
For reserve mints such as BUSD minting, the Backing per PD simply equals to the amount of the underlying asset supplied by the minter.
$BackingPerPD_{lpBond} = 2sqrt(constantProduct) * (\%\ ownership\ of\ the\ pool)$
For LP Mints such as PD-BUSD Minting, the Backing Per PD is calculated differently because the protocol needs to mark down its value. Why? The LP token pair consists of PD, and each PD in circulation will be backed by these LP tokens - there is a cyclical dependency. To safely guarantee all circulating PD are backed, the protocol marks down the value of these LP tokens.