国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(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)遵守國家法律
怀宁县| 昌都县| 房山区| 建平县| 丰镇市| 卫辉市| 冷水江市| 南投市| 弥渡县| 基隆市| 义乌市| 平潭县| 黄冈市| 凤城市| 泉州市| 盱眙县| 永安市| 合水县| 安国市| 黔西| 句容市| 金门县| 沙河市| 武功县| 陇南市| 太湖县| 府谷县| 绥宁县| 柘荣县| 体育| 库尔勒市| 扶风县| 惠州市| 奉贤区| 页游| 衡阳县| 武义县| 桓台县| 大城县| 绵阳市| 通榆县|