DEX is divided into 2 parts: front-end and contract
The functions of DEX are as follows:
- Anyone can add liquidity to become a liquidity provider
- Liquidity providers can withdraw their liquidity and get their cryptocurrency back at any time
- Users can exchange between assets in the trading pool, provided there is sufficient liquidity
- Users are charged a small transaction fee, which is split among liquidity providers so that they can earn money by providing liquidity
This exchange contains only one trading pair, namely ETH and Krypto Devtoken
- When adding liquidity:
- If there is no asset in the pool and the initial value of the two tokens is 0, then accept any eth or Crypto Devtoken provided by the user and give the user LP tokens
- If there are assets in the pool, receive the eth provided by the user, and determine how much Crypto Devtoken the user needs to provide to the contract according to the ratio, and give the user LP tokens
- When removing liquidity:
- exchange
- VSCode or other IDE
- React
- next
- web3modal
- three
================================================================
这个repo里包含了Uniswap的原理图,我整合了知乎上的一篇文章(链接在导图里面有)和LW3的教程,做了总结性的思维导图 😉
DEX分为2部分:前端和合约
DEX的功能如下:
- 任何人都可以添加流动性以成为流动性提供者
- 流动性提供者可以随时移除他们的流动性并取回他们的加密货币
- 用户可以在交易池中的资产之间进行交换,前提是有足够的流动性
- 用户被收取少量交易费用,这些费用在流动性提供商之间分配,以便他们可以通过提供流动性来赚钱
这个交易所只包含一个交易对,即ETH和rypto Devtoken
- 添加流动性时:
- 如果池内没有资产,2种代币初始值都是0,那么接受任何用户提供的eth或Crypto Devtoken,并给用户LP代币
- 如果池内有资产,接收用户提供的eth,并根据比例确定用户需要提供多少Crypto Devtoken给合约,并给用户LP代币
- 移除流动性时:
- 交换
- VSCode或其他IDE
- React
- next
- web3modal
- three
话不多说 上图:tanabata_tree:
Uniswap的原理图
项目框架