kadena-io / marmalade

Decentralized Infrastructure for Poly-Fungibles and NFTs
24 stars 16 forks source link

Token Creation #154

Closed daplcor closed 10 months ago

daplcor commented 1 year ago

Context (Environment)

Simplification and future-proofing the token creation process.

Detailed Description

When running create-token-id, several pieces of information are necessary. On the surface, this isn't an issue, but over time, changes have been made to this process. Virtually every use case we use has no value in hashing {token-details}, and it overcomplicates mass minting and autonomous minting operations. With the further addition of chainId in the mix, it further creates unnecessary pain points. At this time, we are protecting minting by the introduction of the creator guard, where uri and guard are hashed. This is a safe way to protect from hijacking.

Right now, we are defining a schema to follow, providing a guard outside of the token schema, and then introducing the more problematic piece by automatically adding the chainId. When running larger operations, this adds unnecessary complexity and possibilities for failure.

Possible Implementation

remove the current token-details and simply hash uri and guard.

(defschema token-details uri:string precision:integer policies:[module{kip.token-policy-v2}] )

Update this function (defun create-token-id:string (token-details:object{token-details} creation-guard:guard) (format "t:{}" [(hash [token-details (at 'chain-id (chain-data)) creation-guard])]) )

to something simpler that only hashes {'token:token-uri, 'guard:creation-guard}

jermaine150 commented 10 months ago

Thanks for the feedback! The data that is included in the token id creation has been deliberately selected to tackle current, but also future features of Marmalade, for example, cross-chain transfers. Therefore I'm closing this issue, since we won't be making any changes to this.