Skip to content

[In Editing] DEX with Automated Liquidity Pools #11

@jonathanbahai

Description

@jonathanbahai

DEX with Automated Liquidity Pools

PIP: 11
Title: DEX with Automated Liquidity Pools
Authors: Jonathan Baha'i <jbahai@freedomledger.com>
Status: Draft
Type: Informational
Created: 20-12-22

DEX - The Peerplays dex is very similar to Bitshares with one major difference, it is designed to only support PPY pairing. This was done to prevent Peerplays from turning into a shitcoin factory which has happened everywhere else.

Liquidity Pools / AMM - A feature which has not been implemented in Peerplays with several variations of LP/AMM available in various markets for different purposes. Our LP should be designed to serve the purpose of enabling coins/tokens which exist within Peerplays to be able to instantly ‘swap’ to pay for fees within the network, and also to provide liquidity to the network.

Eg. Suppose there is PIZZA, HOTDOGS, ETH, EOS, HIVE, BTC on Peerplays. If I only have ETH in my account and want to be able to send ETH to another peerplays user, and have no PPY, the transaction should go through an instant swap and complete the transfer without the end user needing to buy/hold PPY.

Likewise, if I am trading on the Peerplays DEX and only have ETH and want to trade only against ETH, I want to be able to view the pairs in ETH, I can thanks to the Peerswap LPs. Even though the DEX has all pairs in PPY, I can still trade in ETH based on the LP available for ETH.

Eg. I want to place an order for PIZZA on the dex (a trade, hold the pepperoni), and only have ETH in my balance. I can place the order to BUY Pizza and my ETH through the LP is converted to PPY and then placed on the order book.

This means that for all pairs within Peerplays the DEX volume becomes pooled into the PPY pairing and prevents fractional pools while generating more transactional volume for the LPs which translates into more profits for those that provide it. win/win/win.

This positions Peerplays DEX and LPs as a value add to all the other coins/tokens worldwide by providing a fast/easy use platform that can operate within their core preferred asset instead of forcing others to adopt PPY.

For example, if I wanted to create a DEX interface that was just for all the tokens to pair to BTC, I can easily do that and never reveal PPY as the underlying asset for fees. I could likewise, create one for PIZZA, or EOS.. and so on. I believe these interfaces will become personalized as we go into the future based on peoples community preferences and lifestyle and therefore we will provide the tools to support that.

How Liquidity Pools Work in Peerplays

I have only kept my understanding of LPs and AMM at a high level in order to keep myself from getting too far into the weeds of what others are doing and instead focus on the practical needs of what Peerplays requires for its purposes. We want LPs/AMM that matches our objectives. So please contribute any additional details I may be missing or need to be addressed in order to complete it.

Any token within the Peerplays network (including SONs) can create a pool. The ownership of the pool depends on the liquidity providers and the token owner. If it is a decentralized asset, then parameters would fall to the Advisors, where private assets would fall to the asset owner.

I will use BTC as an example since this is what is coming soon to Peerplays.

I have 10 BTC and I deposit it to my Peerplays account.

I wish to see my BTC grow (who doesn’t?)

I want to deposit 9BTC into the LP and earn rewards, so I PowerUP and input 9BTC for my balance. My 9 BTC gets confirmed by the liquidity pool contract and I receive an NFT token with the details that includes the date of creation, and the exact amount of BTC deposited.

Graphical representation of these NFTs should be considered also as this will impact peoples sense of ownership.

I now qualify for participation rewards in Peerplays. This means when I vote for witnesses, I now can gain rewards, when anyone requires a Peerswap of BTC/PPY, I will get rewards.

My NFT (I like to call this GPOS NFT to be specific) can be burned and I can get my BTC back, but only on a timed schedule. The smaller the stake the sooner it can be withdrawn, the larger, the longer. This should be relative to all other NFTs. and using a straight curve increases the time of lockup linear in coindays.

If however, I wish to liquidity immediately without delay, I can always put my GPOS NFT up for sale on the NFT marketplace. Someone else could buy it and I can see a profit from the potential future rewards even by the sale of the asset. Similar to how a company is sold with a multiplier to consider future revenues, a GPOS NFT could ask a similar premium.

Wait, where is the PPY coming from?

When PPY holders PowerUP they can select the pool they wish to support. If there was say BTC, ETH, PIZZA, HOTDOG, and EOS available, if I had say 1000 PPY I could then PowerUP say 100PPY to BTC, 100PPY to ETH, and 800PPY to PIZZA (because it's delicious).

Advisor controlled LPs will have the backing of the reserve pool against the other side and will have the rewards that accumulate from this go back to the reserve pool.

This means that the 9BTC I put into the pool now has the same backing from the reserve pool assuming there was no one who supported the pool with their PPY (hard to imagine).

Users PPY in the pool will be first to receive rewards and the network only will when the LP goes below user funding.

The end result is a process flow that is frictionless for the end user, and insured.

How are the rewards calculated?

This is a tricky part that I am still struggling with. My understanding is that as far as the LP is concerned, with every swap that takes place, we can expect at 0.3% or something to that effect being deducted from the transaction to go to the LP.

My initial design was to have the rewards then target NFT holders according to the staking power of their NFT relative to the whole pool. If my 9BTC was all that was in the pool for PPY/BTC, then I would get 50% of all fee rewards generated, and the other 50% would go to the reserve pool.

This is rather simplistic and doesn’t incorporate some necessary gamification elements that would help a great deal. For example, I believe that a bell curve on rewards should be implemented in order to encourage the median middle rather than all reward flow going to minnows (encourages them to put more in), or the whales (discourages them from taking over the whole thing and instead spreads out more).

It would be ideal if this curve was calculated based on NFT backing assets and then targeted with a curve of 5/15/60/15/5. The look of the NFT could be programmed to change when they enter into the different ‘levels’ with the most ideal being the 60 zone.

How are the fees calculated?

Because the core asset is PPY, when I deposited my 9 BTC I also had the fee paid in PPY. This means that when the rewards are paid out, they are also paid out in PPY. I can however select to have my payout in BTC, but that would be another swap, and I am paying for that.

How is the price discovered? (AMM)

I believe that price discovery should happen in the DEX by taking the price over a 30 minute period and then publishing it. I believe this is what is most optimal in regular markets and based on a study of Moonieswap found this to be more in favor of LPs vs. arbitrage bots. If there is a better way to do this please add. I don’t believe we should be feeding prices from other networks as they are prone to manipulation and attack of the system by way of manipulating other low volume inputs. Given the high amount of liquidity which should be achieved with our pairs, it would serve as the most reliable price discovery which can be independently verified.

TBC...

Feedback is welcome during this drafting of this proposal. Please join in dev discussion by leaving comments below.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions