bitmark-inc / bitmark-protocol

1 stars 1 forks source link

Create IID templates #4

Open nodestory opened 3 years ago

nodestory commented 3 years ago

Acceptance criteria:

nodestory commented 3 years ago

Example of CryptoKitties

{
  "@context": [
    "https://internft.org/ns/token/v1"
  ],
  "@type": "token:template",
  "classBehavior": [
    {
      "idTemplate": "did:abc:token:${id}#mint",
      "path": "did:abc:token:${id}/mint",
      "type": "token:internalCall",
      "authorizedCaller": [
        "#ceoAddress",
        "#cooAddress",
        "#cfoAddress"
      ]
    },
    {
      "idTemplate": "did:abc:token:${id}#mintPromo",
      "path": "did:abc:token:${id}/mintPromo",
      "type": "token:internalCall",
      "authorizedCaller": [
        "#ceoAddress",
        "#cooAddress",
        "#cfoAddress"
      ]
    }
  ],
  "classProperty": [
    {
      "idTemplate": "did:abc:token:ck#controller",
      "type": "token:controller",
      "value": "LITERAL_COSMOS_ADDRESS",
      "mutable": true
    },
    {
      "idTemplate": "did:abc:token:${id}#ceoAddress",
      "type": "token:cosmosAddress",
      "value": "LITERAL_COSMOS_ADDRESS",
      "mutable": true
    },
    {
      "idTemplate": "did:abc:token:${id}#cfoAddress",
      "type": "token:cosmosAddress",
      "value": "LITERAL_COSMOS_ADDRESS",
      "mutable": true
    },
    {
      "idTemplate": "did:abc:token:${id}#cooAddress",
      "type": "token:cosmosAddress",
      "value": "LITERAL_COSMOS_ADDRESS",
      "mutable": true
    }
  ],
  "tokenBehavior": [
    {
      "idTemplate": "did:abc:token:ck:${token:tokenId}#update",
      "path": "did:abc:token:ck:${token:tokenId}/update",
      "handler": "/token/update",
      "type": "token:internalCall",
      "authorizedCaller": "token:owner"
    },
    {
      "idTemplate": "did:abc:token:ck:${token:tokenId}#send",
      "path": "did:abc:token:ck${token:tokenId}/send",
      "type": "token:internalCall",
      "handler": "/token/send",
      "authorizedCaller": "token:owner"
    },
    {
      "idTemplate": "did:abc:token:ck:${token:tokenId}#sendZ",
      "path": "did:abc:token:ck:${token:tokenId}/sendZ",
      "type": "token:authorizedCall"
    }
  ],
  "tokenProperty": [
    {
      "idTemplate": "did:abc:token:#id",
      "type": "token:uint256",
      "mutable": false,
      "valueTemplate": "${id}"
    },
    {
      "idTemplate": "did:abc:token:${id}#genes",
      "type": "token:uint256",
      "mutable": false
    },
    {
      "idTemplate": "did:abc:token:${id}#birthTime",
      "type": "token:uint64",
      "mutable": false
    },
    {
      "idTemplate": "did:abc:token:${id}#cooldownEndBlock",
      "type": "token:uint64",
      "mutable": "internally"
    },
    {
      "idTemplate": "did:abc:token:${id}#matronId",
      "type": "token:uint32",
      "mutable": false
    },
    {
      "idTemplate": "did:abc:token:${id}#sireId",
      "type": "token:uint32",
      "mutable": false
    },
    {
      "idTemplate": "did:abc:token:${id}#siringWithId",
      "type": "token:uint32",
      "mutable": "internally"
    },
    {
      "idTemplate": "did:abc:token:${id}#cooldownIndex",
      "type": "token:uint16",
      "mutable": "internally"
    },
    {
      "idTemplate": "did:abc:token:$(id}#generation",
      "type": "token:uint16",
      "mutable": false
    },
    {
      "idTemplate": "did:abc:token:$(id}#owner",
      "type": "token:cosmosAddress",
      "mutable": "internally"
    }
  ]
}
awesome-doge commented 3 years ago
{
    "@context": [
        "https://www.w3.org/ns/did/v1",
        {
            "iid": "https://iidcontext.org/ns/v1"
        },
        {
            "ff": "https://feralfile.com/ns/v1"
        }
    ],
    "@type": "iid:feralfile",

    // 
    "classBehavior": [    
        {
            // Create a new NFT
            "idTemplate": "iid:bmk:${iid:tokenId}#ffcreat",   
            "path": "iid:bmk:${iid:tokenId}/ffcreat",
            "type": "iid:internalCall",
            "authorizedCaller": [
                // Address 
                "iid:bmk:${iid:tokenId}#issuingcompanypublickey", 
                // Address 
                "iid:bmk:${iid:tokenId}#artworkauthorpublickey" 
            ]
        },
        {
            // Update NFT
            "idTemplate": "iid:bmk:${iid:tokenId}#ffupdate",   
            "path": "iid:bmk:${iid:tokenId}/ffupdate",
            "type": "iid:internalCall",
            "authorizedCaller": [
                // Address 
                "iid:bmk:${iid:tokenId}#issuingcompanypublickey"
            ]
        },
        {
            // Delete NFT
            "idTemplate": "iid:bmk:${iid:tokenId}#ffdelete",   
            "path": "iid:bmk:${iid:tokenId}/ffdelete",
            "type": "iid:internalCall",
            "authorizedCaller": [
                // Address 
                "iid:bmk:${iid:tokenId}#issuingcompanypublickey"
            ]
        },
        {
            // Modify Bitmark Certificate owned by the artwork
            "idTemplate": "iid:bmk:${iid:tokenId}#assignbc",   
            "path": "iid:bmk:${iid:tokenId}/assignbc",
            "type": "iid:internalCall",
            "authorizedCaller": [
                // Address 
                "iid:bmk:${iid:tokenId}#issuingcompanypublickey"
            ]
        },

    ],
    //
    "classProperty": [ 
        {
            // Issuing company name
            "idTemplate": "iid:bmk:${iid:tokenId}#issuingcompanyname", 
            "type":"iid:uint16",
            "value":"LITERAL_BITMARK_ADDRESS",
            "mutable":true
        },
        {
            // Issuing company public key
            "idTemplate": "iid:bmk:${iid:tokenId}#issuingcompanypublickey", 
            "type":"iid:uint256",
            "mutable":true
        },
        {
            // Issuing company signature
            "idTemplate": "iid:bmk:${iid:tokenId}#issuingcompanysignature", 
            "type":"iid:uint256",
            "mutable":true
        },
        {
            // Artwork author name
            "idTemplate": "iid:bmk:${iid:tokenId}#artworkauthorname", 
            "type":"iid:uint256",
            "mutable":true
        },
        {
            // Artwork Author Public Key
            "idTemplate": "iid:bmk:${iid:tokenId}#artworkauthorpublickey", 
            "type":"iid:uint256",
            "mutable":true
        },
        {
            // Artwork Author signature
            "idTemplate": "iid:bmk:${iid:tokenId}#rtworkauthorsignature", 
            "type":"iid:uint256",
            "mutable":true
        },
        {
            // Bitmark Certificate owned by the artwork
            "idTemplate": "iid:bmk:${iid:tokenId}#artworkbc", 
            "type":"iid:uint256",
            "mutable":true
        },

    ],
    // 
    "tokenBehavior": [
        {
            // Transfer artwork
            "idTemplate": "iid:bmk:${iid:tokenId}#transfer",  
            "path": "iid:bmk:${iid:tokenId}/transfer",
            "type": "iid:internalCall",
            "handler": "/token/transfer",
            "authorizedCaller": [
                "iid:bmk:${iid:tokenId}#ownerpublickey"
            ]
        },

    ],
    // 
    "tokenProperty": [  
        {     
            // Artwork Token ID
            "idTemplate":"iid:bmk:${iid:tokenId}#artworktokenid",    
            "type" : "iid:uint256",
            "mutable" : false,
            "valueTemplate" : "${iid:artworktokenid}"
        },
        {     
            // Artwork name
            "idTemplate":"iid:bmk:${iid:tokenId}#artworkname",    
            "type" : "iid:uint256",
            "mutable" : false,
            "valueTemplate" : "${iid:artworkname}"
        },
        {     
            // Artwork description
            "idTemplate":"iid:bmk:${iid:tokenId}#artworkdescription",    
            "type" : "iid:uint256",
            "mutable" : false,
            "valueTemplate" : "${iid:artworkdescription}"
        },
        {     
            // Total number of issued
            "idTemplate":"iid:bmk:${iid:tokenId}#totalnumberofissued",    
            "type" : "iid:uint256",
            "mutable" : false,
            "valueTemplate" : "${iid:totalnumberofissued}"
        },
        {     
            // Issue number
            "idTemplate":"iid:bmk:${iid:tokenId}#issuenumber",    
            "type" : "iid:uint256",
            "mutable" : false,
            "valueTemplate" : "${iid:issuenumber}"
        },
        {     
            // Owner public key
            "idTemplate":"iid:bmk:${iid:tokenId}#ownerpublickey",    
            "type" : "iid:uint256",
            "mutable" : false,
            "valueTemplate" : "${iid:ownerpublickey}"
        },
        {     
            // Owner signature
            "idTemplate":"iid:bmk:${iid:tokenId}#ownersignature",    
            "type" : "iid:uint256",
            "mutable" : false,
            "valueTemplate" : "${iid:ownersignature}"
        },
        {     
            // Encoding method
            "idTemplate":"iid:bmk:${iid:tokenId}#encodingmethod",    
            "type" : "iid:uint256",
            "mutable" : false,
            "valueTemplate" : "${iid:encodingmethod}"
        },
        {     
            // Document target path
            "idTemplate":"iid:bmk:${iid:tokenId}#documenttargetpath",    
            "type" : "iid:uint256",
            "mutable" : false,
            "valueTemplate" : "${iid:documenttargetpath}"
        },
        {     
            // Artwork file format
            "idTemplate":"iid:bmk:${iid:tokenId}#artworkfileformat",    
            "type" : "iid:uint256",
            "mutable" : false,
            "valueTemplate" : "${iid:artworkfileformat}"
        },
        {     
            // Artwork hash
            "idTemplate":"iid:bmk:${iid:tokenId}#artworkhash",    
            "type" : "iid:uint256",
            "mutable" : false,
            "valueTemplate" : "${iid:artworkhash}"
        },
        {     
            // Artwork issuing time
            "idTemplate":"iid:bmk:${iid:tokenId}#artworkissuingtime",    
            "type" : "iid:uint256",
            "mutable" : false,
            "valueTemplate" : "${iid:artworkissuingtime}"
        }
    ]
}
awesome-doge commented 3 years ago
截圖 2021-06-07 下午1 35 08 截圖 2021-06-07 下午1 35 44
awesome-doge commented 3 years ago

