diff --git a/PR_MESSAGE.md b/PR_MESSAGE.md new file mode 100644 index 000000000..f9cf08d58 --- /dev/null +++ b/PR_MESSAGE.md @@ -0,0 +1 @@ +This pull request includes changes that address various improvements and updates to the codebase. Significant refactoring has been done to enhance functionality, improve error handling, and update dependencies. These changes are crucial for the ongoing development and maintenance of the application. diff --git a/README.md b/README.md index f525ae41a..3cca73fe3 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -# MissionEnrolment2024: Onchain Attestation and Verification +# MissionEnrollment2024: Onchain Attestation and Verification -MissionEnrolment2024 is a decentralized application (dApp) that leverages blockchain technology to create immutable attestations for mission enrolment. +MissionEnrollment2024 is a decentralized application (dApp) that leverages blockchain technology to create immutable attestations for mission enrollment. Built with Next.js, React, and the Ethereum Attestation Service (EAS), this project aims to provide a transparent and decentralized platform for verifying mission participation and achievements. ## SuperHack 2024 This dApp was developed during [SuperHack 2024](https://ethglobal.com/events/superhack2024), an online async hackathon organized by [ETHGlobal](https://ethglobal.com/). The event took place from August 2nd to August 16th, 2024, bringing together developers, designers, and blockchain enthusiasts to collaborate on innovative projects. -MissionEnrolment2024 showcases the potential of blockchain technology in creating verifiable and transparent systems for mission-based activities on Ethereum. +MissionEnrollment2024 showcases the potential of blockchain technology in creating verifiable and transparent systems for mission-based activities on Ethereum. ## Features -- **Onchain Attestations**: Creates immutable records of mission enrolment using the Ethereum Attestation Service (EAS). +- **Onchain Attestations**: Creates immutable records of mission enrollment using the Ethereum Attestation Service (EAS). - **ENS Integration**: Supports Ethereum Name Service for user-friendly addressing. - **ETHGlobal POAPs Retrieval**: Verifies attendance at ETHGlobal events through Proof of Attendance Protocol tokens. - **Interactive Single-Page Application**: Offers a streamlined user experience with stage-based components. @@ -79,21 +79,21 @@ MissionEnrolment2024 showcases the potential of blockchain technology in creatin ## Usage -MissionEnrolment2024 provides a streamlined single-page application flow for mission enrolment, verification, and NFT migration: +MissionEnrollment2024 provides a streamlined single-page application flow for mission enrollment, verification, and NFT migration: 1. Connect your Ethereum wallet to the application using the "Connect Wallet" button. -2. Navigate through the mission enrolment stages: +2. Navigate through the mission enrollment stages: a. Enter your ENS (Ethereum Name Service) name or Ethereum address for identity verification. b. The application will automatically retrieve and verify your ETHGlobal POAPs to confirm event attendance. c. Review the details of your mission participation, including verified events and achievements. -3. Create an onchain attestation for your mission enrolment: +3. Create an onchain attestation for your mission enrollment: a. Click the "Create Attestation" button to initiate the process. b. Sign the attestation transaction using your connected wallet. c. Wait for the transaction to be confirmed on the Ethereum network. 4. Once confirmed, view your attestation details, which are now immutably recorded on the blockchain. -5. Explore the "Recent Attestations" section to see other verified mission enrolments and the growing community of participants. +5. Explore the "Recent Attestations" section to see other verified mission enrollments and the growing community of participants. -This streamlined process ensures a transparent and verifiable record of your mission enrolment, leveraging the security and immutability of blockchain technology. The single-page application design provides a seamless user experience throughout the entire enrolment and verification process. +This streamlined process ensures a transparent and verifiable record of your mission enrollment, leveraging the security and immutability of blockchain technology. The single-page application design provides a seamless user experience throughout the entire enrollment and verification process. ## Disclaimer diff --git a/components/IdentityVerification.tsx b/components/IdentityVerification.tsx index dc2392939..e2d994c56 100644 --- a/components/IdentityVerification.tsx +++ b/components/IdentityVerification.tsx @@ -47,21 +47,30 @@ const IdentityVerification: React.FC<{ onVerified: (address: string) => void }>

Identity Verification

Please enter your ENS name or Ethereum address:

