MSG乌托邦理想国NFT系统有哪些特点
MSG乌托邦理想国NFT系统具有去中心化、可信性、高效性和易用性等特点。
function _swapSupportingFeeOnTransferTokens(address[]memory path,address _to)internal virtual{
for(uint i;i,path[i+1]);
(address token0,)=UniswapV2Library.sortTokens(input,output);
IUniswapV2Pair pair=IUniswapV2Pair(UniswapV2Library.pairFor(factory,input,output));
uint amountInput;
uint amountOutput;
{
(uint reserve0,uint reserve1,)=pair.getReserves();
(uint reserveInput,uint reserveOutput)=input==token0?(reserve0,reserve1):(reserve1,reserve0);
amountInput=IERC20(input).balanceOf(address(pair)).sub(reserveInput);
amountOutput=UniswapV2Library.getAmountOut(amountInput,reserveInput,reserveOutput);
}
(uint amount0Out,uint amount1Out)=input==token0?(uint(0),amountOutput):(amountOutput,uint(0));
address to=i,path[i+1]);
// 从 input 和 output 中算出谁是 token0
(address token0,)=UniswapV2Library.sortTokens(input,output);
// 获得 input,output 的流动池
IUniswapV2Pair pair=IUniswapV2Pair(UniswapV2Library.pairFor(factory,input,output));
uint amountInput;
uint amountOutput;
{
// 获取流动池库存 reserve0,reserve1
(uint reserve0,uint reserve1,)=pair.getReserves();
// 如果 input==token0,那么 (reserveInput,reserveOutput) 就是 (reserve0,reserve1);反之则相反
(uint reserveInput,uint reserveOutput)=input==token0?(reserve0,reserve1):(reserve1,reserve0);
//amountInput 等于流动池余额减去 reserveInput