a beginner contract developer here

    pragma solidity ^0.5.0;
contract waterBill{
    address admin;
    uint public rateperliter;
    struct Individual{
        string name;
        string addr;
        uint water;
        uint BillAmount;
    mapping (address=>Individual) individual;
    address[] Useraccts;
    constructor() public{
    modifier onlyAdmin(){
        require(msg.sender==admin,"Only Admin has access to this function");_;
     event NewUser(
         string _name,
         address _address,
         uint _waterconsumed
     event BillGenerated(
         address _address,
      uint billamount
    function setUser(string memory _name,address _address,uint _waterconsumed,string memory _Physicaladdress) public onlyAdmin()
        Individual memory User=individual[_address];
        Useraccts.push(_address) -1;
    emit NewUser(_name,_address,_waterconsumed);
     function setBill(address _address) public onlyAdmin() returns(uint){

    emit BillGenerated(_address,individual[_address].BillAmount);
       return individual[_address].BillAmount;
    function getBill(address _address) view public returns(uint){
        return individual[_address].BillAmount;
    function setRate(uint _rate) public onlyAdmin(){

while running this contract in remix IDE, im able to set a new user(setUser), im able to set the rate, but yet when i call setBill, the result is not updated when i call from get Bill

can anyone help me out?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.