DEC & Uniswap - How Does That Work?

in LeoFinance2 months ago (edited)

During last night's AMA with @aggroed, @jarvie was asking how the price of DEC was determined now that the game is using the Uniswap pool. In this video I go through how that is calcuated.

Uniswap is actually very simple. You have two assets that are equal in value by definition.

If you change one by adding to the pool (user sells to the pool), then the amount that comes out from the other side has to balance the product. It's a simple inverse relationship.

If you want to read the Uniswap white paper on the calculations, check it out here:

In my calculations in the video, I neglected the last step of fee add-backs to the pool. It's close enough and I didn't want to get to bogged down in the details. My simplified calculations are within 1.6%



In the chart below, you can see the inverse relationship between DEC and ETH in the pool:

I got these values from entering swap trades.

You can see that as you sell into the pool in larger and larger amounts, the price you are paying gets worse and worse. So if you pay 500 ETH for DEC, you end up with 71M DEC. But if you double the ETH and pay 1000 ETH, you only get 85M DEC. So that is the market feedback that mitigates large traders from pushing the market every which way.

Similarly, you can see that at the extremes of selling DEC into the pool, you get way less bang for your crystal.

I hope this helps clear up how the Uniswap market works.

credit: @mariosfame

If you are visiting from twitter, reddit, or elsewhere click the sign up button at the top to start interacting!

If you are already a LeoFinance user, leave a vote and comment below.

Posted Using LeoFinance Beta


The chart is an interesting addition :)

Nicely explained the WDEC/ETH pool. Thanks for sharing.

You post has been manually curated by @monster-curator Team!**


Good job men

thanks for writing about it... turns out its easier than expected to explain that is a good thing.

So uniswap has a price feed for eth (where do they get that... from their usd-eth pair?)

Neal. Thanks for the post. I was at the SL AMA around the last part and was wondering about how this works. So this documentation is helpful.

My next question is on the GAS fees. Inside the uniswap pool, does each transaction incur a gas fee? If yes, then your embedded asset should decay at a rate and you need incentives to overcome that decay... is it not?

Gas is certainly a pain.

If you are providing liquidity to the pool, you pay gas when you enter and exit the pool.

If you are swapping, you pay gas on each swap.

The liquidity provider (LP) does not pay gas against random user swapping in and out. Your fee earnings are automatically added to your LP position, so there are no transactions on your end until you remove your liquidity.

Posted Using LeoFinance Beta