POG Contract for Storing Scores
The PoG network uses a smart contract deployed on the blockchain to store, update, and retrieve the Proof of Gamer (PoG) scores securely. This contract acts as the single source of truth for player scores and facilitates transparent and immutable record-keeping. Below is a breakdown of the contract's functionality in relation to score storage and retrieval.
Score Storage and Event Tracking
Oracles submit their calculated PoG scores to the contract after completing the validation process. These scores are stored in the blockchain and linked to the unique player (identified by wallet address). The key components of the contract include:
Event-Driven Architecture: The PoG contract listens for events emitted by Oracles when they submit new scores or update existing ones. Events such as ScoreSubmitted and ScoreUpdated allow for real-time tracking and monitoring of the system's performance.
TokenMinted Event: When an Oracle successfully calculates and submits a player's PoG score, the contract mints a token representing the score. This token is linked to the player’s wallet address, storing the PoG score on-chain for transparency and security. The event triggers the following actions:
Retrieve the user's wallet address.
Fetch associated player data and calculate a new PoG score.
Mint a new token for the player with the calculated score and store it using IPFS for data integrity.
Score Integrity: Every stored PoG score is linked to an immutable IPFS hash that contains metadata about the player’s score and gaming history. The contract ensures data integrity through cryptographic proofs, verifying that the score is accurate and tamper-proof.
Score Updates and Modifications
The PoG contract also supports the updating of previously stored scores when there are recalculations or corrections. Oracles may encounter situations where a player’s performance changes or inconsistencies are discovered. In such cases:
HashesUpdated Event: This event is triggered when the data associated with a PoG score (stored as a token) is modified. The Oracle submits the updated PoG score along with new IPFS and Data Integrity hashes, ensuring that any change in the score or associated data is recorded transparently.
Score Custody: In some instances, Oracles may delegate control of a player's PoG token to a trusted custodian. The contract supports this functionality via the CustodianUpdated and CustodianExpiryUpdated events, which allow Oracles to securely transfer score custody, with expiration times to manage the period of control.
Retrieval of PoG Scores
Players, Oracles, and other network participants can retrieve PoG scores via the contract. The following processes are involved:
Public Retrieval: Anyone on the network can query the contract for a player’s current PoG score using their wallet address. The contract fetches the token linked to the player and retrieves the latest PoG score stored on-chain.
Data Synchronization: Oracles ensure that all on-chain data is synchronized with off-chain storage solutions like IPFS, maintaining consistency and ensuring that the PoG score data is always accurate and verifiable.
Security and Auditing
The contract implements multiple layers of security to ensure that only authorized Oracles can submit or modify PoG scores. These mechanisms include:
Role-Based Access Control: Only Oracles with the appropriate cryptographic keys are permitted to interact with the contract and modify PoG scores.
Audit Logs: Every transaction and score submission is recorded on-chain, allowing for full traceability and auditing of all changes made to PoG scores.
This section outlines the contract’s role in ensuring secure, transparent, and verifiable storage of PoG scores, critical to maintaining trust in the decentralized PoG scoring system.
Last updated