diff --git a/components/sc/buyTicket.tsx b/components/sc/buyTicket.tsx index 877c743..01dfa40 100644 --- a/components/sc/buyTicket.tsx +++ b/components/sc/buyTicket.tsx @@ -38,9 +38,11 @@ const BuyTicket = () => { // Handle buying a ticket for the event const handleBuyTicket = async () => { - if (!eventId) { - alert('Please enter a valid Event ID.'); - return; + if (eventId !== null) { + if (eventId < 0) { + alert('Please enter a valid Event ID.'); + return; + } } try { diff --git a/contracts/EventManager.sol b/contracts/EventManager.sol index d59c3f7..1485b9a 100644 --- a/contracts/EventManager.sol +++ b/contracts/EventManager.sol @@ -129,6 +129,7 @@ contract EventManager { ticketCounter++; // Update number of tickets sold + events[_eventId].tickets.push(ticketCounter - 1); events[_eventId].ticketsSold++; // Transfer FLR to event host diff --git a/lib/ethers.ts b/lib/ethers.ts index 3c4c788..5f5c093 100644 --- a/lib/ethers.ts +++ b/lib/ethers.ts @@ -2,7 +2,7 @@ import { ethers } from 'ethers'; const FLARE_TESTNET_RPC_URL = 'https://coston2.enosys.global/ext/C/rpc'; -const CONTRACT_ADDRESS = '0xA4E90EF8f5846C568515e9120635edb1f2776842'; +const CONTRACT_ADDRESS = '0xA171873976afaf4b1442c959C2e03b7d52656340'; export function getFlareProvider() { const flareRpcUrl = FLARE_TESTNET_RPC_URL;