Shooting Range

FINANCIALUTILITYTOOLS

Exposed methods

addGun adds a gun to the shooting range

parameter nametypedetails
_guntypestringthe type of the gun
_gunnamestringthe model of the gun
_guncodestringserial number of the gun
rentedboolkeeps track if a gun is rented or not

disableGun disables a gun from the shooting range

parameter nametypedetails
_indexuintindex of the gun in the shooting range

rentGun the gun renting function, it enables the customer to pick a gun and how many bullets he desires to use, the customer will also be required to pay upfront

parameter nametypedetails
_guncodestringserial number of the gun
_bulletsuintnumber of the bullets choen by the customer

setPrices owner sets the price for the guns

parameter nametypedetails
_bulletspriceuintprice of one bullet
_assaultuintprice multiplier for an assault rifle
_shotgunuintprice multiplier for shotgun
_pistoluintprice multiplier for a pistol
_dmruintprice multiplier for a designated marksman rifle
_smguintprice for a submachine gun

withdraw allows the owner to get his earnings

withdrawGun function for the customer to return the gun

parameter nametypedetails
_guncodestringserial number of the gun

checkPrice calculates the price for a gun

parameter nametypedetails
_guntypestringthe type of the gun
_bulletsuintnumber of the bullets choen by the customer

getIndexForguncode returns the index of a gun

parameter nametypedetails
_guncodestringserial number of the gun

getGunInfo returns infomation regarding a gun

parameter nametypedetails
_indexuintindex of the gun

Events

gunAdd communicates that a gun was added. gunRemove communicates when a gun is removed gunRent communicates when a gun is rented gunWithdraw communicates when a gun is returned

Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract