Example Contract Interactions
This page provides detailed information about example contracts that demonstrate interactions with the ProofOfIdentity
contract within the Haven1 network.
These examples are designed to guide developers through practical implementations of the hPassport
Example Contracts
This directory contains two example contracts that interact with the ProofOfIdentity
contract.
AuctionPOI.sol: This contract is an implementation of an NFT auction system. It uses the
userType
of an account to permission the auction process, showcasing how user identity attributes can govern smart contract functionalities.SimpleStoragePOI.sol: This contract is a variant of the classic
SimpleStorage
, modified to permission accounts based on theircompetencyRating
. It serves as an example of implementing conditional access to functionalities within a contract based on user identity attributes.
Important Notes
Demonstration Purpose: These contracts incorporate many Solidity best practices but are intended for demonstration purposes only.
Production Considerations:
The
bid
function inAuctionPOI.sol
(line 280) should include a reentrancy guard in a production environment.The transfer of H1 tokens in
AuctionPOI.sol
(lines 454 and 468) should be approached with caution, avoiding optimistic transfers in most cases.
Identity Verification Checks
Both contracts include explicit checks for:
The presence of an accountโs ID NFT.
The suspended status of the account.
In the Haven1 network, these checks would typically be redundant as the network itself restricts transactions for accounts without an ID NFT or with a suspended status. However, they are included in these examples for educational purposes.
Testing
Example tests for both contracts are available in the directory: test/proof-of-identity/examples
. These tests can be used as a reference for developing and validating your own contracts that interact with the hPassport.
Last updated