git.delta.rocks / unique-network / refs/commits / c311337f0c46

difftreelog

Add data fields for limited owners control

Greg Zaitsev2021-02-09parent: #563ceaa.patch.diff
in: master

2 files changed

modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -185,6 +185,8 @@
 
     // Timeouts for item types in passed blocks
     pub sponsor_transfer_timeout: u32,
+    pub owner_can_transfer: bool,
+    pub owner_can_destroy: bool,
 }
 
 impl Default for CollectionLimits {
@@ -193,7 +195,10 @@
             account_token_ownership_limit: 10_000_000, 
             token_limit: u32::max_value(),
             sponsored_data_size: u32::max_value(), 
-            sponsor_transfer_timeout: 14400 }
+            sponsor_transfer_timeout: 14400,
+            owner_can_transfer: true,
+            owner_can_destroy: true
+        }
     }
 }
 
@@ -590,7 +595,7 @@
                 sponsor_confirmed: false,
                 variable_on_chain_schema: Vec::new(),
                 const_on_chain_schema: Vec::new(),
-                limits: CollectionLimits::default(),
+                limits: CollectionLimits::default()
             };
 
             // Add new collection to map
modifiedruntime_types.jsondiffbeforeafterboth
before · runtime_types.json
1{2    "Schedule": {3      "version": "u32",4      "put_code_per_byte_cost": "Gas",5      "grow_mem_cost": "Gas",6      "regular_op_cost": "Gas",7      "return_data_per_byte_cost": "Gas",8      "event_data_per_byte_cost": "Gas",9      "event_per_topic_cost": "Gas",10      "event_base_cost": "Gas",11      "call_base_cost": "Gas",12      "instantiate_base_cost": "Gas",13      "dispatch_base_cost": "Gas",14      "sandbox_data_read_cost": "Gas",15      "sandbox_data_write_cost": "Gas",16      "transfer_cost": "Gas",17      "instantiate_cost": "Gas",18      "max_event_topics": "u32",19      "max_stack_height": "u32",20      "max_memory_pages": "u32",21      "max_table_size": "u32",22      "enable_println": "bool",23      "max_subject_len": "u32"24    },25    "AccessMode": {26      "_enum": [27        "Normal",28        "WhiteList"29      ]30    },31    "DecimalPoints": "u8",32    "CollectionMode": {33      "_enum": {34        "Invalid": null,35        "NFT": null,36        "Fungible": "DecimalPoints",37        "ReFungible": "DecimalPoints"38      }39    },40    "Ownership": {41      "Owner": "AccountId",42      "Fraction": "u128"43    },44    "FungibleItemType": {45      "Value": "u128"46    },47    "NftItemType": {48      "Owner": "AccountId",49      "ConstData": "Vec<u8>",50      "VariableData": "Vec<u8>"51    },52    "ReFungibleItemType": {53      "Owner": "Vec<Ownership<AccountId>>",54      "ConstData": "Vec<u8>",55      "VariableData": "Vec<u8>"56    },57    "CollectionType": {58      "Owner": "AccountId",59      "Mode": "CollectionMode",60      "Access": "AccessMode",61      "DecimalPoints": "DecimalPoints",62      "Name": "Vec<u16>",63      "Description": "Vec<u16>",64      "TokenPrefix": "Vec<u8>",65      "MintMode": "bool",66      "OffchainSchema": "Vec<u8>",67      "SchemaVersion": "SchemaVersion",68      "Sponsor": "AccountId",69      "SponsorConfirmed": "bool",70      "Limits": "CollectionLimits",71      "VariableOnChainSchema": "Vec<u8>",72      "ConstOnChainSchema": "Vec<u8>"73    },74    "RawData": "Vec<u8>",75    "Address": "AccountId",76    "LookupSource": "AccountId",77    "Weight": "u64",78    "CreateNftData": {79      "const_data": "Vec<u8>",80      "variable_data": "Vec<u8>" 81    },82    "CreateFungibleData": {83      "value": "u128"84    },85    "CreateReFungibleData": {86      "const_data": "Vec<u8>",87      "variable_data": "Vec<u8>" 88    },89    "CreateItemData": {90      "_enum": {91        "NFT": "CreateNftData",92        "Fungible": "CreateFungibleData",93        "ReFungible": "CreateReFungibleData"94      }95    },96    "SchemaVersion": {97      "_enum": [98        "ImageURL",99        "Unique"100      ]101    },102    "CollectionId": "u32",103    "TokenId": "u32",104    "ChainLimits": {105      "CollectionNumbersLimit": "u32",106      "AccountTokenOwnershipLimit": "u32",107      "CollectionAdminsLimit": "u64",108      "CustomDataLimit": "u32",109      "NftSponsorTimeout": "u32",110      "FungibleSponsorTimeout": "u32",111      "RefungibleSponsorTimeout": "u32",112      "OffchainSchemaLimit": "u32",113      "VariableOnChainSchemaLimit": "u32",114      "ConstOnChainSchemaLimit": "u32"115    },116    "CollectionLimits": {117      "AccountTokenOwnershipLimit": "u32",118      "SponsoredMintSize": "u32",119      "TokenLimit": "u32",120      "SponsorTimeout": "u32"121    },122    "AccountInfo": "AccountInfoWithProviders",123    "AccountInfoWithProviders": {124      "nonce": "Index",125      "consumers": "RefCount",126      "providers": "RefCount",127      "data": "AccountData"128    }129130  }131  
after · runtime_types.json
1{2    "Schedule": {3      "version": "u32",4      "put_code_per_byte_cost": "Gas",5      "grow_mem_cost": "Gas",6      "regular_op_cost": "Gas",7      "return_data_per_byte_cost": "Gas",8      "event_data_per_byte_cost": "Gas",9      "event_per_topic_cost": "Gas",10      "event_base_cost": "Gas",11      "call_base_cost": "Gas",12      "instantiate_base_cost": "Gas",13      "dispatch_base_cost": "Gas",14      "sandbox_data_read_cost": "Gas",15      "sandbox_data_write_cost": "Gas",16      "transfer_cost": "Gas",17      "instantiate_cost": "Gas",18      "max_event_topics": "u32",19      "max_stack_height": "u32",20      "max_memory_pages": "u32",21      "max_table_size": "u32",22      "enable_println": "bool",23      "max_subject_len": "u32"24    },25    "AccessMode": {26      "_enum": [27        "Normal",28        "WhiteList"29      ]30    },31    "DecimalPoints": "u8",32    "CollectionMode": {33      "_enum": {34        "Invalid": null,35        "NFT": null,36        "Fungible": "DecimalPoints",37        "ReFungible": "DecimalPoints"38      }39    },40    "Ownership": {41      "Owner": "AccountId",42      "Fraction": "u128"43    },44    "FungibleItemType": {45      "Value": "u128"46    },47    "NftItemType": {48      "Owner": "AccountId",49      "ConstData": "Vec<u8>",50      "VariableData": "Vec<u8>"51    },52    "ReFungibleItemType": {53      "Owner": "Vec<Ownership<AccountId>>",54      "ConstData": "Vec<u8>",55      "VariableData": "Vec<u8>"56    },57    "CollectionType": {58      "Owner": "AccountId",59      "Mode": "CollectionMode",60      "Access": "AccessMode",61      "DecimalPoints": "DecimalPoints",62      "Name": "Vec<u16>",63      "Description": "Vec<u16>",64      "TokenPrefix": "Vec<u8>",65      "MintMode": "bool",66      "OffchainSchema": "Vec<u8>",67      "SchemaVersion": "SchemaVersion",68      "Sponsor": "AccountId",69      "SponsorConfirmed": "bool",70      "Limits": "CollectionLimits",71      "VariableOnChainSchema": "Vec<u8>",72      "ConstOnChainSchema": "Vec<u8>"73    },74    "RawData": "Vec<u8>",75    "Address": "AccountId",76    "LookupSource": "AccountId",77    "Weight": "u64",78    "CreateNftData": {79      "const_data": "Vec<u8>",80      "variable_data": "Vec<u8>" 81    },82    "CreateFungibleData": {83      "value": "u128"84    },85    "CreateReFungibleData": {86      "const_data": "Vec<u8>",87      "variable_data": "Vec<u8>" 88    },89    "CreateItemData": {90      "_enum": {91        "NFT": "CreateNftData",92        "Fungible": "CreateFungibleData",93        "ReFungible": "CreateReFungibleData"94      }95    },96    "SchemaVersion": {97      "_enum": [98        "ImageURL",99        "Unique"100      ]101    },102    "CollectionId": "u32",103    "TokenId": "u32",104    "ChainLimits": {105      "CollectionNumbersLimit": "u32",106      "AccountTokenOwnershipLimit": "u32",107      "CollectionAdminsLimit": "u64",108      "CustomDataLimit": "u32",109      "NftSponsorTimeout": "u32",110      "FungibleSponsorTimeout": "u32",111      "RefungibleSponsorTimeout": "u32",112      "OffchainSchemaLimit": "u32",113      "VariableOnChainSchemaLimit": "u32",114      "ConstOnChainSchemaLimit": "u32"115    },116    "CollectionLimits": {117      "AccountTokenOwnershipLimit": "u32",118      "SponsoredMintSize": "u32",119      "TokenLimit": "u32",120      "SponsorTimeout": "u32",121      "OwnerCanTransfer": "bool",122      "OwnerCanDestroy": "bool"123    },124    "AccountInfo": "AccountInfoWithProviders",125    "AccountInfoWithProviders": {126      "nonce": "Index",127      "consumers": "RefCount",128      "providers": "RefCount",129      "data": "AccountData"130    }131132  }133