Video Game Renting

TOOLSFINANCIALUTILITYDOCUMENTS

Contract purpose

This smart contract manages the video games renting process for a website or store that provides this kind of service

Exposed methods and variables

manager address of the store manager

record returns the details about a specific video game based on its id

addVideoGame called by the manager when he wants to add a new video game to the list

parameter nametypedetails
_namestringvideo game name
_versionstringthe version of the game
_releaseDateintegerthe date when the video game was released (unix time)
_pPDayintegerthe amount the client needs to pay to rent the game for a day
_pPWeekintegerthe amount the client needs to pay to rent the game for a week

rentVideoGame payable function called by the client when he wants to rent a specific video game and emits GameRented event

parameter nametypedetails
idintegerunique identifier of the game

makeGameAvailable allows the manager to mark as available a previously booked game

parameter nametypedetails
idintegerunique identifier of the game
addrethereum addressthe address of the client

transferMoney allows the manager to transfer money from the contract's balance to his own account

parameter nametypedetails
amountintegerthe sum the manager wants to transfer

getBalance returns the balance of the contract when called by the manager

Events

GameRented

parameter nametypedetails
idintegerunique identifier of the rented game
clientethereum addressthe address of the client who booked the game
Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract