本文由 威-kaifa873 整理发布,仅作为项目开发需求参考!飞机@sleu88
The Uniswap smart contract code consists of two github projects. One is the core, and the other is the neighborhood.
Core logic, the logic of a single swap. Peripheral services are built on the basis of swap one by one. A single swap, a transaction pair formed by two tokens, is commonly known as the "pool". Each transaction pair has some basic attributes: reserve0/reserve1 and total supply. Reserve0/reserve1 is the storage amount of the two tokens of the transaction pair. Total supply is the total amount of current liquidity tokens. Each transaction pair corresponds to a liquidity provider token (LPT - liquidity provider token). In short, LPT records the contributions of all liquidity providers. The sum of all liquidity tokens is total supply. The idea of the Uniswap protocol is that the product of reserve0 * reserve1 remains unchanged.