Getting Started
Protocol Mechanics
Contracts
Equations

# Staking

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

# Bonding

$bond Price = 1 + Premium$
WAGMI has an intrinsic value of 1 DAI, which is roughly equivalent to \$1. In order to make a profit from bonding which can be distributed to stakers, Euphoria charges a premium for each bond.
$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 WAGMI is minted from the profit and subsequently distributed amongst all stakers.
$debt Ratio = bondsOutstanding/wagmiSupply$
The debt ratio is the total of all WAGMI promised to bonders divided by the total supply of WAGMI. This allows us to measure the debt of the system.
$bondPayout_{reserveBond} = marketValue_{asset}\ /\ bondPrice$
Bond payout determines the number of WAGMI sold to a bonder. For reserve bonds, the market value of the assets supplied by the bonder is used to determine the bond payout. For example, if a user supplies 1000 DAI and the bond price is 250 DAI, the user will be entitled 4 WAGMI.
$bondPayout_{lpBond} = marketValue_{lpToken}\ /\ bondPrice$
For liquidity bonds, the market value of the LP tokens supplied by the bonder is used to determine the bond payout. For example, if a user supplies 0.001 WAGMI-DAI LP token which is valued at 1000 DAI at the time of bonding, and the bond price is 250 DAI, the user will be entitled 4 WAGMI.

# WAGMI Supply

$WAGMI_{supplyGrowth} = WAGMI_{stakers} + WAGMI_{bonders} + WAGMI_{DAO}$
WAGMI supply does not have a hard cap. Its supply increases when:
• WAGMI minted and distributed to the stakers.
• WAGMI is minted for the bonder. This happens whenever someone purchases a bond.
• WAGMI is minted for the DAO. This happens whenever someone purchases a bond. The DAO gets the same number of WAGMI as the bonder.
$WAGMI_{stakers} = WAGMI_{totalSupply} * rewardRate$
At the end of each epoch, the treasury mints WAGMI at a set reward rate. These WAGMI will be distributed to all the stakers in the protocol. You can track the latest reward rate on the Euphoria Staking page.
$WAGMI_{bonders} = bondPayout$
Whenever someone purchases a bond, a set number of WAGMI is minted. These WAGMI will not be released to the bonder 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 bonding section above to see how it is calculated.
$WAGMI_{DAO} = WAGMI_{bonders}$
The DAO receives the same amount of WAGMI as the bonder. This represents the DAO profit.

# Backing per WAGMI

$WAGMI_{backing} = treasuryBalance_{stablecoin} + treasuryBalance_{otherAssets}$
Every WAGMI in circulation is backed by the Euphoria treasury. The assets in the treasury can be divided into two categories: stablecoin and non-stablecoin.
$treasuryBalance_{stablecoin} = RFV_{reserveBond} + RFV_{lpBond}$
The stablecoin balance in the treasury grows when bonds are sold. RFV is calculated differently for different bond types.
$RFV_{reserveBond} = assetSupplied$
For reserve bonds such as the DAI bond and the UST bond, the RFV simply equals to the amount of the underlying asset supplied by the bonder.
$RFV_{lpBond} = 2sqrt(constantProduct) * (\%\ ownership\ of\ the\ pool)$
For LP bonds such as the WAGMI-DAI bond and the WAGMI-UST bond, the RFV is calculated differently because the protocol needs to mark down its value. Why? The LP token pair consists of WAGMI, and each WAGMI in circulation will be backed by these LP tokens - there is a cyclical dependency. To safely guarantee all circulating WAGMI are backed, the protocol marks down the value of these LP tokens, hence the name risk-free value (RFV).