Theater Tickets

Under Review

TOOLSUTILITYDOCUMENTSFINANCIAL

Contract purpose

This Smart Contract is used for keeping track of theater tickets sales. People can use this online service to purchase one or more tickets a performance of a theater play added to the list by the site manager. Also, for each play there are different types of tickets depending on where the seat is located.

Exposed methods and variables

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

plays returns the details of a theater play when called with the id of that particular play

performances returns the details of a performance when called with the performance ID

ticketTypes returns the ticket type details when called with the ticket type ID

addPlay allows the manager to add a new play to the list. It emits the NewPlay event

parameter nametypedetails
_playIDintegerthe id of the added theater play (unique)
_playDetailsstringa description of the play

createTicketType this function allows tha manager to create a ticket type that can be assign to multiple performances

parameter nametypedetails
_typeIDintegerthe unique identifier of ticket type
_priceintegerthe price of this ticket type

addPerformance the manager can add a performance for a particular play an emits the PerformanceForPlay event

parameter nametypedetails
_playIDintegerthe id of the play for which the performance is created
_datestringthe date when the performance will take place
_timestringthe time of the performance

assignTicketTypeToPerformance allows the manager assign a ticket type for an existing performance, along with the number of tickets from that type available for sale. It emits the TicketsForPerformance event and the selling can start

parameter nametypedetails
_performanceIDintegerthe unique identifier of the performance
_typeIDintegerthe unique ticket type
_nrOfTicketsintegerthe number of available tickets

buyTickets using this payable function, people can buy tickets for any performance listed and it emits the NewPurchase event

parameter nametypedetails
_performanceIDintegerthe unique id of the performance for which the tickets will be bought
_typeIDintegerthe type of the tickets
_nrOfTicketsintegerhow many tickets the buyer will take

stopSelling the manager can stop the sale of tickets for a certain performance

parameter nametypedetails
_performanceIDintegerthe id of the performance

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

NewPlay

parameter nametypedetails
PlayIDintegerthe id of the added theater play (unique)

PerformanceForPlay

parameter nametypedetails
PerformanceIDintegerthe id of the performance

ticketsForPerformance

parameter nametypedetails
PerformanceIDintegerthe id of the performance
TicketTypeintegerthe id of the ticket type

NewPurchase

parameter nametypedetails
PerformanceIDintegerthe id of the performance
TicketTypeintegerthe id of the ticket type
BuyerAddressethereum addressthe address of the buyer
Reviewed by Modex
Buy
Buy Contract

Create an account or login to purchase this smart contract