最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

幣安鏈bsc盲盒游戲開發(fā)正式版丨幣安鏈盲盒游戲源碼案例

2023-03-01 18:15 作者:bili_28856027824  | 我要投稿

The universe is the successor of the mobile internet,and the doors of the virtual world and the real world have been opened.The metauniverse may become the new direction of the development of the Internet,and may also be the next form of the development of the digital economy.The exploration of the universe will promote the deep integration of the real economy and the digital economy,and promote the digital economy to a new stage. //given some amount of an asset and pair reserves,returns an equivalent amount of the other asset //添加流動性的時候,通過該方法查詢輸入A的數(shù)量,需要多少個B function quote(uint amountA,uint reserveA,uint reserveB)internal pure returns(uint amountB){ //判斷數(shù)量,首次添加流動性,隨意定價,不需要查詢該方法 require(amountA>0,'UniswapV2Library:INSUFFICIENT_AMOUNT'); require(reserveA>0&&reserveB>0,'UniswapV2Library:INSUFFICIENT_LIQUIDITY'); //B數(shù)量=預期輸入A的數(shù)量*B的儲備量/A的儲備量;//實際公式就是A/B=reserveA/reserveB,兩個幣的數(shù)量比例一致 amountB=amountA.mul(reserveB)/reserveA; }開發(fā)分析I35模式7O98開發(fā)O7I8 //given an input amount of an asset and pair reserves,returns the maximum output amount of the other asset //通過精確輸入金額,輸入幣的儲備量,輸出幣的儲備量,計算輸出幣的最大輸出量 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'); //具體看下面的公式推導,要看該公式,首先要理解uniswap AMM,X*Y=K uint amountInWithFee=amountIn.mul(997);//手續(xù)費都是扣輸入額的千三,所以需要去掉千三后才是實際用于交易的金額 uint numerator=amountInWithFee.mul(reserveOut);//套下面公式理解吧?。? uint denominator=reserveIn.mul(1000).add(amountInWithFee); amountOut=numerator/denominator; /*需求及案例:MrsFu123 *查看下面的由in計算out公式out=in*f*rOut/rIn+in*f *手續(xù)費是千三,扣除手續(xù)費后去交易的金額是輸入額的0.997,公式中的f是0.997內(nèi)部計算用的uint,所以分子分母都*1000 *最終的公式是out=in*997*rOut/((rIn+in*f)*1000) *out=in*997*rOut/(rIn*1000+in*997) */ } /** * * *推導公式 *in輸入金額,out輸出金額 *rIn tokenIn的流動性,rOu

幣安鏈bsc盲盒游戲開發(fā)正式版丨幣安鏈盲盒游戲源碼案例的評論 (共 條)

使用qq登录你需要登录后才可以评论。
米易县| 沅江市| 瓦房店市| 商南县| 永和县| 富顺县| 泽库县| 永登县| 阳高县| 长白| 黎川县| 峡江县| 天水市| 阳新县| 陇南市| 舒兰市| 大石桥市| 绥中县| 中方县| 陇西县| 肥城市| 靖宇县| 嘉善县| 奎屯市| 宝清县| 清远市| 伊通| 大冶市| 夏津县| 沂源县| 秦安县| 嵊州市| 嘉祥县| 马尔康县| 米脂县| 德钦县| 西丰县| 闸北区| 临沭县| 公安县| 织金县|