- setInputAddress(e.target.value)} - className="w-full max-w-md p-2 border rounded mb-4" - placeholder="vitalik.eth or 0x..." - disabled={isVerifying} - /> - {isLoading &&

Resolving...

} - {ensName &&

Resolved ENS Name: {ensName}

} - {ensAddress &&

Resolved Address: {ensAddress}

} +
+ setInputAddress(e.target.value)} + className="w-full max-w-md p-2 border rounded mb-4" + placeholder="vitalik.eth or 0x..." + disabled={isVerifying} + /> + {isLoading && ( + + + + + + + )} +
+ {ensName &&

Resolved ENS Name: {ensName}

} + {ensAddress &&

Resolved Address: {ensAddress}

} diff --git a/contracts/AttestationService.sol b/contracts/AttestationService.sol index 2bc3adffa..1cc8a1e92 100644 --- a/contracts/AttestationService.sol +++ b/contracts/AttestationService.sol @@ -11,7 +11,7 @@ contract AttestationService is Ownable { IEAS private immutable eas; ISchemaRegistry private immutable schemaRegistry; - bytes32 public missionEnrolmentSchema; + bytes32 public missionEnrollmentSchema; event SchemaCreated(bytes32 indexed schemaId); event AttestationCreated(bytes32 indexed attestationId, address indexed recipient); @@ -21,15 +21,15 @@ contract AttestationService is Ownable { schemaRegistry = ISchemaRegistry(_schemaRegistry); } - function createMissionEnrolmentSchema() external onlyOwner { + function createMissionEnrollmentSchema() external onlyOwner { string memory schema = "address userAddress,uint256 tokenId,uint256 timestamp"; bytes32 schemaId = schemaRegistry.register(schema, ISchemaResolver(address(0)), true); - missionEnrolmentSchema = schemaId; + missionEnrollmentSchema = schemaId; emit SchemaCreated(schemaId); } - function createMissionEnrolmentAttestation(address recipient, uint256 tokenId) external returns (bytes32) { - require(missionEnrolmentSchema != bytes32(0), "Schema not created"); + function createMissionEnrollmentAttestation(address recipient, uint256 tokenId) external returns (bytes32) { + require(missionEnrollmentSchema != bytes32(0), "Schema not created"); bytes memory data = abi.encode(recipient, tokenId, block.timestamp); diff --git a/pages/index.tsx b/pages/index.tsx index ebe15a789..1c644a0e8 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,5 +1,6 @@ import React, { useEffect, useState } from "react"; -import EventAttendanceVerification from "../components/EventAttendanceVerification"; +import { useLocalStorage } from "usehooks-ts"; +import EventAttendanceProof from "../components/EventAttendanceProof"; import IdentityVerification from "../components/IdentityVerification"; import OnchainAttestation from "../components/OnchainAttestation"; @@ -17,8 +18,8 @@ interface POAPEvent { const stageDescriptions = { identity: "Verify your identity using ENS or Ethereum address", attendance: "Confirm your attendance proof for ETHGlobal Brussels 2024", - attestation: "Create an onchain attestation of your mission enrolment", - complete: "Mission enrolment completed successfully", + attestation: "Create an onchain attestation of your mission enrollment", + complete: "Mission enrollment completed successfully", }; const Home: React.FC = () => { @@ -30,13 +31,18 @@ const Home: React.FC = () => { if (completedStages.length === 0 && currentStage !== "identity") { setCurrentStage("identity"); } - }, [completedStages, currentStage]); + }, [completedStages, currentStage, setCurrentStage]); const handleStageCompletion = (stage: Stage) => { - setCompletedStages(prev => [...prev, stage]); + const newCompletedStages = [...completedStages, stage]; + setCompletedStages(newCompletedStages); + localStorage.setItem('completedStages', JSON.stringify(newCompletedStages)); + const currentIndex = stages.indexOf(stage); if (currentIndex < stages.length - 1) { - setCurrentStage(stages[currentIndex + 1]); + const nextStage = stages[currentIndex + 1]; + setCurrentStage(nextStage); + localStorage.setItem('currentStage', nextStage); } }; @@ -79,15 +85,14 @@ const Home: React.FC = () => { return (
-

Mission Enrolment 2024

+

Mission Enrollment 2024

Current Stage: {currentStage.charAt(0).toUpperCase() + currentStage.slice(1)}

{stageDescriptions[currentStage]}

-

- Complete this stage to proceed to the next step of your mission enrolment. -

+

Complete this stage to proceed to the next step of your mission enrollment.

+
{renderCurrentStage()}