cadence icon indicating copy to clipboard operation
cadence copied to clipboard

Allow Scripts to "Borrow" Resources by ID

Open dete opened this issue 3 years ago • 4 comments

Issue To Be Solved

It's hard for scripts to access the information in Resources if they don't know where they are stored. Often, a Resource's ID is known, but its storage location is not.

Suggested Solution

Allow scripts (and only scripts) to borrow a reference to Resource objects by ID, regardless of where they are stored. This would allow a script to get access to the data about a resource without having to know where it is.

dete avatar Dec 14 '22 21:12 dete

Note: there is a proposed feature of the new NFT standard that would enable loading of metadata for any NFT via its ID. The problem with this is that it encourages metadata storage in the contract instead of in the NFT, which is not aligned with the "resource mindset".

j1010001 avatar Dec 14 '22 22:12 j1010001

@j1010001 metadata has to be stored in the contract actually. (i am not sure if any contract store in the resource)

@dete this is great feature, but it is too tricky , basically flow-go has to be resource aware. Ofc can make ugly solutions here (cadence alerting flow-go when resource saved, moved etc)

This is dream come true

bluesign avatar Dec 15 '22 17:12 bluesign

Would really love to see this.

bjartek avatar Jan 06 '23 12:01 bjartek

wrote a forum post about storage fees ( softly touching this topic ) https://forum.onflow.org/t/storage-fees-improvements-and-few-random-ideas-on-the-way/5104

bluesign avatar Aug 18 '23 19:08 bluesign