Skip to content

marryinweb3/ERC721-520

Repository files navigation

two-logo

line

ERC721-520 Token — A SBTs Implementation

Mainnet Contract (Marry3 Certificate):https://etherscan.io/token/0x70c82f15103f972ab058eca784c45dcdcf53b5c2

On May 20, 2022, this ERC721-520 core contract will be deployed to the Ethereum chain, and the world's first pair of Marry3 Certificates will be minted for my lover

This day is our 7th wedding anniversary, the 8th anniversary of our relationship, and the first day of our marriage in the Web3 world. Wish all future "addresses" receive blessings from contracts here!

The naming of ERC721-520 is derived from this, it's a ERC721 extension and SBTs special implement.

line

This is a specification based on the ERC721 standard that defines a necessary intimacy in the web3 world: marriage. Its valid certificate is the token in this contract. You or other products can query the pairing status and past records of any address through the official contract, official website, etc.

ERC721-520 Token is an implementation of NFT-like Soulbound Token Vitalik's Blog Post about Soulbound

  • implement from erc721, most NFT usage scenarios are seamlessly compatible
  • non-transferable and non-sellable, one person can only have one valid Token at the same time.
  • mint paired soulbound token through multi-signature flow, Mint will issue 2 Soulbound Tokens at one time.
  • can be destroyed through multi-signature flow, and new Soulbound Token can be minted with other addresses after burn.

line

Marry3 Certificate

Marry3 (Marry in Web3) Certificate is just a basic and core contract implemented through the ERC721-520 protocol.

Around it, Marry3 DAPP will implement a series of application contracts, including but not limited to:

  • Register the contract. Verify user identity and realize multi-signature common registration, registration record, payment, rebate and other capabilities.
  • Multi-signature contracts. Through the binding relationship of ERC721-520 Token, the multi-signature agreement is transformed to realize the compatibility of multi-signature wallets.
  • Deposit contracts. Through ERC20 Token and multi-signature contracts, applications such as deposit and withdrawal can be realized.
  • Shared contracts. The binding relationship can be written and used by other third parties to open up the identity ecology.

Overall structure:

line

Standard

this token is base on ERC721 standard, and add some new feature:

new features:

  • Two addresses: The two addresses must be together to mint the token
  • Two certificates: two tokens will be mint at a time: two certificates
  • No bigamy: An address can only be mint with one address at the same time. After mint, it cannot be mint again. You need to call divorce (divorce) to destroy the two tokens mint from the two.
  • No derailment: ERC721-520 tokens cannot be transferred and can only be held by the minter
  • Divorce: ERC721-520 tokens can be negotiated and destroyed. The process is similar to mint. After destruction, new tokens can be minted with other addresses.
  • No gender restrictions: anyone of any gender can get married

new functions:

  • mint: Mint two tokens at the same time through two addresses and assign them to two addresses respectively
  • Through any token, you can query the specific information of the two tokens
  • The user's marriage and divorce records are recorded in the contract, which can be queried
  • Check: Pass in two addresses to check whether they are in the registered state
  • Look up the marriage records of an address

line

Test Case

  • ✓ correctly checks all the supported interfaces
  • ✓ correctly mints two NFT for A and B
  • ✓ throws when trying to get count of NFTs owned by 0x0 address
  • ✓ throws when trying to mint nft second time for A
  • ✓ throws when trying to mint nft second time for B
  • ✓ throws when trying to mint NFT to 0x0 address
  • ✓ finds the correct owner of NFToken id
  • ✓ check pair
  • ✓ check pair
  • ✓ throws when trying to find owner od non-existing NFT id
  • ✓ throws when transfers NFT from owner
  • ✓ correctly burns two NFTs for A and B
  • ✓ correctly burns two NFTs for A and B and mint again
  • ✓ throws when trying to burn non existent NFT

line

Requirements

  • NodeJS 12+ is supported
  • Windows, Linux or macOS

line

Installation

npm

This is the recommended installation method if you want to use this package in your JavaScript project.

This project is released as an npm module. You must install it using the npm command:

$ npm install ERC721-520

Source

This is the recommended installation method if you want to improve the nibbstack/ERC721-520 project.

Clone this repository and install the required npm dependencies:

$ git clone git@github.com:marryinweb3/ERC721-520.git
$ cd ERC721-520
$ npm install

Make sure that everything has been set up correctly:

$ npm run test

line

Licence

See LICENSE for details.