Merge branch 'main' of https://github.com/Ayush272002/ticketchain into aesthetic-glitch-fixes

This commit is contained in:
Adwit Mukherji
2024-10-27 02:47:43 +00:00
13 changed files with 935 additions and 557 deletions

View File

@@ -4,6 +4,6 @@
"@next/next/no-img-element": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-unused-vars":"off"
"@typescript-eslint/no-unused-vars": "off"
}
}

122
app/host/page.tsx Normal file
View File

@@ -0,0 +1,122 @@
'use client';
import EventForm from '@/components/custom/EventForm';
import FeaturedEvent from '@/components/custom/FeaturedEvent';
import Footer from '@/components/custom/footer';
import Header from '@/components/custom/header';
import { Button } from '@/components/ui/button';
import { FlipWords } from '@/components/ui/flip-words';
import { useRouter } from 'next/navigation';
import React, { useEffect, useRef, useState } from 'react';
import { motion } from 'framer-motion';
import { EventFormData } from '@/components/custom/EventForm';
import { createEvent } from '@/lib/createEvent';
const Page = () => {
const router = useRouter();
const [isClient, setIsClient] = useState(false);
const inputRef = useRef<HTMLInputElement>(null);
useEffect(() => {
setIsClient(true);
}, []);
function searchForEvents() {
if (inputRef.current && inputRef.current.value === '') return;
if (inputRef.current)
router.replace('/events?q=' + encodeURIComponent(inputRef.current.value));
}
function handleSubmit(data: {
name: string;
description: string;
capacity: number;
ticketPrice: number;
location: string;
eventStartTime: Date;
eventEndTime?: Date | undefined;
images?: string[] | undefined;
}) {
createEvent({
name: data.name,
description: data.description,
location: data.location,
capacity: data.capacity,
ticketPrice: data.ticketPrice,
startDate: data.eventStartTime,
endDate: data.eventEndTime || new Date(),
images: data.images || [],
toast: ({ title, variant }) => {
alert(title);
},
});
router.push('/events');
}
const words = [
'adventure',
'concert',
'outing',
'journey',
'hackathon',
'conference',
];
return (
<>
<Header />
<div className="relative min-h-screen overflow-hidden">
{/* Video Background */}
{isClient && (
<video
autoPlay
loop
muted
className="absolute inset-0 w-full h-full object-cover z-0"
src="BGVid2.mp4"
>
Your browser does not support the video tag.
</video>
)}
{/* Dark Overlay for Enhanced Readability */}
<div className="absolute inset-0 bg-black opacity-50 z-10"></div>
{/* Page Content Over the Video */}
<div className="relative z-20 min-h-screen bg-gradient-to-b from-transparent to-gray-900 pt-20">
<div className="container mx-auto p-4 flex justify-center items-center min-h-screen">
<motion.div
className="w-full max-w-3xl p-8 bg-black bg-opacity-40 rounded-xl shadow-lg"
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
transition={{ duration: 0.5, ease: 'easeOut' }}
whileHover={{ scale: 1.02 }}
>
<div className="text-6xl font-bold text-white text-center text-shadow-lg flex justify-center items-center flex-col">
<motion.h1
className="mb-8 text-transparent bg-clip-text bg-gradient-to-r from-purple-400 via-pink-500 to-red-500"
initial={{ opacity: 0, y: -20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5, delay: 0.2 }}
>
Create your event here!
</motion.h1>
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5, delay: 0.4 }}
>
<EventForm onSubmit={handleSubmit} />
</motion.div>
</div>
</motion.div>
</div>
<Footer />
</div>
</div>
</>
);
};
export default Page;

View File

@@ -16,3 +16,10 @@ const EventPage = () => {
};
export default EventPage;
// profile page
// EventForm to Register Events
// on submit form
// fix ui to match ticketchain initial ui
//

123
components/ProfilePage.tsx Normal file
View File

