ERC721P Jingzhe: Code is Law

PandaDAO
6 min readJul 11, 2022

--

— — by @hellopandadao, @duloti53 & Tuna

rpc.club

ERC721P, or ERC721 Panda in its full name, is a decentralized NFT swap protocol developed by PandaDAO and currently being audited by SlowMist.

The discussion of our own NFT project started around Jingzhe, one of the 24 Chinese solar terms where insects wake up from hibernation, at the end of March. Back then, the idea of ERC721P has yet formed, and the design of our NFT was also completely different from what we have now. To commemorate our past efforts and hope for an end to this absolute winter of a market, we have decided to name the first version of ERC721P Jingzhe.

The Panda DAO team believes greatness is not created by a person or an entity, but by an all-encompassing and sound underlying logic. That’s why since the inception of ERC721P, our guiding ethos has always been “Code is Law”.

PandaDAO’s first PFP collection, Random Panda Club (represented as RPC) will also be the first project to implement ERC721P. The name of the collection, RPC, is to commemorate the randomness of great things in our lives, such as the creation of Earth, the inception of life and the endless possibilities of web3.

For the rest of this article, we will give a deep introduction to ERC721P, using RPC as an example. As more collections adopt ERC721P, the content will be different, but the underlying logic will remain the same because Code is Law.

Critical Issues in The NFT Market

Low Liquidity

The problem of low liquidity has been a thorn at its back since the inception of NFT. When floor price starts to tank, the liquidity crisis becomes incredibly acute. Even if a collection is backed by a treasury, once the price deviates too far from the backing value, the liquidity issue emerges again.

HODL… And Then?

Royalties always go to the marketplaces and the founding team, never the holders. The only way to make money is to flip your NFT and sell it to the bigger fool. Not only does this makes NFTs a zero-sum game, but it also discourages people to hold NFTs long-term.

Fatigue

When we buy NFTs, we often choose the one that fits our taste. However, taste changes, and we start to look for something new.

ERC721P is made to solve these issues.

  • Giving NFTs intrinsic value leads to arbitrage opportunities, which would attract liquidity looking to capitalize on the price difference
  • The Swap provides users with an alternative liquidation option that won’t affect the floor price
  • The ERC721P-ERC20 LP design will push up the backing price whenever someone interacts with the contract, making HODLing a viable strategy
  • Reborn gives users a chance to obtain more desirable NFTs
How NFT and ERC20 Tokens Interact in ERC721P

ERC721P, A Decentralized Swap Protocol

The Swap

Every RPC NFT will be backed by 50,000 $PANDA when the contract goes live. Holders may exchange one RPC for 50,000 $PANDA, and vice versa. Since Panda DAO is deploying the treasury to buy back $PANDA at $0.005 each, each RPC has an intrinsic value of $250 USD. Once the backing pool collects more $PANDA from contract interactions, the intrinsic value will also grow as a result.

With this design, there is an arbitrage opportunity in the RPC market.

If floor price < RPC’s intrinsic value:

If floor price > RPC’s intrinsic value

However, this arbitrage opportunity will be unavailable when the amount of NFT in the LP falls below the minimum requirement of 1,000 RPCs.

Rising Tides

Another key feature of ERC721P is the 7.5% transaction fee for every interaction with the LP, such as The Swap. Of the 7.5%, half of it will be put into the LP to increase the backing price of the NFT, while the other half will be transferred to the community treasury for the NFT’s future development, such as the cost to maintain Chainlink’s oracle and future airdrops. Under this mechanism, the longer you hold an NFT, the more backing tokens you receive, and the higher your return. Under the same logic, the earlier you redeem an NFT from the LP, the fewer tokens you have to spend.

NFT to ERC20 Swap Transaction Cost Equation

Reborn

Last but certainly not least, the final piece to the ERC721P puzzle, is Reborn. Assuming you have a low rarity score NFT, or maybe you want a flashier NFT, you can use Reborn to exchange your original NFT for a new one. Since we are using Chainlink’s oracle for this feature, the outcome will be completely random. The chance of getting a 1/1 and an ordinary NFT will be exactly the same.

How NFT Reborn Affects The Backing Pool

In the future, PandaDAO plans to add blue chips like BAYC, Doodles, and Azuki into the LP, available to all holders. This update will be executed as ERC721P 2.0 goes live.

Just like the Swap feature, NFT Reborn will take 7.5% backing value as transaction cost, half for the treasury, and half for the LP.

In summary, the goal of ERC721P is to provide RPC holders a safety net using the treasury they helped build up, regardless of the market condition. By enabling holders to exit their positions without dumping the market, the price of RPC can be safely supported.

ChainLink’s Role in ERC721P

Two of the main features of ERC721P, Swap, and Reborn, rely on completely random outcomes. To achieve this, we have implemented ChainLink’s Variable Random Function (VRF2.0) into the contract. The outcome of VRF2.0 is produced alongside a block, meaning that no one will know the answer preemptively, thus preventing an attack.

During testing, we noticed that the complicated logic of fulfillRandomWords inside Chainlink VRF substantially increased the failure rate of contract execution. At the same time, since the gas fee for these executions can’t be accurately predicted when random requests are sent out, it is crucial to minimize the gas cost of contract executions. After careful consideration, we decided that the contract will only be responsible for storing these random words, and leave the subsequent NFT Transfer to the holders.

Also, even after a great amount of simplification of the execution logic of the contract, there is still a chance for VRF to fail in extreme scenarios. When the situation arises, PandaDAO’s multi-sig wallet will initiate a backup RNG, Commit Reveal. The generation of random words will solely rely on the random salt submitted by the client and the hash from miners. The chance to execute malicious actions based on the random word outcome is close to zero.

In simple terms, if you come across a VRF failure when using Reborn or redeeming an NFT from the LP, you can file a ticket and provide on-chain proof of said failure. After the team authenticates this event, we will provide you with a WL and allow you to create a new random word using Commit Reveal.

Logic Graph of NFT Reborn

The Next Step for ERC721P

With the creation of ERC721P, Panda DAO can:

  • Give NFTs intrinsic value in ERC20 tokens, so you never have to HODL to zero again
  • Attract liquidity with arbitrage opportunities
  • The Swap allows innocent holders of compromised NFTs to put them back into the pool and receive a clean NFT instead

There are many use cases for ERC721P waiting to be explored. Perhaps the Reborn system can resurrect “dead” NFTs back to life? Or maybe when ERC721P is adopted on a larger scale, the entire market will become much more liquid and vibrant.

We believe ERC721P’s future will be decentralized, determined not by a single entity, but by the entire market. What PandaDAO is focused on is optimizing the contract to perfection, so that no matter how the market, the community, or even the internet changes, the code still lives on. By removing an individual’s ability to tamper with the underlying logic of the code, we can finally evolve from “founder’s will is law” to “code is law”.

--

--