Token Engineering Questions

Question 1

Bob is trading with a Constant Product Market Maker with no fees, and he wishes to trade 100 Token X into the pool. He considers two strategies: he can either trade all 100 Token X in one trade, or he can break this trade up into 100 trades of 1 Token X each. Assuming that there are no trading fees and ignoring gas fees, which strategy would return more Token Y for his trades?

In a Constant Product Market Maker (CPMM) such as Uniswap or Balancer, the product of the quantities of two tokens (Token X and Token Y) in the pool remains constant. Let's assume the initial pool contains x Token X and y Token Y.

When Bob trades 100 Token X into the pool, the constant product formula can be used to calculate the resulting quantities of Token X and Token Y. The formula is:

x * y = (x + 100) * y'

where y' represents the resulting quantity of Token Y after the trade.

Now let's consider the two strategies Bob is contemplating:

  1. One trade of 100 Token X:
    Using the constant product formula, we can solve for y' when x = x + 100. This means the resulting quantity of Token Y after the trade would be:

x * y = (x + 100) * y'
y' = (x * y) / (x + 100)

  1. 100 trades of 1 Token X each:
    For each trade, Bob is effectively incrementing x by 1, and we can calculate the resulting quantity of Token Y after each trade using the constant product formula. After 100 trades, the final quantity of Token Y would be:

y' = (x * y) / (x + 1) * (x + 2) * ... * (x + 100)

Now, to determine which strategy would return more Token Y, we need to compare the resulting quantities obtained from each strategy. Since the second strategy involves multiple trades, the resulting quantity of Token Y would depend on the order and timing of each trade. It's challenging to determine the exact outcome without considering factors like slippage and impermanent loss.

In general, if there are no trading fees or gas fees, both strategies should result in the same amount of Token Y, assuming the same initial quantities of Token X and Token Y. However, the second strategy of breaking up the trade into smaller increments might be more susceptible to slippage or other market dynamics, which could potentially result in a slightly lower quantity of Token Y compared to the first strategy of a single large trade.

It's important to note that this analysis assumes no fees, including trading fees and gas fees. In reality, there may be additional costs associated with executing trades on decentralized exchanges.

Question 2

Suppose we have a constant product market maker of the form x · y = M, where M is a constant. Alice finds that when there are 50 Token X in the pool, the Spot Price is 2 Token Y/Token X. What is the value of M? Your answer will be a whole number; enter it with no commas and no decimal points.

In a constant product market maker (CPMM) of the form x · y = M, the value of M represents the constant product of the quantities of Token X (x) and Token Y (y) in the pool.

Given that the Spot Price is 2 Token Y/Token X when there are 50 Token X in the pool, we can use this information to calculate the value of M.

The Spot Price is defined as the ratio of Token Y to Token X in the pool at a specific moment. In this case, the Spot Price is 2 Token Y/Token X, which means for every 1 Token X, there are 2 Token Y in the pool.

Let's substitute these values into the CPMM formula x · y = M:

50 · 2 = M

100 = M

Therefore, the value of M is 100.

Answer

Question 3

Suppose we consider a constant product Automated Market Maker pool that charges fees on incoming trades , using the invariant curve such x · y = k, where k is the invariant (which increases with each trade), x is the amount of Token X, and y is the amount of Token Y. Initially the pool contains 100 Token X and 100 Token Y, and fees are set to 1% of incoming trades. If Bob trades 50 Token X into the pool, how much Token Y will he receive in exchange? Round your answer to four decimal places, and use a decimal point.

In a constant product Automated Market Maker (AMM) pool that charges fees on incoming trades, the invariant curve is given by the equation x · y = k, where x is the amount of Token X, y is the amount of Token Y, and k is the invariant.

Initially, the pool contains 100 Token X and 100 Token Y, so we can calculate the initial value of k:

k = 100 · 100 = 10000

Now, let's consider Bob trading 50 Token X into the pool. The fees are set to 1% of incoming trades, so Bob's trade will incur a fee of 1% of 50 Token X, which is 0.01 * 50 = 0.5 Token X.

After deducting the fee, the amount of Token X that actually goes into the pool is 50 - 0.5 = 49.5 Token X. We can now calculate the resulting amount of Token Y using the invariant curve equation:

x · y = k

(100 + 49.5) · y = 10000

149.5 · y = 10000

y = 10000 / 149.5

y ≈ 66.8445

