大公排指的是全网排列,小公排指的是单体伞下排列,一条线公排指的是按一条线排列,跳排指的按指定某代数为推荐关系。
大公排和小公排常见的排网方式是自上而下自左至右。
公排模式中常见的案例有双轨二二复制,三轨三三复制,五五复制、太阳线等。
For users,it is mainly about experiencing various meta universe application scenarios,such as meta universe e-commerce,meta universe social networking,meta universe entertainment,and meta universe office.All real-world scenarios can be presented in the meta universe through digital technology,so it can also be understood as a digital city,and more importantly,a digital earth.
swap是普通用户进行代币交易的操作。普通用户通过swap操作实现两种token之间的交易。
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[]calldata path,
address to,
uint deadline
)external virtual override ensure(deadline)returns(uint[]memory amounts){
Uniswap支持多种代币的交换。具体的含义是,Uniswap提供了多级交易池的路由功能。举个例子,已有两个交易对TokenA-TokenB,以及TokenB-TokenC,通过swap接口,可以实现TokenA-TokenC的交换,其中经过的TokenA-TokenB,TokenB-TokenC,称为路径(path)。amountIn是路径中的第一个代币的数量,amountOutMin是期望的交换后的最少的数量。
amounts=UniswapV2Library.getAmountsOut(factory,amountIn,path);
require(amounts[amounts.length-1]>=amountOutMin,‘UniswapV2Router:INSUFFICIENT_OUTPUT_AMOUNT’);
amounts是每个路径上的交换后的数量。amounts[amounts.length-1]也就是最后一条路径的输出数量。注意,UniswapV2Library.getAmountsOut的实现(在获取每个交易对的reserve信息后,调用getAmountOut函数):
function getAmountOut(uint amountIn,uint reserveIn,uint reserveOut)internal pure returns(uint amountOut){
require(amountIn>0,'UniswapV2Library:INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn>0&&reserveOut>0,'UniswapV2Library:INSUFFICIENT_LIQUIDITY');
uint amountInWithFee=amountIn.mul(997);
uint numerator=amountInWithFee.mul(reserveOut);
uint denominator=reserveIn.mul(1000).add(amountInWithFee);
amountOut=numerator/denominator;
}