public-awesome / cw-nfts

Examples and helpers to build NFT contracts on CosmWasm
Apache License 2.0
188 stars 180 forks source link

WIP: CW5144-base and CW5144 Package #128

Open gachouchani1999 opened 1 year ago

gachouchani1999 commented 1 year ago

This PR is work in progress and an RFR (Request for Review)

This contract and package comes from the ERC and EIP 5144 specifications for a Soul Bound Token for a non-fungible token that is attached to a Soul (an NFT), rather than an address. I believe this specification should be introduced formally to Cosmwasm as it is a necessity for introducing DeSoc (decentralized society) projects into the Cosmos ecosystem.

This is just the base contract and other developers could build on top of this in order to add other functionalities, such as a recovery function that allows a third party to recover an SBT from a certain NFT (as discussed in the main Vitalik white paper).

Changes:

  1. Removed all instances of transfer, approvals, revokes and operators, and burn, which includes queries, executes, and any related function.
  2. Created a Soul struct which is the NFT that the SBT is bounded to rather than an address. Owner is now a Soul rather than an Addr.
  3. Tests are changed to accomodate to the above changes and they all pass.
  4. In order to be able to query through a Multi-index, a Soul has an implementation to get a key string in that form: {nft_address}_{token_id}
  5. Tried to fix linting/warnings as much as possible.
  6. README for CW5144 is still a WIP and incomplete.