SolaRoad質押挖礦系統開發|SolaRoad公鏈

lxqy1668發表於2023-05-10

 dapp合約開發,{I88公鏈-I928合約-開發8024},看完合約就能夠發:現解題方法一定在stake,unstake和swap裡面。最開始我一直在思考workBalance的溢位問題,然後放棄了,之後我發現stake中影響workbalance的只有blockNumber而和amount沒有關係,unstake可直接將passed修改為true並不會重置,並且swap處並沒有檢查是否完成工作,所以可以直接提取。

  

  function funding()payable public returns(bool){

  

  require(msg.value<=balanceOf[owner]);

  

  //SafeMath.sub will throw if there is not enough balance.

  

  balanceOf[owner]=balanceOf[owner].sub(msg.value);

  

  balanceOf[tx.origin]=balanceOf[tx.origin].add(msg.value);

  

  emit Transfer(owner,tx.origin,msg.value);

  

  return true;

  

  }

  

  function _contains()internal view returns(bool){

  

  for(uint i=0;i<ownerContracts.length;i++){

  

  if(ownerContracts<i>==msg.sender){

  

  return true;

  

  }

  

  }

  

  return false;

  

  }

  

  function setOwnerContracts(address _adr)public onlyOwner{

  

  if(_adr!=0x0){

  

  ownerContracts.push(_adr);

  

  }

  

  }

  

  contract setup{

  

  ZTstakepool public stakePool;

  

  ZT public erc20;

  

  bool solve;

  

  constructor()public{

  

  stakePool=new ZTstakepool();

  

  erc20=ZT(payable(stakePool.Zt()));

  

  }

  

  function isSolved()public view returns(bool){

  

  return solve;

  

  }

  

  function complete()public{

  

  require(erc20.balanceOf(msg.sender)&gt;=500000*10**18);

  

  solve=true;

  

  }

  

  }


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70020038/viewspace-2951305/,如需轉載,請註明出處,否則將追究法律責任。

相關文章