@@ -0,0 +1,123 @@
import { useRouter } from 'next/router';
// import { Input } from 'postcss'; // Removed incorrect import
import React, { useEffect, useRef, useState } from 'react';
import FeaturedEvent from './custom/FeaturedEvent';
import Footer from './custom/footer';
import Header from './custom/header';
import { Button } from './ui/button';
import { FlipWords } from './ui/flip-words';
const ProfilePage = () => {
const router = useRouter();
const [isClient, setIsClient] = useState(false);
const inputRef: any = useRef(null);
useEffect(() => {
setIsClient(true);
}, []);
function searchForEvents() {
if (inputRef.current.value == '') return;
router.replace('/events?q=' + encodeURIComponent(inputRef.current.value));
}
const words = [
'adventure',
'concert',
'outing',
'journey',
'hackathon',
'conference',
];
return (
<>
<Header />
<div className="relative min-h-screen overflow-hidden">
{/* Video Background */}
{isClient && (
<video
autoPlay
loop
muted
className="absolute inset-0 w-full h-full object-cover z-0"
src="BGVid2.mp4"
>
Your browser does not support the video tag.
</video>
)}
{/* Dark Overlay for Enhanced Readability */}
<div className="absolute inset-0 bg-black opacity-50 z-10"></div>
{/* Page Content Over the Video */}
<div className="relative z-20 min-h-screen bg-gradient-to-b from-transparent to-gray-900 pt-20">
<div className="container mx-auto p-4">
<div className="container mx-auto justify-center items-center p-4">
<div className="text-6xl font-bold text-white text-center text-shadow-lg">
Book your next
<FlipWords
words={words}
className="text-pink-500 text-opacity-75 pl-3.5"
/>
on the Flare blockchain.
</div>
</div>
<div className="flex items-center justify-center mt-6 flex-col gap-4">
<input
type="text"
placeholder="Search for your next experience..."
className="flex w-full rounded-md border border-input bg-white bg-opacity-50 placeholder:text-black px-4 py-6 text-lg shadow-sm"
ref={inputRef}
/>
<Button
className="bg-pink-600 bg-opacity-50 text-white px-4 py-6 text-lg w-full hover:bg-pink-500"
onClick={searchForEvents}
>
Search for events
</Button>
</div>
<main>
<section className="mb-8 mt-4 mx-auto grid grid-cols-4 gap-4">
<FeaturedEvent
name="FAB XO Halloween"
description="Halloween is upon us and is one of the biggest nights of the FAB XO calendar. Fancy dress is encouraged! So have your fancy dress ready and we look forward to seeing who have the best fancy dress on the night! As a special treat we will be serving our very own witches brew!!!"
location="Birmingham, UK"
eventStartDate={1729980000}
eventHost="0x225C73C8c536C4F5335a2C1abECa95b0f221eeF6"
imageURL={
'https://www.guildofstudents.com/asset/Event/7572/Halloween-Fab-XO-Web-Event.jpg'
}
/>
<FeaturedEvent
name="Halls Halloween Spooktacular"
description="Put on your spookiest costume and head on down to Pritchatts Park and join your Event Activators for our ResLife SPOOKTACULAR on Wednesday 30th October 5-8pm."
location="Birmingham, UK"
eventStartDate={1730307600}
eventHost="0x225C73C8c536C4F5335a2C1abECa95b0f221eeF6"
imageURL={
'https://www.guildofstudents.com/asset/Event/41187/Spooktacular-Web-Event-2024.png'
}
/>
<FeaturedEvent
name="Housing Fair"
description="Were hosting a Housing Fair, so make sure you save the date! Whether youre living in student accommodation or the local community, this will be a great place to start as you begin thinking about where youll be living next year."
location="Birmingham, UK"
eventStartDate={1730804400}
eventHost="0x225C73C8c536C4F5335a2C1abECa95b0f221eeF6"
imageURL={
'https://www.guildofstudents.com/asset/Event/41111/Housing-Fair-Web-Event.png'
}
/>
</section>
</main>
<Footer />
</div>
</div>
</div>
</>
);
};
export default ProfilePage;

View File

