difftreelog
Smart contract update
in: master
4 files changed
smart_contract/ink-types-node-runtime/README.mddiffbeforeafterboth--- a/smart_contract/ink-types-node-runtime/README.md
+++ b/smart_contract/ink-types-node-runtime/README.md
@@ -30,64 +30,4 @@
## Test
```
cargo +nightly test
-```
-
-## UI custom types
-```
-{
- "Schedule": {
- "version": "u32",
- "put_code_per_byte_cost": "Gas",
- "grow_mem_cost": "Gas",
- "regular_op_cost": "Gas",
- "return_data_per_byte_cost": "Gas",
- "event_data_per_byte_cost": "Gas",
- "event_per_topic_cost": "Gas",
- "event_base_cost": "Gas",
- "call_base_cost": "Gas",
- "instantiate_base_cost": "Gas",
- "dispatch_base_cost": "Gas",
- "sandbox_data_read_cost": "Gas",
- "sandbox_data_write_cost": "Gas",
- "transfer_cost": "Gas",
- "instantiate_cost": "Gas",
- "max_event_topics": "u32",
- "max_stack_height": "u32",
- "max_memory_pages": "u32",
- "max_table_size": "u32",
- "enable_println": "bool",
- "max_subject_len": "u32"
- },
- "CollectionMode": {
- "_enum": {
- "Invalid": null,
- "NFT": "u32",
- "Fungible": "u32",
- "ReFungible": "(u32, u32)"
- }
- },
- "NftItemType": {
- "Collection": "u64",
- "Owner": "AccountId",
- "Data": "Vec<u8>"
- },
- "CollectionType": {
- "Owner": "AccountId",
- "Mode": "CollectionMode",
- "Access": "u8",
- "NextItemId": "u64",
- "DecimalPoints": "u32",
- "Name": "Vec<u16>",
- "Description": "Vec<u16>",
- "TokenPrefix": "Vec<u8>",
- "CustomDataSize": "u32",
- "OffchainSchema": "Vec<u8>",
- "Sponsor": "AccountId",
- "UnconfirmedSponsor": "AccountId"
- },
- "RawData": "Vec<u8>",
- "Address": "AccountId",
- "LookupSource": "AccountId",
- "Weight": "u64"
-}
```
\ No newline at end of file
smart_contract/ink-types-node-runtime/calls/lib.rsdiffbeforeafterboth1#![cfg_attr(not(feature = "std"), no_std)]23use ink_lang as ink;45#[ink::contract(version = "0.1.0", env = NodeRuntimeTypes)]6mod calls {7 use ink_core::env;8 use ink_prelude::vec::Vec;9 use ink_prelude::*;10 use ink_types_node_runtime::{calls as runtime_calls, NodeRuntimeTypes};11 use scale::{12 Decode,13 Encode,14 };1516 #[derive(Encode, Decode)]17 pub struct NftItemType {18 pub collection: u64,19 pub owner: AccountId,20 pub data: Vec<u8>,21 }2223 /// This simple dummy contract dispatches substrate runtime calls24 #[ink(storage)]25 struct Calls {}2627 impl Calls {28 #[ink(constructor)]29 fn new(&mut self) {}3031 #[ink(message)]32 fn transfer(&self, collection_id: u64, item_id: u64, new_owner: AccountId) {33 env::println(&format!(34 "transfer invoke_runtime params {:?}, {:?}, {:?} ",35 collection_id, item_id, new_owner36 ));3738 let transfer_call = runtime_calls::transfer(collection_id, item_id, new_owner);39 // dispatch the call to the runtime40 let result = self.env().invoke_runtime(&transfer_call);4142 // report result to console43 // NOTE: println should only be used on a development chain)44 env::println(&format!("transfer invoke_runtime result {:?}", result));45 }4647 // SafeTransfer4849 #[ink(message)]50 fn approve(&self, approved: AccountId, collection_id: u64, item_id: u64) {51 env::println(&format!(52 "approve invoke_runtime params {:?}, {:?}, {:?} ",53 approved, collection_id, item_id54 ));5556 let approve_call = runtime_calls::approve(approved, collection_id, item_id);57 // dispatch the call to the runtime58 let result = self.env().invoke_runtime(&approve_call);5960 // report result to console61 // NOTE: println should only be used on a development chain)62 env::println(&format!("approve invoke_runtime result {:?}", result));63 }6465 #[ink(message)]66 fn get_approved(&self, collection_id: u64, item_id: u64) -> Vec<AccountId> {67 let mut key = vec![68 // Precomputed: Twox128("Nft")69 244, 63, 251, 230, 30, 244, 104, 116, 157, 54, 23, 172, 26, 99, 196, 183,70 // Precomputed: Twox128("ApprovedList")71 86, 163, 236, 207, 221, 111, 252, 227, 254, 40, 142, 38, 40, 224, 192, 18,72 ];7374 let key_ext = vec![75 146, 214, 40, 117, 20, 27, 72, 25, 232, 204, 175, 194, 112, 244, 140, 100,76 ];77 key.extend_from_slice(&key_ext);7879 // collection id 80 let mut collection_bytes: Vec<u8> = collection_id.to_be_bytes().iter().cloned().collect();81 collection_bytes.reverse();82 key.extend_from_slice(&collection_bytes.as_slice());8384 // item id 85 let mut item_bytes: Vec<u8> = item_id.to_be_bytes().iter().cloned().collect();86 item_bytes.reverse();87 key.extend_from_slice(&item_bytes.as_slice()); 8889 // fetch from runtime storage90 let result = self.env().get_runtime_storage::<Vec<AccountId>>(&key[..]);91 92 match result {93 Some(Ok(accounts)) => { 94 env::println(&format!("get_approved result {:?}", accounts));95 accounts 96 },97 Some(Err(err)) => {98 env::println(&format!("Error reading {:?}", err));99 vec![]100 }101 None => {102 env::println(&format!("No data at key {:?}", key));103 vec![]104 }105 }106 }107108 #[ink(message)]109 fn transfer_from(&self, collection_id: u64, item_id: u64, new_owner: AccountId) {110 env::println(&format!(111 "transfer_from invoke_runtime params {:?}, {:?}, {:?} ",112 collection_id, item_id, new_owner113 ));114115 let transfer_from_call =116 runtime_calls::transfer_from(collection_id, item_id, new_owner);117 // dispatch the call to the runtime118 let result = self.env().invoke_runtime(&transfer_from_call);119120 // report result to console121 // NOTE: println should only be used on a development chain)122 env::println(&format!("transfer_from invoke_runtime result {:?}", result));123 }124125 // SafeTransferFrom126 #[ink(message)]127 fn create_item(&self, collection_id: u64, properties: Vec<u8>, owner: AccountId) {128 env::println(&format!(129 "create_item invoke_runtime params {:?}, {:?} ",130 collection_id, properties131 ));132133 let create_item_call = runtime_calls::create_item(collection_id, properties, owner);134 // dispatch the call to the runtime135 let result = self.env().invoke_runtime(&create_item_call);136137 // report result to console138 // NOTE: println should only be used on a development chain)139 env::println(&format!("create_item invoke_runtime result {:?}", result));140 }141142 #[ink(message)]143 fn burn_item(&self, collection_id: u64, item_id: u64) {144 env::println(&format!(145 "burn_item invoke_runtime params {:?}, {:?}",146 collection_id, item_id147 ));148149 let burn_item_call = runtime_calls::burn_item(collection_id, item_id);150 // dispatch the call to the runtime151 let result = self.env().invoke_runtime(&burn_item_call);152153 // report result to console154 // NOTE: println should only be used on a development chain)155 env::println(&format!("burn_item invoke_runtime result {:?}", result));156 }157158 // GetOwner159 #[ink(message)]160 fn get_owner(&self, collection_id: u64, token_id: u64) -> AccountId {161 let mut key = vec![162 // Precomputed: Twox128("Nft")163 244, 63, 251, 230, 30, 244, 104, 116, 157, 54, 23, 172, 26, 99, 196, 183,164 // Precomputed: Twox128("ItemList")165 116, 232, 175, 181, 237, 113, 149, 125, 139, 77, 55, 251, 115, 253, 29, 240,166 ];167168 let key_ext = vec![169 146, 214, 40, 117, 20, 27, 72, 25, 232, 204, 175, 194, 112, 244, 140, 100,170 ];171 key.extend_from_slice(&key_ext);172173 // collection id 174 let mut collection_bytes: Vec<u8> = collection_id.to_be_bytes().iter().cloned().collect();175 collection_bytes.reverse();176 key.extend_from_slice(&collection_bytes.as_slice());177178 // token id 179 let mut token_bytes: Vec<u8> = token_id.to_be_bytes().iter().cloned().collect();180 token_bytes.reverse();181 key.extend_from_slice(&token_bytes.as_slice()); 182183 // fetch from runtime storage 184 let result = self.env().get_runtime_storage::<NftItemType>(&key[..]);185 186 match result {187 Some(Ok(item)) => { 188 env::println(&format!("get_owner result {:?}", item.owner));189 item.owner190 },191 Some(Err(err)) => {192 env::println(&format!("Error reading {:?}", err));193 AccountId::from([0u8; 32])194 }195 None => {196 env::println(&format!("No data at key {:?}", key));197 AccountId::from([0u8; 32])198 }199 }200 }201202 #[ink(message)]203 fn get_balance_of(&self, collection_id: u64, owner: AccountId) -> u64 {204 let mut key = vec![205 // Precomputed: Twox128("Nft")206 244, 63, 251, 230, 30, 244, 104, 116, 157, 54, 23, 172, 26, 99, 196, 183,207 // Precomputed: Twox128("Balance")208 78, 168, 234, 12, 1, 250, 164, 43, 110, 179, 68, 168, 92, 71, 179, 135,209 ];210211 let key_ext = vec![212 15, 97, 136, 0, 76, 187, 168, 28, 239, 85, 170, 23, 77, 81, 248, 159,213 ];214 key.extend_from_slice(&key_ext);215216 // collection id 217 let mut collection_bytes: Vec<u8> = collection_id.to_be_bytes().iter().cloned().collect();218 collection_bytes.reverse();219 key.extend_from_slice(&collection_bytes.as_slice());220221 // owner222 key.extend_from_slice(&owner.encode()); 223224 // fetch from runtime storage225 let result = self.env().get_runtime_storage::<u64>(&key[..]);226 227 match result {228 Some(Ok(balance)) => { 229 env::println(&format!("get_balance_of result {:?}", balance));230 balance231 },232 Some(Err(err)) => {233 env::println(&format!("Error reading {:?}", err));234 0235 }236 None => {237 env::println(&format!("No data at key {:?}", key));238 0239 }240 }241 }242 }243}1#![cfg_attr(not(feature = "std"), no_std)]23use ink_lang as ink;45#[ink::contract(version = "0.1.0", env = NodeRuntimeTypes)]6mod calls {7 use ink_core::env;8 use ink_prelude::vec::Vec;9 use ink_prelude::*;10 use ink_types_node_runtime::{calls as runtime_calls, NodeRuntimeTypes, RawData, AccountList };11 use scale::{12 Decode,13 Encode,14 };1516 #[derive(Encode, Decode)]17 pub struct NftItemType {18 pub collection: u64,19 pub owner: AccountId,20 pub data: Vec<u8>,21 }2223 /// This simple dummy contract dispatches substrate runtime calls24 #[ink(storage)]25 struct Calls {}2627 impl Calls {28 #[ink(constructor)]29 fn new(&mut self) {}3031 #[ink(message)]32 fn transfer(&self, new_owner: AccountId, collection_id: u64, item_id: u64, value: u64) {33 env::println(&format!(34 "transfer invoke_runtime params {:?}, {:?}, {:?}, {:?} ",35 new_owner, collection_id, item_id, value36 ));3738 let transfer_call = runtime_calls::transfer(new_owner, collection_id, item_id, value);39 // dispatch the call to the runtime40 let result = self.env().invoke_runtime(&transfer_call);4142 // report result to console43 // NOTE: println should only be used on a development chain)44 env::println(&format!("transfer invoke_runtime result {:?}", result));45 }4647 // SafeTransfer4849 #[ink(message)]50 fn approve(&self, approved: AccountId, collection_id: u64, item_id: u64) {51 env::println(&format!(52 "approve invoke_runtime params {:?}, {:?}, {:?} ",53 approved, collection_id, item_id54 ));5556 let approve_call = runtime_calls::approve(approved, collection_id, item_id);57 // dispatch the call to the runtime58 let result = self.env().invoke_runtime(&approve_call);5960 // report result to console61 // NOTE: println should only be used on a development chain)62 env::println(&format!("approve invoke_runtime result {:?}", result));63 }6465 #[ink(message)]66 fn get_approved(&self, collection_id: u64, item_id: u64) -> AccountList {67 let mut key = vec![68 // Precomputed: Twox128("Nft")69 244, 63, 251, 230, 30, 244, 104, 116, 157, 54, 23, 172, 26, 99, 196, 183,70 // Precomputed: Twox128("ApprovedList")71 86, 163, 236, 207, 221, 111, 252, 227, 254, 40, 142, 38, 40, 224, 192, 18,72 ];7374 let key_ext = vec![75 146, 214, 40, 117, 20, 27, 72, 25, 232, 204, 175, 194, 112, 244, 140, 100,76 ];77 key.extend_from_slice(&key_ext);7879 // collection id 80 let mut collection_bytes: Vec<u8> = collection_id.to_be_bytes().iter().cloned().collect();81 collection_bytes.reverse();82 key.extend_from_slice(&collection_bytes.as_slice());8384 // item id 85 let mut item_bytes: Vec<u8> = item_id.to_be_bytes().iter().cloned().collect();86 item_bytes.reverse();87 key.extend_from_slice(&item_bytes.as_slice()); 8889 // fetch from runtime storage90 let result = self.env().get_runtime_storage::<Vec<AccountId>>(&key[..]);91 92 match result {93 Some(Ok(accounts)) => { 94 env::println(&format!("get_approved result {:?}", accounts));95 AccountList(accounts) 96 },97 Some(Err(err)) => {98 env::println(&format!("Error reading {:?}", err));99 AccountList(vec![])100 }101 None => {102 env::println(&format!("No data at key {:?}", key));103 AccountList(vec![])104 }105 }106 }107108 #[ink(message)]109 fn transfer_from(&self, new_owner: AccountId, collection_id: u64, item_id: u64, value: u64) {110 env::println(&format!(111 "transfer_from invoke_runtime params {:?}, {:?}, {:?}, {:?} ",112 new_owner, collection_id, item_id, value113 ));114115 let transfer_from_call =116 runtime_calls::transfer_from(new_owner, collection_id, item_id, value);117 // dispatch the call to the runtime118 let result = self.env().invoke_runtime(&transfer_from_call);119120 // report result to console121 // NOTE: println should only be used on a development chain)122 env::println(&format!("transfer_from invoke_runtime result {:?}", result));123 }124125 // SafeTransferFrom126 #[ink(message)]127 fn create_item(&self, collection_id: u64, properties: RawData, owner: AccountId) {128 env::println(&format!(129 "create_item invoke_runtime params {:?}, {:?}, {:?} ",130 collection_id, properties, owner131 ));132133 let create_item_call = runtime_calls::create_item(collection_id, properties.into(), owner);134 // dispatch the call to the runtime135 let result = self.env().invoke_runtime(&create_item_call);136137 // report result to console138 // NOTE: println should only be used on a development chain)139 env::println(&format!("create_item invoke_runtime result {:?}", result));140 }141142 #[ink(message)]143 fn burn_item(&self, collection_id: u64, item_id: u64) {144 env::println(&format!(145 "burn_item invoke_runtime params {:?}, {:?}",146 collection_id, item_id147 ));148149 let burn_item_call = runtime_calls::burn_item(collection_id, item_id);150 // dispatch the call to the runtime151 let result = self.env().invoke_runtime(&burn_item_call);152153 // report result to console154 // NOTE: println should only be used on a development chain)155 env::println(&format!("burn_item invoke_runtime result {:?}", result));156 }157158 // GetOwner159 #[ink(message)]160 fn get_owner(&self, collection_id: u64, token_id: u64) -> AccountId {161 let mut key = vec![162 // Precomputed: Twox128("Nft")163 244, 63, 251, 230, 30, 244, 104, 116, 157, 54, 23, 172, 26, 99, 196, 183,164 // Precomputed: Twox128("ItemList")165 116, 232, 175, 181, 237, 113, 149, 125, 139, 77, 55, 251, 115, 253, 29, 240,166 ];167168 let key_ext = vec![169 146, 214, 40, 117, 20, 27, 72, 25, 232, 204, 175, 194, 112, 244, 140, 100,170 ];171 key.extend_from_slice(&key_ext);172173 // collection id 174 let mut collection_bytes: Vec<u8> = collection_id.to_be_bytes().iter().cloned().collect();175 collection_bytes.reverse();176 key.extend_from_slice(&collection_bytes.as_slice());177178 // token id 179 let mut token_bytes: Vec<u8> = token_id.to_be_bytes().iter().cloned().collect();180 token_bytes.reverse();181 key.extend_from_slice(&token_bytes.as_slice()); 182183 // fetch from runtime storage 184 let result = self.env().get_runtime_storage::<NftItemType>(&key[..]);185 186 match result {187 Some(Ok(item)) => { 188 env::println(&format!("get_owner result {:?}", item.owner));189 item.owner190 },191 Some(Err(err)) => {192 env::println(&format!("Error reading {:?}", err));193 AccountId::from([0u8; 32])194 }195 None => {196 env::println(&format!("No data at key {:?}", key));197 AccountId::from([0u8; 32])198 }199 }200 }201202 #[ink(message)]203 fn get_balance_of(&self, collection_id: u64, owner: AccountId) -> u64 {204 let mut key = vec![205 // Precomputed: Twox128("Nft")206 244, 63, 251, 230, 30, 244, 104, 116, 157, 54, 23, 172, 26, 99, 196, 183,207 // Precomputed: Twox128("Balance")208 78, 168, 234, 12, 1, 250, 164, 43, 110, 179, 68, 168, 92, 71, 179, 135,209 ];210211 let key_ext = vec![212 15, 97, 136, 0, 76, 187, 168, 28, 239, 85, 170, 23, 77, 81, 248, 159,213 ];214 key.extend_from_slice(&key_ext);215216 // collection id 217 let mut collection_bytes: Vec<u8> = collection_id.to_be_bytes().iter().cloned().collect();218 collection_bytes.reverse();219 key.extend_from_slice(&collection_bytes.as_slice());220221 // owner222 key.extend_from_slice(&owner.encode()); 223224 // fetch from runtime storage225 let result = self.env().get_runtime_storage::<u64>(&key[..]);226 227 match result {228 Some(Ok(balance)) => { 229 env::println(&format!("get_balance_of result {:?}", balance));230 balance231 },232 Some(Err(err)) => {233 env::println(&format!("Error reading {:?}", err));234 0235 }236 None => {237 env::println(&format!("No data at key {:?}", key));238 0239 }240 }241 }242 }243}smart_contract/ink-types-node-runtime/src/calls.rsdiffbeforeafterboth--- a/smart_contract/ink-types-node-runtime/src/calls.rs
+++ b/smart_contract/ink-types-node-runtime/src/calls.rs
@@ -17,6 +17,18 @@
}
}
+// #[cfg_attr(feature = "ink-generate-abi", derive(Metadata))]
+#[derive(Encode, Decode, Debug, Eq, Clone, PartialEq)]
+pub enum CollectionMode {
+ Invalid,
+ // custom data size
+ NFT(u32),
+ // decimal points
+ Fungible(u32),
+ // custom data size and decimal points
+ ReFungible(u32, u32),
+}
+
/// Generic Balance Call, could be used with other runtimes
#[derive(Encode, Decode, Clone, PartialEq, Eq)]
pub enum Nft<T>
@@ -25,19 +37,28 @@
T::AccountId: Member + Codec,
{
#[allow(non_camel_case_types)]
- create_collection(Vec<u16>, Vec<u16>, Vec<u8>, u8, u32, u32),
+ create_collection(Vec<u16>, Vec<u16>, Vec<u8>, CollectionMode),
#[allow(non_camel_case_types)]
destroy_collection(u64),
#[allow(non_camel_case_types)]
+ add_collection_admin(u64, T::AccountId),
+
+ #[allow(non_camel_case_types)]
+ remove_collection_admin(u64, T::AccountId),
+
+ #[allow(non_camel_case_types)]
change_collection_owner(u64, T::AccountId),
#[allow(non_camel_case_types)]
- add_collection_admin(u64, T::AccountId),
+ set_collection_sponsor(u64, T::AccountId),
+
+ #[allow(non_camel_case_types)]
+ confirm_sponsorship(u64),
#[allow(non_camel_case_types)]
- remove_collection_admin(u64, T::AccountId),
+ remove_collection_sponsor(u64),
#[allow(non_camel_case_types)]
create_item(u64, Vec<u8>, T::AccountId),
@@ -46,37 +67,36 @@
burn_item(u64, u64),
#[allow(non_camel_case_types)]
- transfer(T::AccountId, u64, u64),
+ transfer(T::AccountId, u64, u64, u64),
#[allow(non_camel_case_types)]
nft_approve(T::AccountId, u64, u64),
#[allow(non_camel_case_types)]
- nft_transfer_from(T::AccountId, u64, u64),
+ nft_transfer_from(T::AccountId, u64, u64, u64),
#[allow(non_camel_case_types)]
nft_safe_transfer(u64, u64, T::AccountId),
+
+ #[allow(non_camel_case_types)]
+ set_offchain_schema(u64, Vec<u8>),
}
-pub fn transfer(collection_id: u64, item_id: u64, new_owner: AccountId) -> Call {
- Nft::<NodeRuntimeTypes>::transfer(collection_id, item_id, new_owner.into()).into()
+pub fn transfer(new_owner: AccountId, collection_id: u64, item_id: u64, value: u64) -> Call {
+ Nft::<NodeRuntimeTypes>::transfer(new_owner.into(), collection_id, item_id, value).into()
}
pub fn create_collection(
collection_name: Vec<u16>,
collection_description: Vec<u16>,
token_prefix: Vec<u8>,
- mode: u8,
- decimal_points: u32,
- custom_data_size: u32,
+ mode: CollectionMode
) -> Call {
Nft::<NodeRuntimeTypes>::create_collection(
collection_name,
collection_description,
token_prefix,
- mode,
- decimal_points,
- custom_data_size,
+ mode
)
.into()
}
@@ -89,8 +109,8 @@
Nft::<NodeRuntimeTypes>::nft_approve(approved.into(), collection_id, item_id).into()
}
-pub fn transfer_from(collection_id: u64, item_id: u64, new_owner: AccountId) -> Call {
- Nft::<NodeRuntimeTypes>::nft_transfer_from(collection_id, item_id, new_owner.into()).into()
+pub fn transfer_from(new_owner: AccountId, collection_id: u64, item_id: u64, value: u64) -> Call {
+ Nft::<NodeRuntimeTypes>::nft_transfer_from(new_owner.into(), collection_id, item_id, value).into()
}
pub fn create_item(collection_id: u64, properties: Vec<u8>, owner: AccountId) -> Call {
smart_contract/ink-types-node-runtime/src/lib.rsdiffbeforeafterboth--- a/smart_contract/ink-types-node-runtime/src/lib.rs
+++ b/smart_contract/ink-types-node-runtime/src/lib.rs
@@ -4,8 +4,9 @@
use ink_core::env::Clear;
use scale::{Decode, Encode};
use sp_core::crypto::AccountId32;
+use ink_prelude::vec::Vec;
#[cfg(feature = "ink-generate-abi")]
-use type_metadata::{HasTypeDef, HasTypeId, MetaType, Metadata, TypeDef, TypeId, TypeIdArray};
+use type_metadata::{ HasTypeDef, HasTypeId, MetaType, Metadata, TypeDef, TypeId, TypeIdArray, TypeIdSlice};
pub mod calls;
@@ -46,6 +47,59 @@
/// The default SRML balance type.
pub type Balance = u128;
+#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Encode, Decode)]
+pub struct AccountList(pub Vec<AccountId>);
+
+impl AccountList {
+ pub fn new(param: Vec<AccountId>) -> AccountList {
+ AccountList(param)
+ }
+}
+
+impl Into<Vec<AccountId>> for AccountList {
+ fn into(self) -> Vec<AccountId> {
+ self.0
+ }
+}
+
+#[cfg(feature = "ink-generate-abi")]
+impl HasTypeDef for AccountList {
+ fn type_def() -> TypeDef {
+ TypeDef::builtin()
+ }
+}
+
+#[cfg(feature = "ink-generate-abi")]
+impl HasTypeId for AccountList {
+ fn type_id() -> TypeId {
+ TypeIdSlice::new(AccountId::meta_type()).into()
+ }
+}
+
+
+#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Encode, Decode)]
+pub struct RawData(Vec<u8>);
+
+impl Into<Vec<u8>> for RawData {
+ fn into(self) -> Vec<u8> {
+ self.0
+ }
+}
+
+#[cfg(feature = "ink-generate-abi")]
+impl HasTypeDef for RawData {
+ fn type_def() -> TypeDef {
+ TypeDef::builtin()
+ }
+}
+
+#[cfg(feature = "ink-generate-abi")]
+impl HasTypeId for RawData {
+ fn type_id() -> TypeId {
+ TypeIdSlice::new(u8::meta_type()).into()
+ }
+}
+
/// The default SRML hash type.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Encode, Decode)]
pub struct Hash([u8; 32]);