Guest User

Untitled

a guest
May 27th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. // ---------- CARS ----------
  2.  
  3. uint public carID;
  4. mapping(uint => Vehicle) cars;
  5. uint[] public carListings;
  6.  
  7. function newCar(string _color, string _make, uint32 _year) public returns (uint ID) {
  8. carID ++;
  9. ID = carID;
  10.  
  11. Vehicle storage car = cars[carID];
  12. car.color = _color;
  13. car.make = _make;
  14. car.year = _year;
  15.  
  16. carListings.push(carID) -1;
  17. }
  18.  
  19.  
  20. // ---------- TRUCKS ----------
  21.  
  22. uint public truckID;
  23. mapping(uint => Vehicle) trucks;
  24. uint[] public truckListings;
  25.  
  26.  
  27. function newTruck(string _color, string _make, uint32 _year) public returns (uint ID) {
  28. truckID ++;
  29. ID = truckID;
  30.  
  31. Vehicle storage truck = trucks[truckID];
  32. truck.color = _color;
  33. truck.make = _make;
  34. truck.year = _year;
  35.  
  36. truckListings.push(truckID);
  37. }
Add Comment
Please, Sign In to add comment