Concert Tickets

UTILITYFINANCIAL

Contract purpose

This Smart Contract is used for keeping track of concert tickets sales. Using blockchain, the transactions are transparent to anyone and it is easier to combat the tickets reselling on black market.

Exposed methods and variables

manager the ethereum address of the contract manager

concerts returns the details of a concert when called with the id of the particular concert

addConcert allows the manager to add a concert to the list

parameter nametypedetails
_concertIDintegerthe id of the added concert
_concertDetailsstringthe details about the concert(location, singers etc)

defineTicketTypeForConcert this function allows the manager to create a type pf ticket for a particular concert so that people can start purchasing tickets

parameter nametypedetails
_concertIDintegerthe unique identifier of the concert
_typeIDintegerunique identifier for the ticket type which was added
_priceintegerthe price of a ticket of this type
_nrOfTicketsAvailableintegerthe number of tickets available for this type and price

buyTickets payable function that allows people to buy concert tickets of a particular type. The buyer has to send to the contract a double amount if he is buying two tickets (a person cannot buy more than 2 tickets). It emits the NewPurchase event

parameter nametypedetails
_concertIDintegerthe unique identifier of the concert
_typeIDintegerunique identifier for the ticket type which was added
_nrOfTicketsintegerthe number of tickets the buyer wants to purchase (1 or 2)

stopSelling allows the manager to end the purchasing period for a particular concert

parameter nametypedetails
_concertIDintegerthe unique identifier of the concert

getTicketTypeDetails returns the price and the number of tickets still available for a ticket type of a specific concert

parameter nametypedetails
_concertIDintegerthe unique identifier of the concert
_typeIDintegerunique identifier for the ticket type

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

NewPurchase

parameter nametypedetails
ConcertIDintegerthe id of the concert
TicketTypeintegerthe type of the ticket
BuyerAddressethereum addressthe address of the buyer
Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract