量化合約機(jī)器人開發(fā)案例版丨量化合約機(jī)器人系統(tǒng)開發(fā)(詳細(xì)及邏輯)丨量化合約源碼成品
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;
}開發(fā)模式及源碼I35功能7O98設(shè)計(jì)O7I8
//給定資產(chǎn)的輸出量和對(duì)準(zhǔn)備金,返回其他資產(chǎn)所需的輸入量
//(x+a)(y-b)=xy
//a=bx/(y-b)
//考慮手續(xù)費(fèi):
//實(shí)際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);
//加一是防止數(shù)據(jù)溢出
amountIn=(numerator/denominator).add(1);
}開發(fā)需求:MrsFu123
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.