Therefore, Bob will receive approximately 66.8445 Token Y in exchange for his 50 Token X trade (after accounting for the 1% fee). Rounded to four decimal places, the amount of Token Y Bob will receive is 66.8445.

Question 4

Alice wants to trade 3 Token X into a pool. She is considering 4 different types of AMM pools, each of which has 10 Token X and 1000 Token Y. However, each pool has a different invariant curve with a different equation. Which of the equations below would give Alice the largest amount of Token Y for her trade? (x represents amount of Token X in the pool, y represents the amount of Token Y in the pool.)

To determine which equation would give Alice the largest amount of Token Y for her trade of 3 Token X, let's evaluate each option based on the initial pool values of 10 Token X and 1000 Token Y.

  1. x + y = constant: For this equation, the total sum of Token X and Token Y remains constant. Since Alice wants to trade 3 Token X into the pool, the equation becomes 3 + y = constant. In this case, the constant would be 13 (initial Token X + traded Token X). Alice's resulting amount of Token Y would be 13 - 3 = 10.

  2. x²y³ = k: Using this equation, we can calculate the value of k using the initial pool values: 10² * 1000³ = k. Simplifying, we have 10,000,000 * 1,000,000,000 = k. Therefore, k is an extremely large value. However, this equation does not allow us to determine the resulting amount of Token Y specifically for Alice's trade of 3 Token X.

  3. 2x + 3y = constant: Again, the total sum of 2 times Token X and 3 times Token Y remains constant. If Alice trades 3 Token X, the equation becomes 2 * 3 + 3y = constant. Simplifying, we have 6 + 3y = constant. In this case, the constant would be 16 (2 * initial Token X + traded Token X). Solving for y, we get 3y = 10, and therefore, y ≈ 3.3333. However, this equation does not provide the exact resulting amount of Token Y for Alice's trade.

  4. x · y = k: Using this equation, we can calculate the value of k using the initial pool values: 10 * 1000 = k. Therefore, k = 10,000. Alice's resulting amount of Token Y would be 10,000 / (10 + 3) = 10,000 / 13 ≈ 769.2308.

Based on the given options, the equation x · y = k would provide Alice with the largest amount of Token Y for her trade of 3 Token X. Using this equation, Alice would receive approximately 769.2308 Token Y in exchange for her 3 Token X trade.

Apologies for the confusion in my previous response. You are correct, given the equation x²y³ = k, we do know the values of x and k. Let's calculate the resulting value of y using that equation and the provided values.

For this equation, x²y³ = k, we have x = 10 (initial Token X) and k = 10,000. Substituting these values into the equation, we get:

10²y³ = 10,000

100y³ = 10,000

Dividing both sides by 100:

y³ = 100

Taking the cube root of both sides:

y = ∛100

y ≈ 4.6416

Therefore, for the equation x²y³ = k, if Alice trades 3 Token X into the pool with initial values of 10 Token X and 1000 Token Y, she would receive approximately 4.6416 Token Y in exchange.

Question 5

Initially, Alice provided 400 Token X and 10 Token Y to a Liquidity Pool. After a few months, the price on the external market has moved so that 4 Token X are trading for 1 Token Y on external markets. Did Alice experience impermanent loss?

Question 6

TRUE or FALSE: Typically, the states that it is possible to actually reach in a system is a proper subset of all possible states in the system.

FALSE

Question 7

Both Alice and Bob are running automated market maker pool containing Token X and Token Y. Alice decides to use the weighted constant-sum curve 2x + 5y = M, where M is a constant. Bob's initial AMM curve is x · y = 2000. Each pool initially has 40 Token X. If Alice's pool contains the same amount of Token Y as Bob's pool, what is the value of the constant M? Enter your answer a whole number, with no commas or decimal places.

2x + 5y = M
x · y = 2000

2(40) + 5y = M
40 · y = 2000

80 + 5 y = M
y = 2000/40 = 50

80 + 5 (50) = M

250 + 80 = 330

Question 8

Alice wants to trade for 20 Token Y, and she is trying to decide between two Liquidity Pools. The first pool is a constant product market maker with no fees, of the form x · y = M. The second pool is governed by a Constant Product Market Maker of the form x · y = N, with fees of exactly p% taken on the incoming trade. At the moment, the first pool has the exact same amount of Token X and Token Y as the second pool does. To Alice's surprise, she finds that she will have to trade in the same amount of Token X either way. If we let Δx denote the amount that Alice needs to put into the pool, which of the following is equivalent to (x+Δx)/(x + (1-p)Δx)?