Skip to content

Commit

Permalink
Edit app for Production
Browse files Browse the repository at this point in the history
  • Loading branch information
ceeriil committed Mar 27, 2024
1 parent 1dd2c29 commit 191551e
Show file tree
Hide file tree
Showing 30 changed files with 486 additions and 148 deletions.
6 changes: 5 additions & 1 deletion packages/hardhat/contracts/Loogie.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ contract Loogie is ILoogie, ERC721Enumerable, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;

uint256 public constant limit = 3728;

mapping (uint256 => bytes3) public color;
mapping (uint256 => uint256) public chubbiness;
mapping (uint256 => uint256) public mouthLength;
Expand All @@ -32,8 +34,10 @@ contract Loogie is ILoogie, ERC721Enumerable, Ownable {
constructor(address _minter) public ERC721("DailyLoogies", "DL") {
minter = _minter;
}

function mintItem() public override onlyMinter returns (uint256) {

require(_tokenIds.current() < limit, "DONE MINTING");
_tokenIds.increment();

uint256 id = _tokenIds.current();
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat/deploy/02_deploy_loogie_auction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const deployLoogieActionContract: DeployFunction = async function (hre: HardhatR
}

const [hour, minBidIncrementPercentage] = [3600, 5];
const duration = hour / 2;
const duration = hour * 24;

const loogieAuction = await deploy("LoogieAuction", {
from: deployer,
Expand Down
89 changes: 51 additions & 38 deletions packages/hardhat/deployments/sepolia/Loogie.json

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions packages/hardhat/deployments/sepolia/LoogieAuction.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "0xc4cE2aEF86D93cB5873A27D32D5567578E905b97",
"address": "0x6F2d7f159F00e0aE9197D3eF5Cc480D33aE0f693",
"abi": [
{
"inputs": [
Expand Down Expand Up @@ -394,43 +394,43 @@
"type": "function"
}
],
"transactionHash": "0x572070c796fbfd3e6161a6ad9160e68775c28a37d6529338b2815ae46476cc77",
"transactionHash": "0xab0ff6c248ae1add595895eb7dfb7137bb5b5bdab6d848396fcc726eb8bcf1ce",
"receipt": {
"to": null,
"from": "0x0Fa85d42B92aa0BA788951F7EA9807Bc4Bc72111",
"contractAddress": "0xc4cE2aEF86D93cB5873A27D32D5567578E905b97",
"transactionIndex": 77,
"gasUsed": "1110355",
"logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000200000000000000000000000000000020000000000000000000800000000000000000000002000000000400000000000000000000000000000020000000000000000000080000000000000000000000000000000000000000000000000002000000000000000000000000000001000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0x6ab6a95732de2c32bfa6d75b2f377fd79e7c5ad8792a7a88c2ac4dbdb80c7501",
"transactionHash": "0x572070c796fbfd3e6161a6ad9160e68775c28a37d6529338b2815ae46476cc77",
"contractAddress": "0x6F2d7f159F00e0aE9197D3eF5Cc480D33aE0f693",
"transactionIndex": 109,
"gasUsed": "1090431",
"logsBloom": "0x00000000000000000000000000000000000000000000000000800000200000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000002000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000002000000000000000000000000000001000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0x90377ac928685dea130a9733948304c71a6d505bea582fd691dfcb870fe16e60",
"transactionHash": "0xab0ff6c248ae1add595895eb7dfb7137bb5b5bdab6d848396fcc726eb8bcf1ce",
"logs": [
{
"transactionIndex": 77,
"blockNumber": 5558897,
"transactionHash": "0x572070c796fbfd3e6161a6ad9160e68775c28a37d6529338b2815ae46476cc77",
"address": "0xc4cE2aEF86D93cB5873A27D32D5567578E905b97",
"transactionIndex": 109,
"blockNumber": 5569755,
"transactionHash": "0xab0ff6c248ae1add595895eb7dfb7137bb5b5bdab6d848396fcc726eb8bcf1ce",
"address": "0x6F2d7f159F00e0aE9197D3eF5Cc480D33aE0f693",
"topics": [
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000fa85d42b92aa0ba788951f7ea9807bc4bc72111"
],
"data": "0x",
"logIndex": 177,
"blockHash": "0x6ab6a95732de2c32bfa6d75b2f377fd79e7c5ad8792a7a88c2ac4dbdb80c7501"
"logIndex": 91,
"blockHash": "0x90377ac928685dea130a9733948304c71a6d505bea582fd691dfcb870fe16e60"
}
],
"blockNumber": 5558897,
"cumulativeGasUsed": "8761177",
"blockNumber": 5569755,
"cumulativeGasUsed": "10498742",
"status": 1,
"byzantium": true
},
"args": [
86400,
3600,
0,
5,
"0x5c6A8a97B4Cb1b9Ca806160C0220a8d461442D54",
"0xad5e9545e7cf781295Df2A926848089d5df5f289"
"0x487b702311Cb982FA59446eb0421F248C3101EF4",
"0x2Af56dC2c853f02C4744ffe6b9820dffc5C2172A"
],
"numDeployments": 1,
"solcInputHash": "cb092902266f82f5212a67400e565809",
Expand Down
16 changes: 8 additions & 8 deletions packages/hardhat/deployments/sepolia/WETH.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "0x5c6A8a97B4Cb1b9Ca806160C0220a8d461442D54",
"address": "0x487b702311Cb982FA59446eb0421F248C3101EF4",
"abi": [
{
"anonymous": false,
Expand Down Expand Up @@ -286,19 +286,19 @@
"type": "receive"
}
],
"transactionHash": "0x570b294cc38159eb62f333f9865f15426e47470a9c91ce78763037c1f4a05321",
"transactionHash": "0x0f062b2e09d62ed4f5381bc24449dfab21ef85a8c011742e04146b1aa757441e",
"receipt": {
"to": null,
"from": "0x0Fa85d42B92aa0BA788951F7EA9807Bc4Bc72111",
"contractAddress": "0x5c6A8a97B4Cb1b9Ca806160C0220a8d461442D54",
"transactionIndex": 239,
"contractAddress": "0x487b702311Cb982FA59446eb0421F248C3101EF4",
"transactionIndex": 80,
"gasUsed": "558088",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0xc5654c5278fee3a4f31a16ff36a9c326a70d697c4328884cfdb4adfc9d5253f6",
"transactionHash": "0x570b294cc38159eb62f333f9865f15426e47470a9c91ce78763037c1f4a05321",
"blockHash": "0xf4011325387fe7a192aba916a7b6c782cb8b684bb221988650a92ffd7277394f",
"transactionHash": "0x0f062b2e09d62ed4f5381bc24449dfab21ef85a8c011742e04146b1aa757441e",
"logs": [],
"blockNumber": 5558895,
"cumulativeGasUsed": "23077212",
"blockNumber": 5569753,
"cumulativeGasUsed": "10767755",
"status": 1,
"byzantium": true
},
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/hardhat/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const config: HardhatUserConfig = {
},
},
},
defaultNetwork: "localhost",
defaultNetwork: "sepolia",
namedAccounts: {
deployer: {
// By default, it will take the first Hardhat account as the deployer
Expand Down
20 changes: 12 additions & 8 deletions packages/nextjs/app/collection/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,25 @@ const LOOGIE_GRAPHQL = gql`
chubbiness
color
mouthLength
owner
}
auction(id: $id) {
amount
}
bids(first: 6, orderBy: amount, orderDirection: desc) {
id
endTime
startTime
settled
amount
bidder {
id
}
auction {
endTime
startTime
loogie {
owner
}
bids(orderBy: amount, orderDirection: desc) {
id
amount
bidder {
id
}
}
}
}
Expand All @@ -49,7 +53,7 @@ const CollectionId: NextPage = () => {
return (
<>
<section className="flex items-center flex-col flex-grow pt-5 relative">
<Auction loogiesData={loogiesData} />
<Auction loogieId={slug} loogiesData={loogiesData} />
</section>
</>
);
Expand Down
6 changes: 3 additions & 3 deletions packages/nextjs/app/collection/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Card } from "~~/components/loogies/Card";
const Collection: NextPage = () => {
const LOOGIE_GRAPHQL = `
{
loogies(first:10){
loogies(first:20 orderBy:id orderDirection:desc) {
id,
chubbiness,
color
Expand All @@ -25,8 +25,8 @@ const Collection: NextPage = () => {

return (
<>
<section className="flex items-center flex-col flex-grow pt-16 relative">
<div className="container mx-auto grid lg:grid-cols-3 md:grid-cols-2 gap-x-6 gap-y-8">
<section className="flex items-center flex-col flex-grow pt-16 relative pb-32">
<div className="container mx-auto grid lg:grid-cols-3 md:grid-cols-2 gap-x-6 gap-y-8 px-4 md:px-0">
{loogiesData &&
loogiesData?.loogies?.map((loogie: any, index: number) => {
return (
Expand Down
38 changes: 27 additions & 11 deletions packages/nextjs/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,60 @@ import { gql, useQuery } from "@apollo/client";
import type { NextPage } from "next";
import { Auction } from "~~/components/loogies/auction/Auction";

const GET_LATEST_AUCTION = gql`
{
auctions(where: { settled_not: true }) {
loogie {
id
}
}
}
`;

const LOOGIE_GRAPHQL = gql`
query GetLoogieData($id: Int!) {
query getLoogieData($id: Int!) {
loogie(id: $id) {
id
chubbiness
color
mouthLength
owner
}
auction(id: $id) {
amount
endTime
}
bids(first: 6, orderBy: amount, orderDirection: desc) {
id
startTime
amount
settled
bidder {
id
}
auction {
endTime
startTime
loogie {
owner
}
bids(orderBy: amount, orderDirection: desc) {
id
amount
bidder {
id
}
}
}
}
`;

const Home: NextPage = () => {
const { data: currentAuctionData } = useQuery(GET_LATEST_AUCTION);
const loogieId = currentAuctionData?.auctions[0]?.loogie?.id;
const { data: loogiesData } = useQuery(LOOGIE_GRAPHQL, {
variables: { id: 4 },
pollInterval: 1000,
variables: { id: parseInt(loogieId) },
pollInterval: 10000,
skip: !loogieId, // Skip the query if the latest auction ID is not available
});

return (
<>
<section className="flex items-center flex-col flex-grow pt-5 relative">
<Auction loogiesData={loogiesData} />
<Auction loogieId={loogieId} loogiesData={loogiesData} />
</section>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const Footer = () => {
const isLocalNetwork = targetNetwork.id === hardhat.id;

return (
<div className="min-h-0 py-5 px-1 mb-11 lg:mb-0">
<div className="min-h-0 py-2 px-1 mb-[-3] lg:mb-0 bg-base-100">
<div>
<div className="fixed flex justify-between items-center w-full z-10 p-4 bottom-0 left-0 pointer-events-none">
<div className="flex flex-col md:flex-row gap-2 pointer-events-auto"></div>
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/components/ScaffoldEthAppWithProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const ScaffoldEthApp = ({ children }: { children: React.ReactNode }) => {
<div className="flex flex-col min-h-screen app">
<Header />
<main className="relative flex flex-col flex-1">{children}</main>
<Footer />
</div>
<Footer />
<Toaster />
</>
);
Expand All @@ -46,7 +46,7 @@ export const ScaffoldEthAppWithProviders = ({ children }: { children: React.Reac
setMounted(true);
}, []);

const subgraphUri = "http://localhost:8000/subgraphs/name/loogie";
const subgraphUri = "https://api.studio.thegraph.com/proxy/64348/dailyloogies/0.0.4";
const apolloClient = new ApolloClient({
uri: subgraphUri,
cache: new InMemoryCache(),
Expand Down
7 changes: 4 additions & 3 deletions packages/nextjs/components/loogies/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ type CardProps = {

export const Card: React.FC<CardProps> = ({ id, chubbiness, mouthLength, color, ownerAddress }) => {
return (
<div className="border border-black rounded flex flex-col justify-between min-w-[14rem]">
<div className="border border-black rounded flex flex-col justify-between min-w-[7rem]">
<div>
<div className="py-1 min-h-[250px] w-full relative rounded-t border-b border-black flex items-center justify-center">
<div className="py-1 min-h-[250px] w-full relative rounded-t border-b border-black flex items-center justify-center overflow-hidden">
<RenderLoogie
id={id}
color={useHexToColor(color)}
Expand All @@ -29,7 +29,8 @@ export const Card: React.FC<CardProps> = ({ id, chubbiness, mouthLength, color,
<div className="p-6 py-3 bg-base-100 ">
<h2 className="font-semibold text-2xl">Loogie #{id}</h2>
<p className="">
This Loogie is the color #f1c55f with a chubbiness of {chubbiness} and mouth length of {mouthLength}!!!
This Loogie is the color {useHexToColor(color)} with a chubbiness of {chubbiness} and mouth length of
{mouthLength}!!!
</p>
{ownerAddress && <Address address={ownerAddress} />}
</div>
Expand Down
26 changes: 26 additions & 0 deletions packages/nextjs/components/loogies/LoadingSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react";

export const LoadingSkeleton = () => {
return (
<>
<div className="animate-pulse mt-2">
<div className="h-6 w-[100%] bg-slate-300 rounded"></div>
</div>
<div className="animate-pulse mt-2">
<div className="h-6 w-[100%] bg-slate-300 rounded"></div>
</div>
<div className="animate-pulse mt-2">
<div className="h-6 w-[100%] bg-slate-300 rounded"></div>

<div className="grid grid-cols-2 gap-4">
<div className="animate-pulse mt-2">
<div className="h-24 w-[100%] bg-slate-300 rounded"></div>
</div>
<div className="animate-pulse mt-2">
<div className="h-24 w-[100%] bg-slate-300 rounded"></div>
</div>
</div>
</div>
</>
);
};
Loading

0 comments on commit 191551e

Please sign in to comment.