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#L110functionisApprovedForAll(address account,address operator) publicviewoverridereturns (bool) {if (operator == phiMapAddress) {returntrue; }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".
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.)
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. */functionsetOwner(address newOwner) externalvirtualonlyOwner { _owners[newOwner] =true;emitOwnershipGranted(msg.sender, newOwner); }/** * @dev Remove the address of the owner list. */functionremoveOwner(address oldOwner) externalvirtualonlyOwner { _owners[oldOwner] =false;emitOwnershipRemoved(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 standardfunctionroyaltyInfo(uint256,uint256 salePrice)externalviewoverridereturns (address receiver,uint256 royaltyAmount) {return (address(this), (salePrice * secondaryRoyalty) /10000); }/// @notice Receive royaltiesreceive() externalpayable {addToOwnerBalance(msg.value); }/// @notice Adds funds to the payment balance for the owner./// @param amount The amount to add to the balance.functionaddToOwnerBalance(uint256 amount) internal {emitPaymentReceivedOwner(amount); paymentBalanceOwner += amount; }/* ---------------------------------- ADMIN --------------------------------- *//// @notice set primary market ratio.functionsetRoyalityFee(uint256 newRoyalityFee) externalonlyOwner { royalityFee = newRoyalityFee;emitSetRoyalityFee(newRoyalityFee); }functionsetSecondaryRoyalityFee(uint256 newSecondaryRoyalty) externalonlyOwner { secondaryRoyalty = newSecondaryRoyalty;emitSetSecondaryRoyalityFee(newSecondaryRoyalty); }/// @notice Sends you your full available balance./// @param withdrawTo The address to send the balance to.functionwithdrawOwnerBalance(address withdrawTo) externalonlyOwnernonReentrant {require(withdrawTo !=address(0),"cant set address(0)");if (paymentBalanceOwner ==0) revertPaymentBalanceZero();uint256 balance = paymentBalanceOwner; paymentBalanceOwner =0; (bool success, ) = withdrawTo.call{ value: balance }("");if (!success) revertPaymentBalanceZero();emitPaymentWithdrawnOwner(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.