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

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

分投趣fintoch系統(tǒng)開發(fā)(開發(fā)原理)丨fintoch分投趣系統(tǒng)開發(fā)(開發(fā)案例)

2023-03-10 09:59 作者:bili_33032327742  | 我要投稿

  智能合約是基于事件驅(qū)動(dòng)有狀態(tài),可部署共享的分布式數(shù)據(jù)庫上的計(jì)算機(jī)程序,多用IF-THEN語句。廣義來說,智能合約是一種可以實(shí)現(xiàn)自我執(zhí)行和自我驗(yàn)證的計(jì)算機(jī)協(xié)議。


  區(qū)塊鏈(Blockchain)是指通過去中心化和去信任的方式集體維護(hù)一個(gè)可靠數(shù)據(jù)庫的技術(shù)方案。該技術(shù)方案主要讓參與系統(tǒng)中的任意多個(gè)節(jié)點(diǎn),通過一串使用密碼學(xué)方法相關(guān)聯(lián)產(chǎn)生的數(shù)據(jù)塊(block),每個(gè)數(shù)據(jù)塊中包含了一定時(shí)間內(nèi)的系統(tǒng)全部信息交流數(shù)據(jù),并且生成數(shù)據(jù)指紋用于驗(yàn)證其信息的有效性和鏈接(chain)下一個(gè)數(shù)據(jù)庫塊。


  ///notice calculte exchange rate according to current stage


  ///return exchange rate.zero if not in sale.


  function exchangeRate()constant returns(uint256){


  if(stage()==Stage.Early){


  return venPerEthEarlyStage;


  }


  if(stage()==Stage.Normal){


  return venPerEth;


  }


  return 0;


  }


  ///notice for test purpose


  function blockTime()constant returns(uint32){


  return uint32(block.timestamp);


  }邏輯及需求分析I59詳細(xì)2OO7開發(fā)3O69


  ///notice estimate stage


  ///return current stage


  function stage()constant returns(Stage){


  if(finalized){


  return Stage.Finalized;


  }


  if(!initialized){


  //deployed but not initialized


  return Stage.Created;


  }


  if(blockTime()<startTime){


  //not started yet


  return Stage.Initialized;


  }


  if(uint256(soldOut.official).add(soldOut.channels)>=publicSupply){


  //all sold out


  return Stage.Closed;


  }


  if(blockTime()<endTime){


  //in sale


  if(blockTime()<startTime.add(earlyStageLasts)){


  //early bird stage


  return Stage.Early;


  }


  //normal stage


  return Stage.Normal;


  }


  //closed


  return Stage.Closed;


  }開發(fā)源碼及功能:yy625019


  function isContract(address _addr)constant internal returns(bool){


  uint size;


  if(_addr==0)return false;


  assembly{


  size:=extcodesize(_addr)


  }


  return size>0;


  }


  ///notice entry to buy tokens


  function()payable{


  buy();


  }


  ///notice entry to buy tokens


  function buy()payable{


  //reject contract buyer to avoid breaking interval limit


  require(!isContract(msg.sender));


  require(msg.value>=0.01 ether);


  uint256 rate=exchangeRate();


  //here don't need to check stage.rate is only valid when in sale


  require(rate>0);


  //each account is allowed once in minBuyInterval


  require(blockTime()>=ven.lastMintedTimestamp(msg.sender)+minBuyInterval);


  uint256 requested;


  //and limited to maxBuyEthAmount


  if(msg.value>maxBuyEthAmount){


  requested=maxBuyEthAmount.mul(rate);


  }else{


  requested=msg.value.mul(rate);


  }


  uint256 remained=officialLimit.sub(soldOut.official);


  if(requested>remained){


  //exceed remained


  requested=remained;


  }


  uint256 ethCost=requested.div(rate);


  if(requested>0){


  ven.mint(msg.sender,requested,true,blockTime());


  //transfer ETH to vault


  ethVault.transfer(ethCost);


  soldOut.official=requested.add(soldOut.official).toUINT120();


  onSold(msg.sender,requested,ethCost);


  }


  uint256 toReturn=msg.value.sub(ethCost);


  if(toReturn>0){


  //return over payed ETH


  msg.sender.transfer(toReturn);


  }


  }


  ///notice returns tokens sold officially


  function officialSold()constant returns(uint256){


  return soldOut.official;


  }


  ///notice returns tokens sold via channels


  function channelsSold()constant returns(uint256){


  return soldOut.channels;


  }


  ///notice manually offer tokens to channel


  function offerToChannel(address _channelAccount,uint256 _venAmount)onlyOwner{


  Stage stg=stage();


  //since the settlement may be delayed,so it's allowed in closed stage


  require(stg==Stage.Early||stg==Stage.Normal||stg==Stage.Closed);


  soldOut.channels=_venAmount.add(soldOut.channels).toUINT120();


  //should not exceed limit


  require(soldOut.channels<=channelsLimit);


  ven.mint(


  _channelAccount,


  _venAmount,


  true,//unsold tokens can be claimed by channels portion


  blockTime()


  );


  onSold(_channelAccount,_venAmount,0);


  }


  ///notice initialize to prepare for sale


  ///param _ven The address VEN token contract following ERC20 standard


  ///param _ethVault The place to store received ETH


  ///param _venVault The place to store non-publicly supplied VEN tokens


  function initialize(


  VEN _ven,


  address _ethVault,


  address _venVault)onlyOwner{


  require(stage()==Stage.Created);


  //ownership of token contract should already be this


  require(_ven.owner()==address(this));


  require(address(_ethVault)!=0);


  require(address(_venVault)!=0);


  ven=_ven;


  ethVault=_ethVault;


  venVault=_venVault;


  ven.mint(


  venVault,


  reservedForTeam.add(reservedForOperations),


  false,//team and operations reserved portion can't share unsold tokens


  blockTime()


  );


  ven.mint(


  venVault,


  privateSupply.add(commercialPlan),


  true,//private ICO and commercial plan can share unsold tokens


  blockTime()


  );


  initialized=true;


  onInitialized();


  }


  ///notice finalize


  function finalize()onlyOwner{


  //only after closed stage


  require(stage()==Stage.Closed);


  uint256 unsold=publicSupply.sub(soldOut.official).sub(soldOut.channels);


  if(unsold>0){


  //unsold VEN as bonus


  ven.offerBonus(unsold);


  }


  ven.seal();


  finalized=true;


  onFinalized();


  }


  event onInitialized();


  event onFinalized();


  event onSold(address indexed buyer,uint256 venAmount,uint256 ethCost);


  }


分投趣fintoch系統(tǒng)開發(fā)(開發(fā)原理)丨fintoch分投趣系統(tǒng)開發(fā)(開發(fā)案例)的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
永嘉县| 嘉义县| 加查县| 昌都县| 同德县| 阳曲县| 大宁县| 临漳县| 五台县| 西华县| 南召县| 尤溪县| 乐陵市| 汝南县| 封开县| 沁水县| 张家界市| 土默特右旗| 科技| 拜城县| 革吉县| 手游| 无为县| 时尚| 固始县| 镇宁| 边坝县| 炉霍县| 广州市| 新化县| 疏勒县| 青浦区| 大港区| 瑞金市| 赣州市| 沛县| 肇州县| 平山县| 灵武市| 井研县| 永福县|