Explore Philand
  • Welcome to Phi
    • 🏝️What's Phi?
    • 🌄Mission
    • 🏃‍♀️Story
    • 🏄Phi Crew
  • ⚡Products
    • 🏝️Phi Land
      • 🔦User Guide for Phi Land
        • 0️⃣Before Playing Phi
          • 🦊Download a Crypto Wallet
          • 🟣Get $MATIC
          • 🔷Get an ENS Domain
        • 1️⃣Access Phi Land
        • 2️⃣Create your Phi Land
        • 3️⃣Claim Quest Objects
        • 4️⃣Purchase Items on Shop
        • 5️⃣Deposit Objects to Land
        • 6️⃣Build your land
        • 7️⃣Share your land on Twitter
      • 🎧Phi Music
      • ⛓️Hyperlinks & Link List
      • 💫Transferring Land
      • ↔️Phi Connect
    • ⚔️Phi Quest
      • 🔦User Guide for Phi Quest
        • 0️⃣Before Playing Phi
          • 🦊Download a Crypto Wallet
          • 🟣Get $MATIC
        • 1️⃣Access Phi Quest
        • 2️⃣Claim Quest Objects
          • Quest List
          • Adventure
          • Campaign
        • 3️⃣Purchase Items on Shop
        • 4️⃣Play Phi Land with Items you got
      • 🧑Account
      • 🏅Active Score Rank Quests
    • 🍭Phi Opportunity (beta)
    • 💎Phi Material
      • ⚒️Phi Craft
      • 🥗UGC Craft
    • 🔮OpenSea Collection Links
    • 💡How-to's
      • 🏷️Mastering ENS (Ethereum Name Service)
        • How to Register an ENS Domain Name
        • How to Renew an ENS Domain Name
        • How to Manage ENS records
          • How to set up the Avatar record in ENS
            • Using MintYourPFP to set an Avatar to an ENS name
        • How to Transfer ENS to Another Wallet
        • How to set up an ENS Subdomain
    • ❓FAQ
      • Must I have an ENS to play Phi Quest?
      • How can I get an ENS domain?
      • Why don't my ENS domains show up?
      • Can I use ENS subdomains for Phi Land?
      • What happens when I transfer ENS?
      • I can't create a land
      • Why cannot access to my land?
      • Why can't I change the baseplate?
      • Why can’t I claim Quest objects?
      • Any rewards for participating in Testnet?
      • What is Phi Quest?
      • How the Leaderboard on Phi Quest is calculated?
      • Why are there two EXPs?
      • I claimed objects on Phi Quest. How can I create my Phi Land?
      • Why can’t I see my objects in my wallet?
      • Can I trade Quest Objects?
      • Are traded objects included in my EXP calculation?
      • My EXP not showing, leaderboard not updating
      • Which browser should I use?
      • Which devices are supported?
      • How to update my Twitter OGP image (card)?
    • 📬Submit Feedback
      • Bug Report
      • Feature Request
      • User Survey
  • ⚙️DEVELOPERS
    • 🪴Create Philand
    • 🎨Objects NFT
      • ⛓️Quest Object
      • 🌾Free Object
      • 🧊Premium Object
      • 🍰Baseplate Object
      • 🧮Wallpaper Object
      • 💄Other Topics
      • 💡Appendix
    • 🛠️Use PhiMap
      • 🗺️Deposit/Withdraw
      • 🍧Save Philand
      • 👀View Function
      • 💡Appendix
    • 💝Philand API
      • ⌚Introduction
      • 🔑Authentication
        • 😄Use API key
        • 😍Get Access Token
        • 🤩Verify Access Token
        • 🤪Get Refresh Token
        • 😎Refresh JWT
      • 🫔Quest
        • 🎾Get Quest List
        • 🏀Get Quest Status
        • ⚽Trigger Eligible Check
        • 🎯Get Claimed Status
        • 🏓Get Verify Coupon
      • 🏝️Philand
        • 🫑View Philand Link
        • 🍍Get Philand Image
      • 🧸Account
        • 🍞Get Philand List
        • 👑Get PhiRank
      • 🎺Object
        • 🎸Get Object Info
      • 🦖Example Call
        • 🤠Quest Claim
      • 👔Related Links
    • 🧑‍🏫How to Verify your transaction
      • 👓Read Contract Method
      • 🚩Third-party API
      • 🦷Whitelist
    • 📄Contracts
      • 👮Audit
  • 💼Career
    • 👯Phi is hiring
  • 🔗Official links
    • Website
    • Twitter
    • Discord
    • Discourse
    • Medium
    • Github
    • Guild.xyz
    • Lenster
    • Instagram
