"use client"; import type { NextPage } from "next"; import { formatEther } from "viem"; import { Address } from "~~/components/scaffold-eth"; import { useScaffoldEventHistory } from "~~/hooks/scaffold-eth"; const Events: NextPage = () => { const { data: EthToTokenEvents, isLoading: isEthToTokenEventsLoading } = useScaffoldEventHistory({ contractName: "DEX", eventName: "EthToTokenSwap", }); const { data: tokenToEthEvents, isLoading: isTokenToEthEventsLoading } = useScaffoldEventHistory({ contractName: "DEX", eventName: "TokenToEthSwap", }); const { data: liquidityProvidedEvents, isLoading: isLiquidityProvidedEventsLoading } = useScaffoldEventHistory({ contractName: "DEX", eventName: "LiquidityProvided", }); const { data: liquidityRemovedEvents, isLoading: isLiquidityRemovedEventsLoading } = useScaffoldEventHistory({ contractName: "DEX", eventName: "LiquidityRemoved", }); return ( <>
{isEthToTokenEventsLoading ? (
) : (
ETH To Balloons Events
{!EthToTokenEvents || EthToTokenEvents.length === 0 ? ( ) : ( EthToTokenEvents?.map((event, index) => { return ( ); }) )}
Address Amount of ETH in Amount of Balloons out
No events found
{parseFloat(formatEther(event.args.ethInput || 0n)).toFixed(4)} {parseFloat(formatEther(event.args.tokenOutput || 0n)).toFixed(4)}
)} {isTokenToEthEventsLoading ? (
) : (
Balloons To ETH Events
{!tokenToEthEvents || tokenToEthEvents.length === 0 ? ( ) : ( tokenToEthEvents?.map((event, index) => { return ( ); }) )}
Address Amount of Balloons In Amount of ETH Out
No events found
{parseFloat(formatEther(event.args.tokensInput || 0n)).toFixed(4)} {parseFloat(formatEther(event.args.ethOutput || 0n)).toFixed(4)}
)} {isLiquidityProvidedEventsLoading ? (
) : (
Liquidity Provided Events
{!liquidityProvidedEvents || liquidityProvidedEvents.length === 0 ? ( ) : ( liquidityProvidedEvents?.map((event, index) => { return ( ); }) )}
Address Amount of ETH In Amount of Balloons In Lİquidity Minted
No events found
{parseFloat(formatEther(event.args.ethInput || 0n)).toFixed(4)} {parseFloat(formatEther(event.args.tokensInput || 0n)).toFixed(4)} {parseFloat(formatEther(event.args.liquidityMinted || 0n)).toFixed(4)}
)} {isLiquidityRemovedEventsLoading ? (
) : (
Liquidity Removed Events
{!liquidityRemovedEvents || liquidityRemovedEvents.length === 0 ? ( ) : ( liquidityRemovedEvents?.map((event, index) => { return ( ); }) )}
Address Amount of ETH Out Amount of Balloons Out Liquidity Withdrawn
No events found
{parseFloat(formatEther(event.args.ethOutput || 0n)).toFixed(4)} {parseFloat(formatEther(event.args.tokensOutput || 0n)).toFixed(4)} {parseFloat(formatEther(event.args.liquidityWithdrawn || 0n)).toFixed(4)}
)}
); }; export default Events;