Architecture
Overview
Phi Protocol consists of several components, divided into Credential Part, Create Art Part, and Reward Part.
Phi Protocol consists of the following main contracts:
Cred: Manages credential data.
PhiFactory: Manages the creation of NFTs.
PhiNFT1155: Manages NFTs representing credentials.
PhiRewards: Manages the distribution of rewards.
BondingCurve: Manages the bonding curve for credentials.
CuratorRewardsDistributor: Manages the distribution of curator rewards.
ContributeRewards: Manages additional rewards for credentials.
Upgradeability
The Cred, PhiFactory, and PhiNFT1155 contracts use the UUPS upgradeability pattern and can be upgraded by the owner.
Phi Protocol leverages smart contracts to manage and verify onchain credentials and NFTs, creating a comprehensive system for forming, visualizing, and showcasing onchain identities. The Cred
contract handles credential management, signaling, and fees, while the PhiFactory
contract focuses on NFT creation, claiming, and rewards.
NFT Creation and Claiming
To create NFTs linked to credentials, follow these steps:
Call the
createArt
function of the PhiFactory contract, passing the signed data and creation settings.The PhiFactory contract deploys a new PhiNFT1155 contract or uses an existing contract to create NFTs.
Users can call the merkleClaim
or signatureClaim
function of the PhiFactory contract to claim NFTs if they meet the conditions. 3. Each PhiNFT1155 contracts also have merkleClaim
and signatureClaim
. You can check this method in Claimable.sol
Cred Part
Cred Contract: Manages credential data, signaling, and obtaining price for curating share.
Credential Owner: Sets the description and verifier for the credential.
Curator: buy share the credential.
Bonding Curve: Manages the bonding curve for credential prices.
Contribute Reward: Manages additional rewards for credentials.
Verification Flow:
Merkle Proof: Uses Arweave to store credential data and Merkle proof verifier information.
Signature Type: Uses an PHI AWS backend and Verifier API End point for verification.
MERKLE Type: The verifier address is the Credential Creator.
https://github.com/PHI-LABS-INC/dune-csv-export
SIGNATURE Type: The verifier address is the Verifier hosting the backend.
https://github.com/PHI-LABS-INC/verifier-template
Key Functions:
buyShareCred: Allows a user to buy share of a credential by specifying its ID. This function requires a payment.
createCred: Allows a creator to create a new credential by specifying various parameters such as the cred info URL, verification type, and bonding curve address. This function stores the cred data and issues a new credential ID.
Create Art Part
PhiFactory Contract: Manages the creation of art (NFTs) linked to credentials.
Artist: Creates the art.
Arweave: Stores the art data.
Cred1155 Contract: Represents the created art as NFTs.
Minting Flow:
Mint Fee: Users pay a mint fee to mint NFTs.
Minting: Users can mint NFTs if they meet the conditions.
Distributor: Distributes curator fees.
Key Functions:
createArt: Allows an artist to create new art (NFTs) linked to cred. The function requires signed data and creation settings and deploys a new PhiNFT1155 contract or uses an existing contract to create NFTs.
claim: Allows users to claim NFTs through Merkle proofs or signatures by providing the necessary encoded data.
Signature case
Basic vs Advanced
Regarding "Basic" and "Advanced", the difference lies in what they verify. The former determines true/false for requirements, while the latter involves the verifier checking the number of swaps in a specific contract, ETH balance, or some other message against the requirements.
Reward Part
Overview
When minting NFTs, Phi Protocol manages the distribution of rewards to different stakeholders. The rewards are divided among the artist, referrer, verifier, and curator. The flow of ETH during the minting process depends on whether the NFT is created on the same chain as the credential (cred
) or a different chain.
PhiRewards Contract: Manages the distribution of rewards to artists, curators, and other participants.
Key Reward Components
Artist Reward: Reward allocated to the artist who created the NFT.
Referral Reward: Reward allocated to the referrer if there is one.
Verifier Reward: Reward allocated to the verifier who verifies the credential.
Curate Reward: Reward allocated to the curator who buy the cred share.
ETH Flow During Minting
When minting an NFT:
Users call the
claim
function in thePhiFactory
contract.The function determines the total mint fee and checks if the required amount of ETH is provided.
The ETH provided by the user is then split according to the reward distribution scenarios above.
Cred and NFT on the Same Chain:
If the credential (
cred
) and NFT are on the same chain, the curator receives the curator reward directly.
Cred and NFT on Different Chains:
If the NFT is on a different chain than the credential, the curator reward is sent to the artist instead.
PhiRewards Contract:
Manages deposits and withdrawals for reward distributions.
Calculates the total mint reward for a given quantity and mint fee.
Distributes rewards by updating balances for each stakeholder.
RewardControl Contract:
Abstract contract managing deposits and withdrawals.
Handles reward distribution and balance updates.
Example Flow for Paid Mint with Referral
User calls
claim
function with sufficient ETH to cover the total mint fee.ETH is split as follows:
Artist receives
paid fee + 0.0001 ETH
Referrer receives
0.00005 ETH
Verifier receives
0.00005 ETH
Curator receives
0.00005 ETH
if on the same chain as the credential, otherwise the artist receives this amount.Phi Protocol receives
0.00005 ETH
The
PhiRewards
contract updates balances for each stakeholder based on the calculated rewards.Rewards are deposited into the respective accounts.
NFT royalties are managed with the identifier 2981. Generally, a 5% royalty is set.
Last updated