EAS Details
Contract Details
Last updated
Contract Details
Last updated
eventId: string
eventType: string
connectionsCount: uint8
connectedAddresses: address[]
Note: Need to handle User Consent/ User Privacy for storing data publicly!
The Proof of Connection Protocol (POCP) smart contract facilitates event registration, user attestations of participation, and connection management for events, while maintaining user reputation scores. It integrates with the Ethereum Attestation Service (EAS) for verifying attestations.
Access Controls and Constraints:
Number of Connections: Users must have at least one connection (connectionCount >= 1
).
Timeout Enforcement: Attestations must be made before the event's expiration time (attestation.time <= s_eventExpirationTimestamps[eventId]
).
Connected Addresses Length: The length of connectedAddresses
must be between 1 and 255 (1 <= connectedAddresses.length <= 255
), and it must match the provided connectionCount
.
Duplicate Attestations: Users cannot attest to the same event more than once. This is enforced by only the contract owner being able to attest, which ensures that duplicate attestations for the same event cannot happen.
Reputation System: Users earn 1 reputation point for each successful attestation. Reputation scores are stored as uint64
to accommodate a large number of points over time.
Attester Verification: Only the contract owner is permitted to make attestations, ensuring that attestations are controlled centrally.
Functions:
addCheckInData
Purpose: This function allows anyone to register an event by providing a unique eventId
. The function sets the event's expiration timestamp to 24 hours from the current block time.
Key Logic: It ensures the eventId
is not empty and updates the s_eventExpirationTimestamps
mapping with the new expiration time.
improveReputation
Purpose: Allows a user to increase their reputation score by interacting with a registered event.
Key Logic: The event must not have expired when this function is called. It increments the user's reputation score by 1 if the event is valid.
onAttest
(Internal)
Purpose: Handles user attestations. It processes the attestation by decoding the provided data, verifying the event's validity and expiration, checking for duplicate attestations, and validating the connection data.
Key Logic:
Verifies the attestation is being made by the contract owner.
Ensures the event is valid and exists.
Validates the event expiration time and ensures the connected addresses match the connection count.
getReputationScore
Purpose: A public view function that retrieves the reputation score of a specific user.
Key Logic: Returns the user's reputation score based on their participation in events and successful attestations.
getEventExpiration
Purpose: A public view function that retrieves the expiration timestamp of a registered event.
Key Logic: Allows users to check how much time is left to make valid attestations for a given event.
onRevoke
(Internal)
Purpose: An internal function that handles the revocation of attestations, which is not supported in this contract.
Key Logic: Always returns false
, indicating that attestations cannot be revoked once made.