solidity学習ノート(二)構造体とマッピングデバッグ


pragma solidity ^0.4.16;
/**
 * The StructMapping contract does that         
  1.    mapping   python                 ,
          , address addr:int amount,          
          ,                 ,(    excel
         。。)
  2.     struct  str(member1,member2)       ,     ,  
  str.member1  。 mapping             。    ,  mapp[key]
    ,    mapp value。
  */
contract StructMapping {
    struct Funder {
        address addr;
        uint amount;  
    }
    mapping (uint => Funder) funders;
    uint FunderNum ;

    event ev(string _str,address _addr,uint _amount);     

    function newFunder(address _addr,uint _amount) public payable returns(uint){
        funders[FunderNum++] = Funder(_addr,_amount);
        ev("newFunder",_addr,_amount);
        return FunderNum;
    }

    function setFunder(uint _num,uint _amount)  public {
        funders[_num].amount = _amount;
        ev("newFunder",funders[_num].addr,funders[_num].amount);      
    }   
    function StructMapping () public{       
    }    
}
 /*  3.     :(1)   newfunder    view   ,  payable   , 
                   。(2)        returns        
     return       。


   4.  :                  ,             
            ?  :         Funder             
     number           。 */