@@ -1,4 +1,4 @@
import React from 'react';
import React, { useState } from 'react';
import {
Card,
CardHeader,
@@ -13,7 +13,7 @@ import { buyHandler } from '@/lib/buyHandler';
import { useToast } from '@/hooks/use-toast';
import NumberPicker from './TicketButton';
interface EventDescriptionProps {
export interface EventDescriptionProps {
eventDetails: {
EventID: number;
name: string;
@@ -32,8 +32,10 @@ const EventDescription: React.FC<EventDescriptionProps> = ({
eventDetails,
}) => {
const { toast } = useToast();
const [numTickets, setNumTickets] = useState(1);
const handleBuyNow = () => {
buyHandler(eventDetails.EventID, toast);
buyHandler(eventDetails.EventID, numTickets, toast);
};
return (
@@ -79,7 +81,10 @@ const EventDescription: React.FC<EventDescriptionProps> = ({
</Button>
<div className="relative md:left-5">
<NumberPicker
initialCount={numTickets}
min={1}
max={eventDetails.capacity - eventDetails.ticketsSold}
onChange={setNumTickets}
/>
</div>
</CardFooter>

View File

@@ -58,7 +58,7 @@ const eventSchema = z
});
// Define the TypeScript type based on the Zod schema
type EventFormData = z.infer<typeof eventSchema>;
export type EventFormData = z.infer<typeof eventSchema>;
interface EventFormProps {
onSubmit: (data: EventFormData) => void;

View File

@@ -1,6 +1,5 @@
'use client';
import React, { useState } from 'react';
import { Button } from '../ui/button'; // Adjust import path to where your shadcn Button component is located
import React from 'react';
import { Button } from '../ui/button';
interface NumberPickerProps {
initialCount?: number;
@@ -15,25 +14,23 @@ const NumberPicker: React.FC<NumberPickerProps> = ({
max = 10,
onChange,
}) => {
const [count, setCount] = useState<number>(initialCount);
const [count, setCount] = React.useState(initialCount);
React.useEffect(() => {
if (onChange) {
onChange(count);
}
}, [count, onChange]);
const increment = () => {
if (count < max) {
const newCount = count + 1;
setCount(newCount);
if (onChange) {
onChange(newCount);
}
setCount(count + 1);
}
};
const decrement = () => {
if (count > min) {
const newCount = count - 1;
setCount(newCount);
if (onChange) {
onChange(newCount);
}
setCount(count - 1);
}
};

View File

@@ -65,6 +65,16 @@ const Header = () => {
</a>
</Link>
</li>
<li>
<Link href="/host" legacyBehavior>
<a
className="text-white hover:text-light-purple hover:text-opacity-75 transition-colors duration-300"
style={{ textShadow: '1px 1px 2px rgba(0, 0, 0, 0.5)' }}
>
Host Event
</a>
</Link>
</li>
<li>
<Link href="/contact" legacyBehavior>
<a

View File

@@ -0,0 +1,504 @@
[
{
"inputs": [
{
"internalType": "uint256",
"name": "_ticketId",
"type": "uint256"
},
{
"internalType": "address",
"name": "_to",
"type": "address"
},
{
"internalType": "bool",
"name": "_allowed",
"type": "bool"
}
],
"name": "approveTicket",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_eventId",
"type": "uint256"
}
],
"name": "buyTicket",
"outputs": [
{
"internalType": "uint256",
"name": "_ticketId",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "_name",
"type": "string"
},
{
"internalType": "string",
"name": "_description",
"type": "string"
},
{
"internalType": "uint256",
"name": "_capacity",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_ticketPrice",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_eventDate",
"type": "uint256"
},
{
"internalType": "string[]",
"name": "_images",
"type": "string[]"
}
],
"name": "createEvent",
"outputs": [
{
"internalType": "uint256",
"name": "_eventId",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "eventId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "name",
"type": "string"
},
{
"indexed": false,
"internalType": "uint256",
"name": "eventDate",
"type": "uint256"
}
],
"name": "EventCreated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "ticketId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "eventId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "buyer",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "price",
"type": "uint256"
}
],
"name": "TicketPurchased",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "ticketId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "trustee",
"type": "address"
}
],
"name": "TicketTransferApproved",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "ticketId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "to",
"type": "address"
}
],
"name": "TicketTransferred",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_ticketId",
"type": "uint256"
},
{
"internalType": "address",
"name": "_to",
"type": "address"
}
],
"name": "transferTicket",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_ticketId",
"type": "uint256"
},
{
"internalType": "address",
"name": "_to",
"type": "address"
}
],
"name": "transferTicketFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_cents",
"type": "uint256"
}
],
"name": "centsToFlare",
"outputs": [
{
"internalType": "uint256",
"name": "_flr",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "eventCounter",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "events",
"outputs": [
{
"internalType": "string",
"name": "name",
"type": "string"
},
{
"internalType": "string",
"name": "description",
"type": "string"
},
{
"internalType": "uint256",
"name": "capacity",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "ticketsSold",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "ticketPrice",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "eventDate",
"type": "uint256"
},
{
"internalType": "address payable",
"name": "eventHost",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "feedIds",
"outputs": [
{
"internalType": "bytes21",
"name": "",
"type": "bytes21"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_eventId",
"type": "uint256"
}
],
"name": "getEventImages",
"outputs": [
{
"internalType": "string[]",
"name": "",
"type": "string[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_eventId",
"type": "uint256"
}
],
"name": "getEventPriceFlare",
"outputs": [
{
"internalType": "uint256",
"name": "_flr",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_eventId",
"type": "uint256"
}
],
"name": "getEventTickets",
"outputs": [
{
"internalType": "uint256[]",
"name": "",
"type": "uint256[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getFlareFeed",
"outputs": [
{
"internalType": "uint256",
"name": "_feedValue",
"type": "uint256"
},
{
"internalType": "int8",
"name": "_decimals",
"type": "int8"
},
{
"internalType": "uint64",
"name": "_timestamp",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getFtsoV2CurrentFeedValues",
"outputs": [
{
"internalType": "uint256[]",
"name": "_feedValues",
"type": "uint256[]"
},
{
"internalType": "int8[]",
"name": "_decimals",
"type": "int8[]"
},
{
"internalType": "uint64",
"name": "_timestamp",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "ticketCounter",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "tickets",
"outputs": [
{
"internalType": "address",
"name": "holder",
"type": "address"
},
{
"internalType": "uint256",
"name": "boughtTime",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "eventId",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "userTickets",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
]

View File

@@ -17,6 +17,7 @@ type ToastFunction = (options: {
export const buyHandler = async (
eventId: number,
numTickets: number,
toast: ToastFunction
): Promise<void> => {
if (eventId < 0) {
@@ -24,42 +25,62 @@ export const buyHandler = async (
return;
}
try {
if (typeof window.ethereum === 'undefined') {
toast({
title: 'Please install MetaMask or another Ethereum wallet',
variant: 'destructive',
});
return;
}
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const contract = getContract().connect(signer);
let ticketCost = await contract.getEventPriceFlare(eventId);
ticketCost = ticketCost.mul(105).div(100);
const balance = await provider.getBalance(await signer.getAddress());
if (balance.lt(ticketCost)) {
toast({
title: 'Insufficient balance to cover ticket cost and gas fees.',
variant: 'destructive',
});
return;
}
const tx = await contract.buyTicket(eventId, { value: ticketCost });
const receipt = await tx.wait();
if (numTickets <= 0) {
toast({
title: `Ticket purchased successfully! Transaction Hash: ${receipt.transactionHash}`,
});
} catch (error) {
console.error('Error buying ticket:', error);
toast({
title: 'Transaction failed. Please try again.',
title: 'Please select at least one ticket.',
variant: 'destructive',
});
return;
}
toast({
title:
'You might be asked to approve multiple transactions if you buy multiple tickets',
});
while (numTickets > 0) {
try {
if (typeof window.ethereum === 'undefined') {
toast({
title: 'Please install MetaMask or another Ethereum wallet',
variant: 'destructive',
});
return;
}
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const contract = getContract().connect(signer);
const singleTicketCost = await contract.getEventPriceFlare(eventId);
const totalTicketCost = singleTicketCost
.mul(numTickets)
.mul(105)
.div(100);
const balance = await provider.getBalance(await signer.getAddress());
if (balance.lt(totalTicketCost)) {
toast({
title: 'Insufficient balance to cover ticket cost and gas fees.',
variant: 'destructive',
});
return;
}
const tx = await contract.buyTicket(eventId, { value: totalTicketCost });
const receipt = await tx.wait();
toast({
title: `Tickets purchased successfully! Transaction Hash: ${receipt.transactionHash}`,
});
numTickets -= 1;
} catch (error) {
console.error('Error buying tickets:', error);
toast({
title: 'Transaction failed. Please try again.',
variant: 'destructive',
});
}
}
};

91
lib/createEvent.ts Normal file
View File

@@ -0,0 +1,91 @@
import { ethers } from 'ethers';
import { getContract } from './ethers';
interface CreateEventProps {
name: string;
description: string;
location: string;
capacity: number;
ticketPrice: number;
startDate: Date;
endDate: Date;
images: string[];
toast: ToastFunction;
}
type ToastFunction = (options: {
title: string;
variant?: 'default' | 'destructive' | null | undefined;
}) => void;
declare global {
interface Window {
ethereumProvider?: ethers.providers.ExternalProvider & {
isMetaMask?: boolean;
request?: (method: string, params?: unknown[]) => Promise<unknown>;
};
}
}
export const createEvent = async ({
name,
description,
location,
capacity,
ticketPrice,
startDate,
endDate,
images,
toast,
}: CreateEventProps) => {
try {
console.log('Starting createEvent function');
if (typeof window.ethereum === 'undefined') {
console.error('Ethereum provider not found');
toast({
title: 'Please install MetaMask or another Ethereum wallet',
variant: 'destructive',
});
return;
}
console.log('Connecting to Ethereum provider');
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const contract = getContract().connect(signer);
console.log('Preparing transaction data');
const tx = await contract.createEvent(
name,
description,
capacity,
ethers.utils.parseEther(ticketPrice.toString()),
Math.floor(startDate.getTime() / 1000),
images
);
console.log('Transaction sent, waiting for confirmation');
const receipt = await tx.wait();
console.log('Transaction confirmed:', receipt.transactionHash);
toast({
title: `Event created successfully! Transaction Hash: ${receipt.transactionHash}`,
});
return receipt.transactionHash;
} catch (error) {
console.error('Error in createEvent:', error);
if (error instanceof Error) {
toast({
title: `Transaction failed: ${error.message}`,
variant: 'destructive',
});
} else {
toast({
title: 'Transaction failed. Please try again.',
variant: 'destructive',
});
}
throw error;
}
};

View File

@@ -1,4 +1,5 @@
import { ethers } from 'ethers';
import EventManagerABI from '../contracts/EventManagerABI.json';
const FLARE_TESTNET_RPC_URL = process.env.NEXT_PUBLIC_RPC_URL;
const CONTRACT_ADDRESS = process.env.NEXT_PUBLIC_CONTRACT_ADDRESS;
@@ -12,509 +13,6 @@ export function getFlareProvider() {
export function getContract() {
const provider = getFlareProvider();
const contractAddress = CONTRACT_ADDRESS;
const contractABI = [
{
inputs: [
{
internalType: 'uint256',
name: '_ticketId',
type: 'uint256',
},
{
internalType: 'address',
name: '_to',
type: 'address',
},
{
internalType: 'bool',
name: '_allowed',
type: 'bool',
},
],
name: 'approveTicket',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{
internalType: 'uint256',
name: '_eventId',
type: 'uint256',
},
],
name: 'buyTicket',
outputs: [
{
internalType: 'uint256',
name: '_ticketId',
type: 'uint256',
},
],
stateMutability: 'payable',
type: 'function',
},
{
inputs: [
{
internalType: 'string',
name: '_name',
type: 'string',
},
{
internalType: 'string',
name: '_description',
type: 'string',
},
{
internalType: 'uint256',
name: '_capacity',
type: 'uint256',
},
{
internalType: 'uint256',
name: '_ticketPrice',
type: 'uint256',
},
{
internalType: 'uint256',
name: '_eventDate',
type: 'uint256',
},
{
internalType: 'string[]',
name: '_images',
type: 'string[]',
},
],
name: 'createEvent',
outputs: [
{
internalType: 'uint256',
name: '_eventId',
type: 'uint256',
},
],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
stateMutability: 'nonpayable',
type: 'constructor',
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: 'uint256',
name: 'eventId',
type: 'uint256',
},
{
indexed: false,
internalType: 'string',
name: 'name',
type: 'string',
},
{
indexed: false,
internalType: 'uint256',
name: 'eventDate',
type: 'uint256',
},
],
name: 'EventCreated',
type: 'event',
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: 'uint256',
name: 'ticketId',
type: 'uint256',
},
{
indexed: false,
internalType: 'uint256',
name: 'eventId',
type: 'uint256',
},
{
indexed: false,
internalType: 'address',
name: 'buyer',
type: 'address',
},
{
indexed: false,
internalType: 'uint256',
name: 'price',
type: 'uint256',
},
],
name: 'TicketPurchased',
type: 'event',
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: 'uint256',
name: 'ticketId',
type: 'uint256',
},
{
indexed: false,
internalType: 'address',
name: 'owner',
type: 'address',
},
{
indexed: false,
internalType: 'address',
name: 'trustee',
type: 'address',
},
],
name: 'TicketTransferApproved',
type: 'event',
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: 'uint256',
name: 'ticketId',
type: 'uint256',
},
{
indexed: false,
internalType: 'address',
name: 'from',
type: 'address',
},
{
indexed: false,
internalType: 'address',
name: 'to',
type: 'address',
},
],
name: 'TicketTransferred',
type: 'event',
},
{
inputs: [
{
internalType: 'uint256',
name: '_ticketId',
type: 'uint256',
},
{
internalType: 'address',
name: '_to',
type: 'address',
},
],
name: 'transferTicket',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{
internalType: 'uint256',
name: '_ticketId',
type: 'uint256',
},
{
internalType: 'address',
name: '_to',
type: 'address',
},
],
name: 'transferTicketFrom',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{
internalType: 'uint256',
name: '_cents',
type: 'uint256',
},
],
name: 'centsToFlare',
outputs: [
{
internalType: 'uint256',
name: '_flr',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'eventCounter',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256',
},
],
name: 'events',
outputs: [
{
internalType: 'string',
name: 'name',
type: 'string',
},
{
internalType: 'string',
name: 'description',
type: 'string',
},
{
internalType: 'uint256',
name: 'capacity',
type: 'uint256',
},
{
internalType: 'uint256',
name: 'ticketsSold',
type: 'uint256',
},
{
internalType: 'uint256',
name: 'ticketPrice',
type: 'uint256',
},
{
internalType: 'uint256',
name: 'eventDate',
type: 'uint256',
},
{
internalType: 'address payable',
name: 'eventHost',
type: 'address',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256',
},
],
name: 'feedIds',
outputs: [
{
internalType: 'bytes21',
name: '',
type: 'bytes21',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'uint256',
name: '_eventId',
type: 'uint256',
},
],
name: 'getEventImages',
outputs: [
{
internalType: 'string[]',
name: '',
type: 'string[]',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'uint256',
name: '_eventId',
type: 'uint256',
},
],
name: 'getEventPriceFlare',
outputs: [
{
internalType: 'uint256',
name: '_flr',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'uint256',
name: '_eventId',
type: 'uint256',
},
],
name: 'getEventTickets',
outputs: [
{
internalType: 'uint256[]',
name: '',
type: 'uint256[]',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'getFlareFeed',
outputs: [
{
internalType: 'uint256',
name: '_feedValue',
type: 'uint256',
},
{
internalType: 'int8',
name: '_decimals',
type: 'int8',
},
{
internalType: 'uint64',
name: '_timestamp',
type: 'uint64',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'getFtsoV2CurrentFeedValues',
outputs: [
{
internalType: 'uint256[]',
name: '_feedValues',
type: 'uint256[]',
},
{
internalType: 'int8[]',
name: '_decimals',
type: 'int8[]',
},
{
internalType: 'uint64',
name: '_timestamp',
type: 'uint64',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'ticketCounter',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256',
},
],
name: 'tickets',
outputs: [
{
internalType: 'address',
name: 'holder',
type: 'address',
},
{
internalType: 'uint256',
name: 'boughtTime',
type: 'uint256',
},
{
internalType: 'uint256',
name: 'eventId',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: '',
type: 'address',
},
{
internalType: 'uint256',
name: '',
type: 'uint256',
},
],
name: 'userTickets',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
},
];
const contractABI = EventManagerABI;
return new ethers.Contract(contractAddress!, contractABI, provider);
}