TransWikia.com

Can't deploy on https://wallet.ethereum.org: DAO

Ethereum Asked by Anatoly on December 16, 2021

I’m writing Decentralised Application.
I’ve added function vote() an function changeName().
After that my code can’t compile on wallet.ethereum.org.
Though remix.ethereum.org shows no mistakes.

pragma solidity ^0.4.19;

contract SimpleDAO {

  string public name;   
  string public symbol;  
  uint8 public decimals;

  uint256 public totalSupply; 

   mapping (address => uint256) public balanceOf; 

   mapping (address => mapping (address => uint256)) public allowance;  

    uint8 public minVotes = 6;
   string public proposalName;
   bool public voteActive = false;
  struct Votes{
     uint256 current;
     uint numberOfVotes;
   }
   Votes public election;

   event Transfer(address from, address to, uint256 value);

   event Approve(address from, address to, uint256 value);

    function SimpleDao() public { 

     decimals = 0;

    totalSupply = 1000000 * (10 ** uint256(decimals));
    balanceOf[msg.sender] = totalSupply;

    name = "SimpleDAO";

    symbol = "tDAO"; 
  }

 function  _transfer (address _from, address _to, uint256 _value) internal{
  require (_to != 0x0);
 require(balanceOf[_from] >= _value);
 require(balanceOf[_to] + _value >= balanceOf[_to]);
 balanceOf[_from] -= _value;
 balanceOf[_to] += _value;
  Transfer(_from,_to,_value);
}
 function transfer(address _to, uint256 _value) public {
   _transfer(msg.sender, _to, _value);
 }

   function transferFrom (address _from, address _to, uint256 _value) public { 

  require(_value <= allowance[_from][_to]);  
   allowance[_from][_to] -= _value;  

  _transfer(_from, _to, _value);
}
   function approve(address _to, uint256 _value) public{

   allowance[msg.sender][_to] = _value; 

   Approve(msg.sender, _to, _value);
 }  

  function newName (string _proposalName)  public{
     require(!voteActive);
     proposalName = _proposalName;
     voteActive = true;
  }
  function vote(bool _vote) public {
       require(voteActive);
       if (_vote) {
         election.current += uint256(balanceOf[msg.sender]);            
         }
       else {
         election.current      -= uint256(balanceOf[msg.sender]);
        } 
         election.numberOfVotes += uint256(balanceOf[msg.sender]);  
      }
   function changeName() public{
     require(voteActive);
    require(election.numberOfVotes >= minVotes);
     if (election.current > 0) {
         name = proposalName;  
      }    
       election.numberOfVotes = 0; 
       election.current = 0;
       voteActive = false;
  }
}

One Answer

The answer is that it should be deployed in mist, not on wallet.ethereum.org

Answered by Anatoly on December 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP