Coder Social home page Coder Social logo

Identity View about flow-nft HOT 10 CLOSED

onflow avatar onflow commented on June 26, 2024 2
Identity View

from flow-nft.

Comments (10)

bjartek avatar bjartek commented on June 26, 2024

Come to think of it, a lot of the information here is already accessible runtime from a &{MetadataViews.Resolver} reference like id, type and uuid. So maybe this could just boil down to a Minteror Source view that discriminates who really minted this, if the contract supports multiple minters.

On the other hand, what if the resource in question here is a wrapper, how do you then expose the data from the underlying resource it wraps?

from flow-nft.

bjartek avatar bjartek commented on June 26, 2024

Come to think of this even more, I do not belive id is present in &{MetadatViews.Resolver} so i still think this is a good idea.

from flow-nft.

hichana avatar hichana commented on June 26, 2024

@bjartek this is an interesting nut to crack here. How do other chains solve this problem if at all? Or if there is no technical solution a given other chain, how does the community have some consensus on the correct minter?

from flow-nft.

bjartek avatar bjartek commented on June 26, 2024

Well on chains that are not resource oriented a shared contract would give bad resource isolatiob, but on flow resources are owned by users not contracts. So i guess the problem is not there.

from flow-nft.

hichana avatar hichana commented on June 26, 2024

I was thinking like on an evm chain if someone were to clone and deploy a contract, who is to say which one is the 'correct minter'? Maybe that's what the 'discriminator' field here would do?

from flow-nft.

bjartek avatar bjartek commented on June 26, 2024

Wondering if this should contain a nounce and the path an item is stored at. Like this maybe?

/// This view is there to display the Identity of this resource or the resource it has wrapped.
 /// $param id: The id of the resource
 /// $param uuid: The universal id of the resource that is guaranteed to be unique
 /// $param type: The type of the resource, type+id is useful to map to uuid
 /// $param typeIdentifier: A more human readable version of type
 /// $param discriminator: If this resource is a multi tenant like resource like starly/rarible discriminator can be used to discriminate it
 /// $param nounce: A nounce that increases if a item is moved so that you can verify that a pointer to it was made for the given nounce    
 /// $param path: The path a resource is stored in. Very useful if you want to send a resource to somebodies storage.
 pub struct Identity{
     pub let id:UInt64
     pub let uuid: UInt64
     pub let type:Type
     pub let typeIdentifier:String
     pub let discriminator: String
     pub let nounce: UInt64
     pub let path: PublicPath

     init(id:UInt64, uuid:UInt64, type:Type, discriminator:String, nounce: UInt64, path: PublicPath) {
         self.id=id
         self.uuid=uuid
         self.type=type
         self.typeIdentifier=type.identifier
         self.discriminator=discriminator
         self.nounce=nounce
         self.path=path
     }
 }

from flow-nft.

joshuahannan avatar joshuahannan commented on June 26, 2024

@bjartek Can you elaborate a bit more on the discriminator? I'm not sure how that is used to differentiate?

Also, what is stopping someone from faking the discriminator and the nonce?

for path, you're saying that if you had a random generic NFT, you could get the path from it to deposit it without knowing the actual contract it came from?

from flow-nft.

bjartek avatar bjartek commented on June 26, 2024

Discriminator could be used to discriminate things like

  • the minter of a starly card
  • the kind of nft in gaia
  • the kind of nft in mintstore
  • the minter in rarible

Basically all shared contracts that can be grouped on something besides where they happend to be stored.

from flow-nft.

bjartek avatar bjartek commented on June 26, 2024

Nobody is stopping anybody from faking anything no matter the view. I do not see what makes it relevant.

from flow-nft.

bjartek avatar bjartek commented on June 26, 2024

If you know the path you can try to borrow the NFT.Receiver or NFT.CP on that path (not everybody kink them :( )
and deposit the item to somebody else. In things like alchemy and find this is now hard coded everywhere.

from flow-nft.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.