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
  • For UX, all Object initially use setApproveForAll to PhiMap contract
  • Control Sale Status by SetOpenForSale Method
  • PhiShop
  • MultiOwner
  • EIP2981
  • MetaMaterial

Was this helpful?

  1. DEVELOPERS
  2. Objects NFT

Other Topics

UX, Security, Future...

For UX, all Object initially use setApproveForAll to PhiMap contract

This function returns whether a specific account is approved by a specific operator for all tokens. If the operator is equal to phiMapAddress, the function always returns true.

    // this method always allow PhiMap contract to move Object
    // then users don't need to call `setApprovalForAll`
    // reference: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/ERC1155.sol#L110
    function isApprovedForAll(address account, address operator) public view override returns (bool) {
        if (operator == phiMapAddress) {
            return true;
        }
        return super.isApprovedForAll(account, operator);
    }

We introduce superApprove for UX perspective. These are all implemented in object contracts(Quest, Premium, Free, Wallpaper, and Baseplate).

Control Sale Status by SetOpenForSale Method

This function called "setOpenForSale" takes two arguments: a token ID of type "uint256" and a boolean value "check". The function sets the "forSale" property of the object with the specified token ID to the value of "check".

function setOpenForSale(uint256 tokenId, bool check) public virtual onlyOwner {
        allObjects[tokenId].forSale = check;
        emit SetOpenForSale(tokenId, check);
    }

With this function, we can control whether a user can claim or not. Essentially, we respect the community's opinion, but we might change it.

PhiShop

You can bulk purchase Objects other than Quest Object and also deposit to Map at the same time. (*Gas fees may be expensive when Polygon network is congested especially operate many objects.)

     /*
     * @title shopBuyAndDepositObject
     * @param receiverAddress : receive address
     * @param ftokenIds : free object tokenId list
     * @param ptokenIds : premium object tokenId list
     * @param wtokenIds : wallpaper tokenId list
     * @param depositContractAddresses : array of deposit contract addresses
     * @param depositTokenIds :  array of deposit token ids
     * @param depositAmounts :  array of deposit amounts
     */
    function shopBuyAndDepositObject(
        string memory name,
        uint256[] memory ftokenIds,
        uint256[] memory ptokenIds,
        uint256[] memory wtokenIds,
        uint256[] memory btokenIds,
        address[] memory depositContractAddresses,
        uint256[] memory depositTokenIds,
        uint256[] memory depositAmounts
    ) external payable nonReentrant

MultiOwner

All object contracts are managed by Owners. Currently, only timelock contracts have owner privileges. Methods with the 'onlyowner' modifier can only be executed through the Timelock contract.

    /**
     * @dev Set the address of the owner.
     */
    function setOwner(address newOwner) external virtual onlyOwner {
        _owners[newOwner] = true;
        emit OwnershipGranted(msg.sender, newOwner);
    }

    /**
     * @dev Remove the address of the owner list.
     */
    function removeOwner(address oldOwner) external virtual onlyOwner {
        _owners[oldOwner] = false;
        emit OwnershipRemoved(msg.sender, oldOwner);
    }

EIP2981

EIP2981 is a proposal for a royalty payment mechanism in the Ethereum network.

The proposal specifies a way for contract creators to receive a share of the transaction fees when their contracts are used. This would allow creators to be rewarded for their contributions to the Ethereum ecosystem. All object contracts have royalty functions based on EIP2981.

    /* -------------------------------------------------------------------------- */
    /*                                  ROYALTIES                                 */
    /* -------------------------------------------------------------------------- */
    /* --------------------------------- PUBLIC --------------------------------- */
    /// @notice EIP2981 royalty standard
    function royaltyInfo(uint256, uint256 salePrice)
        external
        view
        override
        returns (address receiver, uint256 royaltyAmount)
    {
        return (address(this), (salePrice * secondaryRoyalty) / 10000);
    }

    /// @notice Receive royalties
    receive() external payable {
        addToOwnerBalance(msg.value);
    }

    /// @notice Adds funds to the payment balance for the owner.
    /// @param amount The amount to add to the balance.
    function addToOwnerBalance(uint256 amount) internal {
        emit PaymentReceivedOwner(amount);
        paymentBalanceOwner += amount;
    }

    /* ---------------------------------- ADMIN --------------------------------- */
    /// @notice set primary market ratio.
    function setRoyalityFee(uint256 newRoyalityFee) external onlyOwner {
        royalityFee = newRoyalityFee;
        emit SetRoyalityFee(newRoyalityFee);
    }

    function setSecondaryRoyalityFee(uint256 newSecondaryRoyalty) external onlyOwner {
        secondaryRoyalty = newSecondaryRoyalty;
        emit SetSecondaryRoyalityFee(newSecondaryRoyalty);
    }

    /// @notice Sends you your full available balance.
    /// @param withdrawTo The address to send the balance to.
    function withdrawOwnerBalance(address withdrawTo) external onlyOwner nonReentrant {
        require(withdrawTo != address(0), "cant set address(0)");
        if (paymentBalanceOwner == 0) revert PaymentBalanceZero();
        uint256 balance = paymentBalanceOwner;
        paymentBalanceOwner = 0;

        (bool success, ) = withdrawTo.call{ value: balance }("");
        if (!success) revert PaymentBalanceZero();

        emit PaymentWithdrawnOwner(balance);
    }

MetaMaterial

We love board games and video games... In the past, we have tried a theme in Encode Hackthon and published it as a MetaMaterial. Of course, we also think that it is one feature element that may be deployed in PHI.

PreviousWallpaper ObjectNextAppendix

Last updated 2 years ago

Was this helpful?

PhiShop: '0xc6E5240054DBE92BDe25546cF0C72dC499c41Ca8'

โš™๏ธ
๐ŸŽจ
๐Ÿ’„
https://polygonscan.com/address/0xc6E5240054DBE92BDe25546cF0C72dC499c41Ca8
๐Ÿ“„Contracts
Polygon-phi-contract/MultiOwner.sol at main ยท PHI-LABS-INC/Polygon-phi-contractGitHub
Logo