diff --git a/packages/nextjs/app/builders/0x5cc8Be96B1C9A68F57a73b5bEa60cF5D890055A1/page.tsx b/packages/nextjs/app/builders/0x5cc8Be96B1C9A68F57a73b5bEa60cF5D890055A1/page.tsx deleted file mode 100644 index e020984..0000000 --- a/packages/nextjs/app/builders/0x5cc8Be96B1C9A68F57a73b5bEa60cF5D890055A1/page.tsx +++ /dev/null @@ -1,143 +0,0 @@ -import { NextPage } from "next"; -import { EnvelopeIcon, GlobeAltIcon } from "@heroicons/react/24/outline"; -import { Address } from "~~/components/scaffold-eth"; - -const GitHubIcon = () => ( - - - -); - -const BuidlGuidlLogo = () => ( - - - -); - -const styles = { - container: "min-h-screen p-8 bg-gradient-to-b from-base-200 to-base-300 dark:from-base-300 dark:to-base-200", - card: "max-w-4xl mx-auto p-12 bg-base-100 rounded-2xl shadow-xl border border-base-300 dark:bg-base-200 dark:border-base-400", - profileSection: "flex flex-col md:flex-row items-center md:items-start gap-8", - avatarContainer: "relative group", - avatar: "w-40 h-40 md:w-48 md:h-48 rounded-2xl shadow-lg transition-transform duration-300 group-hover:scale-105", - nameSection: "flex-1 text-center md:text-left space-y-2", - name: "text-4xl font-extrabold text-base-content dark:text-white bg-gradient-to-r from-primary to-secondary bg-clip-text", - section: "mt-10", - sectionTitle: "text-2xl font-extrabold mb-6 text-base-content dark:text-white flex items-center gap-2", - titleIcon: "w-6 h-6 text-primary", - bio: "text-base-content dark:text-white font-semibold leading-relaxed text-lg", - highlight: - "inline-block bg-primary/20 dark:bg-primary/30 text-primary dark:text-primary-content px-3 py-1 rounded-md font-bold", - socialLinks: "flex gap-6 items-center justify-center md:justify-start mt-8", - socialIcon: - "p-3 hover:bg-base-200 dark:hover:bg-base-300 rounded-xl transition-all duration-200 hover:scale-110 hover:shadow-md text-base-content dark:text-white", - divider: "my-8 border-t border-base-300 dark:border-base-400", - addressContainer: - "mt-2 bg-base-200 dark:bg-base-300 py-2 px-4 rounded-lg inline-block text-base-content dark:text-white", - buidlGuidlLink: - "flex items-center gap-2 text-base-content dark:text-white hover:text-primary dark:hover:text-primary transition-colors duration-200", -}; - -const builderDetails = { - name: "Gbolahan Akande", - address: "0x5cc8Be96B1C9A68F57a73b5bEa60cF5D890055A1", - bio: ( - <> - A passionate Web3 developer with experience in{" "} - Solidity and{" "} - full-stack development. Currently building{" "} - decentralized applications and contributing to{" "} - BuidlGuidl projects. Excited about the future of{" "} - blockchain technology and its potential to reshape the digital world. - - ), - avatar: "https://1.gravatar.com/userimage/206352262/e4937825bd2f70cf0335dce4e8792eda?size=256", - links: { - github: "gboigwe", - website: "https://agedevs.netlify.app", - email: "geakande@gmail.com", - buidlGuidl: "0x5cc8Be96B1C9A68F57a73b5bEa60cF5D890055A1", - }, -}; - -const GbolahanAkandeBuilderPage: NextPage = () => { - return ( -
-
-
-
- Profile -
-
-

{builderDetails.name}

-
-
-
- -
- {builderDetails.links.buidlGuidl && ( - - - {/* BuidlGuidl Profile */} - - )} - {builderDetails.links.github && ( - - - - )} - {builderDetails.links.website && ( - - - - )} - {builderDetails.links.email && ( - - - - )} -
-
-
- -
- -
-

About Me

-

{builderDetails.bio}

-
-
-
- ); -}; - -export default GbolahanAkandeBuilderPage; diff --git a/packages/nextjs/app/page.tsx b/packages/nextjs/app/page.tsx index 2f1253b..d7da889 100644 --- a/packages/nextjs/app/page.tsx +++ b/packages/nextjs/app/page.tsx @@ -2,24 +2,25 @@ import Link from "next/link"; import type { NextPage } from "next"; -import { useContractRead } from "wagmi"; import { BugAntIcon, MagnifyingGlassIcon, RocketLaunchIcon, UserGroupIcon } from "@heroicons/react/24/outline"; import BuildersGrid from "~~/components/batch/BuildersGrid"; -import deployedContracts from "~~/contracts/deployedContracts"; - -const BATCH_REGISTRY_ADDRESS = "0x65E42251A2ca0906c640331afd77f45F4682c56C"; -const BATCH_REGISTRY_ABI = deployedContracts[31337].BatchRegistry.abi; +import { useScaffoldReadContract } from "~~/hooks/scaffold-eth/useScaffoldReadContract"; const Home: NextPage = () => { - const { data: checkedInCount, isLoading } = useContractRead({ - address: BATCH_REGISTRY_ADDRESS, - abi: BATCH_REGISTRY_ABI, + const { + data: checkedInCount, + isLoading, + error, + } = useScaffoldReadContract({ + contractName: "BatchRegistry", functionName: "checkedInCounter", }); const displayCount = isLoading ? ( - ) : checkedInCount ? ( + ) : error ? ( + "Error loading" + ) : typeof checkedInCount === "bigint" ? ( checkedInCount.toString() ) : ( "0" diff --git a/packages/nextjs/components/batch/BuildersGrid.tsx b/packages/nextjs/components/batch/BuildersGrid.tsx index d89a507..162be37 100644 --- a/packages/nextjs/components/batch/BuildersGrid.tsx +++ b/packages/nextjs/components/batch/BuildersGrid.tsx @@ -7,21 +7,6 @@ interface Builder { address: string; } -// This needs to be in a server component or API route -// async function getBuilderAddresses() { -// const buildersPath = path.join(process.cwd(), 'app/builders'); -// try { -// const directories = await readdir(buildersPath, { withFileTypes: true }); -// return directories -// .filter(dirent => dirent.isDirectory()) -// .map(dirent => dirent.name) -// .filter(name => name.startsWith('0x')); -// } catch (error) { -// console.error('Error reading builders directory:', error); -// return []; -// } -// } - // Client component const BuildersGrid = () => { const [builders, setBuilders] = useState([]); diff --git a/packages/nextjs/contracts/deployedContracts.ts b/packages/nextjs/contracts/deployedContracts.ts index 008d4eb..140dd17 100644 --- a/packages/nextjs/contracts/deployedContracts.ts +++ b/packages/nextjs/contracts/deployedContracts.ts @@ -4,6 +4,445 @@ */ import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; -const deployedContracts = {} as const; +const deployedContracts = { + 10: { + CheckIn: { + address: "0x309cccD3d8Cb8869c08c718F8e1FF39398738564", + abi: [ + { + inputs: [ + { + internalType: "address", + name: "_batchRegistryAddress", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [], + name: "batchRegistry", + outputs: [ + { + internalType: "contract IBatchRegistry", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "checkMeIn", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + ], + inheritedFunctions: {}, + }, + }, + 31337: { + BatchRegistry: { + address: "0x5FbDB2315678afecb367f032d93F642f64180aa3", + abi: [ + { + inputs: [ + { + internalType: "address", + name: "initialOwner", + type: "address", + }, + { + internalType: "uint16", + name: "batchNumber", + type: "uint16", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [], + name: "AlreadyGraduated", + type: "error", + }, + { + inputs: [], + name: "BatchNotOpen", + type: "error", + }, + { + inputs: [], + name: "GraduationClosed", + type: "error", + }, + { + inputs: [], + name: "NotAContract", + type: "error", + }, + { + inputs: [], + name: "NotCheckedIn", + type: "error", + }, + { + inputs: [], + name: "NotInAllowList", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + ], + name: "OwnableInvalidOwner", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "OwnableUnauthorizedAccount", + type: "error", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "bool", + name: "first", + type: "bool", + }, + { + indexed: false, + internalType: "address", + name: "builder", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "checkInContract", + type: "address", + }, + ], + name: "CheckedIn", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + inputs: [], + name: "BATCH_NUMBER", + outputs: [ + { + internalType: "uint16", + name: "", + type: "uint16", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "allowList", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "batchGraduationNFT", + outputs: [ + { + internalType: "contract BatchGraduationNFT", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "checkIn", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "checkedInCounter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "graduate", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "graduatedTokenId", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "graduationOpen", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "isOpen", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "toggleBatchOpenStatus", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "toggleGraduationOpenStatus", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address[]", + name: "builders", + type: "address[]", + }, + { + internalType: "bool[]", + name: "statuses", + type: "bool[]", + }, + ], + name: "updateAllowList", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "yourContractAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + stateMutability: "payable", + type: "receive", + }, + ], + inheritedFunctions: { + owner: "@openzeppelin/contracts/access/Ownable.sol", + renounceOwnership: "@openzeppelin/contracts/access/Ownable.sol", + transferOwnership: "@openzeppelin/contracts/access/Ownable.sol", + }, + }, + CheckIn: { + address: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512", + abi: [ + { + inputs: [ + { + internalType: "address", + name: "_batchRegistryAddress", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [], + name: "batchRegistry", + outputs: [ + { + internalType: "contract IBatchRegistry", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "checkMeIn", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + ], + inheritedFunctions: {}, + }, + }, +} as const; export default deployedContracts satisfies GenericContractsDeclaration;