import React, {useCallback, useMemo} from 'react'; import Page from '../../components/Page'; import {createGlobalStyle} from 'styled-components'; import { Switch} from 'react-router-dom'; import {useWallet} from 'use-wallet'; import UnlockWallet from '../../components/UnlockWallet'; import ExchangeCard from './components/ExchangeCard'; import styled from 'styled-components'; import useRaffleStats from '../../hooks/useRaffleBalance'; import useUnicornFinance from '../../hooks/useUnicornFinance'; import {useTransactionAdder} from '../../state/transactions/hooks'; import HomeImage from '../../assets/img/fairybg.gif'; import Collage from '../../assets/img/collage.jpg'; import { Card, Grid } from '@material-ui/core'; import LaunchCountdown from '../../components/LaunchCountdown'; const BackgroundImage = createGlobalStyle` body { background: url(${HomeImage}) repeat !important; background-size: cover !important; // background: linear-gradient(90deg, rgba(144,17,105,1) 0%, rgba(95,17,144,1) 100%); } `; const NFTRaffle: React.FC = () => { // compatible format for most browser + metamask browser. Needs to be YYYY-MM-ddTHH:mm:ssZ const startDate = new Date('2022-04-30T3:00:00Z'); const endDate = new Date('2022-05-03T4:00:00Z'); const raffleAddress = '0x37219231a957e09F6e674B218043FdF1C5145F68'; const {account} = useWallet(); const unicornFinance = useUnicornFinance(); const addTransaction = useTransactionAdder(); const raffleStats = useRaffleStats(account, raffleAddress); const startTime = Number(startDate); const endTime = Number(endDate); const raffleBals = useMemo( () => (raffleStats ? Number(raffleStats.totalSupply).toFixed(0) : null), [raffleStats], ); const userBals = useMemo( () => (raffleStats ? Number(raffleStats.priceInDollars).toFixed(0) : null), [raffleStats], ); const handleBuyBonds = useCallback( async (amount: string) => { const tx = await unicornFinance.sendUnicorn(amount, raffleAddress); addTransaction(tx, { summary: `Send ${Number(amount).toFixed(2)} WCRO to the raffle ${amount} `, }); }, [unicornFinance, addTransaction], ); return ( {!!account ? ( <>

Partner NFT Raffle

This isn't just your average raffle, this raffle gives you the chance to win NFTs from our awesome partners! Each with utility that goes into a reward pool for 3 winners to choose from! To enter simply click the enter raffle button below to send 5 WCRO to the raffle address or manually send WCRO to the raffle address shown below.

Raffle address: {raffleAddress}

Raffle Details

5 WCRO Per Entry, Unlimited Entries Per Wallet!

3 Winners will be selected!

1st- Picks 3 NFTs from reward pool

2nd- Picks 2 NFTs from reward pool

3rd- Picks 1 NFT from reward pool

NFT Collage

Many thanks to our awesome partners for donating NFTs!

El Taco Finance

Magik Finance

Miniverse Finance

{Date.now() > endTime ?

Raffle Closed

:

Raffle Open

} {Date.now() < startTime ? : }

Raffle Stats

Total WCRO entered: {raffleBals}

Your WCRO entered: {userBals}

Your Raffle entries: {Number(userBals)/5}

Your account: {account}

startTime ? 'Raffle is open! 5 WCRO = 1 Entry' : 'Raffle is currently closed' } disabled={Date.now() < endTime && Date.now() > startTime ? false : true} onExchange={handleBuyBonds} />
) : ( )}
); }; const StyledBond = styled.div` display: flex; @media (max-width: 768px) { width: 100%; flex-flow: column nowrap; align-items: center; } `; const StyledCardWrapper = styled.div` display: flex; flex: 1; flex-direction: column; @media (max-width: 768px) { width: 80%; } `; export default NFTRaffle;