Movie Tickets

Contract purpose

This Smart Contract is used for keeping track of movie tickets sales. People can use this online service to purchase one or more tickets for the movies added by the website manager.

Exposed methods and variables

sysManager the ethereum address of the contract manager, given as parameter at contract creation

movieList returns the details of a movie when called with the id of that particular movie

addMovie allows the manager to add a new movie to the list

parameter nametypedetails
_movieIDintegerthe id of the added movie (unique)
_titlestringthe title of the new movie
_priceintegerthe price for a movie ticket (in wei)
_movieDateintegerthe date when the movie is projected (unix time)

makeBooking this payable function enables people to buy movie tickets and it emits the NewBooking event that contains the booking id by which the booking can be further identified inside the contract. The sum sent to the contract has to cover the price for the number of tickets that will be purchased.

parameter nametypedetails
_movieIDintegerthe unique identifier of the movie
_nrOfTicketsintegerthe number of tickets the person wants to buy

getBookingDetails returns the details of a previously made booking ( the customer address, movie ID, number of tickets bought, the booking date)

parameter nametypedetails
_bookingIDintegerthe unique identifier of the booking

increaseNrOfTickets allows the manager to increase the number of tickets available for a movie in case there were people who canceled their bookings

parameter nametypedetails
_movieIDintegerthe unique identifier of the movie
_valueintegerthe additional number of tickets

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



parameter nametypedetails
BookingIDintegerthe id of the new booking made
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract