Sirwin
Sirwin

DEC & Uniswap - How Does That Work?

By nealmcspadden | Monster Maverick | 10 Oct 2020


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 calculated.

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: https://hackmd.io/C-DvwDSfSxuh-Gd4WKE_ig#Example-ETH-%E2%86%92-OMG

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%

ETH -> DEC
3q52Dkr5nBe3xY4zygt1mK63YM5n6QqwiQ8kdP5jL5ssHdM6aYxqitW8y4H8pxcaxhxZP8NKA2Jrr?format=match&mode=fit&width=640

DEC -> ETH
3q52Dkr5nBe3xY4zygt1mK63YM5n7jNmwp6A226XM3GkdekiVwd5UmAT4iHHphgpohrv1QSxYWZQS?format=match&mode=fit&width=640

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

3q52Dkr5nBe3xY4zygt1mK63YM5n8FtarcNb7viFAkz2xBSfJdRRdakFFgBxmhngpn5rYNHKNJVfc?format=match&mode=fit&width=640

I got these values from entering swap trades.

3q52Dkr5nBe3xY4zygt1mK63YM5n8cF3Jri8JcFUnPQEvNqQY1pYNok9QqHTrHR1QiVVers85mFug?format=match&mode=fit&width=640

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.

Originally Posted Using LeoFinance

How do you rate this article?

14


nealmcspadden
nealmcspadden

Just an anarcho-capitalist living the good life.


Monster Maverick
Monster Maverick

My blog covering blockchain gaming content including Monster Maverick Show replays, updates, and more.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.