Powered by GitBook
On this page
  • Step 1: Create a Collection Contract
  • Create Collection
  • Verify Collection
  • Step 2: Create an Object in your Collection Contract
  • Upload to IPFS
  • Create an Object in Collection Contract
  • Step 3: Craft a Craft Recipe
  • What is a Craft Recipe
  • Creating a Craft Recipe
  • Step 4: Set Crafting Permissions in your Created Collection Contract
  • List of Polygon Contracts

Was this helpful?

  1. Products
  2. Phi Material

UGC Craft

Phi UGC Craft Creation Flow

PreviousPhi CraftNextOpenSea Collection Links

Last updated 1 year ago

Was this helpful?

Phi introduces a unique way for users to craft advanced objects. With Phi Craft, you can create your own UGC Craft Recipe with your own Phi UGC Objects.

This guide requires knowledge on:

  • using an IPFS storage to store NFT images and NFT Metadata

  • interacting with smart contracts directly using a tool like Polygonscan

Step 1: Create a Collection Contract

Create Collection

  • _name: The name of your collection. This is similar to OpenSea's NFT Collection name.

  • _symbol: The symbol representing your collection. This is similar to an ERC-712/ERC-1155 token name.

Verify Collection

A list of all the Collections created by the address will be returned.

Step 2: Create an Object in your Collection Contract

In this step, we will be uploading an Image and NFT Metadata using your preferred IPFS storage and then create an Object (NFT) in the Collection created in Step 1.

Upload to IPFS

  1. Then, using the link to your NFT images, create and upload the NFT Metadata in JSON format to the same storage to receive the URL. The minimum information needed are as follows:

{
  name: "Cubo",
  collection: {
    name: "PHI - UGC Craftable Object",
  },
  image: "https://bafkreiehtfsekl42r4uslafy3uyfqpudswrdgt4yqfrfvstrs7tw2yt45u.ipfs.nftstorage.link/",
}

Hold on to the URL to the NFT Metadata for the next step.

Create an Object in Collection Contract

Navigate to the Collection Contract created in Step 1 and execute the createObject function.

  • tokenUri - the NFT Metadata URL.

  • maxClaimable - The amount of this object can be crafted.

Do not use the NFT Image URL for this step!

Step 3: Craft a Craft Recipe

What is a Craft Recipe

A Craft Recipe is a set of logic in order to craft/claim a UGC Object. There are 3 components to a Craft Recipe:

You may enter a list of materials in the following format:

[{
  "tokenAddress": "0x27996B7f37a5455E41aE6292fd00d21df1Fb82f1",
  "tokenId": 100001,
  "amount": 1
},{
  ...
}]

Catalyst This is the condition that must be fulfilled in order to use the Craft Recipe. There are 3 supported catalysts:

ERC-20 balance - e.g. Holds Polygon USDC $1000

