How is the valuation of determined?

How is valued?

Author: 0xCygaar, Crypto KOL; Translator: LianGuai0xxz

This article briefly explains how prices shares and other interesting facts about the friend contract.

The contract can be found here:

It’s actually quite simple – users deposit ETH into the contract, and the contract tracks the supply of each “friend” as well as the balance of each holder of that “friend”.

I will mainly explain how pricing works, as this seems to be a mystery to most people.

Here is the pricing function, only 4 lines of code:

The code looks intimidating, so let’s simplify it. Let’s assume you only want to buy/sell one share (amount = 1). This is also known as the spot price.

Using our middle school algebra skills, we can expand the function, and we will get: price = supply^2 / 16000

That’s all there is to it. The price of someone’s share is directly proportional to the square of the circulating supply. As the supply increases, the price rises exponentially. (I have removed the logic to handle the edge case of 0 supply in the above calculation).

To calculate the circulating shares of a “friend” based on a known price (the price displayed by the application), we can solve for supply using the formula above: supply = sqrt(price * 16000)

Using 2blknoiz06 as a simple example: supply = sqrt(2.4256 * 16000) = 197 circulating shares

The rest of the contract is straightforward. The buy and sell functions both calculate the spot price, use that value to determine protocol fees and subject fees, update internal accounting, and send the fees to the correct destination address.

Users buying/selling shares are required to pay protocol fees and subject fees (to the issuer of the friend shares). So far, everything I have explained is how an automated market maker works for currency pairs. Users buy and sell based on the pricing formula.

Other interesting facts:

Total trading volume has reached 26,803 ETH

Protocol fee is 5%

Subject fee is 5%

The protocol has earned $6.57 million

That’s all there is to it. The contract is not upgradable, so the only thing that can update in the future is the protocol/subject fees and the destination address for protocol fees.