# MachineX

MachineX is the first DEX purpose-built for Machine DeFi. Deployed on [peaq](/introduction/peaq), MachineX gives people access to DePIN tokens, the PEAQ token, and, eventually, tokens representing value-generating machines themselves (i.e. Machine RWAs).

At launch, users will be able to swap between assets and provide liquidity into both [Concentrated](/protocol/concentrated-liquidity) and [Legacy](/protocol/legacy-liquidity) liquidity pools.

Over time, MachineX will evolve into a [MetaDEX](https://paragraph.com/@dromos/the-metadex-and-defi-introduction-and-overview) - a DEX model where liquidity providers earn token emissions and fees generated by the protocol are directed to participating token holders. The model will be adapted to best serve the DePIN projects launching on peaq and the peaq chain itself.


# peaq

{% embed url="<https://docs.peaq.xyz/build/introduction>" %}
<https://docs.peaq.xyz/build/introduction>
{% endembed %}

{% embed url="<https://www.peaq.xyz/>" %}
<https://www.peaq.xyz/>
{% endembed %}


# Concentrated Liquidity

Concentrated Liquidity is currently the most efficient method of market making that on-chain decentralized exchanges have access to. This was popularized when Uniswap released V3. To get an idea of what Uniswap V3 offers we can compare it to a more centralized, well-known liquidity scheme: A CEX Order Book.

<figure><img src="/files/0B6ceaeYKxQoV419Wwda" alt=""><figcaption></figcaption></figure>

As you can easily see in the CEX Order Book diagram above, the bids (buys) and asks (sells) are clearly shown, and the depth at which a market order would impact the median price is visually discernible. Interesting enough, the concentrated liquidity model, is represented visually as an inverse histogram of the order book.

<figure><img src="/files/wCNvHAAetMZ7Zd9T4Lka" alt=""><figcaption></figcaption></figure>

The blue area shaded in represents the liquidity ranges summated between all users within the pool.

Concentrated liquidity positions have a defined range chosen by the liquidity provider. Each liquidity provider chooses the lower and upper bound at which their liquidity can be utilized.

This means that liquidity is concentrated into narrower price ranges, providing much deeper liquidity to the market than if that liquidity had to be spread across the full (0,∞) range (as required in previous models such as Uniswap V2).

For example, $100,000 of liquidity spread from 0 to ∞ is exponentially less efficient than $100,000 of liquidity with a defined range of ($1,000-$1,100). It is calculable that the same $100,000 of liquidity is now concentrated in a $100 price range, providing an **efficient swapping experience**. Concentrated liquidity provides the lowest slippage currently feasible within the DeFi space.


# Legacy Liquidity

Legacy pools are the traditional Uniswap V2 and Stableswap pools with some modifications throughout iterations. Legacy pools can either be Volatile or Stable:

**Volatile:** Uniswap V2

**Stable:** Stableswap

## Volatile

Volatile legacy pairs are akin to the typical Uniswap V2 balanced pools that have existed for many years. The swap curve is:

$$
x∗y=k
$$

The balance of TokenA and TokenB in the pool will be of equal value to each other. For example, if there is an ETH-USDC legacy volatile pool, and ETH price is currently 4000 USDC, the pool will have 1 ETH per 4000 USDC.

Volatile pools are recommended for low-maintenance set and forget liquidity providing of non-correlated assets

## Stable

Correlated legacy pairs are akin to Curve's Stableswap pools which provide low slippage for traders. The swap curve is:

$$
xy(x^2+y^2)>=k
$$

The balance of TokenA and TokenB in the pool will vary based on the current place on the price curve. The closer each asset is to each other in pricing, the closer to 50/50 the pool will be.


# Fee Distribution

At launch, the following distribution structure will be used for all swap fees generated:

| Recipient                                                                | Fee Percentage |
| ------------------------------------------------------------------------ | -------------- |
| Liquidity Providers                                                      | 90%            |
| MachineX                                                                 | 9%             |
| [Network-Level Incentives Pool](/protocol/network-level-incentives-pool) | 1%             |

It is known that this distribution structure will change in the future as more features are introduced to MachineX.


# Network-Level Incentives Pool

1% of all swap fees generated on MachineX will go to peaq's Network Level Incentives Pools to subsidize new machines and DePINs.

<figure><img src="/files/y6LDNyM6H01xGunUjFfs" alt=""><figcaption></figcaption></figure>

{% embed url="<https://www.peaq.xyz/blog/welcome-to-machine-defi>" %}
<https://www.peaq.xyz/blog/welcome-to-machine-defi>
{% endembed %}


# Contract Addresses

| Contract                           | Address                                    |
| ---------------------------------- | ------------------------------------------ |
| WPEAQ                              | 0x3cD66d2e1fac1751B0A20BeBF6cA4c9699Bb12d7 |
| PERMIT2                            | 0x000000000022D473030F116dDEE9F6B43aC78BA3 |
| FeeCollector                       | 0x8DC13a3fC0A5A533dee8a00F8C68589E640b000e |
| AccessHub Proxy                    | 0x1ac7ca1A2BFd592991726daBC5E14cBb3976eE2D |
| ProxyAdmin                         | 0xAeb16e632dE8d0DaBB7E664961B13B06b686B997 |
| ProxyOwner                         | 0xA1A17CAf56624Ad3FC38898C6AF8Ecc310730aB9 |
| PairFactory                        | 0xA3f356f0403b4f10345cD95E0C80483FDdD63Ebd |
| MachineXV3Factory                  | 0x2646DCbE025D21A2925fdaCeB639e998E17d6060 |
| MachineXV3PoolDeployer             | 0x378524816AEeec75D3cD2B8216813450E9CD15E5 |
| NonfungibleTokenPositionDescriptor | 0xF9B9c6574A7D8C344d816293ff53EB09287f781d |
| NonfungiblePositionManager         | 0x4DbC7DD463Bb4a8C6C4381cCEeB58b9327C7Cfa4 |
| SwapRouter                         | 0x723eA41937d7C1F5a4C5ccFa5bfF82210de17C71 |
| Quoter                             | 0x040DA8cfa606774f160B209ec3ae31BBac2B19E6 |
| QuoterV2                           | 0xA675327f7A18bA35860617b2dBD5a6feC786CdBa |
| TickLens                           | 0x918256d1f4521cBEE9312025D6e9549F0BdC3e51 |
| UniswapInterfaceMulticall          | 0x6e2f0Ee91dc8Ba3392411DC3cfEB5cc51D6E4D66 |
| UniversalRouter                    | 0x5E37287fce6B74c500340c717CEE661fD8ebA095 |
| MixedRouteQuoterV1                 | 0x5Bf68a61d07911896D58bCBD540Fe17C7e239f03 |
| LegacyRouter                       | 0xe8AfC3b7544C5bE0BAce54B2c5beCc93ABf25221 |


# Links

Website: [https://machinex.xyz](https://machinex.xyz/)

App: [https://app.machinex.xyz](https://app.machinex.xyz/)

X: <https://x.com/machinedex>

Discord: <https://discord.gg/3Mp7FgW683>


# Media Kit

{% file src="/files/DgZGC9o5SyWItryKOU6l" %}

{% file src="/files/5YCzHEVK7SY3CeEyGcvw" %}

{% file src="/files/1Lp96PEbKU22Pkq55KxF" %}

{% file src="/files/AyV7GO6gkyW0iyZJdIls" %}

{% file src="/files/5KwCHKYpLoMbyWOosLaE" %}

{% file src="/files/rPHmRRSBRu1H3SoLjtog" %}


# Bridging to peaq

## Squid

Use Squid to do cross-chain swaps from USDC/USDT to PEAQ.

<https://app.squidrouter.com/?chains=1%2C3338&tokens=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48%2C0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee>

## Stargate

Use Stargate to bridge assets to peaq as LayerZero OFTs. These are the main assets used in MachineX pools alongside $PEAQ and native DePIN tokens.

| Token  | peaq Address                               | Quick URL                                                                                                                                                             |
| ------ | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| USDT   | 0xf4D9235269a96aaDaFc9aDAe454a0618eBE37949 | <https://stargate.finance/bridge?dstChain=peaq&dstToken=0xf4D9235269a96aaDaFc9aDAe454a0618eBE37949>                                                                   |
| USDC   | 0xbbA60da06c2c5424f03f7434542280FCAd453d10 | <https://stargate.finance/bridge?dstChain=peaq&dstToken=0xbbA60da06c2c5424f03f7434542280FCAd453d10>                                                                   |
| ANYONE | 0xe67F39FbE8C24ef8b3542efED1eE9963cEFC1f2a | <https://stargate.finance/bridge?dstChain=peaq&dstToken=0xe67F39FbE8C24ef8b3542efED1eE9963cEFC1f2a>                                                                   |
| AUKI   | 0xF67Db9d00401D9e883208882F5c100d7482b083D | <https://stargate.finance/bridge?srcChain=base&srcToken=0xF9569cFb8FD265e91aa478d86ae8c78b8AF55Df4&dstChain=peaq&dstToken=0xF67Db9d00401D9e883208882F5c100d7482b083D> |


# Audits

MachineX is built on the same contracts as Shadow Exchange, utilizing Ramses V3 Core, which is based on Uniswap V3 with several enhancements.

| Entity                         | Description            | Link                                                                         |
| ------------------------------ | ---------------------- | ---------------------------------------------------------------------------- |
| Spearbit                       | Shadow Exchange Audit  | [Report](https://cantina.xyz/portfolio/98695d75-ee7d-4e1c-aa96-6379f73c5b2c) |
| Consensys Diligence            | Ramses V3 CLMM Audit   | [Report](https://diligence.consensys.io/audits/2024/08/ramses-v3)            |
| Code4rena Security Competition | Ramses V3 CLMM Contest | [Report](https://code4rena.com/reports/2024-10-ramses-exchange)              |

## Additional Security Coverage <a href="#additional-security-coverage" id="additional-security-coverage"></a>

* **Specialized Testing Review** by 100Proof via C4rena
* **Post-Competition CL Audit** by Zenith Mitigation
* **Private Development Review** by yAudit
* **Testing Review** with Spearbit researchers


# Disclaimer

In addition to contract-specific risks, it is important for users to be aware of the risks associated with the MachineX platform as a whole. We strongly advise all users to thoroughly review the documentation and risk explanations provided before engaging with the platform.

We emphasize the importance of conducting your own research, understanding the risks involved, and making informed decisions when using the MachineX platform. Users should carefully assess their risk tolerance and consider all potential outcomes before engaging with the platform.