Bitmark Certificate template

{
    "@context": [
        "https://www.w3.org/ns/did/v1",
        {
            "iid": "https://iidcontext.org/ns/v1"
        },
        {
            "ff": "https://feralfile.com/ns/v1"
        }
    ],
    "@type": "iid:bitmarkcertificate",
    // 
    "classBehavior": [    
        {
            // Create Bitmark Certificate
            "idTemplate": "iid:bmk:${iid:tokenId}#createbc",   
            "path": "iid:bmk:${iid:tokenId}/create",
            "type": "iid:internalCall",
            "authorizedCaller": [
                // Address 
                "iid:bmk:${iid:tokenId}#bcissuer", 
                // Address 
                "iid:bmk:${iid:tokenId}#artworkauthorpublickey" 
            ]
        },
        {
            // Update Bitmark Certificate
            "idTemplate": "iid:bmk:${iid:tokenId}#updatebc",   
            "path": "iid:bmk:${iid:tokenId}/updatebc",
            "type": "iid:internalCall",
            "authorizedCaller": [
                // Address 
                "iid:bmk:${iid:tokenId}#artworkauthorpublickey" 
            ]
        },
        {
            // Delete Bitmark Certificate
            "idTemplate": "iid:bmk:${iid:tokenId}#deletebc",   
            "path": "iid:bmk:${iid:tokenId}/deletebc",
            "type": "iid:internalCall",
            "authorizedCaller": [
                // Address 
                "iid:bmk:${iid:tokenId}#artworkauthorpublickey" 
            ]
        }
    ],
    // Certificate Author, Certificate Version, Certificate Title
    "classProperty": [ 
        {
            // Bitmark Certificate issuer
            "idTemplate": "iid:bmk:${iid:tokenId}#bcissuer", 
            "type":"iid:uint256",
            "mutable":true
        },
        {
            // Bitmark Certificate issuer public key
            "idTemplate": "iid:bmk:${iid:tokenId}#bcissuerpublickey", 
            "type":"iid:uint256",
            "mutable":true
        },
        {
            // Bitmark Certificate issuer signature
            "idTemplate": "iid:bmk:${iid:tokenId}#bcissuersignature", 
            "type":"iid:uint256",
            "mutable":true
        },
        {
            // Bitmark Certificate Author
            "idTemplate": "iid:bmk:${iid:tokenId}#bcauthor", 
            "type":"iid:uint256",
            "mutable":true
        },
        {
            // Bitmark Certificate Author Public Key
            "idTemplate": "iid:bmk:${iid:tokenId}#bcauthorpublickey", 
            "type":"iid:uint256",
            "mutable":true
        },
        {
            // Bitmark Certificate Author Signature
            "idTemplate": "iid:bmk:${iid:tokenId}#bcauthorsignature", 
            "type":"iid:uint256",
            "mutable":true
        },
    ],
    // assign Certificate, update assign Certificate
    "tokenBehavior": [
        {
            // Let the artwork have a Bitmark Certificate
            "idTemplate": "iid:bmk:${iid:tokenId}#assignbc",  
            "path": "iid:bmk:${iid:tokenId}/assignbc",
            "type": "iid:internalCall",
            "handler": "/token/transfer",
            "authorizedCaller": [
                "iid:bmk:${iid:tokenId}#issuingcompanypublickey"
            ]
        },
        {
            // Let the artwork update the Bitmark Certificate
            "idTemplate": "iid:bmk:${iid:tokenId}#updateassignbc",  
            "path": "iid:bmk:${iid:tokenId}/updateassignbc",
            "type": "iid:internalCall",
            "handler": "/token/transfer",
            "authorizedCaller": [
                "iid:bmk:${iid:tokenId}#issuingcompanypublickey"
            ]
        },
        {
            // Let the artwork delete Bitmark Certificate
            "idTemplate": "iid:bmk:${iid:tokenId}#deleteassignbc",  
            "path": "iid:bmk:${iid:tokenId}/deleteassignbc",
            "type": "iid:internalCall",
            "handler": "/token/transfer",
            "authorizedCaller": [
                "iid:bmk:${iid:tokenId}#issuingcompanypublickey"
            ]
        },

    ],
    // id, description, proof , Author
    "tokenProperty": [  
        {     
            // Bitmark certificate ID
            "idTemplate":"iid:bmk:#bcid",    
            "type" : "iid:uint256",
            "mutable" : false,
            "valueTemplate" : "${iid:tokenId}"
        },
        {
            // Bitmark Certificate description
            "idTemplate": "iid:bmk:${iid:tokenId}#bcdescription", 
            "type": "iid:uint256",
            "mutable": false
        },
        {
            // Bitmark Certificate title
            "idTemplate": "iid:bmk:${iid:tokenId}#bctitle", 
            "type": "iid:uint64",
            "mutable": false
        },
        {
            // Bitmark Certificate version
            "idTemplate": "iid:bmk:${iid:tokenId}#bcversion", 
            "type": "iid:uint64",
            "mutable": "iid:bitmarkAddress"
        },
        {
            // Bitmark Certificate hash value
            "idTemplate": "iid:bmk:${iid:tokenId}#bchashvalue", 
            "type": "iid:uint64",
            "mutable": "iid:bitmarkAddress"
        },
        {
            // Bitmark Certificate file path
            "idTemplate": "iid:bmk:${iid:tokenId}#bcfilepath", 
            "type": "iid:uint64",
            "mutable": "iid:bitmarkAddress"
        },
        {
            // Bitmark certificate issuing time
            "idTemplate": "iid:bmk:${iid:tokenId}#bcissuingtime", 
            "type": "iid:uint64",
            "mutable": "iid:bitmarkAddress"
        },

    ]
}