The 404 Revolution: Opening the Purse Box | Part 1

Purse
Purse.Land
Published in
5 min readJun 7, 2024

--

The purpose of this article is to describe in detail how PURSE-404 differs from other 404 tokens and to provide sufficient documentation for holders to understand how PURSE-404 works.

Rationale

PURSE-404 was inspired by Pandora’s ERC404. The two most popular implementations of the dual-natured token are ERC404 and DN404. Between ERC404 and DN404, the development team picked the former as the inspiration for PURSE-404

“When the team was first designing PURSE as a 404 token, the question the team sought to answer was: is it possible to upgrade an existing ERC20 token to a 404 token?“

Due to the design of ERC404 and DN404 contracts, the team determined it was not able to use them directly in an upgrade since these contracts are not designed for upgrading an existing ERC20 token in the first place.
Using either ERC404 or DN404 contracts to implement a 404 token would ultimately require the team to deploy a brand new token altogether, which is what the team wants to avoid.

The solution was simple: preserve the underlying ERC20 token and build the dual nature logic on top of the existing code.

The result of this endeavor is an upgraded version of PURSE that behaves like a typical 404 dual-natured token but with a slight difference in the accounting of balances and the way NFTs are minted.

High-Level Architecture

At a very high level, the architecture of PURSE-404 can be illustrated as such:

The underlying logic for PURSE as an ERC20 token remains unchanged from before, and logic to enable PURSE to function also as an ERC721 token was added down the inheritance chain to enable PURSE to behave as a dual-natured token.

Changes to PURSE

There are 6 major changes on the PURSE-404 Upgrade

  1. Accounting of Balances
  2. Minting
  3. Transferring Purse
  4. Maintaining Purse NFT
  5. NFTs in Queue
  6. Token IDs

Accounting of Balances

PURSE now accounts for 2 types of balances:

  • Inactive Balance: Refers to the amount of PURSE(ERC20) that an address has
  • Active Balance: Refers to the ERC20 value of PURSE(ERC721) that an address has
  • Total Balance: Refers to the sum of Inactive Balance and Active Balance of an address
  • This also refers to how much PURSE an address still has.

An address’s total balance of PURSE at any given point in time would be the sum of its Inactive Balance and Active Balance.

An inactive balance represents PURSE that has not been used to mint PURSE NFTs, while an active balance represents the ERC20 value of the total number of NFTs the address currently holds.

The accounting of an address’s Inactive Balance and Active Balance of PURSE follows the general guidelines:

  1. ERC20-related transfers update the Inactive Balance.
  2. ERC721-related transfers update the Active Balance.
  3. The Total Balance, which is the sum of the Inactive Balance and Active Balance, represents the total amount of PURSE an address can use.
  4. When the Inactive Balance is insufficient to cover an ERC20-related transfer, funds in the Active Balance will be moved to the Inactive Balance to cover the deficit. (NFTs will be removed).
  5. The Active Balance can only be multiples of 1,000,000;
    and 1,000,000 PURSE in the Active Balance represents 1 NFT.

You can learn more about the implementation of these changes on our gitbook.

Minting

When it comes to minting NFTs from a 404 token, most 404 tokens that have been deployed would behave in the following way:
- If an address’s balance reaches the required amount of tokens required to represent 1 NFT, an NFT will be minted to the address automatically.
- No separate transaction from the address is required to mint an NFT.

This is, however, not the case for PURSE.

In PURSE, the minting of a PURSE NFT must be a transaction that an address voluntarily executes. That is, even if an address successfully accumulates enough PURSE tokens, they must still execute the `mintERC721` function successfully in the PURSE contract in order to mint their PURSE NFTs.

The number of NFTs mintable at once would depend on an address’s Inactive Balance and enough $ETH to pay.

The contract only accepts the exact amount of ETH required for the mint transaction; any amount that is not exact will result in a failure to mint the PURSE NFTs.

PURSE required from IB = no. of NFTs to mint * ERC20 equivalent amount for 1 NFT

payable amount in ETH = mintingCost per NFT * no. of NFTs to mint

The rationale behind this design is to give users the flexibility to participate in different token types.

Because of how the underlying ERC20 contract is preserved in PURSE, even if users choose not to mint any PURSE NFTs, PURSE would still function exactly as before — like any other ERC20 token. And if users decide to mint PURSE NFT(s), they can participate in new avenues for trading and asset management.

You can learn more about the implementation of these changes on our gitbook.

Closing the Part 1

This is the end of the 1st part of the article. Thank you for reading the first part of the PURSE-404 update and stay tuned for Part 2.

We will break down the details of the other changes in the next article.

If you’d like to know more about PURSE-404 and stay up-to-date with us, check out any of the links below.

Join PURSE Official Channels

Twitter: https://twitter.com/Purse_Land
Telegram: https://t.me/purse_land
Website: https://purse.land/

--

--

Purse
Purse.Land

Reward token by @PundiXLabs. Created to incentivize #XPOS usage, redeem #NFT’s, expand Pundi X Chain’s ecosystem and increase $PUNDIX value through rewards.