My plan is to develop a sample agreement contract between customer and car provider. workflow is as below...

  1. Customer will register to carRentalServiceProvider contract.
  2. after registration, only registered customer can rent a car using RentingCar contract. (not working both registered and non registered customer is renting car) actually i am facing a problem to deploy this contract. I guess problem is with below function with isActive() function
    function rentingCarFromCarPool (address _customerAddress){

    if(isActive() && NumberOfAvailableCarInPool > 0){
        carRentingFromPool[_customerAddress] = CarRentingStatus({
                                                    carRentActive: true, 
                                                    lastUpdate: now,
                                                    carModel: "ToyotaCorolla X 2015"
    } else {


IsActive function:

function isActive()  returns (bool) {
    if(rentCar[msg.sender].active == true){
    return true;
    } else {
    return false;

enter image description here

enter image description here

  1. car service provider can set rent and registration fee for customer with CarRentalServiceProvider contract.>>>> (works fine)

  2. customer can pay the bill using CarRentalServiceCustomer contract. Problem is after paying the rent and registration fee both should be zero. But it is not becoming 0 after showing successful payment. But from my contract account showing the same amount of money.

enter image description here

here is my complete code https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.9+commit.364da425.js

Kindly help me to develop this project as per plan and error free. Thanks a lot in advance.

Note: after solving this problem i will add some other functionalities.


These issues can probably be set aside for testing purposes:

  1. GeneralAccount is missing
  2. onlyOwner is missing (#1)

Multiple functions using _providerAddress appear to be confused with regard to who sends the transaction and what it does. Is the _providerAddress the renter? Are these functions intended to be used by the office staff or the public? I note that some of then are for paying fees, so possibly by the public, but they are not sending fees; so intent is confusing.

Might be possible to organize this and demonstrate by example but I find it challenging to understand intent from only the code as it is. Please clarify how the contract is intended to operate:

  1. Office defines a fleet of cars. They have fixed fees, or vary by rental agreement?
  2. User registers self, or office registers user?
  3. User selects car and rents for self, or office selects car and rents to user?
  4. User pays fee to office and office applies to registration, or user pays to registration.
  5. User pays rent to office and office applies to rent, or user pays rent to agreement?
  6. Each car has a specific rental fee, or rental fee set by office for each rental agreement?

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.