mirror of
https://github.com/0xShay/ticketchain.git
synced 2026-01-11 13:13:25 +00:00
Return new ticket's ID on creation
This commit is contained in:
@@ -102,7 +102,7 @@ contract EventManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO: ADD CURRENCY CONVERSION + CHECK
|
//TODO: ADD CURRENCY CONVERSION + CHECK
|
||||||
function buyTicket(uint256 _eventId) public payable {
|
function buyTicket(uint256 _eventId) public payable returns (uint256 _ticketId) {
|
||||||
require(_eventId < eventCounter, "Invalid event ID");
|
require(_eventId < eventCounter, "Invalid event ID");
|
||||||
require(events[_eventId].eventDate > block.timestamp, "Event has already passed");
|
require(events[_eventId].eventDate > block.timestamp, "Event has already passed");
|
||||||
require(events[_eventId].tickets.length < events[_eventId].capacity, "Event is full");
|
require(events[_eventId].tickets.length < events[_eventId].capacity, "Event is full");
|
||||||
@@ -122,6 +122,8 @@ contract EventManager {
|
|||||||
// Transfer FLR to event host
|
// Transfer FLR to event host
|
||||||
(bool sent, ) = events[_eventId].eventHost.call{value: msg.value}("");
|
(bool sent, ) = events[_eventId].eventHost.call{value: msg.value}("");
|
||||||
require(sent, "Failed to send FLR to event host");
|
require(sent, "Failed to send FLR to event host");
|
||||||
|
|
||||||
|
return ticketCounter - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function transferTicketForce(uint256 _ticketId, address _to) private {
|
function transferTicketForce(uint256 _ticketId, address _to) private {
|
||||||
|
|||||||
Reference in New Issue
Block a user