How To Hire Ethereum Developers (Ultimate Guide)
pragma solidity 0.4.18;
import "./Vehicle.sol";
contract VehicleOwner {
address public owner;
mapping(bytes32 => address) public vehicles;
event NewVehicleAdded(address indexed newVehicle, uint256 timestamp);
function VehicleOwner() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function createNewVehicle(string model, string make, bytes32 vin) public onlyOwner {
address newVehicle = new Vehicle(model, make, vin);
vehicles[vin] = newVehicle;
NewVehicleAdded(newVehicle, now);
}
}
So, let’s go line and by line and understand what is happening here. Code: pragma solidity 0.4.18; An...