Skip to content

chiwei19/homework2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2024-Spring-HW2

Please complete the report problem below:

Problem 1

Provide your profitable path, the amountIn, amountOut value for each swap, and your final reward (your tokenB balance).

Solution

截圖 2024-04-12 下午11 04 30 截圖 2024-04-12 下午11 03 48

Problem 2

What is slippage in AMM, and how does Uniswap V2 address this issue? Please illustrate with a function as an example.

slippage is price change before swaping,we uniswap can set a minimum amount out 截圖 2024-04-12 下午5 27 17

Problem 3

Please examine the mint function in the UniswapV2Pair contract. Upon initial liquidity minting, a minimum liquidity is subtracted. What is the rationale behind this design?

This ensures the total supply is always greater than zero, preventing division by zero errors.

Problem 4

Investigate the minting function in the UniswapV2Pair contract. When depositing tokens (not for the first time), liquidity can only be obtained using a specific formula. What is the intention behind this? 截圖 2024-04-12 下午5 43 31 maintain the pool 50/50

Solution

Problem 5

What is a sandwich attack, and how might it impact you when initiating a swap?

A bigger order placed before my smaller order, then moved the price against me, ending up receiving fewer tokens

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published