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

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

Avatar阿凡達(dá)泰山眾籌商城開發(fā)說明丨Avatar阿凡達(dá)泰山眾籌商城系統(tǒng)開發(fā)(案例及詳細(xì))

2023-03-01 10:53 作者:bili_16249894763  | 我要投稿

  The"new retail"model has broken the respective closed state of online and offline.Online and offline can be integrated,complement each other and rely on each other.Online and offline more perform the functions of transaction and payment.Offline is usually used as a platform for screening and experience,while efficient logistics connects online and offline and forms a commercial closed loop with its interaction.


  interface IERC20{


  event Approval(address indexed owner,address indexed spender,uint value);


  event Transfer(address indexed from,address indexed to,uint value);


  function name()external view returns(string memory);


  function symbol()external view returns(string memory);


  function decimals()external view returns(uint8);


  function totalSupply()external view returns(uint);


  function balanceOf(address owner)external view returns(uint);


  function allowance(address owner,address spender)external view returns(uint);


  function approve(address spender,uint value)external returns(bool);


  function transfer(address to,uint value)external returns(bool);


  function transferFrom(address from,address to,uint value)external returns(bool);


  }開發(fā)流程I35源碼7O98設(shè)計(jì)O7I8?


  function addLiquidity(//添加流動(dòng)性,兩個(gè)代幣


  address tokenA,


  address tokenB,


  uint amountADesired,


  uint amountBDesired,


  uint amountAMin,


  uint amountBMin,


  address to,//lp接收人,新版的uniswap前端好像不支持設(shè)置這個(gè)了


  uint deadline//交易的成交時(shí)間,默認(rèn)是當(dāng)前時(shí)間+20分鐘后的時(shí)間的秒值


  )external virtual override ensure(deadline)returns(uint amountA,uint amountB,uint liquidity){


  //調(diào)用內(nèi)部方法_addLiquidity獲取到兩個(gè)幣實(shí)際所需要的數(shù)量


  (amountA,amountB)=_addLiquidity(tokenA,tokenB,amountADesired,amountBDesired,amountAMin,amountBMin);


  address pair=UniswapV2Library.pairFor(factory,tokenA,tokenB);//查找到pair地址


  TransferHelper.safeTransferFrom(tokenA,msg.sender,pair,amountA);//給pair轉(zhuǎn)A數(shù)量


  TransferHelper.safeTransferFrom(tokenB,msg.sender,pair,amountB);//給pair轉(zhuǎn)B數(shù)量


  liquidity=IUniswapV2Pair(pair).mint(to);//調(diào)用pair的mint方法,會(huì)有添加的lp數(shù)量返回


  }模式及案例:MrsFu123


  function addLiquidityETH(//添加流動(dòng)性,其中一個(gè)幣種是eth


  address token,


  uint amountTokenDesired,


  uint amountTokenMin,


  uint amountETHMin,//eth最小輸入量;對(duì)應(yīng)的Desired在msg.value


  address to,


  uint deadline


  )external virtual override payable ensure(deadline)returns(uint amountToken,uint amountETH,uint liquidity){


  //調(diào)用內(nèi)部方法_addLiquidity獲取到兩個(gè)幣實(shí)際所需要的數(shù)量


  //eth使用weth代幣替代


  (amountToken,amountETH)=_addLiquidity(


  token,


  WETH,


  amountTokenDesired,


  msg.value,//ethDesired


  amountTokenMin,


  amountETHMin


  );


  address pair=UniswapV2Library.pairFor(factory,token,WETH);//獲取到pair地址


  TransferHelper.safeTransferFrom(token,msg.sender,pair,amountToken);//給pair轉(zhuǎn)代幣數(shù)量


  IWETH(WETH).deposit{value:amountETH}();//調(diào)用weth的兌換方法,通過eth換weth


  assert(IWETH(WETH).transfer(pair,amountETH));//給pair轉(zhuǎn)weth數(shù)量


  liquidity=IUniswapV2Pair(pair).mint(to);//調(diào)用pair的mint方法,會(huì)有添加的lp數(shù)量返回


  //refund dust eth,if any


  //如果傳入的eth數(shù)量,大于實(shí)際所需的eth數(shù)量,將剩余的eth返還給用戶


  if(msg.value>amountETH)TransferHelper.safeTransferETH(msg.sender,msg.value-amountETH);


  }


Avatar阿凡達(dá)泰山眾籌商城開發(fā)說明丨Avatar阿凡達(dá)泰山眾籌商城系統(tǒng)開發(fā)(案例及詳細(xì))的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
土默特右旗| 周至县| 夏邑县| 固安县| 大宁县| 阿拉善左旗| 革吉县| 阿坝县| 随州市| 时尚| 石河子市| 黑龙江省| 沁水县| 南宫市| 伊宁市| 准格尔旗| 共和县| 托克托县| 平安县| 健康| 古丈县| 麻江县| 婺源县| 高邑县| 宣汉县| 安陆市| 郎溪县| 塔城市| 长阳| 玉屏| 陆良县| 临沧市| 佳木斯市| 张掖市| 丰都县| 正定县| 苍山县| 信丰县| 宣汉县| 犍为县| 和静县|