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
  • Create PhiMap Flow
  • Map Size
  • Philand require Object-whitelist
  • Freeze method
  • Map initialization
  • SmartContract also make Philand.

Was this helpful?

  1. DEVELOPERS
  2. Use PhiMap

Appendix

This page covers the details of the implementation of Philand.

PreviousView FunctionNextPhiland API

Last updated 2 years ago

Was this helpful?

Create PhiMap Flow

Users need to have the ENS controller. The creation of a new Philand contract is initiated by receiving a "create" message from the Registry contract.

Philand is implemented as an upgradeable contract using the AccessControlUpgradeable.sol from the OpenZeppelin contracts-upgradeable library.

Map Size

Let's also comment on our map size.

As you can see. when creating a contract, a map of size is set to 8 * 8.

constructor() initializer {}

    function initialize(address admin) external initializer {
        numberOfLand = 0;
        // Set the x- and y-axis ranges of the map
        mapSettings = MapSettings(0, 8, 0, 8);
        isMapLocked = false;
        __AccessControl_init();
        _setupRole(DEFAULT_ADMIN_ROLE, admin);
    }

— A smaller PhiLand will fill up quicker, with less objects. Users will feel they have control and agency over their land right from the get-go.

— A smaller land is easier to show off on social media. This is especially important. The higher detailed bigger lands are harder to look good. We don't want a lot of barren Phi Land shots shared on social media. Things should look great quick!

Philand require Object-whitelist

The objects used in PhiMap are required to be registered on the whitelistObject states in Philand. In other words, contracts that are not registered in phimap are not allowed to write.

    /**
     * @dev Set the address of the object for whitelist.
     */
    function setWhitelistObject(address newObject) external onlyOwner {
        _whitelist[newObject] = true;
        emit WhitelistGranted(msg.sender, newObject);
    }

    /**
     * @dev remove the address of the object from whitelist.
     */
    function removehitelistObject(address oldObject) external onlyOwner {
        _whitelist[oldObject] = false;
        emit WhitelistRemoved(msg.sender, oldObject);
    }
 
    
  *** save/ write function uses this whitelist. 
 // Check the contractAddress is whitelisted.
    if (!_whitelist[objectData.contractAddress]) revert InvalidWhitelist();

Freeze method

There is a freeze function in philand that can be used to temporarily stop operations.

    /**
     * @notice Lock map edit action.
     */
    function flipLockMap() external onlyOwner {
        isMapLocked = !isMapLocked;
        emit MapLockStatusChange();
    }
    
    /**
     * @notice Require that map contract has not been locked.
     */
    modifier onlyNotLocked() {
        if (isMapLocked) {
            revert MapIsLocked({ sender: msg.sender });
        }
        _;
    }   

Map initialization

Although the frontend does not have a button for executing this function, the contract has a method for initializing a specific philand. This function is only excecuted by ens owner (philand owner)


    /* -------------------------------- INITIALIZATION -------------------------- */
    /*
     * @title mapInitialization
     * @notice Function for clear user's map objects and links
     * @param name : ens name
     * @dev [Carefully] This function init objects and links
     */
    function mapInitialization(string memory name) external onlyNotLocked onlyPhilandOwner(name) {
        uint256 objectLength = userObject[name].length;
        ObjectInfo[] memory _userObjects = userObject[name];
        for (uint256 i = 0; i < objectLength; ++i) {
            if (_userObjects[i].contractAddress != address(0)) {
                _removeObjectFromLand(name, i);
            }
        }
        delete userObject[name];
        emit MapInitialization(name, msg.sender);
    }

SmartContract also make Philand.

If a smart contract has ens controller, it can also create philand contracts. it can be managed and operated from the contract. This system allows for multiple user usecases, game features, etc...

Registry: '0x6532B97295a0728880AE81D5CD7248f32E24e39a',

PhiMap: '0xe8b6395d223C9D3D85e162f2cb2023bC9088a908',

⚙️
🛠️
💡
https://polygonscan.com/address/0x6532B97295a0728880AE81D5CD7248f32E24e39a
https://polygonscan.com/address/0xe8b6395d223C9D3D85e162f2cb2023bC9088a908
https://github.com/PHI-LABS-INC/contract-philand/blob/main/contracts/Ensmap.sol
Simple flow of creat philand
8 * 8 Size is easy to use