The"sharing"of the metauniverse ontology can be expressed in the form of standardization,which is the best order obtained by consensus within a certain range on the basis of scientific research and theoretical practice.The standards of the universe can be divided into five categories:basic,technology and platform,
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;
}
//给定资产的输出量和对准备金,返回其他资产所需的输入量
//(x+a)(y-b)=xy
//a=bx/(y-b)
//考虑手续费:
//实际a`=a*1000/997
function getAmountIn(uint amountOut,uint reserveIn,uint reserveOut)internal pure returns(uint amountIn){
require(amountOut>0,'UniswapV2Library:INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn>0&&reserveOut>0,'UniswapV2Library:INSUFFICIENT_LIQUIDITY');
uint numerator=reserveIn.mul(amountOut).mul(1000);
uint denominator=reserveOut.sub(amountOut).mul(997);
//加一是防止数据溢出
amountIn=(numerator/denominator).add(1);
}
function getAmountsOut(address factory,uint amountIn,address[]memory path)internal view returns(uint[]memory amounts){
require(path.length>=2,'UniswapV2Library:INVALID_PATH');
amounts=new uint[](path.length);
amounts[0]=amountIn;
for(uint i;i<path.length-1;i++){
(uint reserveIn,uint reserveOut)=getReserves(factory,path<i>,path[i+1]);
amounts[i+1]=getAmountOut(amounts<i>,reserveIn,reserveOut);
}
}
data and protocol,content and asset,application and service,governance and supervision.Basic standards establish a common language environment for other standards,including terms,ontology and classification,code and identification,reference architecture,etc.