# Introduction

These docs are a comprehensive guide to the [88mph protocol v4](https://88mph.app/), to help end-users and developers.

The protocol codebase is open-sourced and hosted on [Github](https://github.com/88mphapp). It's maintained by 88mph contributors and the [community](/grants-funding). It has been fully audited several times by [security audits firms](/developer-docs/security). In parallel, 88mph maintains a [bug bounty program](https://immunefi.com/bounty/88mphv3/).

Please don't hesitate to ask on our social media channels if you can't find what you are looking for here:

[Twitter](https://twitter.com/88mphapp) | [Discord](https://discord.gg/95pw2uQ7PE) | [Telegram](https://t.me/join_88mphapp)

88mph is continuously iterating on the best way to operate a non-custodial, fully on-chain fixed yield rate protocol, don't hesitate to send us your direct and honest feedback [here](https://forms.gle/UqKQ1LqhwAFCBWGBA).

## 88mph products

88mph offers two non-custodial on-chain products:

1. A [fixed-term fixed-rate yield product](/getting-started/fixed-apy) acting as an intermediary between you and third-party variable yield rate lending protocols to offer the best fixed yield rate on your capital, with a custom maturity up to 1 year.
2. A yield speculation instrument, called [Yield Tokens](/getting-started/yield-tokens) (YTs),  allowing users to speculate on the variable yield rate of third-party protocols such as Compound or Aave.

By using the fixed rate pools, users receive[ MPH tokens](broken://pages/-Meu0jDwAiSYpMbuUrfx) that can be used to obtain [veMPH tokens](/vemph-gauges/vemph) to earn protocol revenues and exercise voting rights.


# Disclaimer

The Platform only serves as an introducing platform and facilitator between investors and third party protocols and/or platforms. The Platform does not make any profits in relation to such introducing activity and the Platform shall under no circumstances be considered as a party to any relationship created between Users, investors and/or third party protocols or platforms and any such relations are entered into at the User’s sole liability and risk.

The Platform does not have any power over any crypto assets and/or deposits of Users and does not provide any advice, investment advice, execution only or custody services. In addition, the Platform does not buy or sell any financial instruments or provide any banking, portfolio management, trustee, manager of collective assets, fund management or securities firm services. In particular, the Platform does not manage any assets or financial instruments and/or issues or holds any securities or financial instruments whatsoever.

Moreover, the Platform does not act as a financial market infrastructure, in particular a stock exchange, multilateral trading facility (MTF), central counterparty, central securities depository or a payment system. In particular, the Platform does not allow for any simultaneous exchange of bids between several participants on the Platform. The Platform shall not be considered as an organized trading facility (système organisé de négociation / SON) given that it does not allow (a) for multilateral trading in securities or other financial instruments or the conclusion of contracts based on discretionary rules; (b) multilateral trading in financial instruments other than securities whose purpose is the exchange of bids or the conclusion of contracts based on non-discretionary rules or (c) bilateral trading in securities or other financial instruments whose purpose is the exchange of bids. Indeed, the Platform does not intervene as party or counterparty at the level of any transactions on securities or financial instruments, whether simultaneous or not. For these reasons, it does not qualify as SON under Swiss regulation. Trading is deemed to be multilateral if it collects / gathers the interests of multiple participants in the acquisition and sale of securities or other financial instruments within the trading facility with a view to concluding a contract.

No funds transit via the Platform. The Platform does not perform any financial intermediary activities on a professional basis and does not perform any KYC (know your client) verifications on Users.

The Platform, Services, MPH Tokens and related materials, any payment processing and other tasks are provided on an "as is", "with all faults" and "as available" basis. Users expressly agree that their use is at their sole risk. To the fullest extent permitted by applicable law, the Platform makes no representations or warranties of any kind, express or implied, as to the operation of the Platform, Services, MPH Tokens and related materials, any payment processing or other tasks, and disclaims any and all representations or warranties of any kind, express or implied, including without limitation: (a) any implied warranties of merchantability, fitness for a particular purpose, title, or non-infringement; (b) any warranty that the Platform, related materials, the payment processing or other tasks will meet Users’ requirements, will always be available, accessible, uninterrupted, timely, secure, operate without error, or will contain any particular features or functionality; (c) any warranty that the information, content, materials, or submissions included on the Platform will be as represented by Users that the tasks are lawful, or that Users will perform as promised or to Users’ satisfaction; or (d) any implied warranty arising from course of dealing or usage of trade.

By using 88mph, you agree to 88mph's [Terms of Service](https://88mph.app/tos).


# Fixed yield rate

Earn a fixed yield rate on your assets.

88mph offers a fixed yield rate with a custom or preset maturity for various supplied assets, such as DAI, USDC, WBTC, ETH, etc. When users/protocols supply assets, 88mph acts as an non-custodial, fully on-chain intermediary between them and third-party **variable** yield rate protocols to offer the best **fixed** yield rate on their capital.

## How it works

1. **Deposit assets:** provide any amount of assets with a maturity between 1 and 365 days to get the displayed [fixed yield rate](/getting-started/fixed-apy#fixed-yield-rate-model) at maturity.
2. **Your assets generate variable APY:** your deposit generates a yield at a variable rate on third-party protocols, such as Aave or Compound, until it reaches its maturity.
3. **Get a deposit NFT:** fixed rate pool users receive an [NFT (ERC-721)](/getting-started/fixed-apy#deposit-nfts) representing the ownership of their deposits and the related fixed terms. It gives you full control over your deposits. Think about it as your private key allowing you and only you to access the assets you provided via 88mph.app. Store it safely.
4. **Get MPH rewards:** by using 88mph fixed rate pools, you get MPH tokens.
5. **Withdraw:** [withdraw](/getting-started/fixed-apy#withdraw-at-any-time), [top-up](/getting-started/fixed-apy#topping-up-a-deposit), [roll over](/getting-started/fixed-apy#rolling-over-a-deposit) your deposit + fixed-rate yield at any time.

{% hint style="info" %}
For example, a 12-month deposit of 100 DAI will deliver a fixed-rate yield after 12-month of variable yield generation on a third-party protocol. If the fixed yield rate at the time of deposit was 10%, then the user get 10 DAI of yield when the deposit reaches its maturity one year later and some MPH tokens during the deposit duration.
{% endhint %}

To learn more about how 88mph converts a stream of variable-rate yield into fixed-rate yield, check out the [section below](/getting-started/fixed-apy#fixed-yield-rate-model) and our [risk mitigation](/getting-started/risk-mitigation) page.

## Fixed yield rate model

88mph determines a deposit's fixed yield rate based on the 30-day exponential moving average (EMA) of the variable yield rate of the underlying yield protocol, such as Aave or Compound. 88mph offers between 37.5% and 75% of the EMA as the fixed yield rate based on the length of deposit, with longer deposits earning a lower rate.

{% hint style="info" %}
For example, if at the time of deposit the 88mph's 30-day EMA of the Fixed APR asset is 10%, a 7-day deposit of 100 DAI will earn a 7.5% fixed yield. A 12-month deposit of 100 DAI will earn a 3.75% fixed-rate yield.&#x20;
{% endhint %}

## Withdraw at any time

Each deposit has a maturity date, after which the owner can withdraw the deposited assets plus the fixed-rate yield.

Before the maturity date, the user can also withdraw either part or all of a deposit, though the fixed-rate yield would be forfeited, and an additional early withdrawal fee would be applied (0.5% of the withdrawn amount).

The forfeited yield would continue generating yield on third-party yield protocols to [improve security](/getting-started/risk-mitigation). The withdrawal fee would be distributed to veMPH holders as protocol revenues.

## Topping up a deposit

The user may top up a deposit before reaching its maturity date, which essentially creates a new deposit with the same maturity date at the currently offered fixed yield rate, except it is merged with the existing deposit.

There are two benefits of topping up a deposit rather than creating a new one:

1. For regular users, the gas cost of topping up a deposit is cheaper than creating a new one.
2. For protocols, only a single deposit needs to be kept track of, reducing the amount of accounting needed.

## Rolling over a deposit

After a deposit is mature, the user can roll it over to create a new deposit using the principal + fixed-rate yield of the old deposit. The maturity date is customizable just like regular deposits.

The benefit of rolling over a deposit rather than withdrawing a deposit and creating a new one is the cheaper gas cost and fewer number of transactions.

## Deposit NFTs

After making a custom-maturity deposit, the user receives an ERC-721 NFT (Non-fungible token) that represents the ownership of the deposit and its fixed terms, which can be transferred or traded like regular NFTs.

Users have the option to customize the NFT's metadata: title, description, image, etc.

It's an experimental feature allowing everyone to mix creative content with decentralized finance. For example, you can attach a GIF from your favorite crypto artist to a deposit and hang it up on a wall, staring at it every day, knowing that it has an intrinsic value generating a yield at a fixed rate.

{% hint style="info" %}
Deposit NFTs are not burnt at any point, to preserve their artistic value.
{% endhint %}

## Custom maturity

A deposit's maturity refers to **the last date of a deposit's term.** 88mph protocol allows users to customize the deposit maturity by selecting the number of days after which they will be able to withdraw their principal + fixed-rate yield earned. The maximum maturity available on 88mph is currently 365 days. Users can [withdraw their principal](/getting-started/fixed-apy#withdraw-at-any-time) at any time.


# Yield tokens

Speculate on future variable-rate yields and strengthen the solvency of 88mph protocol.

## Overview

Yield tokens or YTs are fungible ERC-20/ERC-1155 tokens that allow speculators to profit from the rise in the variable yield rate of lending protocols (such as Compound or Aave) or hedge part of their borrowing costs of a loan (e.g. Dai borrower on Compound would purchase cDAI YTs on 88mph).

YTs can be purchased by users when a fixed yield rate deposit is made on 88mph, as each YT is tied to a deposit. YTs give holders the right to earn all the future variable-rate yields generated by the corresponding deposit + the purchase cost of the YTs.

## Principle

YTs are more than an instrument for speculating on yields.&#x20;

88mph by essence is highly dependent on market rate volatility. Let's say one depositor brings 1 WBTC with fixed terms (3.75%/1y maturity) and the variable rate of WBTC on the underlying lending protocol then decreases drastically (ie from 10% on avg to 1%). The protocol then needs to find 2.75% extra yield to ensure the redeemability of the 1.037 WBTC owed to the depositor at maturity.&#x20;

Knowing the above, the protocol needs to insure itself against market rates' volatility. While surges in variable rates are beneficial to the protocol, drops, as in the example above, are less desirable.&#x20;

For this reason, 88mph transfers this volatility to other actors looking to get exposure to market rate volatility with significantly smaller capital requirements than the deposit tied to the yield token. Therefore, the leverage available can be tremendous for Yield Token holders (pay 0.035 to earn a variable rate on 1.035).&#x20;

So to summarize it, YT holders are the agents ensuring the protocol against drops in market rates, making sure that the protocol has always enough reserves alongside the net interest margin to stay solvent.

{% hint style="info" %}
Another example, shall we? Let's imagine that the 30-day EMA for the DAI-Compound fixed APR asset is at 10%. So, for a 12-month 100 DAI deposit, the fixed APR offered would be 3.75% (37.5% of the 30-day EMA) before fees. Cf [Fixed interest rate model](/getting-started/fixed-apy#fixed-interest-rate-model) section.

The corresponding 103.75 YTs would cost 3.75 DAI to purchase (learn more about YT token pricing below). The YTs entitle the holders to the variable-rate yield earned by the 100 DAI principal + 3.75 DAI over the deposit's term. If the average Compound variable APY stays at 10% over the deposit duration, then the YT delivers 10.375 DAI to its holders.

Suppose you bought all 103.75 YTs. Your **final balance** will be **10.375 DAI**. Thus, you earn a **6.625 DAI profit** on your investment of **3.75 DAI,** a **176.67%** return on investment.
{% endhint %}

## Yield token pricing

Given a deposit with term length $$t$$, deposit amount $$d$$, and fixed yield rate $$y$$, the yield tokens of this deposit are offered at a cost of $$d⋅t⋅y$$ which is the fixed yield amount offered to the user. This equality is expected, since the point of selling yield tokens is to generate enough funds to pay out the promised fixed yield.

The buyer of the yield tokens would be earning the floating rate yield generated by the deposit amount $$d$$ for the term length $$t$$, so the price for the yield generated by $$1 \text{ money unit } \times 1 \text{ time unit}$$ is $$\frac{d \cdot t \cdot y}{d \cdot t} = y$$ (whose unit is $$\text{time unit}^{-1}$$). This price remains fixed even as time passes, though the actual implementation is more capital efficient as it deducts the floating rate yield generated so far from the cost of the yield tokens.

This means that whenever a user makes a deposit, 88mph is essentially creating a sell order for the tokenized yield at a fixed price, which is equal to the fixed yield rate $$y$$ offered by the oracle. Suppose that there exists a market price for future yield $$y'$$. If $$y' \gg  y$$ , then the sell order will be completely filled, ensuring 88mph’s ability to give the user the promised fixed yield upon maturity date. If $$y' \ll y$$, then the sell order will not be filled at all, meaning 88mph will be offering a kind of “naked” fixed yield on this deposit, which can only be realized by increased floating rate yield offered by the underlying yield protocol. From this, we can see that it’s better for 88mph to err on the side of security and offer a lower fixed yield rate than the expected market price for future yield, which is what 88mph currently does.

## Yield payment

The yield payment to yield token holders is automatically triggered whenever part or all of the corresponding deposit is withdrawn, and it is also possible to manually trigger it via the Claim Button in the user interface or by calling the contract function`DInterest.payInterestToFunders()`.

## Yield token holder refund

When the underlying deposit of a set of yield tokens is withdrawn before maturity, the token holders will receive a refund, the amount of which is the minimum of an estimated lost yield calculated using the average floating yield rate and the fixed-rate yield offered on the withdrawn funds. If the deposit is withdrawn completely, the yield token holders will no longer receive interest payments, and a new yield token contract will be created when the user tops up the deposit in the future. The possibility of early withdrawal makes the return on yield tokens less certain, making it more difficult to price them.

## Why ERC-20/ERC-1155?

As 88mph has multiple YTs tied to a single pool, ERC-1155 standard allows the protocol to easily map to a single 1155 contract with multiple token IDs each representing a YT.

YTs are also an ERC-20 because when a YT is minted for the first time, 88mph deploys a wrapper contract allowing users to interact with the YT through the ERC-20 interface, which makes it easy to trade it on DEXes, etc; since no major DEX supports trading 1155 tokens.


# Risk mitigation

The main risk of depositing funds into 88mph is the risk of insolvency, the situation where 88mph does not have enough funds to return the deposited funds plus fixed yield to a user.&#x20;

88mph and CADLabs have worked together to create a radCAD agent-based model to simulate liquidity and network revenue dynamics for the 88mph v3 protocol. To understand how 88mph model works to mitigate those risks, we invite our users to read the [analysis of 88mph protocol dynamics](https://cadlabs.medium.com/fixed-income-built-on-volatile-yield-simulating-a-novel-class-of-defi-protocols-d10629484069) using radCAD pubished by CADLabs.

{% hint style="info" %}
88mph is a new protocol, but has undergone multiple [security audits](/developer-docs/security).
{% endhint %}

**TL;DR**

88mph relies on three lines of defense to mitigate the risk of insolvency (listed in order of which gets rekt first):

1. An [oracle](/getting-started/fixed-apy#fixed-interest-rate-model) that can accurately price (not necessarily predict) future yield. This ensures that [yield tokens](/getting-started/yield-tokens) get sold most of the time.
2. Frequent [early withdrawals](/getting-started/fixed-apy#withdraw-at-any-time), which allow 88mph depositors to accumulate the forfeited yield to build up a surplus that acts as a backstop.
3. Volatile floating yield rates in the underlying yield protocols, which allows 88mph to use the surplus yield from deposits that were offered low fixed yield rates to subsidize the deficit caused by the deposits that were offered high fixed yield rates.

## Fixed yield rate oracle

For the first line of defense, building oracles for pricing future yield is quite difficult, since there is not a lot of prior work on the matter. Realistically speaking, 88mph will probably settle with building an oracle that offers a rate lower than the market rate most of the time, which trades efficiency for security.

## Yield surplus

For the second line of defense, integrating with other protocols, specifically vaults a la Yearn, will likely help a lot. Vaults generally have frequent deposits & withdrawals, and whenever an early withdrawal happens, not only is the forfeited yield used for 88mph's risk mitigation, an early withdrawal fee is also taken. Using MPH incentives to get vault protocols on board will probably be worth it.

## Yield balancing

For the third line of defense, there's not much we could do about it. Vault integrations will likely help a bit though, since frequent deposits & withdrawals mean there will be diversity in the fixed yield rates offered to deposits, giving the balancing act more to work with.


# MPH Tokenomics

MPH token address: [0x8888801af4d980682e47f1a9036e589479e835c5](https://etherscan.io/token/0x8888801af4d980682e47f1a9036e589479e835c5)

### MPH Total supply

The total supply of the MPH token is capped at 1,888,888 tokens.

To avoid a limitation on the future growth of 88mph, the keys to mint MPH tokens will not be burnt, so that after January 1, 2026, MPH holders may vote to ratify a new token supply cap if desired.

## How is MPH distributed?

At the time of the 88mph's governance vote for the implementation of the [8IP#6 - Implement 88mph Tokenomics 2.0](https://vote.88mph.app/#/proposal/0xb5927e62e03a2c6349b04460d01ae5a654b57d6527fa670a1f48c731e991c8c4) on Dec 19, 2021, the MPH total supply was roughly 417k tokens distributed to 88mph's users when they interacted with the protocol. With a cap of 1,888,888 tokens, roughly 1.4M tokens remained to be issued over the next 4 years.

The total supply will be distributed as such:

* 62.5% to community
* 37.5% to team, advisors, and future employees with 4 years vesting.

The unissued supply of 1.4m will be distributed as such:

* 52.5% to community
* 35% to early team and advisors
* 12.5% to 88mph SA

![](https://i.imgur.com/qtE76V7.png)

We think that this total supply distribution is in line with the industry standards (for eg. [Curve.fi](https://resources.curve.fi/base-features/understanding-tokenomics) or [Frax.finance](https://docs.frax.finance/token-distribution/frax-share-fxs-distribution) distribution)

**Community breakdown (52.5% of unissued MPH)**

![](https://i.imgur.com/1zJTbzf.png)

* 70.5% will be used for incentives to 88mph users over a 4-year distribution schedule:
  * 46.2% will be used for incentives in 2022, which will be immediately minted after the passage of this proposal to prepare for distribution.
  * 30.8% will be used for incentives in 2023
  * 15.4% will be used for incentives in 2024
  * 7.7% will be used for incentives in 2025
* 13.3% is being allocated to the 88mph foundation that is subject to a 10-year unlocking schedule. The 88mph foundation is a way to steward the protocol into the future and distribute grants to developers and contributors. The foundation aims to progressively decentralize how the governance treasury resources are allocated and work with 88mph Council to make decisions in the best interest of the protocol ecosystem.
* 9.5% will be immediately minted and unlocked to acquire protocol-owned liquidity.
* 2.9% will be immediately minted and unlocked to support a bug bounty program denominated in MPH.
* 3.8% will be immediately minted and sold to strategic community members by the foundation to have operational funds at launch. This strategic allocation will be locked up for 1 year.

**Early team and advisors (35% of unissued MPH)**

The early team consisted of 2 founders, and multiple contractors, and advisors. Founders, contractors, and advisors will be on standard 4-year vesting schedules.

The early team is a group of passionate developers, product builders, and business leaders, dedicated to the Ethereum Ecosystem. This team delivered many innovative products since 2017 through various market conditions. They’ve committed a significant amount of energy and time to 88mph and proven their talent, commitment, work ethic, and execution ability.

**88mph SA (12.5% of unissued MPH)**

88mph SA was the original devs shop representing the initial contributors of 88mph protocol since January 15, 2021. Since then, other independant contributors and devs shop joined the journey, such as Szeth Vallano, Dakotah Moses, and Bacon Labs Inc.

88mph SA has no external shareholders and will be under a 4-year vesting schedule.

* 64.3% will be used to fund future developments of the protocol and its associated costs (contractors, audits, taxes, etc).
* 28.6% will be allocated to future employees with vesting.
* 7.1% will be immediately minted and unlocked.

If the governance decides to renegotiate the MPH supply cap after 4 years, the schedule for the increased issuance will be decided by governance at that point in time.

**5-year MPH circulation schedule by buckets (cumulative)**

![](https://i.imgur.com/QJbF7mh.png)

#### Gauge-based incentives & veMPH

In August 2022, 88mph adopted a new system for allocating user incentives, adapted from gauges pioneered by Curve Finance and Balancer protocol.&#x20;

**Notes**: xMPH was phased out, in favor of [veMPH](/vemph-gauges/vemph).


# veMPH

Getting familiar with veMPH

veMPH (vote-escrow MPH) is a vesting and yield system based on [Curve’s veCRV mechanism](https://curve.readthedocs.io/dao-vecrv.html) and inspired by the ve80/20 twist of Balancer protocol.

### Understanding veMPH

To learn more about how veMPH works, please refer to the following page:

{% content-ref url="/pages/b9jZBtUwajOcmoL6aqty" %}
[Understanding veMPH](/vemph-gauges/vemph/understanding-vemph)
{% endcontent-ref %}

### Using veMPH

To learn more about how to use veMPH, please refer to the following page:

{% content-ref url="/pages/bRGPclbYa8NVxtbqnOGu" %}
[Using veMPH](/vemph-gauges/vemph/using-vemph)
{% endcontent-ref %}


# Understanding veMPH

### How is veMPH different from veBAL and veCRV?

There are a few modifications that set veMPH apart:

* Instead of locking pure MPH, **users obtain veMPH by locking** [**80/20 MPH/WETH**](https://app.balancer.fi/#/pool/0x3e09e828c716c5e2bc5034eed7d5ec8677ffba180002000000000000000002b1) **Balancer Pool Tokens** (BPTs). This ensures that even if a large portion of MPH tokens are locked, there is deep trading liquidity.
* **veMPH's maximum locking period is 4 year**, an increase from veBAL's 1 year period. The minimum locking period is 1 week.
* **No boosting**: unlike Balancer or Curve, a user's claimable MPH doesn't depends on their amount of veMPH.

### **Voting Power**

All votes, whether [on-chain](https://88mph.app/gauges) or on [Snapshot](https://vote.88mph.app/#/), consider veMPH voting power. veMPH is also used to vote on the allocation of MPH rewards to each fixed yield rate pool via a gauge system. veMPH voting power scales linearly with the amount of BPT locked and with the amount of remaining lock time.

#### Example

If a user locks 1 BPT of 80/20 MPH/WETH for the maximum time of four year, they will receive 1 veMPH; however, this veMPH quantity starts immediately decaying with time. If the user does not extend the lock period, this will decay to 0 after the four years are complete, at which point the user can redeem their 1 BPT of 80/20 MPH/WETH.

### Protocol Revenue Distribution

A fee of 20% is extracted from the fixed-rate yield generated by the user's deposit. The fixed yield rate displayed on 88mph is after fees.

A early-withdraw fee of 0.5% is extracted from the user's deposit if the deposit is withdrawn before the maturity date is reached.

Incentives distributed by the underlying protocols used by 88mph, such as AAVE and COMP tokens, are collected by 88mph and redistributed according to the protocol revenues distribution.

veMPH holders are entitled to a share of 50% of collected protocol fees and rewards. Users can collect their proportional share ($$\frac{veMPH\_{user}}{veMPH\_{total}}$$) after the fees are consolidated. Consolidation is a necessary step since protocol fees are collected as a wide array of tokens, and dividing up long tail assets for everyone could result in higher gas fees than token value in some cases.

The 50% left will be given to the governance treasury to acquire protocol-owned liquidity and as working capital and metagovernance assets.&#x20;

Please note that the fees and rewards are accumulated in the following [contract](https://etherscan.io/tx/0x08604575328342decf3cd4bd82274b2734a3d10a9f86411aae501bac65a50b8a) and require the governance treasury to initiate a transaction for their distribution. This step is necessary to ensure that the rewards and fees are correctly allocated and distributed according to the contract logic, and in accordance with the rules and decisions of the governance.


# Using veMPH

### Acquiring veMPH

To acquire veMPH, you'll need to do the following:

1. Provide liquidity to the the [80/20 MPH/WETH Balancer pool](https://app.balancer.fi/#/pool/0x3e09e828c716c5e2bc5034eed7d5ec8677ffba180002000000000000000002b1) on Ethereum.
2. Then visit the 88mph [Gauge page](https://88mph.app/gauge) to lock the 80/20 MPH/WETH BPT to get veMPH. In doing so, you'll need to choose your lock period. The longer you lock, the more veMPH and voting power you get, but the longer you must wait to unlock your BPT.

### Topping up an existing veMPH lock

You can lock additional BPTs on the [Gauge page](https://88mph.app/gauge) to increase an existing veMPH balance by entering an amount of BPTs and by clicking on the *Add to Lock* button.

### Extending veMPH Lock Period

To extend your lock time, go to the [Gauge page](https://88mph.app/gauge) and follow the same process as locking your 80/20 MPH/WETH BPT; this time, however, you do not need to provide additional 80/20 MPH/WETH BPT; instead, enter a lock value in the *Lock Duration* field and click on the *Increase Lock Duration* button to extend your lock period and acquire more veMPH.

### Reclaiming Your MPH/WETH BPT

On the [Gauge page](https://88mph.app/gauge), click the Withdraw button in the "BPT Unlocked" card to start unlocking your BPT from expired veMPH.


# Gauges

Gauges are contracts that determine how MPH rewards are allocated and facilitate their distribution.

### Voting

MPH rewards emissions are distributed among different Gauges according to veMPH voting. **All veMPH voting happens on Ethereum mainnet**. veMPH holders can vote for one or more Gauges [here](https://88mph.app/gauge), choosing the percentage of their voting power to allocate to a specific Gauge.

### Dividing a pool's MPH rewards among depositors

Their share of the MPH rewards scales with their proportional deposit amount in that pool. Similar to a traditional staking pool, the higher the % of shares owned in that pool, the bigger the MPH rewards amount received is. The users can claim their MPH rewards on the [Gauge page](https://88mph.app/gauge).

Notes: unlike Curve or Balancer, there is no additional veMPH boost.

### How are Gauges Deployed for a Pool?

Governance has the power to authorize new gauge deployment via the standard [governance process](/governance-2).


# Integration guide

## Smart contract <a href="#smart-contract" id="smart-contract"></a>

To interact with an 88mph pool, you will mostly call the pool's DInterest contract. You can find the source code on [our GitHub](https://github.com/88mphapp/88mph-contracts/blob/v3/contracts/DInterest.sol).

### Creating a deposit <a href="#creating-a-deposit" id="creating-a-deposit"></a>

Creating a deposit has two steps:

1. Give ERC-20 approval to the DInterest contract, the amount of which is at least the deposit amount.
2. Call `DInterest::deposit()`

Once an account makes a deposit, the account will also receive vested MPH rewards.

#### Example <a href="#example" id="example"></a>

```
DInterest pool = DInterest(0xdead);
ERC20 token = ERC20(0x6b175474e89094c44da98b954eedeac495271d0f); // DAI
uint256 depositAmount = 3 * 10 ** 18; // 3 DAI
uint256 maturationTimestamp = now + 365 days;
​require(token.approve(address(pool), depositAmount));
// deposit returns the ID of the deposit
uint64 depositID = pool.deposit(depositAmount, maturationTimestamp);
```

{% hint style="info" %}
Trace and map out all the contract interactions with this [deposit transaction example](https://etherscan.io/tx/0xb2cb9d288385839f78ac10b2bc7e2eea0038a5e22b9a1f94307a922929ac3460).
{% endhint %}

### Withdrawing a deposit <a href="#withdrawing-a-deposit" id="withdrawing-a-deposit"></a>

Withdrawing a deposit has the following steps:

1. Call `DInterest::withdraw()`

Set `virtualTokenAmount` to `type(uint256).max` to withdraw all funds from the deposit, otherwise set it to some proportion of `getDeposit(depositID).virtualTokenTotalSupply` to do a partial withdrawal. An easy way to determine the value for this field is that after maturation, `virtualTokenAmount` equals the amount of underlying tokens that will be withdrawn.

Set `early` to `true` if withdrawing before maturation, `false` if withdrawing after maturation.

#### Example <a href="#example-1" id="example-1"></a>

```
DInterest pool = DInterest(0xdead);
uint64 depositID = 10;
uint256 virtualTokenAmount = type(uint256).max; // withdraw all funds
bool early = false; // withdrawing after maturation​
pool.withdraw(depositID, virtualTokenAmount, early);
```

### Calculate Interest Amount

Function on the DInterest contract to call can be found [here](https://github.com/88mphapp/88mph-contracts/blob/441181e30638ee2ff7a9e07a4ad21c327b9982cc/contracts/DInterest.sol#L459).

If you want to know the interest you'll earn on a 100 DAI deposit for 1 year, the function call would look like `calculateInterestAmount(100*1e18, 31556952)` where 100\*1e18 is 100 DAI in wei and 31556952 is the number of seconds in a year.&#x20;

The returned value is the amount of DAI, in wei, you'd earn in fixed-rate interest before protocol fees are taken into account. To account for the fee, you'll need to call `getInterestFeeAmount()` on the [feeModel contract](https://github.com/88mphapp/88mph-contracts/blob/441181e30638ee2ff7a9e07a4ad21c327b9982cc/contracts/models/fee/PercentageFeeModel.sol#L53).

Once you have both the interest amount (before fees) and the fee amount, subtract the two values to get the amount of interest earned by the depositor after fees. Divide that value by the original deposit amount to get the APR (some additional math is needed for deposit length of less than a year). Here is [an example](https://github.com/88mphapp/ng88mph-frontend/blob/427b76bff4552d1057e5dcb1cdd7dda8a619d003/src/app/data.service.ts#L114) of how we do this in our frontend, which calculates the APR for a 10,000 token deposit for 30 days.

### Withdrawing vested MPH rewards <a href="#withdrawing-vested-mph-rewards" id="withdrawing-vested-mph-rewards"></a>

Each deposit yields vested MPH rewards to the user. This is handled by the [Vesting02 contract](https://github.com/88mphapp/88mph-contracts/blob/v3/contracts/rewards/Vesting02.sol). The vesting is linear and continuous, and is done over the deposit period. If a deposit is withdrawn earlier than the maturation date, the remaining vested rewards are forfeited.

The vesting streams are represented using 1-indexed ERC-721 NFTs, so that they are easily transferrable.

In order to withdraw vested MPH, you need to call `Vesting02::withdraw(uint256 vestID)`. You need the index of a vesting NFT, `vestID`, in order to withdraw the MPH. You can obtain this value using the `Vesting02::depositIDToVestID` mapping using the pool address and deposit ID.

#### Example <a href="#example-2" id="example-2"></a>

```
Vesting02 vesting = Vesting02(0xdead);
uint64 vestID = 10;​ // msg.sender needs to own the vesting NFT
vesting.withdraw(vestID);
```

### Buying yield tokens <a href="#buying-yield-tokens" id="buying-yield-tokens"></a>

Buying yield tokens takes two steps:

1. Approve deposit tokens to the DInterest contract, the amount of which should be at least the cost of the bond.
2. Call `DInterest::fund()` with the ID of the deposit to buy yield tokens from and the amount to pay.

Note that if the amount to pay is greater than the value of the available yield tokens, all of the available yield tokens will be purchased.

#### Example <a href="#example-3" id="example-3"></a>

```
DInterest pool = DInterest(0xdead);
ERC20 token = ERC20(0x6b175474e89094c44da98b954eedeac495271d0f); // DAI​
uint64 depositID = 5;
uint256 payAmount = 3 * 10**18; // 3 DAI
require(token.approve(address(pool), payAmount));
uint64 fundingID = pool.fund(depositID, payAmount);
```

### Zero coupon bonds <a href="#zero-coupon-bonds" id="zero-coupon-bonds"></a>

#### Minting a zero coupon bond <a href="#minting-a-zero-coupon-bond" id="minting-a-zero-coupon-bond"></a>

```
ZeroCouponBond bond = ZeroCouponBond(0xdead);
ERC20 token = ERC20(0x6b175474e89094c44da98b954eedeac495271d0f); // DAI
uint256 depositAmount = 3 * 10**18; // 3 DAI
require(token.approve(address(bond), depositAmount));
​// mint returns the amount of zero coupon bonds minted
// which can be 1-for-1 redeemed for the underlying token
// at maturation
uint256 mintedZCBAmount = bond.mint(depositAmount);
```

#### Redeeming zero coupon bonds for their face value <a href="#redeeming-zero-coupon-bonds-for-their-face-value" id="redeeming-zero-coupon-bonds-for-their-face-value"></a>

```
ZeroCouponBond bond = ZeroCouponBond(0xdead);​
uint256 redeemAmount = 30 * (10 ** 18); // 30 DAI
// setting this to true will withdraw the ZCB's deposit
// from the 88mph pool if it hasn't been done yet
// which will increase the gas cost but also
// ensures that the redemption succeeds
bool withdrawDepositIfNeeded = true;
bond.redeem(redeemAmount, withdrawDepositIfNeeded);
```

## REST API <a href="#rest-api" id="rest-api"></a>

We offer a REST API for fetching basic info of 88mph pools. The endpoint is at <https://api.88mph.app/v3/pools>. The only supported method is GET.

### Example response <a href="#example-response" id="example-response"></a>

```
[  {    "address": "0xb1abaac351e06d40441cf2cd97f6f0098e6473f2",     "token": "0x5b5cfe992adac0c9d48e05854b2d91c73a003858",     "tokenSymbol": "CRV:HUSD",     "protocol": "Harvest",     "oneYearInterestRate": "3.6621277863445296",     "mphAPY": "60.8988450243270707253",     "totalValueLockedInToken": "1548211.678555032702255836",     "totalValueLockedInUSD": "1548211.678555032702255836"   },  ...]
```

### Deployment

Read [DEPLOY\_README.md](https://github.com/88mphapp/88mph-contracts/blob/v3/DEPLOY_README.md)

**Notes**:&#x20;

* The mainnet contract addresses are available here <https://github.com/88mphapp/88mph-contracts/tree/v3/deployments/mainnet> and the rinkeby here <https://github.com/88mphapp/88mph-contracts/tree/v3/deployments/rinkeby> / <https://github.com/88mphapp/88mph-contracts/blob/v3/deployments-exported/rinkeby.json>
* Rinkeby subgraph: <https://thegraph.com/legacy-explorer/subgraph/bacon-labs/eighty-eight-mph-v3-rinkeby>


# Smart contract architecture

## DInterest <a href="#dinterest" id="dinterest"></a>

The main contract is `DInterest`, which users interact with to deposit funds to earn fixed-rate interest, withdraw their funds, or purchase [yield tokens](/getting-started/yield-tokens) or YTs.

### Deposit & withdraw <a href="#deposit-and-withdraw" id="deposit-and-withdraw"></a>

When a user makes a deposit, their funds are transferred to the `MoneyMarket` contract owned by the `DInterest` contract, which are then put to work in the underlying yield protocol. The user receives an ERC-721 NFT that represents the ownership of the deposit, which can be transferred.

Each deposit has a maturity date, after which the deposit NFT can be used to withdraw the deposited principal plus the promised fixed-rate interest. Before the maturity date, the user can also withdraw a deposit, though the fixed-rate interest would be forfeit, and an additional withdrawal fee would be applied. The user can choose to only withdraw a portion of a deposit.

The user may topup a deposit before reaching its maturity date, adding more principal to the deposit and earning more fixed-rate interest (albeit likely at a different fixed-rate). After a deposit is mature, the user can roll it over to create a new deposit using the principal + interest of the old deposit.

The NFT corresponding to a deposit is not burnt at any point, to preserve the potential artistic value of the metadata attached.

### Buy yield tokens <a href="#buy-yield-tokens" id="buy-yield-tokens"></a>

When a user buys some yield tokens of a particular deposit, the funds are transferred to `MoneyMarket` and deposited into the underlying yield protocol. The user will earn the future floating-rate interest generated by the portion of the deposit's principal whose debt is funded by the YT plus the funds used for purchasing the YT. For instance, if a 100 DAI deposit has 10 DAI of debt, then buying yield tokens using 5 DAI will allow you to earn interest on (5 / 10) \* 100 + 5 = 55 DAI.

The interest payout is triggered whenever a portion of the deposit is withdrawn, or when someone manually triggers a payout using `DInterest.payInterestToFunders()`.

## MoneyMarket <a href="#moneymarket" id="moneymarket"></a>

Money market is an abstract interface 88mphs uses to support different underlying yield protocols. Each protocol has its corresponding money market, for instance a `DInterest` pool using Aave to generate interest will use `AaveMarket` as its money market contract.

Money markets store all funds deposited into a `DInterest` pool.

## MPHMinter <a href="#mphminter" id="mphminter"></a>

The `MPHMinter` contract is in charge of the minting of MPH tokens. 88mph mints MPH tokens to reward users who make deposits or purchase YTs. The governance treasury and the developer funds also receive MPH rewards any time new MPH is minted.

Whenever a user makes a deposit or purchases YTs, `DInterest` makes a call to `MPHMinter` to mint MPH rewards. The reward could be vested using `Vesting` or `Vesting02`, or be distributed using `FundingMultitoken.distributeDividends()`.


# Smart contract references

{% content-ref url="/pages/-MeplUM28bCdQKtKFvIh" %}
[DInterest](/developer-docs/smart-contract-references/dinterest)
{% endcontent-ref %}

{% content-ref url="/pages/-MeplUM3bk7h1vK\_1Oqg" %}
[DInterestLens](/developer-docs/smart-contract-references/dinterestlens)
{% endcontent-ref %}

{% content-ref url="/pages/-MeplUM4XyYopZF4Jd0O" %}
[ZeroCouponBond](/developer-docs/smart-contract-references/zerocouponbond)
{% endcontent-ref %}


# DInterest

## `deposit(uint256 depositAmount, uint64 maturationTimestamp) → uint64 depositID, uint256 interestAmount` (external) <a href="#deposit-uint256-depositamount-uint64-maturationtimestamp-uint64-depositid-uint256-interestamount-ext" id="deposit-uint256-depositamount-uint64-maturationtimestamp-uint64-depositid-uint256-interestamount-ext"></a>

Create a deposit using `depositAmount` stablecoin that matures at timestamp `maturationTimestamp`.

@dev The ERC-721 NFT representing deposit ownership is given to msg.sender

@param depositAmount The amount of deposit, in stablecoin

@param maturationTimestamp The Unix timestamp of maturation, in seconds

@return depositID The ID of the created deposit

@return interestAmount The amount of fixed-rate interest

## `topupDeposit(uint64 depositID, uint256 depositAmount) → uint256 interestAmount` (external) <a href="#topupdeposit-uint64-depositid-uint256-depositamount-uint256-interestamount-external" id="topupdeposit-uint64-depositid-uint256-depositamount-uint256-interestamount-external"></a>

Add `depositAmount` stablecoin to the existing deposit with ID `depositID`.

@dev The interest rate for the topped up funds will be the current oracle rate.

@param depositID The deposit to top up

@param depositAmount The amount to top up, in stablecoin

@return interestAmount The amount of interest that will be earned by the topped up funds at maturation

## `rolloverDeposit(uint64 depositID, uint64 maturationTimestamp) → uint256 newDepositID, uint256 interestAmount` (external) <a href="#rolloverdeposit-uint64-depositid-uint64-maturationtimestamp-uint256-newdepositid-uint256-interestamo" id="rolloverdeposit-uint64-depositid-uint64-maturationtimestamp-uint256-newdepositid-uint256-interestamo"></a>

Withdraw all funds from deposit with ID `depositID` and use them to create a new deposit that matures at time `maturationTimestamp`

@param depositID The deposit to roll over

@param maturationTimestamp The Unix timestamp of the new deposit, in seconds

@return newDepositID The ID of the new deposit

## `withdraw(uint64 depositID, uint256 virtualTokenAmount, bool early) → uint256 withdrawnStablecoinAmount` (external) <a href="#withdraw-uint64-depositid-uint256-virtualtokenamount-bool-early-uint256-withdrawnstablecoinamount-ex" id="withdraw-uint64-depositid-uint256-virtualtokenamount-bool-early-uint256-withdrawnstablecoinamount-ex"></a>

Withdraws funds from the deposit with ID `depositID`.

@dev Virtual tokens behave like zero coupon bonds, after maturation withdrawing 1 virtual token yields 1 stablecoin. The total supply is given by deposit.virtualTokenTotalSupply

@param depositID the deposit to withdraw from

@param virtualTokenAmount the amount of virtual tokens to withdraw

@param early True if intend to withdraw before maturation, false otherwise

@return withdrawnStablecoinAmount the amount of stablecoins withdrawn

## `fund(uint64 depositID, uint256 fundAmount) → uint64 fundingID` (external) <a href="#fund-uint64-depositid-uint256-fundamount-uint64-fundingid-external" id="fund-uint64-depositid-uint256-fundamount-uint64-fundingid-external"></a>

Funds the fixed-rate interest of the deposit with ID `depositID`. In exchange, the funder receives the future floating-rate interest generated by the portion of the deposit whose interest was funded.

@dev The sender receives ERC-1155 multitokens (fundingMultitoken) representing their floating-rate bonds.

@param depositID The deposit whose fixed-rate interest will be funded

@param fundAmount The amount of fixed-rate interest to fund. If it exceeds surplusOfDeposit(depositID), it will be set to the surplus value instead.

@param fundingID The ID of the fundingMultitoken the sender received

## `payInterestToFunders(uint64 fundingID) → uint256 interestAmount` (external) <a href="#payinteresttofunders-uint64-fundingid-uint256-interestamount-external" id="payinteresttofunders-uint64-fundingid-uint256-interestamount-external"></a>

Distributes the floating-rate interest accrued by a deposit to the floating-rate bond holders.

@param fundingID The ID of the floating-rate bond

@return interestAmount The amount of interest distributed, in stablecoins

## `calculateInterestAmount(uint256 depositAmount, uint256 depositPeriodInSeconds) → uint256 interestAmount` (public) <a href="#calculateinterestamount-uint256-depositamount-uint256-depositperiodinseconds-uint256-interestamount" id="calculateinterestamount-uint256-depositamount-uint256-depositperiodinseconds-uint256-interestamount"></a>

Computes the amount of fixed-rate interest (before fees) that will be given to a deposit of `depositAmount` stablecoins that matures in `depositPeriodInSeconds` seconds.

@param depositAmount The deposit amount, in stablecoins

@param depositPeriodInSeconds The deposit period, in seconds

@return interestAmount The amount of fixed-rate interest (before fees)

## `surplus() → bool isNegative, uint256 surplusAmount` (public) <a href="#surplus-bool-isnegative-uint256-surplusamount-public" id="surplus-bool-isnegative-uint256-surplusamount-public"></a>

Computes the pool's overall surplus, which is the value of its holdings in the `moneyMarket` minus the amount owed to depositors, funders, and the fee beneficiary.

@return isNegative True if the surplus is negative, false otherwise

@return surplusAmount The absolute value of the surplus, in stablecoins

## `depositsLength() → uint256` (external) <a href="#depositslength-uint256-external" id="depositslength-uint256-external"></a>

Returns the total number of deposits.

@return deposits.length

## `fundingListLength() → uint256` (external) <a href="#fundinglistlength-uint256-external" id="fundinglistlength-uint256-external"></a>

Returns the total number of floating-rate bonds.

@return fundingList.length

## `getDeposit(uint64 depositID) → struct DInterest.Deposit` (external) <a href="#getdeposit-uint64-depositid-struct-dinterest-deposit-external" id="getdeposit-uint64-depositid-struct-dinterest-deposit-external"></a>

Returns the Deposit struct associated with the deposit with ID `depositID`.

@param depositID The ID of the deposit

@return The deposit struct

```
// User deposit data
// Each deposit has an ID used in the depositNFT, which is equal to its index in `deposits` plus 1
struct Deposit {
    uint256 virtualTokenTotalSupply; // depositAmount + interestAmount, behaves like a zero coupon bond
    uint256 interestRate; // interestAmount = interestRate * depositAmount
    uint256 feeRate; // feeAmount = feeRate * depositAmount
    uint256 averageRecordedIncomeIndex; // Average income index at time of deposit, used for computing deposit surplus
    uint64 maturationTimestamp; // Unix timestamp after which the deposit may be withdrawn, in seconds
    uint64 fundingID; // The ID of the associated Funding struct. 0 if not funded.
}
```

## `getFunding(uint64 fundingID) → struct DInterest.Funding` (external) <a href="#getfunding-uint64-fundingid-struct-dinterest-funding-external" id="getfunding-uint64-fundingid-struct-dinterest-funding-external"></a>

Returns the Funding struct associated with the floating-rate bond with ID `fundingID`.

@param fundingID The ID of the floating-rate bond

@return The Funding struct

```
// Funding data
// Each funding has an ID used in the fundingMultitoken, which is equal to its index in `fundingList` plus 1
struct Funding {
    uint64 depositID; // The ID of the associated Deposit struct.
    uint64 lastInterestPayoutTimestamp; // Unix timestamp of the most recent interest payout, in seconds
    uint256 recordedMoneyMarketIncomeIndex; // the income index at the last update (creation or withdrawal)
    uint256 principalPerToken; // The amount of stablecoins that's earning interest for you per funding token you own. Scaled to 18 decimals regardless of stablecoin decimals.
}
```


# DInterestLens

## `withdrawableAmountOfDeposit(contract DInterest pool, uint64 depositID, uint256 virtualTokenAmount) → uint256 withdrawableAmount, uint256 feeAmount` (external) <a href="#withdrawableamountofdeposit-contract-dinterest-pool-uint64-depositid-uint256-virtualtokenamount-uint" id="withdrawableamountofdeposit-contract-dinterest-pool-uint64-depositid-uint256-virtualtokenamount-uint"></a>

Computes the amount of stablecoins that can be withdrawn by burning `virtualTokenAmount` virtual tokens from the deposit with ID `depositID` at time `timestamp`.

@dev The queried timestamp should >= the deposit's lastTopupTimestamp, since the information before this time is forgotten.

@param pool The DInterest pool

@param depositID The ID of the deposit

@param virtualTokenAmount The amount of virtual tokens to burn

@return withdrawableAmount The amount of stablecoins (after fee) that can be withdrawn @return feeAmount The amount of fees that will be given to the beneficiary

## `accruedInterestOfFunding(contract DInterest pool, uint64 fundingID) → uint256 fundingInterestAmount` (external) <a href="#accruedinterestoffunding-contract-dinterest-pool-uint64-fundingid-uint256-fundinginterestamount-exte" id="accruedinterestoffunding-contract-dinterest-pool-uint64-fundingid-uint256-fundinginterestamount-exte"></a>

Computes the floating-rate interest accrued in the floating-rate bond with ID `fundingID`. @param pool The DInterest pool

@param fundingID The ID of the floating-rate bond

@return fundingInterestAmount The interest accrued, in stablecoins

## `fundingIsActive(contract DInterest pool, uint64 fundingID) → bool` (external) <a href="#fundingisactive-contract-dinterest-pool-uint64-fundingid-bool-external" id="fundingisactive-contract-dinterest-pool-uint64-fundingid-bool-external"></a>

A floating-rate bond is no longer active if its principalPerToken becomes 0, which occurs when the corresponding deposit is completely withdrawn. When such a deposit is topped up, a new Funding struct and floating-rate bond will be created.

@param pool The DInterest pool

@param fundingID The ID of the floating-rate bond

@return True if the funding is active, false otherwise

## `totalInterestOwedToFunders(contract DInterest pool) → uint256 interestOwed` (public) <a href="#totalinterestowedtofunders-contract-dinterest-pool-uint256-interestowed-public" id="totalinterestowedtofunders-contract-dinterest-pool-uint256-interestowed-public"></a>

Computes the floating interest amount owed to deficit funders, which will be paid out when a funded deposit is withdrawn.

Formula:∑irecordedFundedPrincipalAmounti(incomeIndexrecordedMoneyMarketIncomeIndexi−1)=incomeIndex(∑irecordedFundedPrincipalAmountirecordedMoneyMarketIncomeIndexi)−∑irecordedFundedPrincipalAmounti\sum\_i recordedFundedPrincipalAmount\_i (\frac{incomeIndex}{recordedMoneyMarketIncomeIndex\_i} - 1) = incomeIndex (\sum\_i \frac{recordedFundedPrincipalAmount\_i}{recordedMoneyMarketIncomeIndex\_i}) - \sum\_i recordedFundedPrincipalAmount\_i∑i​recordedFundedPrincipalAmounti​(recordedMoneyMarketIncomeIndexi​incomeIndex​−1)=incomeIndex(∑i​recordedMoneyMarketIncomeIndexi​recordedFundedPrincipalAmounti​​)−∑i​recordedFundedPrincipalAmounti​​

where i refers to a funding

@param pool The DInterest pool

@return interestOwed The floating-rate interest accrued to all floating-rate bond holders

## `surplusOfDeposit(contract DInterest pool, uint64 depositID) → bool isNegative, uint256 surplusAmount` (public) <a href="#surplusofdeposit-contract-dinterest-pool-uint64-depositid-bool-isnegative-uint256-surplusamount-publ" id="surplusofdeposit-contract-dinterest-pool-uint64-depositid-bool-isnegative-uint256-surplusamount-publ"></a>

Computes the surplus of a deposit, which is the raw surplus of the unfunded part of the deposit. If the deposit is not funded, this will return the same value as {rawSurplusOfDeposit}. @param depositID The ID of the deposit

@return isNegative True if the surplus is negative, false otherwise

@return surplusAmount The absolute value of the surplus, in stablecoins

## `_depositVirtualTokenToPrincipal(struct DInterest.Deposit depositEntry, uint256 virtualTokenAmount) → uint256` (internal) <a href="#depositvirtualtokentoprincipal-struct-dinterest-deposit-depositentry-uint256-virtualtokenamount-uin" id="depositvirtualtokentoprincipal-struct-dinterest-deposit-depositentry-uint256-virtualtokenamount-uin"></a>

Converts a virtual token value into the corresponding principal value. Principal refers to deposit + full interest + fee.

@param depositEntry The deposit struct

@param virtualTokenAmount The virtual token value

@return The corresponding principal value

## `rawSurplusOfDeposit(uint64 depositID) → bool isNegative, uint256 surplusAmount` (public) <a href="#rawsurplusofdeposit-uint64-depositid-bool-isnegative-uint256-surplusamount-public" id="rawsurplusofdeposit-uint64-depositid-bool-isnegative-uint256-surplusamount-public"></a>

Computes the raw surplus of a deposit, which is the current value of the deposit in the money market minus the amount owed (deposit + interest + fee). The deposit's funding status is not considered here, meaning even if a deposit's fixed-rate interest is fully funded, it likely will still have a non-zero surplus.

@param depositID The ID of the deposit

@return isNegative True if the surplus is negative, false otherwise

@return surplusAmount The absolute value of the surplus, in stablecoins


# ZeroCouponBond

## `mint(uint256 depositAmount) → uint256 mintedAmount` (external) <a href="#mint-uint256-depositamount-uint256-mintedamount-external" id="mint-uint256-depositamount-uint256-mintedamount-external"></a>

Mint zero coupon bonds by depositing `depositAmount` stablecoins. @param depositAmount The amount to deposit for minting zero coupon bonds @return mintedAmount The amount of bonds minted

## `withdrawDeposit()` (external) <a href="#withdrawdeposit-external" id="withdrawdeposit-external"></a>

Withdraws the underlying deposit from the DInterest pool.

## `redeem(uint256 amount, bool withdrawDepositIfNeeded)` (external) <a href="#redeem-uint256-amount-bool-withdrawdepositifneeded-external" id="redeem-uint256-amount-bool-withdrawdepositifneeded-external"></a>

Redeems zero coupon bonds 1-for-1 for the underlying stablecoins. @param amount The amount of zero coupon bonds to burn @param withdrawDepositIfNeeded True if withdrawDeposit() should be called if needed, false otherwise (to save gas)

## `withdrawDepositNeeded() → bool` (external) <a href="#withdrawdepositneeded-bool-external" id="withdrawdepositneeded-bool-external"></a>

Checks whether withdrawDeposit() needs to be called. @return True if withdrawDeposit() should be called, false otherwise.


# Audits / Security

The security of the 88mph protocol is our highest priority; our development team, alongside third-party auditors and consultants, has invested considerable effort to create a protocol that we believe is safe and dependable. All contract code and balances are publicly verifiable, and security researchers are eligible for a [bug bounty](https://immunefi.com/bounty/88mphv3/) for reporting undiscovered vulnerabilities.

The current version of 88mph has been reviewed & audited by [Trail of Bits](https://github.com/trailofbits/publications/blob/master/reviews/88mph.pdf), [Code423n4](https://code423n4.com/reports/2021-05-88mph/), and [PeckShield](https://github.com/peckshield/publications/blob/master/audit_reports/PeckShield-Audit-Report-88mphv3-v1.0.pdf).

Previous versions have been audited by [PeckShield](https://github.com/peckshield/publications/blob/master/audit_reports/peckshield-audit-report-88mph-v1.0.pdf) and [Quantstamp](https://certificate.quantstamp.com/full/88-mph). Additional features were audited by [Certik](https://www.certik.org/projects/88mph) and [PeckShield](https://github.com/peckshield/publications/blob/master/audit_reports/peckshield-audit-report-88mph%20Zero%20Coupon%20Bonds-v1.0.pdf). We don't ship unaudited code.

### Additional security analysis

* [Defi safety](https://docs.defisafety.com/finished-reviews/88mph-v3.0-process-quality-review)
* [Defiyield](https://defiyield.info/assets/pdf/88mph.pdf)

{% hint style="danger" %}
Please exercise caution, and make your own determination of security and suitability.
{% endhint %}


# REST API

## Ethereum&#x20;

* <https://api.88mph.app/v2/pools>
* <https://api.88mph.app/v3/pools>

## Other chains

* <https://api.88mph.app/v3/polygon/pools>
* <https://api.88mph.app/v3/avalanche/pools>
* <https://api.88mph.app/v3/fantom/pools>


# Governance

MPH holders have the power to shape the future of the protocol. A dedicated [Snapshot](https://snapshot.org/#/88mph.eth) is live to enable the community of users to signal their preferences on the project developments.

The governance process works by having users signal their preferences with their veMPH tokens on various proposals ranging from protocol parameters to smart ways of using the treasury for allocating grants to teams and individuals who want to shape and help the growth of the 88mph and Ethereum ecosystem. The 88mph community can vote on 8IP - 88mph Improvement Protocol - proposals using their veMPH as their vote's weighting.

## Forum <a href="#forum" id="forum"></a>

The [88mph Forum](https://forum.88mph.app/) is a place for the community to engage in focused discussions regarding the 88mph ecosystem.​

The Forum is divided into the following categories:

#### Proposals

An area to submit your ideas here for improving 88mph in any way. Whether it’s a new asset, updating fee and interest rate structures, system parameters, or tinkering with tokenomics or governance, all proposals are welcomed here. <https://forum.88mph.app/c/proposals/5>​

To view the proposals submitted to Snapshot vote, please click below:

#### General Discussion

For topics that do not belong to any other particular topics. <https://forum.88mph.app/c/general-discussion/7>​

### Site Feedback <a href="#site-feedback" id="site-feedback"></a>

Discussion about this site, its organization, how it works, and how we can improve it. <https://forum.88mph.app/c/site-feedback/2>​

### Knowledge Base <a href="#knowledge-base" id="knowledge-base"></a>

Contribute your knowledge to the community. Share how-tos, tutorials, and other resources. <https://forum.88mph.app/c/knowledge-base/6>​

## Snapshot <a href="#snapshot" id="snapshot"></a>

> Snapshot is an off-chain gasless multi-governance client with easy to verify and hard to contest results.

88mph users can participate in Snapshot governance here: <https://snapshot.org/#/88mph.eth>​

Snapshot governance allows users that have veMPH to participate in deciding the future of the 88mph ecosystem.

​


# Proposals

The 88mph governance proposals are labeled 8IP; 88mph Improvement Proposals, pronounced 'ape' - 🐒

## 8IP-1 <a href="#id-8ip-1" id="id-8ip-1"></a>

The first 8IP laid out the format for all future 88mph Improvement Proposals and can be viewed here: <https://forum.88mph.app/t/8ip-1-88mph-improvement-proposals/22>​

## 8IP-2 <a href="#id-8ip-2" id="id-8ip-2"></a>

> Make depositor reward vest period equal deposit period #QmSZ2M4

| For    | Against |
| ------ | ------- |
| 95.02% | 4.98%   |

View here: <https://snapshot.org/#/88mph.eth/proposal/QmSZ2M4QXEBBwF16NQpTZWLNrDD1VpAYvJTequskvsz9AW>​

## 8IP-3 <a href="#id-8ip-3" id="id-8ip-3"></a>

> Distribute MPH staking rewards in MPH #QmepfUB

| For    | Against |
| ------ | ------- |
| 90.63% | 9.37%   |

View here: <https://snapshot.org/#/88mph.eth/proposal/QmepfUBUnxnQcK427APjofUWN8HoyxbpWf1L9u2uY6Nce6>​

## 8IP-4 <a href="#id-8ip-4" id="id-8ip-4"></a>

> Remove MPH payback during withdrawal #QmVMJzy

| For    | Against |
| ------ | ------- |
| 93.19% | 6.81%   |

View here: <https://snapshot.org/#/88mph.eth/proposal/QmVMJzyWVM8nRfV8A1n6z2mpbyFjvzFAYi7BV415aXzYRe>​

​


# Grants & Funding

88mph provides grants for projects, initiatives, resources, NFTs, and events that encourage and develop the 88mph and Ethereum ecosystem and empower the community. We offer grants ranging from in $MPH and distribute blocks of funds as individuals and teams reach predetermined milestones.

## Get funded <a href="#get-funded" id="get-funded"></a>

Please follow these [detailed steps](https://88mph.app/funding) to apply for funding. After submitting your application, please allow 5 to 10 business days for a response.


# Changelog

### v 4.0

* Added the veMPH and gauges system
* Discontinued the initial MPH rewards program in favor of the veMPH gauge weight allocation model.
* Discontinued xMPH in favor of veMPH revenue distribution.

### v 3.3 01.05.22

* Added latest deposits panel in the navigation bar.
* Added new filtering and ordering capacity to the Earn page.
* Added real-time rate toggle to yield token estimated ROI.
* Added current ROI to active yield token positions.
* Added sliders to estimate ROI to each yield token opportunities section.
* Added approval button to yield token buy modal.
* Added global asset USD price cache.
* Added dynamic y-axis labels to charts.
* Added multichain MPH staking data.
* Added more reliable blocks subgraphs for Fantom and Avalanche.
* Added new helpers/tooltips.
* Changed terms of services and disclaimer in the onboarding UI.
* Fixed the current rate for the harvest pool.
* Fixed incorrect MPH staking data.
* Fixed cache issues and many minor bugs.

### v 3.2 11.24.21

* Added native MPH rewards to 88mph on Fantom network.
* Added Ethereum to Fantom bridge for MPH.
* Added new mobile friendly header navigation.
* Fixed minor bugs.

### v 3.1 10.10.21

* Added support for Avalanche, Polygon, Fantom network.

### v 3.0 09.16.21

* Withdraw partially, roll over, top up your existing [fixed-interest rate deposits](/getting-started/fixed-apy).
* A more generous fixed-interest rate for deposits with a short duration, and a more conservative rate for the long duration.
* [MPH rewards](broken://pages/-Meu0jDwAiSYpMbuUrfx) are vested linearly over the deposit duration and are transferrable NFT.
* [Stake MPH](broken://pages/-Mepkpf0bu8N6fl7j_UD) for xMPH, earn protocol’s revenues via our bi-weekly buy-back mechanism, and voting rights.
* No more MPH payback mechanism when users withdraw their deposits.
* Introducing a 0.5% early withdrawal fee; distributed to the MPH stakers.
* Floating rate bonds are now called [Yield Tokens (YT)](/getting-started/yield-tokens), a new per-deposit system, where a user can choose to fund a fraction of the debt of any individual deposit, regardless of order.
* YT are fungible ERC-20/ERC-1155 tokens.
* YT interest payout is triggered whenever a portion of the deposit funded is withdrawn, or when someone manually triggers a payout using `DInterest.payInterestToFunders()`.
* As a [developer](/developer-docs/integration-guide); interacting with the protocol is easier than ever. There are tons of accountancy burdens removed, help functions, and simple improvements to make an integration with 88mph as easy as building with Compound or Aave.
* The [solvency](/getting-started/risk-mitigation) of each pool can now be managed dynamically by harvesting a % of a pool’s surplus and be redirected to another pool; future release will allow xMPH holders to govern the pool’s parameters.
* One last thing, you can add creative value to a deposit by attaching whatever metadata you want (88mph deposits are ERC-721 tokens).