{"tokenAddress": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", "tokenId": 0, "amount": 1000, "tokenType": 0}

ERC-721 balance - e.g. Holds a Lens Handle

{"tokenAddress": "0xdb46d1dc155634fbc732f92e853b10b288ad5a1d", "tokenId": 0, "amount": 1, "tokenType": 1}

ERC-1155 balance - e.g. Holds a specific Phi Quest Object NFT (tokenId 100001)

{"tokenAddress": "0x3D8C06e65ebf06A9d40F313a35353be06BD46038", "tokenId": 100001, "amount": 1, "tokenType": 2}

You may also choose not to define a catalyst by entering the following parameter:

{"tokenAddress": "0x0000000000000000000000000000000000000000", "tokenId": 0, "amount": 0, "tokenType": 0}

There are 3 tokenTypes:

  • 0 - for ERC-20 tokens

  • 1 - for ERC-721 tokens

  • 2 - for ERC-1155 tokens

Only Polygon smart contracts are supported!

Artifacts This is the output/crafted Objects of the Craft Recipe - specifically this are the UGC Objects you have created in Step 2. You may define multiple Objects and quantity from the same Collection as well.

  • tokenAddress: The Collection Contract address

  • tokenId: The Object in the Collection to be crafted

  • amount: The number of the Objects to be crafted

[{
  "tokenAddress": "0x27996B7f37a5455E41aE6292fd00d21df1Fb82f1",
  "tokenId": 1,
  "amount": 1
},{
  ...
}]

Creating a Craft Recipe

Example of a successful transaction:

Step 4: Set Crafting Permissions in your Created Collection Contract

In this step, we will be enabling the Craft Recipe in the Collection Contract by allowing the Object to be crafted by the Craft Recipe. Craft Recipe will then appear in the Craft page.

Navigate to your Collection Contract and find the setApprovalForUGCCrafting function with the following parameters:

  • tokenId - The reward Object's tokenId

  • recipeId - The Craft Recipe ID from Step 3.

  • approval - Set to true to enable the Craft Recipe, or false to disable.

Your Craft Recipe will appear in the Craft page when the transaction is submitted. Similarly, disabling the recipe will remove it in the Craft page.

Your new Craft Recipe may take up to an hour to appear in the Craft page.

List of Polygon Contracts

Name
Address

0x8D851B86cD299f9020a529A0975365eCFc1048BB

0x7c79490391a5c0186018c0481c3cef67d7ea1186

In this step, we will be creating a UGC NFT Collection Contract to hold UGC Objects. We will be interacting with the smart contract to achieve this.

Navigate to the UGCCraftableObjectFactory smart contract and execute the Execute the function. You will need to decide on the following parameters:

Example of a successful transaction:

You may verify that the Collection Contract was created successfully by calling the function in the same smart contract with your deployer address.

You will need to upload the images to an IPFS/NFT storage like or .

Note: You may also add additional metadata as per .

Example of a successful transaction:

In this step, we will be creating a Craft Recipe by interacting with the smart contract.

Materials This is the ingredients to a Craft Recipe - , , and Phi UGC Objects are currently the acceptable NFTs. At least one material must be defined. Materials will be consumed/burned when the Craft Recipe is used.

Navigate to the function in UGCCraftLogic and enter the details as shown above. When the Craft Recipe creation is successful, you will obtain a recipeId.

ERC-20 Catalyst:

ERC 721 Catalyst:

ERC 1155 Catalyst:

Example of a successful transaction:

⚡
💎
🥗
UGCCraftableObjectFactory
createUGCCraftableObject
https://polygonscan.com/tx/0xa49db77dcefe3fc69d69cdc6ca9b823ba687122dbff2f804e0aff3c9309cfb17
getDeployedUGCCraftableObjects
https://nft.storage/
Arweave
OpenSea's Metadata Standards
https://polygonscan.com/tx/0xe3e515f855a57107c41c9fa59774fab3fdf11fc68720883d0884dbce458647f0
UGCCraftLogic
Phi Materials
Phi Craft Objects
createRecipe
https://polygonscan.com/tx/0x7850b86f65213151efc4c9d253fcc45392e1a19b76128324b3b7deb4b7307ea1
https://polygonscan.com/tx/0x841373ac1aae42d5e2fb343eec3bc9fd63c17fd2ba44babf4d05ad4f47e053bd
https://polygonscan.com/tx/0xebeb074b84d7a0fcd704d3eb34bab003841dbd84a985313d4881be057f6706eb
https://polygonscan.com/tx/0xcc8ea5d9410d3ff40a016df41fe1a775dd0402cfc9bd18107e01408c2614ab84
UGCCraftableObjectFactory
UGCCraftLogic
Components of a UGC Craft Recipe
Smart contract function to create a Collection
List of Collections created by the deployer address
Create an Object with the NFT metadata URI
Creating a Craft Recipe
Allow the Object to be crafted by the Craft Recipe