difftreelog
Merge branch 'develop' into parachain-compose
165 files changed
Makefilediffbeforeafterboth1.PHONY: _eth_codegen1.PHONY: _help2_eth_codegen:2_help:3 @echo "regenerate_solidity - generate stubs/interfaces for contracts defined in native (via evm-coder)"4 @echo "evm_stubs - recompile contract stubs"5 @echo "bench - run frame-benchmarking"6 @echo " bench-evm-migration"7 @echo " bench-nft"384.PHONY: regenerate_solidity9.PHONY: regenerate_solidity5regenerate_solidity:10regenerate_solidity:README.mddiffbeforeafterboth6363642. Remove all installed toolchains with `rustup toolchain list` and `rustup toolchain uninstall <toolchain>`.642. Remove all installed toolchains with `rustup toolchain list` and `rustup toolchain uninstall <toolchain>`.6565663. Install install nightly 2021-03-01 and make it default:663. Install install nightly 2021-06-28 and make it default:676768```bash68```bash69rustup toolchain install nightly-2021-03-0169rustup toolchain install nightly-2021-06-2870rustup default nightly-2021-03-0170rustup default nightly-2021-06-2871```71```7272734. Add wasm target for nightly toolchain:734. Add wasm target for nightly toolchain:747475```bash75```bash76rustup target add wasm32-unknown-unknown --toolchain nightly-2021-03-0176rustup target add wasm32-unknown-unknown --toolchain nightly-2021-06-2877```77```7878795. Build:795. Build:135135136## Building and Running as Parachain locally136## Building and Running as Parachain locally137137138Rust toolchain: nightly-2021-04-23138Rust toolchain: nightly-2021-06-28139Note: checkout this project and polkadot project (see below) in the sibling folders (both under the same folder)139Note: checkout this project and polkadot project (see below) in the sibling folders (both under the same folder)140140141### Build relay141### Build relay142142143```143```144git clone https://github.com/paritytech/polkadot.git144git clone https://github.com/paritytech/polkadot.git145cd polkadot145cd polkadot146git checkout aa386760146git checkout release-v0.9.9147cargo build --release147cargo build --release148```148```149149208208209First of all, add rust toolchain and make it default.209First of all, add rust toolchain and make it default.210```bash210```bash211rustup target add wasm32-unknown-unknown --toolchain nightly-2020-10-01211rustup target add wasm32-unknown-unknown --toolchain nightly-2021-06-28212```212```213213214Then in "/node/src" run build command below214Then in "/node/src" run build command below215```bash215```bash216cargo +nightly-2020-10-01 build --release --features runtime-benchmarks216cargo +nightly-2021-06-28 build --release --features runtime-benchmarks217```217```218218219Run benchmark219Run benchmark257Uncomment following lies:257Uncomment following lies:2581. In node/rpc/Cargo.toml2581. In node/rpc/Cargo.toml259```259```260# pallet-contracts-rpc = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }260# pallet-contracts-rpc = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.9' }261```261```2622622632. In node/rpc/src/lib.rs2632. In node/rpc/src/lib.rs280 # [dependencies.pallet-contracts]280 # [dependencies.pallet-contracts]281 # git = 'https://github.com/paritytech/substrate.git'281 # git = 'https://github.com/paritytech/substrate.git'282 # default-features = false282 # default-features = false283 # branch = 'polkadot-v0.9.8'283 # branch = 'polkadot-v0.9.9'284 # version = '3.0.0'284 # version = '3.0.0'285285286 # [dependencies.pallet-contracts-primitives]286 # [dependencies.pallet-contracts-primitives]287 # git = 'https://github.com/paritytech/substrate.git'287 # git = 'https://github.com/paritytech/substrate.git'288 # default-features = false288 # default-features = false289 # branch = 'polkadot-v0.9.8'289 # branch = 'polkadot-v0.9.9'290 # version = '3.0.0'290 # version = '3.0.0'291291292 # [dependencies.pallet-contracts-rpc-runtime-api]292 # [dependencies.pallet-contracts-rpc-runtime-api]293 # git = 'https://github.com/paritytech/substrate.git'293 # git = 'https://github.com/paritytech/substrate.git'294 # default-features = false294 # default-features = false295 # branch = 'polkadot-v0.9.8'295 # branch = 'polkadot-v0.9.9'296 # version = '3.0.0'296 # version = '3.0.0'297...297...298 # pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }298 # pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }crates/evm-coder-macros/src/solidity_interface.rsdiffbeforeafterboth1#![allow(dead_code)]1#![allow(dead_code)]223use quote::quote;3use quote::quote;4use darling::FromMeta;4use darling::{FromMeta, ToTokens};5use inflector::cases;5use inflector::cases;6use std::fmt::Write;6use std::fmt::Write;7use syn::{7use syn::{8 FnArg, Generics, Ident, ImplItem, ImplItemMethod, ItemImpl, Meta, NestedMeta, PatType, Path,8 Expr, FnArg, GenericArgument, Generics, Ident, ImplItem, ImplItemMethod, ItemImpl, Lit, Meta,9 ReturnType, Type, spanned::Spanned,9 NestedMeta, PatType, Path, PathArguments, ReturnType, Type, spanned::Spanned,10};10};111112use crate::{12use crate::{13 fn_selector_str, parse_ident_from_pat, parse_ident_from_path, parse_ident_from_type,13 fn_selector_str, parse_ident_from_pat, parse_ident_from_path, parse_path, parse_path_segment,14 parse_result_ok, pascal_ident_to_call, pascal_ident_to_snake_call, snake_ident_to_pascal,14 parse_result_ok, pascal_ident_to_call, pascal_ident_to_snake_call, snake_ident_to_pascal,15 snake_ident_to_screaming,15 snake_ident_to_screaming,16};16};77 fn expand_generator(&self) -> proc_macro2::TokenStream {77 fn expand_generator(&self) -> proc_macro2::TokenStream {78 let pascal_call_name = &self.pascal_call_name;78 let pascal_call_name = &self.pascal_call_name;79 quote! {79 quote! {80 #pascal_call_name::generate_solidity_interface(out_set, is_impl);80 #pascal_call_name::generate_solidity_interface(tc, is_impl);81 }81 }82 }82 }838384 fn expand_event_generator(&self) -> proc_macro2::TokenStream {84 fn expand_event_generator(&self) -> proc_macro2::TokenStream {85 let name = &self.name;85 let name = &self.name;86 quote! {86 quote! {87 #name::generate_solidity_interface(out_set, is_impl);87 #name::generate_solidity_interface(tc, is_impl);88 }88 }89 }89 }90}90}121 rename_selector: Option<String>,121 rename_selector: Option<String>,122}122}123124enum AbiType {125 // type126 Plain(Ident),127 // (type1,type2)128 Tuple(Vec<AbiType>),129 // type[]130 Vec(Box<AbiType>),131 // type[20]132 Array(Box<AbiType>, usize),133}134impl AbiType {135 fn try_from(value: &Type) -> syn::Result<Self> {136 let value = Self::try_maybe_special_from(value)?;137 if value.is_special() {138 return Err(syn::Error::new(value.span(), "unexpected special type"));139 }140 Ok(value)141 }142 fn try_maybe_special_from(value: &Type) -> syn::Result<Self> {143 match value {144 Type::Array(arr) => {145 let wrapped = AbiType::try_from(&arr.elem)?;146 match &arr.len {147 Expr::Lit(l) => match &l.lit {148 Lit::Int(i) => {149 let num = i.base10_parse::<usize>()?;150 Ok(AbiType::Array(Box::new(wrapped), num as usize))151 }152 _ => Err(syn::Error::new(arr.len.span(), "should be int literal")),153 },154 _ => Err(syn::Error::new(arr.len.span(), "should be literal")),155 }156 }157 Type::Path(_) => {158 let path = parse_path(value)?;159 let segment = parse_path_segment(path)?;160 if segment.ident == "Vec" {161 let args = match &segment.arguments {162 PathArguments::AngleBracketed(e) => e,163 _ => {164 return Err(syn::Error::new(165 segment.arguments.span(),166 "missing Vec generic",167 ))168 }169 };170 let args = &args.args;171 if args.len() != 1 {172 return Err(syn::Error::new(173 args.span(),174 "expected only one generic for vec",175 ));176 }177 let arg = args.first().unwrap();178179 let ty = match arg {180 GenericArgument::Type(ty) => ty,181 _ => {182 return Err(syn::Error::new(183 arg.span(),184 "expected first generic to be type",185 ))186 }187 };188189 let wrapped = AbiType::try_from(ty)?;190 Ok(Self::Vec(Box::new(wrapped)))191 } else {192 if !segment.arguments.is_empty() {193 return Err(syn::Error::new(194 segment.arguments.span(),195 "unexpected generic arguments for non-vec type",196 ));197 }198 Ok(Self::Plain(segment.ident.clone()))199 }200 }201 Type::Tuple(t) => {202 let mut out = Vec::with_capacity(t.elems.len());203 for el in t.elems.iter() {204 out.push(AbiType::try_from(el)?)205 }206 Ok(Self::Tuple(out))207 }208 _ => Err(syn::Error::new(209 value.span(),210 "unexpected type, only arrays, plain types and tuples are supported",211 )),212 }213 }214 fn is_value(&self) -> bool {215 match self {216 Self::Plain(v) if v == "value" => true,217 _ => false,218 }219 }220 fn is_caller(&self) -> bool {221 match self {222 Self::Plain(v) if v == "caller" => true,223 _ => false,224 }225 }226 fn is_special(&self) -> bool {227 self.is_caller() || self.is_value()228 }229 fn selector_ty_buf(&self, buf: &mut String) -> std::fmt::Result {230 match self {231 AbiType::Plain(t) => {232 write!(buf, "{}", t)233 }234 AbiType::Tuple(t) => {235 write!(buf, "(")?;236 for (i, t) in t.iter().enumerate() {237 if i != 0 {238 write!(buf, ",")?;239 }240 t.selector_ty_buf(buf)?;241 }242 write!(buf, ")")243 }244 AbiType::Vec(v) => {245 v.selector_ty_buf(buf)?;246 write!(buf, "[]")247 }248 AbiType::Array(v, len) => {249 v.selector_ty_buf(buf)?;250 write!(buf, "[{}]", len)251 }252 }253 }254 fn selector_ty(&self) -> String {255 let mut out = String::new();256 self.selector_ty_buf(&mut out).expect("no fmt error");257 out258 }259}260impl ToTokens for AbiType {261 fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {262 match self {263 AbiType::Plain(t) => tokens.extend(quote! {#t}),264 AbiType::Tuple(t) => {265 tokens.extend(quote! {(266 #(#t),*267 )});268 }269 AbiType::Vec(v) => tokens.extend(quote! {Vec<#v>}),270 AbiType::Array(v, l) => tokens.extend(quote! {[#v; #l]}),271 }272 }273}123274124struct MethodArg {275struct MethodArg {125 name: Ident,276 name: Ident,126 camel_name: String,277 camel_name: String,127 ty: Ident,278 ty: AbiType,128}279}129impl MethodArg {280impl MethodArg {130 fn try_from(value: &PatType) -> syn::Result<Self> {281 fn try_from(value: &PatType) -> syn::Result<Self> {131 let name = parse_ident_from_pat(&value.pat)?.clone();282 let name = parse_ident_from_pat(&value.pat)?.clone();132 Ok(Self {283 Ok(Self {133 camel_name: cases::camelcase::to_camel_case(&name.to_string()),284 camel_name: cases::camelcase::to_camel_case(&name.to_string()),134 name,285 name,135 ty: parse_ident_from_type(&value.ty, false)?.clone(),286 ty: AbiType::try_maybe_special_from(&value.ty)?,136 })287 })137 }288 }138 fn is_value(&self) -> bool {289 fn is_value(&self) -> bool {139 self.ty == "value"290 self.ty.is_value()140 }291 }141 fn is_caller(&self) -> bool {292 fn is_caller(&self) -> bool {142 self.ty == "caller"293 self.ty.is_caller()143 }294 }144 fn is_special(&self) -> bool {295 fn is_special(&self) -> bool {145 self.is_value() || self.is_caller()296 self.ty.is_special()146 }297 }147 fn selector_ty(&self) -> &Ident {298 fn selector_ty(&self) -> String {148 assert!(!self.is_special());299 assert!(!self.is_special());149 &self.ty300 self.ty.selector_ty()150 }301 }151302152 fn expand_call_def(&self) -> proc_macro2::TokenStream {303 fn expand_call_def(&self) -> proc_macro2::TokenStream {419 .iter()570 .iter()420 .filter(|a| !a.is_special())571 .filter(|a| !a.is_special())421 .map(MethodArg::expand_solidity_argument);572 .map(MethodArg::expand_solidity_argument);573 let selector = format!("{} {:0>8x}", self.selector_str, self.selector);422574423 quote! {575 quote! {424 SolidityFunction {576 SolidityFunction {577 selector: #selector,425 name: #camel_name,578 name: #camel_name,426 mutability: #mutability,579 mutability: #mutability,427 args: (580 args: (544 )*697 )*545 )698 )546 }699 }547 pub fn generate_solidity_interface(out_set: &mut sp_std::collections::btree_set::BTreeSet<string>, is_impl: bool) {700 pub fn generate_solidity_interface(tc: &evm_coder::solidity::TypeCollector, is_impl: bool) {548 use evm_coder::solidity::*;701 use evm_coder::solidity::*;549 use core::fmt::Write;702 use core::fmt::Write;550 let interface = SolidityInterface {703 let interface = SolidityInterface {559 )*),712 )*),560 };713 };561 if is_impl {714 if is_impl {562 out_set.insert("// Common stubs holder\ncontract Dummy {\n\tuint8 dummy;\n\tstring stub_error = \"this contract is implemented in native\";\n}\n".into());715 tc.collect("// Common stubs holder\ncontract Dummy {\n\tuint8 dummy;\n\tstring stub_error = \"this contract is implemented in native\";\n}\n".into());563 } else {716 } else {564 out_set.insert("// Common stubs holder\ninterface Dummy {\n}\n".into());717 tc.collect("// Common stubs holder\ninterface Dummy {\n}\n".into());565 }718 }566 #(719 #(567 #solidity_generators720 #solidity_generators576 if #solidity_name.starts_with("Inline") {729 if #solidity_name.starts_with("Inline") {577 out.push_str("// Inline\n");730 out.push_str("// Inline\n");578 }731 }579 let _ = interface.format(is_impl, &mut out);732 let _ = interface.format(is_impl, &mut out, tc);580 out_set.insert(out);733 tc.collect(out);581 }734 }582 }735 }583 impl ::evm_coder::Call for #call_name {736 impl ::evm_coder::Call for #call_name {crates/evm-coder-macros/src/to_log.rsdiffbeforeafterboth179 #consts179 #consts180 )*180 )*181181182 pub fn generate_solidity_interface(out_set: &mut sp_std::collections::btree_set::BTreeSet<string>, is_impl: bool) {182 pub fn generate_solidity_interface(tc: &evm_coder::solidity::TypeCollector, is_impl: bool) {183 use evm_coder::solidity::*;183 use evm_coder::solidity::*;184 use core::fmt::Write;184 use core::fmt::Write;185 let interface = SolidityInterface {185 let interface = SolidityInterface {191 };191 };192 let mut out = string::new();192 let mut out = string::new();193 out.push_str("// Inline\n");193 out.push_str("// Inline\n");194 let _ = interface.format(is_impl, &mut out);194 let _ = interface.format(is_impl, &mut out, tc);195 out_set.insert(out);195 tc.collect(out);196 }196 }197 }197 }198198crates/evm-coder/Cargo.tomldiffbeforeafterboth556[dependencies]6[dependencies]7evm-coder-macros = { path = "../evm-coder-macros" }7evm-coder-macros = { path = "../evm-coder-macros" }8primitive-types = { version = "0.9", default-features = false }8primitive-types = { version = "0.10.1", default-features = false }9hex-literal = "0.3"9hex-literal = "0.3.3"10ethereum = { version = "0.7.1", default-features = false }10ethereum = { version = "0.9.0", default-features = false }11evm-core = { default-features = false, git = "https://github.com/uniquenetwork/evm.git", branch="precompile-output-parachain" }11evm-core = { default-features = false, git = "https://github.com/uniquenetwork/evm.git", branch="precompile-output-parachain" }12impl-trait-for-tuples = "0.2.1"12impl-trait-for-tuples = "0.2.1"1313crates/evm-coder/src/abi.rsdiffbeforeafterboth211 self.memory(value.as_bytes())211 self.memory(value.as_bytes())212 }212 }213214 pub fn bytes(&mut self, value: &[u8]) {215 self.memory(value)216 }213217214 pub fn finish(mut self) -> Vec<u8> {218 pub fn finish(mut self) -> Vec<u8> {215 for (static_offset, part) in self.dynamic_part {219 for (static_offset, part) in self.dynamic_part {247impl_abi_readable!(bool, bool);251impl_abi_readable!(bool, bool);248impl_abi_readable!(string, string);252impl_abi_readable!(string, string);253254mod sealed {255 /// Not all types can be placed in vec, i.e `Vec<u8>` is restricted, `bytes` should be used instead256 pub trait CanBePlacedInVec {}257}258259impl sealed::CanBePlacedInVec for U256 {}260impl sealed::CanBePlacedInVec for string {}261impl sealed::CanBePlacedInVec for H160 {}262263impl<R: sealed::CanBePlacedInVec> AbiRead<Vec<R>> for AbiReader<'_>264where265 Self: AbiRead<R>,266{267 fn abi_read(&mut self) -> Result<Vec<R>> {268 let mut sub = self.subresult()?;269 let size = sub.read_usize()?;270 sub.subresult_offset = sub.offset;271 let mut out = Vec::with_capacity(size);272 for _ in 0..size {273 out.push(<Self as AbiRead<R>>::abi_read(&mut sub)?);274 }275 Ok(out)276 }277}278279macro_rules! impl_tuples {280 ($($ident:ident)+) => {281 impl<$($ident),+> sealed::CanBePlacedInVec for ($($ident,)+) {}282 impl<$($ident),+> AbiRead<($($ident,)+)> for AbiReader<'_>283 where284 $(Self: AbiRead<$ident>),+285 {286 fn abi_read(&mut self) -> Result<($($ident,)+)> {287 let mut subresult = self.subresult()?;288 Ok((289 $(<Self as AbiRead<$ident>>::abi_read(&mut subresult)?,)+290 ))291 }292 }293 };294}295296impl_tuples! {A}297impl_tuples! {A B}298impl_tuples! {A B C}299impl_tuples! {A B C D}300impl_tuples! {A B C D E}301impl_tuples! {A B C D E F}302impl_tuples! {A B C D E F G}303impl_tuples! {A B C D E F G H}304impl_tuples! {A B C D E F G H I}305impl_tuples! {A B C D E F G H I J}249306250pub trait AbiWrite {307pub trait AbiWrite {251 fn abi_write(&self, writer: &mut AbiWriter);308 fn abi_write(&self, writer: &mut AbiWriter);273 writer.string(self)330 writer.string(self)274 }331 }275}332}333impl AbiWrite for &Vec<u8> {334 fn abi_write(&self, writer: &mut AbiWriter) {335 writer.bytes(self)336 }337}276338277impl AbiWrite for () {339impl AbiWrite for () {278 fn abi_write(&self, _writer: &mut AbiWriter) {}340 fn abi_write(&self, _writer: &mut AbiWriter) {}308370309#[cfg(test)]371#[cfg(test)]310pub mod test {372pub mod test {373 use crate::{374 abi::AbiRead,375 types::{string, uint256},376 };377311 use super::{AbiReader, AbiWriter};378 use super::{AbiReader, AbiWriter};312 use hex_literal::hex;379 use hex_literal::hex;356 assert_eq!(decoder.string().unwrap(), "Test URI");423 assert_eq!(decoder.string().unwrap(), "Test URI");357 }424 }425426 #[test]427 fn mint_bulk() {428 let (call, mut decoder) = AbiReader::new_call(&hex!(429 "430 36543006431 00000000000000000000000053744e6da587ba10b32a2554d2efdcd985bc27a3 // address432 0000000000000000000000000000000000000000000000000000000000000040 // offset of (uint256, string)[]433 0000000000000000000000000000000000000000000000000000000000000003 // length of (uint256, string)[]434435 0000000000000000000000000000000000000000000000000000000000000060 // offset of first elem436 00000000000000000000000000000000000000000000000000000000000000e0 // offset of second elem437 0000000000000000000000000000000000000000000000000000000000000160 // offset of third elem438439 0000000000000000000000000000000000000000000000000000000000000001 // first token id? #60440 0000000000000000000000000000000000000000000000000000000000000040 // offset of string441 000000000000000000000000000000000000000000000000000000000000000a // size of string442 5465737420555249203000000000000000000000000000000000000000000000 // string443444 000000000000000000000000000000000000000000000000000000000000000b // second token id? Why ==11? #e0445 0000000000000000000000000000000000000000000000000000000000000040 // offset of string446 000000000000000000000000000000000000000000000000000000000000000a // size of string447 5465737420555249203100000000000000000000000000000000000000000000 // string448449 000000000000000000000000000000000000000000000000000000000000000c // third token id? Why ==12? #160450 0000000000000000000000000000000000000000000000000000000000000040 // offset of string451 000000000000000000000000000000000000000000000000000000000000000a // size of string452 5465737420555249203200000000000000000000000000000000000000000000 // string453 "454 ))455 .unwrap();456 assert_eq!(call, 0x36543006);457 let _ = decoder.address().unwrap();458 let data =459 <AbiReader<'_> as AbiRead<Vec<(uint256, string)>>>::abi_read(&mut decoder).unwrap();460 assert_eq!(461 data,462 vec![463 (1.into(), "Test URI 0".to_string()),464 (11.into(), "Test URI 1".to_string()),465 (12.into(), "Test URI 2".to_string())466 ]467 );468 }358}469}359470crates/evm-coder/src/lib.rsdiffbeforeafterboth67 #[test]67 #[test]68 #[ignore]68 #[ignore]69 fn $name() {69 fn $name() {70 use sp_std::collections::btree_set::BTreeSet;70 use evm_coder::solidity::TypeCollector;71 let mut out = BTreeSet::new();71 let mut out = TypeCollector::new();72 $decl::generate_solidity_interface(&mut out, $is_impl);72 $decl::generate_solidity_interface(&mut out, $is_impl);73 println!("=== SNIP START ===");73 println!("=== SNIP START ===");74 println!("// SPDX-License-Identifier: OTHER");74 println!("// SPDX-License-Identifier: OTHER");75 println!("// This code is automatically generated");75 println!("// This code is automatically generated");76 println!();76 println!();77 println!("pragma solidity >=0.8.0 <0.9.0;");77 println!("pragma solidity >=0.8.0 <0.9.0;");78 println!();78 println!();79 for b in out {79 for b in out.finish() {80 println!("{}", b);80 println!("{}", b);81 }81 }82 println!("=== SNIP END ===");82 println!("=== SNIP END ===");crates/evm-coder/src/solidity.rsdiffbeforeafterboth1#[cfg(not(feature = "std"))]1#[cfg(not(feature = "std"))]2use alloc::{string::String};2use alloc::{3 string::String,4 vec::Vec,5 collections::{BTreeSet, BTreeMap},6 format,7};8#[cfg(feature = "std")]9use std::collections::{BTreeSet, BTreeMap};3use core::{fmt, marker::PhantomData};10use core::{11 fmt::{self, Write},12 marker::PhantomData,13 cell::{Cell, RefCell},14};4use impl_trait_for_tuples::impl_for_tuples;15use impl_trait_for_tuples::impl_for_tuples;5use crate::types::*;16use crate::types::*;1718#[derive(Default)]19pub struct TypeCollector {20 structs: RefCell<BTreeSet<string>>,21 anonymous: RefCell<BTreeMap<Vec<string>, usize>>,22 id: Cell<usize>,23}24impl TypeCollector {25 pub fn new() -> Self {26 Self::default()27 }28 pub fn collect(&self, item: string) {29 self.structs.borrow_mut().insert(item);30 }31 pub fn next_id(&self) -> usize {32 let v = self.id.get();33 self.id.set(v + 1);34 v35 }36 pub fn collect_tuple<T: SolidityTupleType>(&self) -> String {37 let names = T::names(self);38 if let Some(id) = self.anonymous.borrow().get(&names).cloned() {39 return format!("Tuple{}", id);40 }41 let id = self.next_id();42 let mut str = String::new();43 writeln!(str, "// Anonymous struct").unwrap();44 writeln!(str, "struct Tuple{} {{", id).unwrap();45 for (i, name) in names.iter().enumerate() {46 writeln!(str, "\t{} field_{};", name, i).unwrap();47 }48 writeln!(str, "}}").unwrap();49 self.collect(str);50 self.anonymous.borrow_mut().insert(names, id);51 format!("Tuple{}", id)52 }53 pub fn finish(self) -> BTreeSet<string> {54 self.structs.into_inner()55 }56}6577pub trait SolidityTypeName: 'static {58pub trait SolidityTypeName: 'static {8 fn solidity_name(writer: &mut impl fmt::Write) -> fmt::Result;59 fn solidity_name(writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result;60 fn is_simple() -> bool;9 fn solidity_default(writer: &mut impl fmt::Write) -> fmt::Result;61 fn solidity_default(writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result;10 fn is_void() -> bool {62 fn is_void() -> bool {11 false63 false12 }64 }13}65}1415macro_rules! solidity_type_name {66macro_rules! solidity_type_name {16 ($($ty:ident => $name:literal = $default:literal),* $(,)?) => {67 ($($ty:ty => $name:literal $simple:literal = $default:literal),* $(,)?) => {17 $(68 $(18 impl SolidityTypeName for $ty {69 impl SolidityTypeName for $ty {19 fn solidity_name(writer: &mut impl core::fmt::Write) -> core::fmt::Result {70 fn solidity_name(writer: &mut impl core::fmt::Write, _tc: &TypeCollector) -> core::fmt::Result {20 write!(writer, $name)71 write!(writer, $name)21 }72 }73 fn is_simple() -> bool {74 $simple75 }22 fn solidity_default(writer: &mut impl core::fmt::Write) -> core::fmt::Result {76 fn solidity_default(writer: &mut impl core::fmt::Write, _tc: &TypeCollector) -> core::fmt::Result {23 write!(writer, $default)77 write!(writer, $default)24 }78 }25 }79 }28}82}298330solidity_type_name! {84solidity_type_name! {31 uint8 => "uint8" = "0",85 uint8 => "uint8" true = "0",32 uint32 => "uint32" = "0",86 uint32 => "uint32" true = "0",33 uint128 => "uint128" = "0",87 uint128 => "uint128" true = "0",34 uint256 => "uint256" = "0",88 uint256 => "uint256" true = "0",35 address => "address" = "0x0000000000000000000000000000000000000000",89 address => "address" true = "0x0000000000000000000000000000000000000000",36 string => "string memory" = "\"\"",90 string => "string" false = "\"\"",37 bytes => "bytes memory" = "hex\"\"",91 bytes => "bytes" false = "hex\"\"",38 bool => "bool" = "false",92 bool => "bool" true = "false",39}93}40impl SolidityTypeName for void {94impl SolidityTypeName for void {41 fn solidity_name(_writer: &mut impl fmt::Write) -> fmt::Result {95 fn solidity_name(_writer: &mut impl fmt::Write, _tc: &TypeCollector) -> fmt::Result {42 Ok(())96 Ok(())43 }97 }98 fn is_simple() -> bool {99 true100 }44 fn solidity_default(_writer: &mut impl fmt::Write) -> fmt::Result {101 fn solidity_default(_writer: &mut impl fmt::Write, _tc: &TypeCollector) -> fmt::Result {45 Ok(())102 Ok(())46 }103 }47 fn is_void() -> bool {104 fn is_void() -> bool {48 true105 true49 }106 }50}107}108109mod sealed {110 pub trait CanBePlacedInVec {}111}112113impl sealed::CanBePlacedInVec for uint256 {}114impl sealed::CanBePlacedInVec for string {}115impl sealed::CanBePlacedInVec for address {}116117impl<T: SolidityTypeName + sealed::CanBePlacedInVec> SolidityTypeName for Vec<T> {118 fn solidity_name(writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {119 T::solidity_name(writer, tc)?;120 write!(writer, "[]")121 }122 fn is_simple() -> bool {123 false124 }125 fn solidity_default(writer: &mut impl fmt::Write, _tc: &TypeCollector) -> fmt::Result {126 write!(writer, "[]")127 }128}129130pub trait SolidityTupleType {131 fn names(tc: &TypeCollector) -> Vec<String>;132 fn len() -> usize;133}134135macro_rules! count {136 () => (0usize);137 ( $x:tt $($xs:tt)* ) => (1usize + count!($($xs)*));138}139140macro_rules! impl_tuples {141 ($($ident:ident)+) => {142 impl<$($ident),+> sealed::CanBePlacedInVec for ($($ident,)+) {}143 impl<$($ident: SolidityTypeName + 'static),+> SolidityTupleType for ($($ident,)+) {144 fn names(tc: &TypeCollector) -> Vec<string> {145 let mut collected = Vec::with_capacity(Self::len());146 $({147 let mut out = string::new();148 $ident::solidity_name(&mut out, tc).expect("no fmt error");149 collected.push(out);150 })*;151 collected152 }153154 fn len() -> usize {155 count!($($ident)*)156 }157 }158 impl<$($ident: SolidityTypeName + 'static),+> SolidityTypeName for ($($ident,)+) {159 fn solidity_name(writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {160 write!(writer, "{}", tc.collect_tuple::<Self>())161 }162 fn is_simple() -> bool {163 false164 }165 fn solidity_default(writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {166 write!(writer, "{}(", tc.collect_tuple::<Self>())?;167 $(168 <$ident>::solidity_default(writer, tc)?;169 )*170 write!(writer, ")")171 }172 }173 };174}175176impl_tuples! {A}177impl_tuples! {A B}178impl_tuples! {A B C}179impl_tuples! {A B C D}180impl_tuples! {A B C D E}181impl_tuples! {A B C D E F}182impl_tuples! {A B C D E F G}183impl_tuples! {A B C D E F G H}184impl_tuples! {A B C D E F G H I}185impl_tuples! {A B C D E F G H I J}5118652pub trait SolidityArguments {187pub trait SolidityArguments {53 fn solidity_name(&self, writer: &mut impl fmt::Write) -> fmt::Result;188 fn solidity_name(&self, writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result;54 fn solidity_get(&self, writer: &mut impl fmt::Write) -> fmt::Result;189 fn solidity_get(&self, writer: &mut impl fmt::Write) -> fmt::Result;55 fn solidity_default(&self, writer: &mut impl fmt::Write) -> fmt::Result;190 fn solidity_default(&self, writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result;56 fn is_empty(&self) -> bool {191 fn is_empty(&self) -> bool {57 self.len() == 0192 self.len() == 058 }193 }63pub struct UnnamedArgument<T>(PhantomData<*const T>);198pub struct UnnamedArgument<T>(PhantomData<*const T>);6419965impl<T: SolidityTypeName> SolidityArguments for UnnamedArgument<T> {200impl<T: SolidityTypeName> SolidityArguments for UnnamedArgument<T> {66 fn solidity_name(&self, writer: &mut impl fmt::Write) -> fmt::Result {201 fn solidity_name(&self, writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {67 if !T::is_void() {202 if !T::is_void() {68 T::solidity_name(writer)203 T::solidity_name(writer, tc)?;204 if !T::is_simple() {205 write!(writer, " memory")?;206 }207 Ok(())69 } else {208 } else {70 Ok(())209 Ok(())71 }210 }72 }211 }73 fn solidity_get(&self, _writer: &mut impl fmt::Write) -> fmt::Result {212 fn solidity_get(&self, _writer: &mut impl fmt::Write) -> fmt::Result {74 Ok(())213 Ok(())75 }214 }76 fn solidity_default(&self, writer: &mut impl fmt::Write) -> fmt::Result {215 fn solidity_default(&self, writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {77 T::solidity_default(writer)216 T::solidity_default(writer, tc)78 }217 }79 fn len(&self) -> usize {218 fn len(&self) -> usize {80 if T::is_void() {219 if T::is_void() {94}233}9523496impl<T: SolidityTypeName> SolidityArguments for NamedArgument<T> {235impl<T: SolidityTypeName> SolidityArguments for NamedArgument<T> {97 fn solidity_name(&self, writer: &mut impl fmt::Write) -> fmt::Result {236 fn solidity_name(&self, writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {98 if !T::is_void() {237 if !T::is_void() {99 T::solidity_name(writer)?;238 T::solidity_name(writer, tc)?;239 if !T::is_simple() {240 write!(writer, " memory")?;241 }100 write!(writer, " {}", self.0)242 write!(writer, " {}", self.0)101 } else {243 } else {102 Ok(())244 Ok(())105 fn solidity_get(&self, writer: &mut impl fmt::Write) -> fmt::Result {247 fn solidity_get(&self, writer: &mut impl fmt::Write) -> fmt::Result {106 writeln!(writer, "\t\t{};", self.0)248 writeln!(writer, "\t\t{};", self.0)107 }249 }108 fn solidity_default(&self, writer: &mut impl fmt::Write) -> fmt::Result {250 fn solidity_default(&self, writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {109 T::solidity_default(writer)251 T::solidity_default(writer, tc)110 }252 }111 fn len(&self) -> usize {253 fn len(&self) -> usize {112 if T::is_void() {254 if T::is_void() {126}268}127269128impl<T: SolidityTypeName> SolidityArguments for SolidityEventArgument<T> {270impl<T: SolidityTypeName> SolidityArguments for SolidityEventArgument<T> {129 fn solidity_name(&self, writer: &mut impl fmt::Write) -> fmt::Result {271 fn solidity_name(&self, writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {130 if !T::is_void() {272 if !T::is_void() {131 T::solidity_name(writer)?;273 T::solidity_name(writer, tc)?;132 if self.0 {274 if self.0 {133 write!(writer, " indexed")?;275 write!(writer, " indexed")?;134 }276 }140 fn solidity_get(&self, writer: &mut impl fmt::Write) -> fmt::Result {282 fn solidity_get(&self, writer: &mut impl fmt::Write) -> fmt::Result {141 writeln!(writer, "\t\t{};", self.1)283 writeln!(writer, "\t\t{};", self.1)142 }284 }143 fn solidity_default(&self, writer: &mut impl fmt::Write) -> fmt::Result {285 fn solidity_default(&self, writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {144 T::solidity_default(writer)286 T::solidity_default(writer, tc)145 }287 }146 fn len(&self) -> usize {288 fn len(&self) -> usize {147 if T::is_void() {289 if T::is_void() {153}295}154296155impl SolidityArguments for () {297impl SolidityArguments for () {156 fn solidity_name(&self, _writer: &mut impl fmt::Write) -> fmt::Result {298 fn solidity_name(&self, _writer: &mut impl fmt::Write, _tc: &TypeCollector) -> fmt::Result {157 Ok(())299 Ok(())158 }300 }159 fn solidity_get(&self, _writer: &mut impl fmt::Write) -> fmt::Result {301 fn solidity_get(&self, _writer: &mut impl fmt::Write) -> fmt::Result {160 Ok(())302 Ok(())161 }303 }162 fn solidity_default(&self, _writer: &mut impl fmt::Write) -> fmt::Result {304 fn solidity_default(&self, _writer: &mut impl fmt::Write, _tc: &TypeCollector) -> fmt::Result {163 Ok(())305 Ok(())164 }306 }165 fn len(&self) -> usize {307 fn len(&self) -> usize {171impl SolidityArguments for Tuple {313impl SolidityArguments for Tuple {172 for_tuples!( where #( Tuple: SolidityArguments ),* );314 for_tuples!( where #( Tuple: SolidityArguments ),* );173315174 fn solidity_name(&self, writer: &mut impl fmt::Write) -> fmt::Result {316 fn solidity_name(&self, writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {175 let mut first = true;317 let mut first = true;176 for_tuples!( #(318 for_tuples!( #(177 if !Tuple.is_empty() {319 if !Tuple.is_empty() {178 if !first {320 if !first {179 write!(writer, ", ")?;321 write!(writer, ", ")?;180 }322 }181 first = false;323 first = false;182 Tuple.solidity_name(writer)?;324 Tuple.solidity_name(writer, tc)?;183 }325 }184 )* );326 )* );185 Ok(())327 Ok(())190 )* );332 )* );191 Ok(())333 Ok(())192 }334 }193 fn solidity_default(&self, writer: &mut impl fmt::Write) -> fmt::Result {335 fn solidity_default(&self, writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {194 if self.is_empty() {336 if self.is_empty() {195 Ok(())337 Ok(())196 } else if self.len() == 1 {338 } else if self.len() == 1 {197 for_tuples!( #(339 for_tuples!( #(198 Tuple.solidity_default(writer)?;340 Tuple.solidity_default(writer, tc)?;199 )* );341 )* );200 Ok(())342 Ok(())201 } else {343 } else {207 write!(writer, ", ")?;349 write!(writer, ", ")?;208 }350 }209 first = false;351 first = false;210 Tuple.solidity_name(writer)?;352 Tuple.solidity_default(writer, tc)?;211 }353 }212 )* );354 )* );213 write!(writer, ")")?;355 write!(writer, ")")?;223 fn solidity_name(&self, is_impl: bool, writer: &mut impl fmt::Write) -> fmt::Result;365 fn solidity_name(366 &self,367 is_impl: bool,368 writer: &mut impl fmt::Write,369 tc: &TypeCollector,370 ) -> fmt::Result;224}371}225372229 Mutable,376 Mutable,230}377}231pub struct SolidityFunction<A, R> {378pub struct SolidityFunction<A, R> {379 pub selector: &'static str,232 pub name: &'static str,380 pub name: &'static str,233 pub args: A,381 pub args: A,234 pub result: R,382 pub result: R,235 pub mutability: SolidityMutability,383 pub mutability: SolidityMutability,236}384}237impl<A: SolidityArguments, R: SolidityArguments> SolidityFunctions for SolidityFunction<A, R> {385impl<A: SolidityArguments, R: SolidityArguments> SolidityFunctions for SolidityFunction<A, R> {238 fn solidity_name(&self, is_impl: bool, writer: &mut impl fmt::Write) -> fmt::Result {386 fn solidity_name(387 &self,388 is_impl: bool,389 writer: &mut impl fmt::Write,390 tc: &TypeCollector,391 ) -> fmt::Result {392 writeln!(writer, "\t// Selector: {}", self.selector)?;239 write!(writer, "\tfunction {}(", self.name)?;393 write!(writer, "\tfunction {}(", self.name)?;240 self.args.solidity_name(writer)?;394 self.args.solidity_name(writer, tc)?;241 write!(writer, ")")?;395 write!(writer, ")")?;242 if is_impl {396 if is_impl {243 write!(writer, " public")?;397 write!(writer, " public")?;251 }405 }252 if !self.result.is_empty() {406 if !self.result.is_empty() {253 write!(writer, " returns (")?;407 write!(writer, " returns (")?;254 self.result.solidity_name(writer)?;408 self.result.solidity_name(writer, tc)?;255 write!(writer, ")")?;409 write!(writer, ")")?;256 }410 }257 if is_impl {411 if is_impl {265 }419 }266 if !self.result.is_empty() {420 if !self.result.is_empty() {267 write!(writer, "\t\treturn ")?;421 write!(writer, "\t\treturn ")?;268 self.result.solidity_default(writer)?;422 self.result.solidity_default(writer, tc)?;269 writeln!(writer, ";")?;423 writeln!(writer, ";")?;270 }424 }271 writeln!(writer, "\t}}")?;425 writeln!(writer, "\t}}")?;283 fn solidity_name(&self, is_impl: bool, writer: &mut impl fmt::Write) -> fmt::Result {437 fn solidity_name(438 &self,439 is_impl: bool,440 writer: &mut impl fmt::Write,441 tc: &TypeCollector,442 ) -> fmt::Result {284 let mut first = false;443 let mut first = false;285 for_tuples!( #(444 for_tuples!( #(286 Tuple.solidity_name(is_impl, writer)?;445 Tuple.solidity_name(is_impl, writer, tc)?;287 )* );446 )* );288 Ok(())447 Ok(())289 }448 }299 pub fn format(&self, is_impl: bool, out: &mut impl fmt::Write) -> fmt::Result {458 pub fn format(459 &self,460 is_impl: bool,461 out: &mut impl fmt::Write,462 tc: &TypeCollector,463 ) -> fmt::Result {300 if is_impl {464 if is_impl {301 write!(out, "contract ")?;465 write!(out, "contract ")?;313 }477 }314 }478 }315 writeln!(out, " {{")?;479 writeln!(out, " {{")?;316 self.functions.solidity_name(is_impl, out)?;480 self.functions.solidity_name(is_impl, out, tc)?;317 writeln!(out, "}}")?;481 writeln!(out, "}}")?;318 Ok(())482 Ok(())319 }483 }328 fn solidity_name(&self, _is_impl: bool, writer: &mut impl fmt::Write) -> fmt::Result {492 fn solidity_name(493 &self,494 _is_impl: bool,495 writer: &mut impl fmt::Write,496 tc: &TypeCollector,497 ) -> fmt::Result {329 write!(writer, "\tevent {}(", self.name)?;498 write!(writer, "\tevent {}(", self.name)?;330 self.args.solidity_name(writer)?;499 self.args.solidity_name(writer, tc)?;331 writeln!(writer, ");")500 writeln!(writer, ");")332 }501 }333}502}crates/evm-coder/tests/a.rsdiffbeforeafterboth223use evm_coder::{solidity_interface, types::*, ToLog, execution::Result};3use evm_coder::{solidity_interface, types::*, ToLog, execution::Result};4use evm_coder_macros::solidity;4use evm_coder_macros::solidity;5use std as sp_std;657struct Impls;6struct Impls;87deploy/dev/host_vars/chain-specs/nft-rococo-local-v0.9.10-source.jsondiffbeforeafterbothno changes
deploy/dev/host_vars/chain-specs/nft-rococo-local-v0.9.9-source.jsondiffbeforeafterbothno changes
deploy/dev/host_vars/chain-specs/nft-westend-local-v0.9.9-source.jsondiffbeforeafterbothno changes
deploy/dev/host_vars/chain-specs/rococo-local-v0.9.10-source.jsondiffbeforeafterbothno changes
deploy/dev/host_vars/chain-specs/rococo-local-v0.9.9-source.jsondiffbeforeafterbothno changes
deploy/dev/host_vars/chain-specs/westend-local-v0.9.9-source.jsondiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-rococo-alice-aura-key.jsondiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-rococo-alice-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-rococo-bob-aura-key.jsondiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-rococo-bob-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-rococo-charlie-aura-key.jsondiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-rococo-charlie-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-rococo-dave-aura-key.jsondiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-rococo-dave-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-rococo-eve-aura-key.jsondiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-rococo-eve-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-rococo-ferdie-aura-key.jsondiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-rococo-ferdie-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-rococo-greg-aura-key.jsondiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-rococo-greg-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-westend-alice-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-westend-bob-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-westend-charlie-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-westend-dave-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-westend-eve-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-westend-ferdie-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/nft-westend-greg-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/relay-rococo-alice-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/relay-rococo-bob-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/relay-rococo-charlie-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/relay-rococo-dave-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/relay-rococo-eve-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/relay-rococo-ferdie-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/relay-westend-alice-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/relay-westend-bob-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/relay-westend-charlie-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/relay-westend-dave-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/relay-westend-eve-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/keys/relay-westend-ferdie-node-keydiffbeforeafterbothno changes
deploy/dev/host_vars/services/parachain-rococo-alice.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/parachain-rococo-bob.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/parachain-rococo-charlie.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/parachain-rococo-dave.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/parachain-rococo-eve.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/parachain-rococo-ferdie.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/parachain-rococo-greg.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/parachain-westend-alice.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/parachain-westend-bob.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/parachain-westend-charlie.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/parachain-westend-dave.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/parachain-westend-eve.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/parachain-westend-ferdie.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/parachain-westend-greg.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/relay-rococo-alice.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/relay-rococo-bob.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/relay-rococo-charlie.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/relay-rococo-dave.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/relay-rococo-eve.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/relay-rococo-ferdie.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/relay-westend-alice.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/relay-westend-bob.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/relay-westend-charlie.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/relay-westend-dave.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/relay-westend-eve.servicediffbeforeafterbothno changes
deploy/dev/host_vars/services/relay-westend-ferdie.servicediffbeforeafterbothno changes
deploy/dev/put-keys-parachain-rococo.shdiffbeforeafterbothno changes
deploy/dev/put-keys-parachain-westend.shdiffbeforeafterbothno changes
deploy/dev/start-parachain-rococo.shdiffbeforeafterbothno changes
deploy/dev/start-parachain-westend.shdiffbeforeafterbothno changes
deploy/dev/start-relay-rococo.shdiffbeforeafterbothno changes
deploy/dev/start-relay-westend.shdiffbeforeafterbothno changes
deploy/dev/stop-parachain-rococo.shdiffbeforeafterbothno changes
deploy/dev/stop-parachain-westend.shdiffbeforeafterbothno changes
deploy/dev/stop-relay-rococo.shdiffbeforeafterbothno changes
deploy/dev/stop-relay-westend.shdiffbeforeafterbothno changes
deploy/westend/host_vars/chain-specs/nft-westend-v0.9.9-source.jsondiffbeforeafterbothno changes
deploy/westend/host_vars/chain-specs/nft-westend-v0.9.9.jsondiffbeforeafterbothno changes
deploy/westend/host_vars/chain-specs/westend-v0.9.9.jsondiffbeforeafterbothno changes
deploy/westend/host_vars/services/parachain-westend-alice.servicediffbeforeafterbothno changes
deploy/westend/host_vars/services/parachain-westend-bob.servicediffbeforeafterbothno changes
deploy/westend/host_vars/services/parachain-westend-charlie.servicediffbeforeafterbothno changes
deploy/westend/host_vars/services/parachain-westend-dave.servicediffbeforeafterbothno changes
deploy/westend/host_vars/services/parachain-westend-eve.servicediffbeforeafterbothno changes
deploy/westend/host_vars/services/parachain-westend-ferdie.servicediffbeforeafterbothno changes
node/cli/Cargo.tomldiffbeforeafterboth334[build-dependencies.substrate-build-script-utils]4[build-dependencies.substrate-build-script-utils]5git = 'https://github.com/paritytech/substrate.git'5git = 'https://github.com/paritytech/substrate.git'6branch = 'polkadot-v0.9.8'6branch = 'polkadot-v0.9.10'7version = '3.0.0'7version = '3.0.0'889################################################################################9################################################################################13default-features = false13default-features = false14features = ['derive']14features = ['derive']15package = 'parity-scale-codec'15package = 'parity-scale-codec'16version = '2.0.0'16version = '2.3.0'171718[dependencies.frame-benchmarking]18[dependencies.frame-benchmarking]19git = 'https://github.com/paritytech/substrate.git'19git = 'https://github.com/paritytech/substrate.git'20branch = 'polkadot-v0.9.8'20branch = 'polkadot-v0.9.10'21version = '3.0.0'21version = '4.0.0-dev'222223[dependencies.frame-benchmarking-cli]23[dependencies.frame-benchmarking-cli]24git = 'https://github.com/paritytech/substrate.git'24git = 'https://github.com/paritytech/substrate.git'25branch = 'polkadot-v0.9.8'25branch = 'polkadot-v0.9.10'26version = '3.0.0'26version = '4.0.0-dev'272728[dependencies.pallet-transaction-payment-rpc]28[dependencies.pallet-transaction-payment-rpc]29git = 'https://github.com/paritytech/substrate.git'29git = 'https://github.com/paritytech/substrate.git'30branch = 'polkadot-v0.9.8'30branch = 'polkadot-v0.9.10'31version = '3.0.0'31version = '4.0.0-dev'323233[dependencies.substrate-prometheus-endpoint]33[dependencies.substrate-prometheus-endpoint]34git = 'https://github.com/paritytech/substrate.git'34git = 'https://github.com/paritytech/substrate.git'35branch = 'polkadot-v0.9.8'35branch = 'polkadot-v0.9.10'36version = '0.9.0'36version = '0.9.0'373738[dependencies.sc-basic-authorship]38[dependencies.sc-basic-authorship]39git = 'https://github.com/paritytech/substrate.git'39git = 'https://github.com/paritytech/substrate.git'40branch = 'polkadot-v0.9.8'40branch = 'polkadot-v0.9.10'41version = '0.9.0'41version = '0.10.0-dev'424243[dependencies.sc-chain-spec]43[dependencies.sc-chain-spec]44git = 'https://github.com/paritytech/substrate.git'44git = 'https://github.com/paritytech/substrate.git'45branch = 'polkadot-v0.9.8'45branch = 'polkadot-v0.9.10'46version = '3.0.0'46version = '4.0.0-dev'474748[dependencies.sc-cli]48[dependencies.sc-cli]49features = ['wasmtime']49features = ['wasmtime']50git = 'https://github.com/paritytech/substrate.git'50git = 'https://github.com/paritytech/substrate.git'51branch = 'polkadot-v0.9.8'51branch = 'polkadot-v0.9.10'52version = '0.9.0'52version = '0.10.0-dev'535354[dependencies.sc-client-api]54[dependencies.sc-client-api]55git = 'https://github.com/paritytech/substrate.git'55git = 'https://github.com/paritytech/substrate.git'56branch = 'polkadot-v0.9.8'56branch = 'polkadot-v0.9.10'57version = '3.0.0'57version = '4.0.0-dev'585859[dependencies.sc-consensus]59[dependencies.sc-consensus]60git = 'https://github.com/paritytech/substrate.git'60git = 'https://github.com/paritytech/substrate.git'61branch = 'polkadot-v0.9.8'61branch = 'polkadot-v0.9.10'62version = '0.9.0'62version = '0.10.0-dev'636364[dependencies.sc-consensus-aura]64[dependencies.sc-consensus-aura]65git = 'https://github.com/paritytech/substrate.git'65git = 'https://github.com/paritytech/substrate.git'66branch = 'polkadot-v0.9.8'66branch = 'polkadot-v0.9.10'67version = '0.9.0'67version = '0.10.0-dev'686869[dependencies.sc-executor]69[dependencies.sc-executor]70features = ['wasmtime']70features = ['wasmtime']71git = 'https://github.com/paritytech/substrate.git'71git = 'https://github.com/paritytech/substrate.git'72branch = 'polkadot-v0.9.8'72branch = 'polkadot-v0.9.10'73version = '0.9.0'73version = '0.10.0-dev'747475[dependencies.sc-finality-grandpa]75[dependencies.sc-finality-grandpa]76git = 'https://github.com/paritytech/substrate.git'76git = 'https://github.com/paritytech/substrate.git'77branch = 'polkadot-v0.9.8'77branch = 'polkadot-v0.9.10'78version = '0.9.0'78version = '0.10.0-dev'797980[dependencies.sc-keystore]80[dependencies.sc-keystore]81git = 'https://github.com/paritytech/substrate.git'81git = 'https://github.com/paritytech/substrate.git'82branch = 'polkadot-v0.9.8'82branch = 'polkadot-v0.9.10'83version = '3.0.0'83version = '4.0.0-dev'848485[dependencies.sc-rpc]85[dependencies.sc-rpc]86git = 'https://github.com/paritytech/substrate.git'86git = 'https://github.com/paritytech/substrate.git'87branch = 'polkadot-v0.9.8'87branch = 'polkadot-v0.9.10'88version = '3.0.0'88version = '4.0.0-dev'898990[dependencies.sc-rpc-api]90[dependencies.sc-rpc-api]91git = 'https://github.com/paritytech/substrate.git'91git = 'https://github.com/paritytech/substrate.git'92branch = 'polkadot-v0.9.8'92branch = 'polkadot-v0.9.10'93version = '0.9.0'93version = '0.10.0-dev'949495[dependencies.sc-service]95[dependencies.sc-service]96features = ['wasmtime']96features = ['wasmtime']97git = 'https://github.com/paritytech/substrate.git'97git = 'https://github.com/paritytech/substrate.git'98branch = 'polkadot-v0.9.8'98branch = 'polkadot-v0.9.10'99version = '0.9.0'99version = '0.10.0-dev'100100101[dependencies.sc-telemetry]101[dependencies.sc-telemetry]102git = 'https://github.com/paritytech/substrate.git'102git = 'https://github.com/paritytech/substrate.git'103branch = 'polkadot-v0.9.8'103branch = 'polkadot-v0.9.10'104version = '3.0.0'104version = '4.0.0-dev'105105106[dependencies.sc-transaction-pool]106[dependencies.sc-transaction-pool]107git = 'https://github.com/paritytech/substrate.git'107git = 'https://github.com/paritytech/substrate.git'108branch = 'polkadot-v0.9.8'108branch = 'polkadot-v0.9.10'109version = '3.0.0'109version = '4.0.0-dev'110110111[dependencies.sc-tracing]111[dependencies.sc-tracing]112git = 'https://github.com/paritytech/substrate.git'112git = 'https://github.com/paritytech/substrate.git'113branch = 'polkadot-v0.9.8'113branch = 'polkadot-v0.9.10'114version = '3.0.0'114version = '4.0.0-dev'115115116[dependencies.sp-block-builder]116[dependencies.sp-block-builder]117git = 'https://github.com/paritytech/substrate.git'117git = 'https://github.com/paritytech/substrate.git'118branch = 'polkadot-v0.9.8'118branch = 'polkadot-v0.9.10'119version = '3.0.0'119version = '4.0.0-dev'120120121[dependencies.sp-api]121[dependencies.sp-api]122git = 'https://github.com/paritytech/substrate.git'122git = 'https://github.com/paritytech/substrate.git'123branch = 'polkadot-v0.9.8'123branch = 'polkadot-v0.9.10'124version = '3.0.0'124version = '4.0.0-dev'125125126[dependencies.sp-blockchain]126[dependencies.sp-blockchain]127git = 'https://github.com/paritytech/substrate.git'127git = 'https://github.com/paritytech/substrate.git'128branch = 'polkadot-v0.9.8'128branch = 'polkadot-v0.9.10'129version = '3.0.0'129version = '4.0.0-dev'130130131[dependencies.sp-consensus]131[dependencies.sp-consensus]132git = 'https://github.com/paritytech/substrate.git'132git = 'https://github.com/paritytech/substrate.git'133branch = 'polkadot-v0.9.8'133branch = 'polkadot-v0.9.10'134version = '0.9.0'134version = '0.10.0-dev'135135136[dependencies.sp-consensus-aura]136[dependencies.sp-consensus-aura]137git = 'https://github.com/paritytech/substrate.git'137git = 'https://github.com/paritytech/substrate.git'138branch = 'polkadot-v0.9.8'138branch = 'polkadot-v0.9.10'139version = '0.9.0'139version = '0.10.0-dev'140140141[dependencies.sp-core]141[dependencies.sp-core]142git = 'https://github.com/paritytech/substrate.git'142git = 'https://github.com/paritytech/substrate.git'143branch = 'polkadot-v0.9.8'143branch = 'polkadot-v0.9.10'144version = '3.0.0'144version = '4.0.0-dev'145145146[dependencies.sp-finality-grandpa]146[dependencies.sp-finality-grandpa]147git = 'https://github.com/paritytech/substrate.git'147git = 'https://github.com/paritytech/substrate.git'148branch = 'polkadot-v0.9.8'148branch = 'polkadot-v0.9.10'149version = '3.0.0'149version = '4.0.0-dev'150150151[dependencies.sp-inherents]151[dependencies.sp-inherents]152git = 'https://github.com/paritytech/substrate.git'152git = 'https://github.com/paritytech/substrate.git'153branch = 'polkadot-v0.9.8'153branch = 'polkadot-v0.9.10'154version = '3.0.0'154version = '4.0.0-dev'155155156[dependencies.sp-keystore]156[dependencies.sp-keystore]157git = 'https://github.com/paritytech/substrate.git'157git = 'https://github.com/paritytech/substrate.git'158branch = 'polkadot-v0.9.8'158branch = 'polkadot-v0.9.10'159version = '0.9.0'159version = '0.10.0-dev'160160161[dependencies.sp-offchain]161[dependencies.sp-offchain]162git = 'https://github.com/paritytech/substrate.git'162git = 'https://github.com/paritytech/substrate.git'163branch = 'polkadot-v0.9.8'163branch = 'polkadot-v0.9.10'164version = '3.0.0'164version = '4.0.0-dev'165165166[dependencies.sp-runtime]166[dependencies.sp-runtime]167git = 'https://github.com/paritytech/substrate.git'167git = 'https://github.com/paritytech/substrate.git'168branch = 'polkadot-v0.9.8'168branch = 'polkadot-v0.9.10'169version = '3.0.0'169version = '4.0.0-dev'170170171[dependencies.sp-session]171[dependencies.sp-session]172git = 'https://github.com/paritytech/substrate.git'172git = 'https://github.com/paritytech/substrate.git'173branch = 'polkadot-v0.9.8'173branch = 'polkadot-v0.9.10'174version = '3.0.0'174version = '4.0.0-dev'175175176[dependencies.sp-timestamp]176[dependencies.sp-timestamp]177git = 'https://github.com/paritytech/substrate.git'177git = 'https://github.com/paritytech/substrate.git'178branch = 'polkadot-v0.9.8'178branch = 'polkadot-v0.9.10'179version = '3.0.0'179version = '4.0.0-dev'180180181[dependencies.sp-transaction-pool]181[dependencies.sp-transaction-pool]182git = 'https://github.com/paritytech/substrate.git'182git = 'https://github.com/paritytech/substrate.git'183branch = 'polkadot-v0.9.8'183branch = 'polkadot-v0.9.10'184version = '3.0.0'184version = '4.0.0-dev'185185186[dependencies.sp-trie]186[dependencies.sp-trie]187git = 'https://github.com/paritytech/substrate.git'187git = 'https://github.com/paritytech/substrate.git'188branch = 'polkadot-v0.9.8'188branch = 'polkadot-v0.9.10'189version = '3.0.0'189version = '4.0.0-dev'190190191[dependencies.substrate-frame-rpc-system]191[dependencies.substrate-frame-rpc-system]192git = 'https://github.com/paritytech/substrate.git'192git = 'https://github.com/paritytech/substrate.git'193branch = 'polkadot-v0.9.8'193branch = 'polkadot-v0.9.10'194version = '3.0.0'194version = '4.0.0-dev'195195196[dependencies.sc-network]196[dependencies.sc-network]197git = 'https://github.com/paritytech/substrate.git'197git = 'https://github.com/paritytech/substrate.git'198branch = 'polkadot-v0.9.8'198branch = 'polkadot-v0.9.10'199version = '0.9.0'199version = '0.10.0-dev'200200201[dependencies.serde]201[dependencies.serde]202features = ['derive']202features = ['derive']203version = '1.0.119'203version = '1.0.130'204204205[dependencies.serde_json]205[dependencies.serde_json]206version = '1.0.41'206version = '1.0.68'207207208208209################################################################################209################################################################################210# Cumulus dependencies210# Cumulus dependencies211211212[dependencies.cumulus-client-consensus-aura]212[dependencies.cumulus-client-consensus-aura]213git = 'https://github.com/paritytech/cumulus.git'213git = 'https://github.com/paritytech/cumulus.git'214branch = 'polkadot-v0.9.8'214branch = 'polkadot-v0.9.10'215215216[dependencies.cumulus-client-consensus-common]216[dependencies.cumulus-client-consensus-common]217git = 'https://github.com/paritytech/cumulus.git'217git = 'https://github.com/paritytech/cumulus.git'218branch = 'polkadot-v0.9.8'218branch = 'polkadot-v0.9.10'219219220[dependencies.cumulus-client-collator]220[dependencies.cumulus-client-collator]221git = 'https://github.com/paritytech/cumulus.git'221git = 'https://github.com/paritytech/cumulus.git'222branch = 'polkadot-v0.9.8'222branch = 'polkadot-v0.9.10'223223224[dependencies.cumulus-client-cli]224[dependencies.cumulus-client-cli]225git = 'https://github.com/paritytech/cumulus.git'225git = 'https://github.com/paritytech/cumulus.git'226branch = 'polkadot-v0.9.8'226branch = 'polkadot-v0.9.10'227227228[dependencies.cumulus-client-network]228[dependencies.cumulus-client-network]229git = 'https://github.com/paritytech/cumulus.git'229git = 'https://github.com/paritytech/cumulus.git'230branch = 'polkadot-v0.9.8'230branch = 'polkadot-v0.9.10'231231232[dependencies.cumulus-primitives-core]232[dependencies.cumulus-primitives-core]233git = 'https://github.com/paritytech/cumulus.git'233git = 'https://github.com/paritytech/cumulus.git'234branch = 'polkadot-v0.9.8'234branch = 'polkadot-v0.9.10'235235236[dependencies.cumulus-primitives-parachain-inherent]236[dependencies.cumulus-primitives-parachain-inherent]237git = 'https://github.com/paritytech/cumulus.git'237git = 'https://github.com/paritytech/cumulus.git'238branch = 'polkadot-v0.9.8'238branch = 'polkadot-v0.9.10'239239240[dependencies.cumulus-client-service]240[dependencies.cumulus-client-service]241git = 'https://github.com/paritytech/cumulus.git'241git = 'https://github.com/paritytech/cumulus.git'242branch = 'polkadot-v0.9.8'242branch = 'polkadot-v0.9.10'243243244244245################################################################################245################################################################################246# Polkadot dependencies246# Polkadot dependencies247[dependencies.polkadot-primitives]247[dependencies.polkadot-primitives]248git = "https://github.com/paritytech/polkadot"248git = "https://github.com/paritytech/polkadot"249branch = 'release-v0.9.8'249branch = 'release-v0.9.10'250250251[dependencies.polkadot-service]251[dependencies.polkadot-service]252git = "https://github.com/paritytech/polkadot"252git = "https://github.com/paritytech/polkadot"253branch = 'release-v0.9.8'253branch = 'release-v0.9.10'254254255[dependencies.polkadot-cli]255[dependencies.polkadot-cli]256git = "https://github.com/paritytech/polkadot"256git = "https://github.com/paritytech/polkadot"257branch = 'release-v0.9.8'257branch = 'release-v0.9.10'258258259[dependencies.polkadot-test-service]259[dependencies.polkadot-test-service]260git = "https://github.com/paritytech/polkadot"260git = "https://github.com/paritytech/polkadot"261branch = 'release-v0.9.8'261branch = 'release-v0.9.10'262262263[dependencies.polkadot-parachain]263[dependencies.polkadot-parachain]264git = "https://github.com/paritytech/polkadot"264git = "https://github.com/paritytech/polkadot"265branch = 'release-v0.9.8'265branch = 'release-v0.9.10'266266267267268################################################################################268################################################################################297targets = ['x86_64-unknown-linux-gnu']297targets = ['x86_64-unknown-linux-gnu']298298299[dependencies]299[dependencies]300futures = '0.3.4'300futures = '0.3.17'301log = '0.4.8'301log = '0.4.14'302flexi_logger = "0.15.7"302flexi_logger = "0.15.7"303parking_lot = '0.10.0'303parking_lot = '0.11.2'304structopt = '0.3.8'304structopt = '0.3.23'305jsonrpc-core = '15.0.0'305jsonrpc-core = '15.1.0'306jsonrpc-pubsub = "15.0.0"306jsonrpc-pubsub = "15.1.0"307307308fc-rpc-core = { version = "1.1.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }308fc-rpc-core = { version = "1.1.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }309fc-consensus = { version = "2.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }309fc-consensus = { version = "2.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }310fc-mapping-sync = { version = "2.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }310fc-mapping-sync = { version = "2.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }311fc-rpc = { version = "2.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }311fc-rpc = { version = "2.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }312fc-db = { version = "1.0.0", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }312fc-db = { version = "2.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }313fp-rpc = { version = "2.0.0", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }313fp-rpc = { version = "3.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }314pallet-ethereum = { version = "3.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }314pallet-ethereum = { version = "4.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }315315316nft-rpc = { path = "../rpc" }316nft-rpc = { path = "../rpc" }317317node/cli/src/chain_spec.rsdiffbeforeafterboth196 const_on_chain_schema: vec![],196 const_on_chain_schema: vec![],197 variable_on_chain_schema: vec![],197 variable_on_chain_schema: vec![],198 limits: CollectionLimits::default(),198 limits: CollectionLimits::default(),199 meta_update_permission: MetaUpdatePermission::ItemOwner,199 transfers_enabled: true,200 transfers_enabled: true,200 },201 },201 )],202 )],node/cli/src/command.rsdiffbeforeafterboth51}51}525253impl SubstrateCli for Cli {53impl SubstrateCli for Cli {54 // TODO use args54 fn impl_name() -> String {55 fn impl_name() -> String {55 "Parachain Collator Template".into()56 "Opal Node".into()56 }57 }575858 fn impl_version() -> String {59 fn impl_version() -> String {59 env!("SUBSTRATE_CLI_IMPL_VERSION").into()60 env!("SUBSTRATE_CLI_IMPL_VERSION").into()60 }61 }6162 // TODO use args62 fn description() -> String {63 fn description() -> String {63 format!(64 format!(64 "Parachain Collator Template\n\nThe command-line arguments provided first will be \65 "Opal Node\n\nThe command-line arguments provided first will be \65 passed to the parachain node, while the arguments provided after -- will be passed \66 passed to the parachain node, while the arguments provided after -- will be passed \66 to the relaychain node.\n\n\67 to the relaychain node.\n\n\67 {} [parachain-args] -- [relaychain-args]",68 {} [parachain-args] -- [relaychain-args]",68 Self::executable_name()69 Self::executable_name()69 )70 )70 }71 }73 env!("CARGO_PKG_AUTHORS").into()74 env!("CARGO_PKG_AUTHORS").into()74 }75 }757677 //TODO use args76 fn support_url() -> String {78 fn support_url() -> String {77 "https://github.com/substrate-developer-hub/substrate-parachain-template/issues/new".into()79 "mailto:support@unique.network".into()78 }80 }798180 fn copyright_start_year() -> i32 {82 fn copyright_start_year() -> i32 {81 201783 202182 }84 }838584 fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {86 fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {91}93}929493impl SubstrateCli for RelayChainCli {95impl SubstrateCli for RelayChainCli {96 // TODO use args94 fn impl_name() -> String {97 fn impl_name() -> String {95 "Parachain Collator Template".into()98 "Opal Node".into()96 }99 }9710098 fn impl_version() -> String {101 fn impl_version() -> String {99 env!("SUBSTRATE_CLI_IMPL_VERSION").into()102 env!("SUBSTRATE_CLI_IMPL_VERSION").into()100 }103 }101104 // TODO use args102 fn description() -> String {105 fn description() -> String {103 "Parachain Collator Template\n\nThe command-line arguments provided first will be \106 "Opal Node\n\nThe command-line arguments provided first will be \104 passed to the parachain node, while the arguments provided after -- will be passed \107 passed to the parachain node, while the arguments provided after -- will be passed \105 to the relaychain node.\n\n\108 to the relaychain node.\n\n\106 parachain-collator [parachain-args] -- [relaychain-args]"109 parachain-collator [parachain-args] -- [relaychain-args]"107 .into()110 .into()108 }111 }109112110 fn author() -> String {113 fn author() -> String {111 env!("CARGO_PKG_AUTHORS").into()114 env!("CARGO_PKG_AUTHORS").into()112 }115 }113116 // TODO use args114 fn support_url() -> String {117 fn support_url() -> String {115 "https://github.com/substrate-developer-hub/substrate-parachain-template/issues/new".into()118 "mailto:support@unique.network".into()116 }119 }117120118 fn copyright_start_year() -> i32 {121 fn copyright_start_year() -> i32 {119 2017122 2021120 }123 }121124122 fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {125 fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {node/cli/src/service.rsdiffbeforeafterboth41// Frontier Imports41// Frontier Imports42use fc_rpc_core::types::FilterPool;42use fc_rpc_core::types::FilterPool;43use fc_rpc_core::types::PendingTransactions;43use fc_rpc_core::types::PendingTransactions;44use fc_mapping_sync::MappingSyncWorker;44use fc_mapping_sync::{MappingSyncWorker, SyncStrategy};454546// Runtime type overrides46// Runtime type overrides47type BlockNumber = u32;47type BlockNumber = u32;96 FullClient,96 FullClient,97 FullBackend,97 FullBackend,98 FullSelectChain,98 FullSelectChain,99 sp_consensus::DefaultImportQueue<Block, FullClient>,99 sc_consensus::DefaultImportQueue<Block, FullClient>,100 sc_transaction_pool::FullPool<Block, FullClient>,100 sc_transaction_pool::FullPool<Block, FullClient>,101 (101 (102 Option<Telemetry>,102 Option<Telemetry>,116 &Configuration,116 &Configuration,117 Option<TelemetryHandle>,117 Option<TelemetryHandle>,118 &TaskManager,118 &TaskManager,119 ) -> Result<sp_consensus::DefaultImportQueue<Block, FullClient>, sc_service::Error>,119 ) -> Result<sc_consensus::DefaultImportQueue<Block, FullClient>, sc_service::Error>,120{120{121 let _telemetry = config121 let _telemetry = config122 .telemetry_endpoints122 .telemetry_endpoints216 &Configuration,216 &Configuration,217 Option<TelemetryHandle>,217 Option<TelemetryHandle>,218 &TaskManager,218 &TaskManager,219 ) -> Result<sp_consensus::DefaultImportQueue<Block, FullClient>, sc_service::Error>,219 ) -> Result<sc_consensus::DefaultImportQueue<Block, FullClient>, sc_service::Error>,220 BIC: FnOnce(220 BIC: FnOnce(221 Arc<FullClient>,221 Arc<FullClient>,222 Option<&Registry>,222 Option<&Registry>,275 import_queue: import_queue.clone(),276 import_queue: import_queue.clone(),276 on_demand: None,277 on_demand: None,277 block_announce_validator_builder: Some(Box::new(|_| block_announce_validator)),278 block_announce_validator_builder: Some(Box::new(|_| block_announce_validator)),279 warp_sync: None,278 })?;280 })?;279281280 let subscription_executor = sc_rpc::SubscriptionTaskExecutor::new(task_manager.spawn_handle());282 let subscription_executor = sc_rpc::SubscriptionTaskExecutor::new(task_manager.spawn_handle());302 max_past_logs: 10000,304 max_past_logs: 10000,303 };305 };304306305 nft_rpc::create_full::<_, _, _, RuntimeApi, _>(full_deps, subscription_executor.clone())307 Ok(nft_rpc::create_full::<_, _, _, RuntimeApi, _>(308 full_deps,309 subscription_executor.clone(),310 ))306 });311 });307312308 task_manager.spawn_essential_handle().spawn(313 task_manager.spawn_essential_handle().spawn(313 client.clone(),318 client.clone(),314 backend.clone(),319 backend.clone(),315 frontier_backend.clone(),320 frontier_backend.clone(),321 SyncStrategy::Normal,316 )322 )317 .for_each(|()| futures::future::ready(())),323 .for_each(|()| futures::future::ready(())),318 );324 );388 config: &Configuration,394 config: &Configuration,389 telemetry: Option<TelemetryHandle>,395 telemetry: Option<TelemetryHandle>,390 task_manager: &TaskManager,396 task_manager: &TaskManager,391) -> Result<sp_consensus::DefaultImportQueue<Block, FullClient>, sc_service::Error> {397) -> Result<sc_consensus::DefaultImportQueue<Block, FullClient>, sc_service::Error> {392 let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;398 let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;393399394 cumulus_client_consensus_aura::import_queue::<400 cumulus_client_consensus_aura::import_queue::<node/rpc/Cargo.tomldiffbeforeafterboth10targets = ["x86_64-unknown-linux-gnu"]10targets = ["x86_64-unknown-linux-gnu"]111112[dependencies]12[dependencies]13futures = { version = "0.3.1", features = ["compat"] }13futures = { version = "0.3.17", features = ["compat"] }14jsonrpc-core = "15.0.0"14jsonrpc-core = "15.1.0"15jsonrpc-pubsub = "15.0.0"15jsonrpc-pubsub = "15.1.0"16# pallet-contracts-rpc = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }16# pallet-contracts-rpc = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.9' }17pallet-transaction-payment-rpc = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }17pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }18pallet-transaction-payment-rpc-runtime-api = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }18pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }19sc-client-api = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }19sc-client-api = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }20sc-consensus-aura = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }20sc-consensus-aura = { version = "0.10.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }21sc-consensus-epochs = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }21sc-consensus-epochs = { version = "0.10.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }22sc-finality-grandpa = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }22sc-finality-grandpa = { version = "0.10.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }23sc-finality-grandpa-rpc = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }23sc-finality-grandpa-rpc = { version = "0.10.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }24sc-keystore = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }24sc-keystore = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }25sc-network = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }25sc-network = { version = "0.10.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }26sc-rpc-api = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }26sc-rpc-api = { version = "0.10.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }27sc-rpc = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }27sc-rpc = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }28sc-service = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }28sc-service = { version = "0.10.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }29sp-api = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }29sp-api = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }30sp-block-builder = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }30sp-block-builder = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }31sp-blockchain = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }31sp-blockchain = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }32sp-consensus = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }32sp-consensus = { version = "0.10.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }33sp-consensus-aura = { version = "0.9", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }33sp-consensus-aura = { version = "0.10.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }34sp-core = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }34sp-core = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }35sp-offchain = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }35sp-offchain = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }36sp-runtime = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }36sp-runtime = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }37sp-storage = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }37sp-storage = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }38sp-session = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }38sp-session = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }39sp-transaction-pool = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }39sp-transaction-pool = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }40sc-transaction-pool = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }40sc-transaction-pool = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }41sc-transaction-graph = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }42substrate-frame-rpc-system = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }41substrate-frame-rpc-system = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }43tokio = { version = "0.2.13", features = ["macros", "sync"] }42tokio = { version = "0.2.25", features = ["macros", "sync"] }444345pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }44pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }46fc-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }45fc-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }47fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }46fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }48fc-rpc-core = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }47fc-rpc-core = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }49fc-db = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }48fc-db = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }50fc-mapping-sync = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }49fc-mapping-sync = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }515052pallet-nft = { path = "../../pallets/nft" }51pallet-nft = { path = "../../pallets/nft" }53nft-runtime = { path = "../../runtime" }52nft-runtime = { path = "../../runtime" }node/rpc/src/lib.rsdiffbeforeafterboth18use sp_block_builder::BlockBuilder;18use sp_block_builder::BlockBuilder;19use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};19use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};20use sp_consensus::SelectChain;20use sp_consensus::SelectChain;21use sp_transaction_pool::TransactionPool;21use sc_service::TransactionPool;22use std::{collections::BTreeMap, marker::PhantomData, sync::Arc};22use std::{collections::BTreeMap, marker::PhantomData, sync::Arc};232324/// Public io handler for exporting into other modules24/// Public io handler for exporting into other modules192 pending_transactions,192 pending_transactions,193 signers,193 signers,194 overrides.clone(),194 overrides.clone(),195 backend,195 backend.clone(),196 is_authority,196 is_authority,197 max_past_logs,197 max_past_logs,198 )));198 )));199199200 if let Some(filter_pool) = filter_pool {200 if let Some(filter_pool) = filter_pool {201 io.extend_with(EthFilterApiServer::to_delegate(EthFilterApi::new(201 io.extend_with(EthFilterApiServer::to_delegate(EthFilterApi::new(202 client.clone(),202 client.clone(),203 backend,203 filter_pool,204 filter_pool,204 500_usize, // max stored filters205 500_usize, // max stored filters205 overrides.clone(),206 overrides.clone(),pallets/contract-helpers/Cargo.tomldiffbeforeafterboth7default-features = false7default-features = false8features = ['derive']8features = ['derive']9package = 'parity-scale-codec'9package = 'parity-scale-codec'10version = '2.0.0'10version = '2.3.0'111112[dependencies.up-sponsorship]12[dependencies.up-sponsorship]13default-features = false13default-features = false14path = '../../primitives/sponsorship'14path = '../../primitives/sponsorship'15version = '0.1.0'15version = '0.1.0'161617[dependencies]17[dependencies]18frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }18frame-support = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }19frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }19frame-system = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }20pallet-contracts = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }20pallet-contracts = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }21sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }21sp-runtime = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }22sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }22sp-std = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }232324[features]24[features]25default = ["std"]25default = ["std"]pallets/contract-helpers/src/lib.rsdiffbeforeafterboth7 use frame_support::sp_runtime::traits::StaticLookup;7 use frame_support::sp_runtime::traits::StaticLookup;8 use frame_support::{pallet_prelude::*, traits::IsSubType};8 use frame_support::{pallet_prelude::*, traits::IsSubType};9 use frame_system::pallet_prelude::*;9 use frame_system::pallet_prelude::*;10 use frame_system::Config as SysConfig;10 use pallet_contracts::chain_extension::UncheckedFrom;11 use pallet_contracts::chain_extension::UncheckedFrom;11 use sp_runtime::{12 use sp_runtime::{12 traits::{DispatchInfoOf, Hash, PostDispatchInfoOf, SignedExtension},13 traits::{DispatchInfoOf, Hash, PostDispatchInfoOf, SignedExtension},176 impl<T> SignedExtension for ContractHelpersExtension<T>177 impl<T> SignedExtension for ContractHelpersExtension<T>177 where178 where178 T: Config + Send + Sync,179 T: Config + Send + Sync,179 T::Call: sp_runtime::traits::Dispatchable,180 <T as SysConfig>::Call: sp_runtime::traits::Dispatchable,180 T::Call: IsSubType<pallet_contracts::Call<T>>,181 <T as SysConfig>::Call: IsSubType<pallet_contracts::Call<T>>,181 T::AccountId: UncheckedFrom<T::Hash>,182 T::AccountId: UncheckedFrom<T::Hash>,182 T::AccountId: AsRef<[u8]>,183 T::AccountId: AsRef<[u8]>,183 {184 {184 const IDENTIFIER: &'static str = "ContractHelpers";185 const IDENTIFIER: &'static str = "ContractHelpers";185 type AccountId = T::AccountId;186 type AccountId = T::AccountId;186 type Call = T::Call;187 type Call = <T as SysConfig>::Call;187 type AdditionalSigned = ();188 type AdditionalSigned = ();188 type Pre = Option<(Self::AccountId, CodeHash<T>, Vec<u8>)>;189 type Pre = Option<(Self::AccountId, CodeHash<T>, Vec<u8>)>;189190pallets/evm-coder-substrate/Cargo.tomldiffbeforeafterboth4edition = "2018"4edition = "2018"556[dependencies]6[dependencies]7sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }7sp-std = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }8sp-core = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }8sp-core = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }9ethereum = { default-features = false, version = "0.7.1" }9ethereum = { default-features = false, version = "0.9.0" }10evm-coder = { default-features = false, path = "../../crates/evm-coder" }10evm-coder = { default-features = false, path = "../../crates/evm-coder" }11pallet-ethereum = { default-features = false, version = "3.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }11pallet-ethereum = { default-features = false, version = "4.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }12pallet-evm = { default-features = false, version = "5.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }12pallet-evm = { default-features = false, version = "6.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }13frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }13frame-support = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }14frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }14frame-system = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }151516[dependencies.codec]16[dependencies.codec]17default-features = false17default-features = false18features = ['derive']18features = ['derive']19package = 'parity-scale-codec'19package = 'parity-scale-codec'20version = '2.0.0'20version = '2.3.0'212122[features]22[features]23default = ["std"]23default = ["std"]pallets/evm-coder-substrate/src/lib.rsdiffbeforeafterboth60 .saturating_add((topics as u64).saturating_mul(G_LOGTOPIC))60 .saturating_add((topics as u64).saturating_mul(G_LOGTOPIC))61 }61 }626263 pub fn generate_transaction() -> ethereum::Transaction {63 pub fn generate_transaction() -> ethereum::TransactionV0 {64 use ethereum::{Transaction, TransactionAction, TransactionSignature};64 use ethereum::{TransactionV0, TransactionAction, TransactionSignature};65 Transaction {65 TransactionV0 {66 nonce: 0.into(),66 nonce: 0.into(),67 gas_price: 0.into(),67 gas_price: 0.into(),68 gas_limit: 0.into(),68 gas_limit: 0.into(),pallets/evm-contract-helpers/Cargo.tomldiffbeforeafterboth4edition = "2018"4edition = "2018"556[dependencies]6[dependencies]7frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }7frame-support = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }8frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }8frame-system = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }9sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }9sp-runtime = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }10sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }10sp-std = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }11sp-core = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }11sp-core = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }12evm-coder = { default-features = false, path = '../../crates/evm-coder' }12evm-coder = { default-features = false, path = '../../crates/evm-coder' }13pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }13pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }14pallet-evm = { default-features = false, version = "5.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }14pallet-evm = { default-features = false, version = "6.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }15up-sponsorship = { default-features = false, path = '../../primitives/sponsorship' }15up-sponsorship = { default-features = false, path = '../../primitives/sponsorship' }16log = "0.4.14"16log = "0.4.14"171718[dependencies.codec]18[dependencies.codec]19default-features = false19default-features = false20features = ['derive']20features = ['derive']21package = 'parity-scale-codec'21package = 'parity-scale-codec'22version = '2.0.0'22version = '2.3.0'232324[features]24[features]25default = ["std"]25default = ["std"]pallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth8};8};9use frame_support::traits::Get;9use frame_support::traits::Get;10use up_sponsorship::SponsorshipHandler;10use up_sponsorship::SponsorshipHandler;11use sp_std::vec::Vec;11use sp_std::{convert::TryInto, vec::Vec};121213struct ContractHelpers<T: Config>(SubstrateRecorder<T>);13struct ContractHelpers<T: Config>(SubstrateRecorder<T>);141450 Ok(())50 Ok(())51 }51 }5253 fn get_sponsoring_rate_limit(&self, contract_address: address) -> Result<uint32> {54 self.0.consume_sload()?;55 Ok(<SponsoringRateLimit<T>>::get(contract_address)56 .try_into()57 .map_err(|_| "rate limit > u32::MAX")?)58 }525953 fn allowed(&self, contract_address: address, user: address) -> Result<bool> {60 fn allowed(&self, contract_address: address, user: address) -> Result<bool> {54 self.0.consume_sload()?;61 self.0.consume_sload()?;pallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterbothbinary blob — no preview
pallets/evm-contract-helpers/src/stubs/ContractHelpers.soldiffbeforeafterboth10}10}111112contract ContractHelpers is Dummy {12contract ContractHelpers is Dummy {13 // Selector: contractOwner(address) 5152b14c13 function contractOwner(address contractAddress)14 function contractOwner(address contractAddress)14 public15 public15 view16 view21 return 0x0000000000000000000000000000000000000000;22 return 0x0000000000000000000000000000000000000000;22 }23 }232425 // Selector: sponsoringEnabled(address) 6027dc6124 function sponsoringEnabled(address contractAddress)26 function sponsoringEnabled(address contractAddress)25 public27 public26 view28 view32 return false;34 return false;33 }35 }343637 // Selector: toggleSponsoring(address,bool) fcac6d8635 function toggleSponsoring(address contractAddress, bool enabled) public {38 function toggleSponsoring(address contractAddress, bool enabled) public {36 require(false, stub_error);39 require(false, stub_error);37 contractAddress;40 contractAddress;38 enabled;41 enabled;39 dummy = 0;42 dummy = 0;40 }43 }414445 // Selector: setSponsoringRateLimit(address,uint32) 77b6c90842 function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)46 function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)43 public47 public44 {48 {48 dummy = 0;52 dummy = 0;49 }53 }505455 // Selector: getSponsoringRateLimit(address) 610cfabd56 function getSponsoringRateLimit(address contractAddress)57 public58 view59 returns (uint32)60 {61 require(false, stub_error);62 contractAddress;63 dummy;64 return 0;65 }6667 // Selector: allowed(address,address) 5c65816551 function allowed(address contractAddress, address user)68 function allowed(address contractAddress, address user)52 public69 public53 view70 view60 return false;77 return false;61 }78 }627980 // Selector: allowlistEnabled(address) c772ef6c63 function allowlistEnabled(address contractAddress)81 function allowlistEnabled(address contractAddress)64 public82 public65 view83 view71 return false;89 return false;72 }90 }739192 // Selector: toggleAllowlist(address,bool) 36de20f574 function toggleAllowlist(address contractAddress, bool enabled) public {93 function toggleAllowlist(address contractAddress, bool enabled) public {75 require(false, stub_error);94 require(false, stub_error);76 contractAddress;95 contractAddress;77 enabled;96 enabled;78 dummy = 0;97 dummy = 0;79 }98 }8099100 // Selector: toggleAllowed(address,address,bool) 4706cc1c81 function toggleAllowed(101 function toggleAllowed(82 address contractAddress,102 address contractAddress,83 address user,103 address user,pallets/evm-migration/Cargo.tomldiffbeforeafterboth4edition = "2018"4edition = "2018"556[dependencies]6[dependencies]7frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }7frame-support = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }8frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }8frame-system = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }9frame-benchmarking = { default-features = false, version = '3.0.0', optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }9frame-benchmarking = { default-features = false, version = '4.0.0-dev', optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }10sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }10sp-runtime = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }11sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }11sp-std = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }12sp-io = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }12sp-io = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }13sp-core = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }13sp-core = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }14pallet-evm = { default-features = false, version = "5.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }14pallet-evm = { default-features = false, version = "6.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }15fp-evm = { default-features = false, version = "2.0.0", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }15fp-evm = { default-features = false, version = "3.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }161617[dependencies.codec]17[dependencies.codec]18default-features = false18default-features = false19features = ['derive']19features = ['derive']20package = 'parity-scale-codec'20package = 'parity-scale-codec'21version = '2.0.0'21version = '2.3.0'222223[features]23[features]24default = ["std", "runtime-benchmarks"]24default = ["std", "runtime-benchmarks"]pallets/evm-migration/src/lib.rsdiffbeforeafterboth55 address: H160,55 address: H160,56 data: Vec<(H256, H256)>,56 data: Vec<(H256, H256)>,57 ) -> DispatchResult {57 ) -> DispatchResult {58 use frame_support::StorageDoubleMap;59 ensure_root(origin)?;58 ensure_root(origin)?;60 ensure!(59 ensure!(61 <MigrationPending<T>>::get(&address),60 <MigrationPending<T>>::get(&address),62 <Error<T>>::AccountIsNotMigrating,61 <Error<T>>::AccountIsNotMigrating,63 );62 );646365 for (k, v) in data {64 for (k, v) in data {66 pallet_evm::AccountStorages::insert(&address, k, v);65 <pallet_evm::AccountStorages<T>>::insert(&address, k, v);67 }66 }68 Ok(())67 Ok(())69 }68 }706971 #[pallet::weight(<SelfWeightOf<T>>::finish(code.len() as u32))]70 #[pallet::weight(<SelfWeightOf<T>>::finish(code.len() as u32))]72 #[transactional]71 #[transactional]73 pub fn finish(origin: OriginFor<T>, address: H160, code: Vec<u8>) -> DispatchResult {72 pub fn finish(origin: OriginFor<T>, address: H160, code: Vec<u8>) -> DispatchResult {74 use frame_support::StorageMap;75 ensure_root(origin)?;73 ensure_root(origin)?;76 ensure!(74 ensure!(77 <MigrationPending<T>>::get(&address),75 <MigrationPending<T>>::get(&address),78 <Error<T>>::AccountIsNotMigrating,76 <Error<T>>::AccountIsNotMigrating,79 );77 );807881 pallet_evm::AccountCodes::insert(&address, code);79 <pallet_evm::AccountCodes<T>>::insert(&address, code);82 <MigrationPending<T>>::remove(address);80 <MigrationPending<T>>::remove(address);83 Ok(())81 Ok(())84 }82 }pallets/evm-transaction-payment/Cargo.tomldiffbeforeafterboth4edition = "2018"4edition = "2018"556[dependencies]6[dependencies]7frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }7frame-support = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }8frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }8frame-system = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }9sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }9sp-runtime = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }10sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }10sp-std = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }11sp-io = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }11sp-io = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }12sp-core = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }12sp-core = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }13pallet-evm = { default-features = false, version = "5.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }13pallet-evm = { default-features = false, version = "6.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }14fp-evm = { default-features = false, version = "2.0.0", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }14fp-evm = { default-features = false, version = "3.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }15pallet-ethereum = { default-features = false, version = "3.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }15pallet-ethereum = { default-features = false, version = "4.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }16up-sponsorship = { default-features = false, path = '../../primitives/sponsorship' }16up-sponsorship = { default-features = false, path = '../../primitives/sponsorship' }171718[dependencies.codec]18[dependencies.codec]19default-features = false19default-features = false20features = ['derive']20features = ['derive']21package = 'parity-scale-codec'21package = 'parity-scale-codec'22version = '2.0.0'22version = '2.3.0'232324[features]24[features]25default = ["std"]25default = ["std"]pallets/inflation/Cargo.tomldiffbeforeafterboth37default-features = false37default-features = false38features = ['derive']38features = ['derive']39package = 'parity-scale-codec'39package = 'parity-scale-codec'40version = '2.0.0'40version = '2.3.0'414142[dependencies.frame-benchmarking]42[dependencies.frame-benchmarking]43default-features = false43default-features = false44optional = true44optional = true45git = 'https://github.com/paritytech/substrate.git'45git = 'https://github.com/paritytech/substrate.git'46branch = 'polkadot-v0.9.8'46branch = 'polkadot-v0.9.10'47version = '3.0.0'47version = '4.0.0-dev'484849[dependencies.frame-support]49[dependencies.frame-support]50default-features = false50default-features = false51git = 'https://github.com/paritytech/substrate.git'51git = 'https://github.com/paritytech/substrate.git'52branch = 'polkadot-v0.9.8'52branch = 'polkadot-v0.9.10'53version = '3.0.0'53version = '4.0.0-dev'545455[dependencies.frame-system]55[dependencies.frame-system]56default-features = false56default-features = false57git = 'https://github.com/paritytech/substrate.git'57git = 'https://github.com/paritytech/substrate.git'58branch = 'polkadot-v0.9.8'58branch = 'polkadot-v0.9.10'59version = '3.0.0'59version = '4.0.0-dev'606061[dependencies.pallet-balances]61[dependencies.pallet-balances]62default-features = false62default-features = false63git = 'https://github.com/paritytech/substrate.git'63git = 'https://github.com/paritytech/substrate.git'64branch = 'polkadot-v0.9.8'64branch = 'polkadot-v0.9.10'65version = '3.0.0'65version = '4.0.0-dev'666667[dependencies.pallet-timestamp]67[dependencies.pallet-timestamp]68default-features = false68default-features = false69git = 'https://github.com/paritytech/substrate.git'69git = 'https://github.com/paritytech/substrate.git'70branch = 'polkadot-v0.9.8'70branch = 'polkadot-v0.9.10'71version = '3.0.0'71version = '4.0.0-dev'727273[dependencies.pallet-randomness-collective-flip]73[dependencies.pallet-randomness-collective-flip]74default-features = false74default-features = false75git = 'https://github.com/paritytech/substrate.git'75git = 'https://github.com/paritytech/substrate.git'76branch = 'polkadot-v0.9.8'76branch = 'polkadot-v0.9.10'77version = '3.0.0'77version = '4.0.0-dev'787879[dependencies.sp-std]79[dependencies.sp-std]80default-features = false80default-features = false81git = 'https://github.com/paritytech/substrate.git'81git = 'https://github.com/paritytech/substrate.git'82branch = 'polkadot-v0.9.8'82branch = 'polkadot-v0.9.10'83version = '3.0.0'83version = '4.0.0-dev'848485[dependencies.serde]85[dependencies.serde]86default-features = false86default-features = false87features = ['derive']87features = ['derive']88version = '1.0.119'88version = '1.0.130'898990[dependencies.sp-runtime]90[dependencies.sp-runtime]91default-features = false91default-features = false92git = 'https://github.com/paritytech/substrate.git'92git = 'https://github.com/paritytech/substrate.git'93branch = 'polkadot-v0.9.8'93branch = 'polkadot-v0.9.10'94version = '3.0.0'94version = '4.0.0-dev'959596[dependencies.sp-core]96[dependencies.sp-core]97default-features = false97default-features = false98git = 'https://github.com/paritytech/substrate.git'98git = 'https://github.com/paritytech/substrate.git'99branch = 'polkadot-v0.9.8'99branch = 'polkadot-v0.9.10'100version = '3.0.0'100version = '4.0.0-dev'101101102[dependencies.sp-io]102[dependencies.sp-io]103default-features = false103default-features = false104git = 'https://github.com/paritytech/substrate.git'104git = 'https://github.com/paritytech/substrate.git'105branch = 'polkadot-v0.9.8'105branch = 'polkadot-v0.9.10'106version = '3.0.0'106version = '4.0.0-dev'107107108pallets/nft-charge-transaction/Cargo.tomldiffbeforeafterboth16default-features = false16default-features = false17features = ['derive']17features = ['derive']18package = 'parity-scale-codec'18package = 'parity-scale-codec'19version = '2.0.0'19version = '2.3.0'202021[dependencies]21[dependencies]22serde = { version = "1.0.119", default-features = false }22serde = { version = "1.0.130", default-features = false }23frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }23frame-support = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }24frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }24frame-system = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }25pallet-balances = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }25pallet-balances = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }26pallet-transaction-payment = { default-features = false, version = "3.0.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }26pallet-transaction-payment = { default-features = false, version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }27sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }27sp-std = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }28frame-benchmarking = { default-features = false, version = "3.0.0", optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }28frame-benchmarking = { default-features = false, version = "4.0.0-dev", optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }29sp-core = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }29sp-core = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }30sp-io = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }30sp-io = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }31sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }31sp-runtime = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }323233pallet-nft-transaction-payment = { default-features = false, path="../nft-transaction-payment" }33pallet-nft-transaction-payment = { default-features = false, path = "../nft-transaction-payment" }3434pallets/nft-transaction-payment/Cargo.tomldiffbeforeafterboth16default-features = false16default-features = false17features = ['derive']17features = ['derive']18package = 'parity-scale-codec'18package = 'parity-scale-codec'19version = '2.0.0'19version = '2.3.0'202021[dependencies]21[dependencies]22serde = { version = "1.0.119", default-features = false }22serde = { version = "1.0.130", default-features = false }23frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }23frame-support = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }24frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }24frame-system = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }25pallet-transaction-payment = { default-features = false, version = "3.0.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }25pallet-transaction-payment = { default-features = false, version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }26sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }26sp-std = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }27frame-benchmarking = { default-features = false, version = "3.0.0", optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }27frame-benchmarking = { default-features = false, version = "4.0.0-dev", optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }28sp-core = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }28sp-core = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }29sp-io = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }29sp-io = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }30sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }30sp-runtime = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }313132up-sponsorship = { default-features = false, path = "../../primitives/sponsorship", version = "0.1.0" }32up-sponsorship = { default-features = false, path = "../../primitives/sponsorship", version = "0.1.0" }3333pallets/nft/Cargo.tomldiffbeforeafterboth50default-features = false50default-features = false51features = ['derive']51features = ['derive']52package = 'parity-scale-codec'52package = 'parity-scale-codec'53version = '2.0.0'53version = '2.3.0'545455[dependencies.frame-benchmarking]55[dependencies.frame-benchmarking]56default-features = false56default-features = false57optional = true57optional = true58git = 'https://github.com/paritytech/substrate.git'58git = 'https://github.com/paritytech/substrate.git'59branch = 'polkadot-v0.9.8'59branch = 'polkadot-v0.9.10'60version = '3.0.0'60version = '4.0.0-dev'616162[dependencies.frame-support]62[dependencies.frame-support]63default-features = false63default-features = false64git = 'https://github.com/paritytech/substrate.git'64git = 'https://github.com/paritytech/substrate.git'65branch = 'polkadot-v0.9.8'65branch = 'polkadot-v0.9.10'66version = '3.0.0'66version = '4.0.0-dev'676768[dependencies.frame-system]68[dependencies.frame-system]69default-features = false69default-features = false70git = 'https://github.com/paritytech/substrate.git'70git = 'https://github.com/paritytech/substrate.git'71branch = 'polkadot-v0.9.8'71branch = 'polkadot-v0.9.10'72version = '3.0.0'72version = '4.0.0-dev'737374[dependencies.pallet-balances]74[dependencies.pallet-balances]75default-features = false75default-features = false76git = 'https://github.com/paritytech/substrate.git'76git = 'https://github.com/paritytech/substrate.git'77branch = 'polkadot-v0.9.8'77branch = 'polkadot-v0.9.10'78version = '3.0.0'78version = '4.0.0-dev'797980[dependencies.pallet-timestamp]80[dependencies.pallet-timestamp]81default-features = false81default-features = false82git = 'https://github.com/paritytech/substrate.git'82git = 'https://github.com/paritytech/substrate.git'83branch = 'polkadot-v0.9.8'83branch = 'polkadot-v0.9.10'84version = '3.0.0'84version = '4.0.0-dev'858586[dependencies.pallet-randomness-collective-flip]86[dependencies.pallet-randomness-collective-flip]87default-features = false87default-features = false88git = 'https://github.com/paritytech/substrate.git'88git = 'https://github.com/paritytech/substrate.git'89branch = 'polkadot-v0.9.8'89branch = 'polkadot-v0.9.10'90version = '3.0.0'90version = '4.0.0-dev'919192[dependencies.sp-std]92[dependencies.sp-std]93default-features = false93default-features = false94git = 'https://github.com/paritytech/substrate.git'94git = 'https://github.com/paritytech/substrate.git'95branch = 'polkadot-v0.9.8'95branch = 'polkadot-v0.9.10'96version = '3.0.0'96version = '4.0.0-dev'979798[dependencies.pallet-transaction-payment]98[dependencies.pallet-transaction-payment]99default-features = false99default-features = false100git = 'https://github.com/paritytech/substrate.git'100git = 'https://github.com/paritytech/substrate.git'101branch = 'polkadot-v0.9.8'101branch = 'polkadot-v0.9.10'102version = '3.0.0'102version = '4.0.0-dev'103103104[dependencies.serde]104[dependencies.serde]105default-features = false105default-features = false106features = ['derive']106features = ['derive']107version = '1.0.119'107version = '1.0.130'108108109[dependencies.sp-runtime]109[dependencies.sp-runtime]110default-features = false110default-features = false111git = 'https://github.com/paritytech/substrate.git'111git = 'https://github.com/paritytech/substrate.git'112branch = 'polkadot-v0.9.8'112branch = 'polkadot-v0.9.10'113version = '3.0.0'113version = '4.0.0-dev'114114115[dependencies.sp-core]115[dependencies.sp-core]116default-features = false116default-features = false117git = 'https://github.com/paritytech/substrate.git'117git = 'https://github.com/paritytech/substrate.git'118branch = 'polkadot-v0.9.8'118branch = 'polkadot-v0.9.10'119version = '3.0.0'119version = '4.0.0-dev'120120121[dependencies.sp-io]121[dependencies.sp-io]122default-features = false122default-features = false123git = 'https://github.com/paritytech/substrate.git'123git = 'https://github.com/paritytech/substrate.git'124branch = 'polkadot-v0.9.8'124branch = 'polkadot-v0.9.10'125version = '3.0.0'125version = '4.0.0-dev'126126127127128################################################################################128################################################################################140140141141142[dependencies]142[dependencies]143ethereum = { default-features = false, version = "0.7.1" }143ethereum = { default-features = false, version = "0.9.0" }144rlp = { default-features = false, version = "0.5.0" }144rlp = { default-features = false, version = "0.5.0" }145sp-api = { default-features = false, version = '3.0.0', git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.8" }145sp-api = { default-features = false, version = '4.0.0-dev', git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }146146147evm-coder = { default-features = false, path = "../../crates/evm-coder" }147evm-coder = { default-features = false, path = "../../crates/evm-coder" }148pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }148pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }149primitive-types = { version = "0.9.0", default-features = false, features = [149primitive-types = { version = "0.10.1", default-features = false, features = [150 "serde_no_std",150 "serde_no_std",151] }151] }152152153pallet-evm = { default-features = false, version = "5.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }153pallet-evm = { default-features = false, version = "6.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }154pallet-ethereum = { default-features = false, version = "3.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }154pallet-ethereum = { default-features = false, version = "4.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }155fp-evm = { default-features = false, version = '2.0.0', git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }155fp-evm = { default-features = false, version = '3.0.0-dev', git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }156hex-literal = "0.3.1"156hex-literal = "0.3.3"157157pallets/nft/src/eth/erc.rsdiffbeforeafterboth8};8};9use frame_support::storage::{StorageMap, StorageDoubleMap};9use frame_support::storage::{StorageMap, StorageDoubleMap};10use pallet_evm::AddressMapping;10use pallet_evm::AddressMapping;11use pallet_evm_coder_substrate::dispatch_to_evm;11use super::account::CrossAccountId;12use super::account::CrossAccountId;12use sp_std::{vec, vec::Vec};13use sp_std::{vec, vec::Vec};1314300 .into())301 .into())301 }302 }303304 fn set_variable_metadata(305 &mut self,306 caller: caller,307 token_id: uint256,308 data: bytes,309 ) -> Result<void> {310 let caller = T::CrossAccountId::from_eth(caller);311 let token_id = token_id.try_into().map_err(|_| "token id overflow")?;312313 <Module<T>>::set_variable_meta_data_internal(&caller, self, token_id, data)314 .map_err(dispatch_to_evm::<T>)?;315 Ok(())316 }317318 fn get_variable_metadata(&self, token_id: uint256) -> Result<bytes> {319 let token_id = token_id.try_into().map_err(|_| "token id overflow")?;320321 <Module<T>>::get_variable_metadata(self, token_id).map_err(dispatch_to_evm::<T>)322 }323324 fn mint_bulk(&mut self, caller: caller, to: address, token_ids: Vec<uint256>) -> Result<bool> {325 let caller = T::CrossAccountId::from_eth(caller);326 let to = T::CrossAccountId::from_eth(to);327 let mut expected_index = <ItemListIndex>::get(self.id)328 .checked_add(1)329 .ok_or("item id overflow")?;330331 let total_tokens = token_ids.len();332 for id in token_ids.into_iter() {333 let id: u32 = id.try_into().map_err(|_| "token id overflow")?;334 if id != expected_index {335 return Err("item id should be next".into());336 }337 expected_index = expected_index.checked_add(1).ok_or("item id overflow")?;338 }339340 let data = (0..total_tokens)341 .map(|_| {342 CreateItemData::NFT(CreateNftData {343 const_data: vec![].try_into().unwrap(),344 variable_data: vec![].try_into().unwrap(),345 })346 })347 .collect();348349 <Module<T>>::create_multiple_items_internal(&caller, self, &to, data)350 .map_err(dispatch_to_evm::<T>)?;351 Ok(true)352 }353354 #[solidity(rename_selector = "mintBulkWithTokenURI")]355 fn mint_bulk_with_token_uri(356 &mut self,357 caller: caller,358 to: address,359 tokens: Vec<(uint256, string)>,360 ) -> Result<bool> {361 let caller = T::CrossAccountId::from_eth(caller);362 let to = T::CrossAccountId::from_eth(to);363 let mut expected_index = <ItemListIndex>::get(self.id)364 .checked_add(1)365 .ok_or("item id overflow")?;366367 let mut data = Vec::with_capacity(tokens.len());368 for (id, token_uri) in tokens {369 let id: u32 = id.try_into().map_err(|_| "token id overflow")?;370 if id != expected_index {371 panic!("item id should be next ({}) but got {}", expected_index, id);372 }373 expected_index = expected_index.checked_add(1).ok_or("item id overflow")?;374375 data.push(CreateItemData::NFT(CreateNftData {376 const_data: Vec::<u8>::from(token_uri)377 .try_into()378 .map_err(|_| "token uri is too long")?,379 variable_data: vec![].try_into().unwrap(),380 }));381 }382383 <Module<T>>::create_multiple_items_internal(&caller, self, &to, data)384 .map_err(dispatch_to_evm::<T>)?;385 Ok(true)386 }302}387}303388304#[solidity_interface(389#[solidity_interface(pallets/nft/src/eth/mod.rsdiffbeforeafterboth103 CollectionMode::ReFungible => {103 CollectionMode::ReFungible => {104 include_bytes!("stubs/UniqueRefungible.raw") as &[u8]104 include_bytes!("stubs/UniqueRefungible.raw") as &[u8]105 }105 }106 CollectionMode::Invalid => include_bytes!("stubs/UniqueInvalid.raw") as &[u8],107 }106 }108 .to_owned()107 .to_owned()109 })108 })pallets/nft/src/eth/stubs/UniqueFungible.soldiffbeforeafterboth212122// Inline22// Inline23contract InlineNameSymbol is Dummy {23contract InlineNameSymbol is Dummy {24 // Selector: name() 06fdde0324 function name() public view returns (string memory) {25 function name() public view returns (string memory) {25 require(false, stub_error);26 require(false, stub_error);26 dummy;27 dummy;27 return "";28 return "";28 }29 }293031 // Selector: symbol() 95d89b4130 function symbol() public view returns (string memory) {32 function symbol() public view returns (string memory) {31 require(false, stub_error);33 require(false, stub_error);32 dummy;34 dummy;363837// Inline39// Inline38contract InlineTotalSupply is Dummy {40contract InlineTotalSupply is Dummy {41 // Selector: totalSupply() 18160ddd39 function totalSupply() public view returns (uint256) {42 function totalSupply() public view returns (uint256) {40 require(false, stub_error);43 require(false, stub_error);41 dummy;44 dummy;44}47}454846contract ERC165 is Dummy {49contract ERC165 is Dummy {50 // Selector: supportsInterface(bytes4) 01ffc9a747 function supportsInterface(uint32 interfaceId) public view returns (bool) {51 function supportsInterface(uint32 interfaceId) public view returns (bool) {48 require(false, stub_error);52 require(false, stub_error);49 interfaceId;53 interfaceId;53}57}545855contract ERC20 is Dummy, InlineNameSymbol, InlineTotalSupply, ERC20Events {59contract ERC20 is Dummy, InlineNameSymbol, InlineTotalSupply, ERC20Events {60 // Selector: decimals() 313ce56756 function decimals() public view returns (uint8) {61 function decimals() public view returns (uint8) {57 require(false, stub_error);62 require(false, stub_error);58 dummy;63 dummy;59 return 0;64 return 0;60 }65 }616667 // Selector: balanceOf(address) 70a0823162 function balanceOf(address owner) public view returns (uint256) {68 function balanceOf(address owner) public view returns (uint256) {63 require(false, stub_error);69 require(false, stub_error);64 owner;70 owner;65 dummy;71 dummy;66 return 0;72 return 0;67 }73 }687475 // Selector: transfer(address,uint256) a9059cbb69 function transfer(address to, uint256 amount) public returns (bool) {76 function transfer(address to, uint256 amount) public returns (bool) {70 require(false, stub_error);77 require(false, stub_error);71 to;78 to;74 return false;81 return false;75 }82 }768384 // Selector: transferFrom(address,address,uint256) 23b872dd77 function transferFrom(85 function transferFrom(78 address from,86 address from,79 address to,87 address to,87 return false;95 return false;88 }96 }899798 // Selector: approve(address,uint256) 095ea7b390 function approve(address spender, uint256 amount) public returns (bool) {99 function approve(address spender, uint256 amount) public returns (bool) {91 require(false, stub_error);100 require(false, stub_error);92 spender;101 spender;95 return false;104 return false;96 }105 }97106107 // Selector: allowance(address,address) dd62ed3e98 function allowance(address owner, address spender)108 function allowance(address owner, address spender)99 public109 public100 view110 viewpallets/nft/src/eth/stubs/UniqueInvalid.rawdiffbeforeafterbothno changes
pallets/nft/src/eth/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nft/src/eth/stubs/UniqueNFT.soldiffbeforeafterboth334pragma solidity >=0.8.0 <0.9.0;4pragma solidity >=0.8.0 <0.9.0;56// Anonymous struct7struct Tuple0 {8 uint256 field_0;9 string field_1;10}5116// Common stubs holder12// Common stubs holder7contract Dummy {13contract Dummy {354136// Inline42// Inline37contract InlineNameSymbol is Dummy {43contract InlineNameSymbol is Dummy {44 // Selector: name() 06fdde0338 function name() public view returns (string memory) {45 function name() public view returns (string memory) {39 require(false, stub_error);46 require(false, stub_error);40 dummy;47 dummy;41 return "";48 return "";42 }49 }435051 // Selector: symbol() 95d89b4144 function symbol() public view returns (string memory) {52 function symbol() public view returns (string memory) {45 require(false, stub_error);53 require(false, stub_error);46 dummy;54 dummy;505851// Inline59// Inline52contract InlineTotalSupply is Dummy {60contract InlineTotalSupply is Dummy {61 // Selector: totalSupply() 18160ddd53 function totalSupply() public view returns (uint256) {62 function totalSupply() public view returns (uint256) {54 require(false, stub_error);63 require(false, stub_error);55 dummy;64 dummy;58}67}596860contract ERC165 is Dummy {69contract ERC165 is Dummy {70 // Selector: supportsInterface(bytes4) 01ffc9a761 function supportsInterface(uint32 interfaceId) public view returns (bool) {71 function supportsInterface(uint32 interfaceId) public view returns (bool) {62 require(false, stub_error);72 require(false, stub_error);63 interfaceId;73 interfaceId;67}77}687869contract ERC721 is Dummy, ERC165, ERC721Events {79contract ERC721 is Dummy, ERC165, ERC721Events {80 // Selector: balanceOf(address) 70a0823170 function balanceOf(address owner) public view returns (uint256) {81 function balanceOf(address owner) public view returns (uint256) {71 require(false, stub_error);82 require(false, stub_error);72 owner;83 owner;73 dummy;84 dummy;74 return 0;85 return 0;75 }86 }768788 // Selector: ownerOf(uint256) 6352211e77 function ownerOf(uint256 tokenId) public view returns (address) {89 function ownerOf(uint256 tokenId) public view returns (address) {78 require(false, stub_error);90 require(false, stub_error);79 tokenId;91 tokenId;80 dummy;92 dummy;81 return 0x0000000000000000000000000000000000000000;93 return 0x0000000000000000000000000000000000000000;82 }94 }839596 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a1167284 function safeTransferFromWithData(97 function safeTransferFromWithData(85 address from,98 address from,86 address to,99 address to,95 dummy = 0;108 dummy = 0;96 }109 }97110111 // Selector: safeTransferFrom(address,address,uint256) 42842e0e98 function safeTransferFrom(112 function safeTransferFrom(99 address from,113 address from,100 address to,114 address to,107 dummy = 0;121 dummy = 0;108 }122 }109123124 // Selector: transferFrom(address,address,uint256) 23b872dd110 function transferFrom(125 function transferFrom(111 address from,126 address from,112 address to,127 address to,119 dummy = 0;134 dummy = 0;120 }135 }121136137 // Selector: approve(address,uint256) 095ea7b3122 function approve(address approved, uint256 tokenId) public {138 function approve(address approved, uint256 tokenId) public {123 require(false, stub_error);139 require(false, stub_error);124 approved;140 approved;125 tokenId;141 tokenId;126 dummy = 0;142 dummy = 0;127 }143 }128144145 // Selector: setApprovalForAll(address,bool) a22cb465129 function setApprovalForAll(address operator, bool approved) public {146 function setApprovalForAll(address operator, bool approved) public {130 require(false, stub_error);147 require(false, stub_error);131 operator;148 operator;132 approved;149 approved;133 dummy = 0;150 dummy = 0;134 }151 }135152153 // Selector: getApproved(uint256) 081812fc136 function getApproved(uint256 tokenId) public view returns (address) {154 function getApproved(uint256 tokenId) public view returns (address) {137 require(false, stub_error);155 require(false, stub_error);138 tokenId;156 tokenId;139 dummy;157 dummy;140 return 0x0000000000000000000000000000000000000000;158 return 0x0000000000000000000000000000000000000000;141 }159 }142160161 // Selector: isApprovedForAll(address,address) e985e9c5143 function isApprovedForAll(address owner, address operator)162 function isApprovedForAll(address owner, address operator)144 public163 public145 view164 view154}173}155174156contract ERC721Burnable is Dummy {175contract ERC721Burnable is Dummy {176 // Selector: burn(uint256) 42966c68157 function burn(uint256 tokenId) public {177 function burn(uint256 tokenId) public {158 require(false, stub_error);178 require(false, stub_error);159 tokenId;179 tokenId;162}182}163183164contract ERC721Enumerable is Dummy, InlineTotalSupply {184contract ERC721Enumerable is Dummy, InlineTotalSupply {185 // Selector: tokenByIndex(uint256) 4f6ccce7165 function tokenByIndex(uint256 index) public view returns (uint256) {186 function tokenByIndex(uint256 index) public view returns (uint256) {166 require(false, stub_error);187 require(false, stub_error);167 index;188 index;168 dummy;189 dummy;169 return 0;190 return 0;170 }191 }171192193 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59172 function tokenOfOwnerByIndex(address owner, uint256 index)194 function tokenOfOwnerByIndex(address owner, uint256 index)173 public195 public174 view196 view183}205}184206185contract ERC721Metadata is Dummy, InlineNameSymbol {207contract ERC721Metadata is Dummy, InlineNameSymbol {208 // Selector: tokenURI(uint256) c87b56dd186 function tokenURI(uint256 tokenId) public view returns (string memory) {209 function tokenURI(uint256 tokenId) public view returns (string memory) {187 require(false, stub_error);210 require(false, stub_error);188 tokenId;211 tokenId;192}215}193216194contract ERC721Mintable is Dummy, ERC721MintableEvents {217contract ERC721Mintable is Dummy, ERC721MintableEvents {218 // Selector: mintingFinished() 05d2035b195 function mintingFinished() public view returns (bool) {219 function mintingFinished() public view returns (bool) {196 require(false, stub_error);220 require(false, stub_error);197 dummy;221 dummy;198 return false;222 return false;199 }223 }200224225 // Selector: mint(address,uint256) 40c10f19201 function mint(address to, uint256 tokenId) public returns (bool) {226 function mint(address to, uint256 tokenId) public returns (bool) {202 require(false, stub_error);227 require(false, stub_error);203 to;228 to;206 return false;231 return false;207 }232 }208233234 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f209 function mintWithTokenURI(235 function mintWithTokenURI(210 address to,236 address to,211 uint256 tokenId,237 uint256 tokenId,219 return false;245 return false;220 }246 }221247248 // Selector: finishMinting() 7d64bcb4222 function finishMinting() public returns (bool) {249 function finishMinting() public returns (bool) {223 require(false, stub_error);250 require(false, stub_error);224 dummy = 0;251 dummy = 0;227}254}228255229contract ERC721UniqueExtensions is Dummy {256contract ERC721UniqueExtensions is Dummy {257 // Selector: transfer(address,uint256) a9059cbb230 function transfer(address to, uint256 tokenId) public {258 function transfer(address to, uint256 tokenId) public {231 require(false, stub_error);259 require(false, stub_error);232 to;260 to;233 tokenId;261 tokenId;234 dummy = 0;262 dummy = 0;235 }263 }236264265 // Selector: nextTokenId() 75794a3c237 function nextTokenId() public view returns (uint256) {266 function nextTokenId() public view returns (uint256) {238 require(false, stub_error);267 require(false, stub_error);239 dummy;268 dummy;240 return 0;269 return 0;241 }270 }271272 // Selector: setVariableMetadata(uint256,bytes) d4eac26d273 function setVariableMetadata(uint256 tokenId, bytes memory data) public {274 require(false, stub_error);275 tokenId;276 data;277 dummy = 0;278 }279280 // Selector: getVariableMetadata(uint256) e6c5ce6f281 function getVariableMetadata(uint256 tokenId)282 public283 view284 returns (bytes memory)285 {286 require(false, stub_error);287 tokenId;288 dummy;289 return hex"";290 }291292 // Selector: mintBulk(address,uint256[]) 44a9945e293 function mintBulk(address to, uint256[] memory tokenIds)294 public295 returns (bool)296 {297 require(false, stub_error);298 to;299 tokenIds;300 dummy = 0;301 return false;302 }303304 // Selector: mintBulkWithTokenURI(address,(uint256,string)[]) 36543006305 function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)306 public307 returns (bool)308 {309 require(false, stub_error);310 to;311 tokens;312 dummy = 0;313 return false;314 }242}315}243316244contract UniqueNFT is317contract UniqueNFT ispallets/nft/src/lib.rsdiffbeforeafterboth43 OFFCHAIN_SCHEMA_LIMIT, MAX_TOKEN_PREFIX_LENGTH, MAX_COLLECTION_NAME_LENGTH,43 OFFCHAIN_SCHEMA_LIMIT, MAX_TOKEN_PREFIX_LENGTH, MAX_COLLECTION_NAME_LENGTH,44 MAX_COLLECTION_DESCRIPTION_LENGTH, AccessMode, Collection, CreateItemData, CollectionLimits,44 MAX_COLLECTION_DESCRIPTION_LENGTH, AccessMode, Collection, CreateItemData, CollectionLimits,45 CollectionId, CollectionMode, TokenId, SchemaVersion, SponsorshipState, Ownership, NftItemType,45 CollectionId, CollectionMode, TokenId, SchemaVersion, SponsorshipState, Ownership, NftItemType,46 FungibleItemType, ReFungibleItemType,46 MetaUpdatePermission, FungibleItemType, ReFungibleItemType,47};47};484849#[cfg(test)]49#[cfg(test)]145 BadCreateRefungibleCall,145 BadCreateRefungibleCall,146 /// Gas limit exceeded146 /// Gas limit exceeded147 OutOfGas,147 OutOfGas,148 /// Metadata update denied by collection settings149 MetadataUpdateDenied,150 /// Metadata update flag become unmutable with None option151 MetadataFlagFrozen,148 /// Collection settings not allowing items transferring152 /// Collection settings not allowing items transferring149 TransferNotAllowed,153 TransferNotAllowed,150 /// Can't transfer tokens to ethereum zero address154 /// Can't transfer tokens to ethereum zero address251 .max(Self::create_item_fungible())255 .max(Self::create_item_fungible())252 .max(Self::create_item_refungible(data))256 .max(Self::create_item_refungible(data))253 }257 }258 fn create_multiple_items(amount: u32) -> Weight {259 Self::create_multiple_items_nft(amount)260 .max(Self::create_multiple_items_fungible(amount))261 .max(Self::create_multiple_items_refungible(amount))262 }254 fn burn_item() -> Weight {263 fn burn_item() -> Weight {255 // TODO: refungible, fungible264 // TODO: refungible, fungible256 Self::burn_item_nft()265 Self::burn_item_nft()536 variable_on_chain_schema: Vec::new(),545 variable_on_chain_schema: Vec::new(),537 const_on_chain_schema: Vec::new(),546 const_on_chain_schema: Vec::new(),538 limits,547 limits,548 meta_update_permission: MetaUpdatePermission::default(),539 transfers_enabled: true,549 transfers_enabled: true,540 };550 };541551896 /// * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].906 /// * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].897 ///907 ///898 /// * owner: Address, initial owner of the NFT.908 /// * owner: Address, initial owner of the NFT.899 #[weight = <SelfWeightOf<T>>::create_item(items_data.iter()909 #[weight = <SelfWeightOf<T>>::create_multiple_items(items_data.len() as u32)]900 .map(|data| { data.data_size() as u32 })901 .sum())]902 #[transactional]910 #[transactional]903 pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResult {911 pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResult {904912924 /// * collection_id: ID of the collection.932 /// * collection_id: ID of the collection.925 ///933 ///926 /// * value: New flag value.934 /// * value: New flag value.927 #[weight = <SelfWeightOf<T>>::burn_item()]935 #[weight = <SelfWeightOf<T>>::set_transfers_enabled_flag()]928 #[transactional]936 #[transactional]929 pub fn set_transfers_enabled_flag(origin, collection_id: CollectionId, value: bool) -> DispatchResult {937 pub fn set_transfers_enabled_flag(origin, collection_id: CollectionId, value: bool) -> DispatchResult {930938937 target_collection.save()945 target_collection.save()938 }946 }947948 // TODO! transaction weight949 /// Set meta_update_permission value for particular collection950 ///951 /// # Permissions952 ///953 /// * Collection Owner.954 ///955 /// # Arguments956 ///957 /// * collection_id: ID of the collection.958 ///959 /// * value: New flag value.960 #[weight = <T as Config>::WeightInfo::burn_item()]961 #[transactional]962 pub fn set_meta_update_permission_flag(origin, collection_id: CollectionId, value: MetaUpdatePermission) -> DispatchResult {963964 let sender = ensure_signed(origin)?;965 let mut target_collection = Self::get_collection(collection_id)?;966967 ensure!(968 target_collection.meta_update_permission != MetaUpdatePermission::None,969 Error::<T>::MetadataFlagFrozen970 );971 Self::check_owner_permissions(&target_collection, &sender)?;972973 target_collection.meta_update_permission = value;974975 target_collection.save()976 }939977940 /// Destroys a concrete instance of NFT.978 /// Destroys a concrete instance of NFT.941 ///979 ///1309 sender.clone(),1347 sender.clone(),1310 recipient.clone(),1348 recipient.clone(),1311 )?,1349 )?,1312 _ => (),1313 };1350 };131413511315 Self::deposit_event(RawEvent::Transfer(1352 Self::deposit_event(RawEvent::Transfer(1455 from.clone(),1492 from.clone(),1456 recipient.clone(),1493 recipient.clone(),1457 )?,1494 )?,1458 _ => (),1459 };1495 };146014961461 if matches!(collection.mode, CollectionMode::Fungible(_)) {1497 if matches!(collection.mode, CollectionMode::Fungible(_)) {1482 Error::<T>::TokenVariableDataLimitExceeded1518 Error::<T>::TokenVariableDataLimitExceeded1483 );1519 );148415201485 // Modify permissions check1486 ensure!(1521 ensure!(1487 Self::is_item_owner(sender, collection, item_id)?1522 (Self::is_item_owner(sender, collection, item_id)?1523 && collection.meta_update_permission == MetaUpdatePermission::ItemOwner)1488 || Self::is_owner_or_admin_permissions(collection, sender)?,1524 || (Self::is_owner_or_admin_permissions(collection, sender)?1525 && collection.meta_update_permission == MetaUpdatePermission::Admin),1489 Error::<T>::NoPermission1526 Error::<T>::NoPermission1490 );1527 );149115281495 Self::set_re_fungible_variable_data(collection, item_id, data)?1532 Self::set_re_fungible_variable_data(collection, item_id, data)?1496 }1533 }1497 CollectionMode::Fungible(_) => fail!(Error::<T>::CantStoreMetadataInFungibleTokens),1534 CollectionMode::Fungible(_) => fail!(Error::<T>::CantStoreMetadataInFungibleTokens),1498 _ => fail!(Error::<T>::UnexpectedCollectionType),1499 };1535 };150015361501 Ok(())1537 Ok(())1502 }1538 }15391540 pub fn meta_update_check(1541 sender: &T::CrossAccountId,1542 collection: &CollectionHandle<T>,1543 item_id: TokenId,1544 ) -> DispatchResult {1545 match collection.meta_update_permission {1546 MetaUpdatePermission::ItemOwner => ensure!(1547 Self::is_item_owner(sender, collection, item_id)?,1548 Error::<T>::NoPermission1549 ),1550 MetaUpdatePermission::Admin => ensure!(1551 Self::is_owner_or_admin_permissions(collection, sender)?,1552 Error::<T>::NoPermission1553 ),1554 MetaUpdatePermission::None => fail!(Error::<T>::MetadataUpdateDenied),1555 }15561557 Ok(())1558 }15591560 pub fn get_variable_metadata(1561 collection: &CollectionHandle<T>,1562 item_id: TokenId,1563 ) -> Result<Vec<u8>, DispatchError> {1564 Ok(match collection.mode {1565 CollectionMode::NFT => {1566 <NftItemList<T>>::get(collection.id, item_id)1567 .ok_or(Error::<T>::TokenNotFound)?1568 .variable_data1569 }1570 CollectionMode::ReFungible => {1571 <ReFungibleItemList<T>>::get(collection.id, item_id)1572 .ok_or(Error::<T>::TokenNotFound)?1573 .variable_data1574 }1575 _ => fail!(Error::<T>::UnexpectedCollectionType),1576 })1577 }150315781504 pub fn create_multiple_items_internal(1579 pub fn create_multiple_items_internal(1505 sender: &T::CrossAccountId,1580 sender: &T::CrossAccountId,1540 CollectionMode::NFT => Self::burn_nft_item(collection, item_id)?,1615 CollectionMode::NFT => Self::burn_nft_item(collection, item_id)?,1541 CollectionMode::Fungible(_) => Self::burn_fungible_item(sender, collection, value)?,1616 CollectionMode::Fungible(_) => Self::burn_fungible_item(sender, collection, value)?,1542 CollectionMode::ReFungible => Self::burn_refungible_item(collection, item_id, sender)?,1617 CollectionMode::ReFungible => Self::burn_refungible_item(collection, item_id, sender)?,1543 _ => (),1544 };1618 };154516191546 Ok(())1620 Ok(())1645 fail!(Error::<T>::NotReFungibleDataUsedToMintReFungibleCollectionToken);1719 fail!(Error::<T>::NotReFungibleDataUsedToMintReFungibleCollectionToken);1646 }1720 }1647 }1721 }1648 _ => {1649 fail!(Error::<T>::UnexpectedCollectionType);1650 }1651 };1722 };165217231653 Ok(())1724 Ok(())1956 .iter()2027 .iter()1957 .find(|i| i.owner == *subject)2028 .find(|i| i.owner == *subject)1958 .map(|i| i.fraction),2029 .map(|i| i.fraction),1959 CollectionMode::Invalid => None,1960 }2030 }1961 }2031 }196220321993 CollectionMode::ReFungible => {2063 CollectionMode::ReFungible => {1994 <ReFungibleItemList<T>>::contains_key(collection_id, item_id)2064 <ReFungibleItemList<T>>::contains_key(collection_id, item_id)1995 }2065 }1996 _ => false,1997 };2066 };199820671999 ensure!(exists, Error::<T>::TokenNotFound);2068 ensure!(exists, Error::<T>::TokenNotFound);pallets/nft/src/sponsorship.rsdiffbeforeafterboth127127128 sponsored128 sponsored129 }129 }130 _ => false,131 };130 };132 }131 }133132pallets/nft/src/tests.rsdiffbeforeafterboth2004 });2004 });2005}2005}20062007#[test]2008fn set_variable_meta_data_on_nft_with_item_owner_permission_flag() {2009 new_test_ext().execute_with(|| {2010 //default_limits();20112012 let collection_id = create_test_collection(&CollectionMode::NFT, 1);20132014 let origin1 = Origin::signed(1);20152016 let data = default_nft_data();2017 create_test_item(1, &data.into());20182019 TemplateModule::set_meta_update_permission_flag(2020 origin1.clone(),2021 collection_id,2022 MetaUpdatePermission::ItemOwner,2023 );20242025 let variable_data = b"ten chars.".to_vec();2026 assert_ok!(TemplateModule::set_variable_meta_data(2027 origin1,2028 collection_id,2029 1,2030 variable_data.clone()2031 ));20322033 assert_eq!(2034 TemplateModule::nft_item_id(collection_id, 1)2035 .unwrap()2036 .variable_data,2037 variable_data2038 );2039 });2040}20412042#[test]2043fn set_variable_meta_data_on_nft_with_item_owner_permission_flag_neg() {2044 new_test_ext().execute_with(|| {2045 // default_limits();20462047 let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);20482049 let origin1 = Origin::signed(1);2050 let origin2 = Origin::signed(2);20512052 assert_ok!(TemplateModule::set_mint_permission(2053 origin2.clone(),2054 collection_id,2055 true2056 ));2057 assert_ok!(TemplateModule::add_to_white_list(2058 origin2.clone(),2059 collection_id,2060 account(1)2061 ));20622063 let data = default_nft_data();2064 create_test_item(1, &data.into());20652066 assert_ok!(TemplateModule::set_meta_update_permission_flag(2067 origin2.clone(),2068 collection_id,2069 MetaUpdatePermission::ItemOwner,2070 ));20712072 let variable_data = b"ten chars.++".to_vec();2073 assert_noop!(2074 TemplateModule::set_variable_meta_data(2075 origin2,2076 collection_id,2077 1,2078 variable_data.clone()2079 ),2080 Error::<Test>::TokenVariableDataLimitExceeded2081 );200620822007#[test]2083 #[test]2008fn collection_transfer_flag_works() {2084 fn collection_transfer_flag_works() {2029 });2105 });2030}2106 }21072108 #[test]2109 fn set_variable_meta_data_on_nft_with_admin_flag() {2110 new_test_ext().execute_with(|| {2111 // default_limits();21122113 let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);21142115 let origin1 = Origin::signed(1);2116 let origin2 = Origin::signed(2);21172118 assert_ok!(TemplateModule::set_mint_permission(2119 origin2.clone(),2120 collection_id,2121 true2122 ));2123 assert_ok!(TemplateModule::add_to_white_list(2124 origin2.clone(),2125 collection_id,2126 account(1)2127 ));21282129 assert_ok!(TemplateModule::add_collection_admin(2130 origin2.clone(),2131 collection_id,2132 account(1)2133 ));21342135 let data = default_nft_data();2136 create_test_item(1, &data.into());21372138 assert_ok!(TemplateModule::set_meta_update_permission_flag(2139 origin2.clone(),2140 collection_id,2141 MetaUpdatePermission::Admin,2142 ));21432144 let variable_data = b"test set_variable_meta_data method.".to_vec();2145 assert_ok!(TemplateModule::set_variable_meta_data(2146 origin1,2147 collection_id,2148 1,2149 variable_data.clone()2150 ));21512152 assert_eq!(2153 TemplateModule::nft_item_id(collection_id, 1)2154 .unwrap()2155 .variable_data,2156 variable_data2157 );2158 });2159 }21602161 #[test]2162 fn set_variable_meta_data_on_nft_with_admin_flag_neg() {2163 new_test_ext().execute_with(|| {2164 // default_limits();21652166 let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);21672168 let origin1 = Origin::signed(1);2169 let origin2 = Origin::signed(2);21702171 assert_ok!(TemplateModule::set_mint_permission(2172 origin2.clone(),2173 collection_id,2174 true2175 ));2176 assert_ok!(TemplateModule::add_to_white_list(2177 origin2.clone(),2178 collection_id,2179 account(1)2180 ));21812182 let data = default_nft_data();2183 create_test_item(1, &data.into());21842185 assert_ok!(TemplateModule::set_meta_update_permission_flag(2186 origin2.clone(),2187 collection_id,2188 MetaUpdatePermission::Admin,2189 ));21902191 let variable_data = b"test set_variable_meta_data method.".to_vec();2192 assert_noop!(2193 TemplateModule::set_variable_meta_data(2194 origin1,2195 collection_id,2196 1,2197 variable_data.clone()2198 ),2199 Error::<Test>::NoPermission2200 );2201 });2202 }22032204 #[test]2205 fn set_variable_meta_flag_after_freeze() {2206 new_test_ext().execute_with(|| {2207 // default_limits();22082209 let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);22102211 let origin2 = Origin::signed(2);22122213 assert_ok!(TemplateModule::set_meta_update_permission_flag(2214 origin2.clone(),2215 collection_id,2216 MetaUpdatePermission::None,2217 ));2218 assert_noop!(2219 TemplateModule::set_meta_update_permission_flag(2220 origin2.clone(),2221 collection_id,2222 MetaUpdatePermission::Admin2223 ),2224 Error::<Test>::MetadataFlagFrozen2225 );2226 });2227 }22282229 #[test]2230 fn set_variable_meta_data_on_nft_with_none_flag_neg() {2231 new_test_ext().execute_with(|| {2232 // default_limits();22332234 let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 1, 1);2235 let origin1 = Origin::signed(1);22362237 let data = default_nft_data();2238 create_test_item(1, &data.into());22392240 assert_ok!(TemplateModule::set_meta_update_permission_flag(2241 origin1.clone(),2242 collection_id,2243 MetaUpdatePermission::None,2244 ));22452246 let variable_data = b"test set_variable_meta_data method.".to_vec();2247 assert_noop!(2248 TemplateModule::set_variable_meta_data(2249 origin1.clone(),2250 collection_id,2251 1,2252 variable_data.clone()2253 ),2254 Error::<Test>::MetadataUpdateDenied2255 );2256 });2257 }203122582032#[test]2259 #[test]2033fn collection_transfer_flag_works_neg() {2260 fn collection_transfer_flag_works_neg() {2058 assert_eq!(TemplateModule::address_tokens(1, 1), [1]);2285 assert_eq!(TemplateModule::address_tokens(1, 1), [1]);2059 });2286 });2060}2287 }2288 });2289}20612290pallets/scheduler/Cargo.tomldiffbeforeafterboth10readme = "README.md"10readme = "README.md"111112[dependencies]12[dependencies]13serde = { version = "1.0.119", default-features = false }13serde = { version = "1.0.130", default-features = false }14codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }14codec = { package = "parity-scale-codec", version = "2.3.0", default-features = false }15frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }15frame-support = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }16frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }16frame-system = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }17sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }17sp-runtime = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }18sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }18sp-std = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }19sp-io = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }19sp-io = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }20frame-benchmarking = { default-features = false, version = '3.0.0', optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }20frame-benchmarking = { default-features = false, version = '4.0.0-dev', optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }212122up-sponsorship = { default-features = false, path = "../../primitives/sponsorship", version = "0.1.0" }22up-sponsorship = { default-features = false, path = "../../primitives/sponsorship", version = "0.1.0" }23log = { version = "0.4.14", default-features = false }23log = { version = "0.4.14", default-features = false }242425[dev-dependencies]25[dev-dependencies]26sp-core = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }26sp-core = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }27substrate-test-utils = { version = "3.0.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }27substrate-test-utils = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }282829[features]29[features]30default = ["std"]30default = ["std"]pallets/scheduler/src/lib.rsdiffbeforeafterboth794 use super::*;794 use super::*;795795796 use frame_support::{796 use frame_support::{797 parameter_types, assert_ok, ord_parameter_types, assert_noop, assert_err, Hashable,797 Hashable, assert_err, assert_noop, assert_ok, ord_parameter_types, parameter_types,798 traits::{OnInitialize, OnFinalize, Filter},798 traits::{Contains, Filter, OnFinalize, OnInitialize},799 weights::constants::RocksDbWeight,799 weights::constants::RocksDbWeight,800 };800 };801 use sp_core::H256;801 use sp_core::H256;870870871 // Scheduler must dispatch with root and no filter, this tests base filter is indeed not used.871 // Scheduler must dispatch with root and no filter, this tests base filter is indeed not used.872 pub struct BaseFilter;872 pub struct BaseFilter;873 impl Filter<Call> for BaseFilter {873 impl Contains<Call> for BaseFilter {874 fn filter(call: &Call) -> bool {874 fn contains(call: &Call) -> bool {875 !matches!(call, Call::Logger(logger::Call::log(_, _)))875 !matches!(call, Call::Logger(logger::Call::log(_, _)))876 }876 }877 }877 }primitives/nft/Cargo.tomldiffbeforeafterboth9version = '0.9.0'9version = '0.9.0'101011[dependencies]11[dependencies]12codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ['derive'] }12codec = { package = "parity-scale-codec", version = "2.3.0", default-features = false, features = [13 'derive',14] }13serde = { version = "1.0.119", features = ['derive'], default-features = false, optional = true }15serde = { version = "1.0.130", features = [14max-encoded-len = { default-features = false, features = ['derive'], version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }16 'derive',17], default-features = false, optional = true }15frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }18frame-support = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }16frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }19frame-system = { default-features = false, version = '4.0.0-dev', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }17sp-core = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }20sp-core = { version = "4.0.0-dev", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }18sp-std = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }21sp-std = { version = "4.0.0-dev", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }19sp-runtime = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }22sp-runtime = { version = "4.0.0-dev", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.10' }20derivative = "2.2.0"23derivative = "2.2.0"212422[features]25[features]25 "serde1",28 "serde1",26 "serde/std",29 "serde/std",27 "codec/std",30 "codec/std",28 "max-encoded-len/std",29 "frame-system/std",31 "frame-system/std",30 "frame-support/std",32 "frame-support/std",31 "sp-runtime/std",33 "sp-runtime/std",primitives/nft/src/lib.rsdiffbeforeafterboth4pub use serde::{Serialize, Deserialize};4pub use serde::{Serialize, Deserialize};556use sp_runtime::sp_std::prelude::Vec;6use sp_runtime::sp_std::prelude::Vec;7use codec::{Decode, Encode};7use codec::{Decode, Encode, MaxEncodedLen};8use max_encoded_len::MaxEncodedLen;9pub use frame_support::{8pub use frame_support::{10 BoundedVec, construct_runtime, decl_event, decl_module, decl_storage, decl_error,9 BoundedVec, construct_runtime, decl_event, decl_module, decl_storage, decl_error,11 dispatch::DispatchResult,10 dispatch::DispatchResult,74#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]73#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]75#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]74#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]76pub enum CollectionMode {75pub enum CollectionMode {77 Invalid,78 NFT,76 NFT,79 // decimal points77 // decimal points80 Fungible(DecimalPoints),78 Fungible(DecimalPoints),81 ReFungible,79 ReFungible,82}80}8384impl Default for CollectionMode {85 fn default() -> Self {86 Self::Invalid87 }88}898190impl CollectionMode {82impl CollectionMode {91 pub fn id(&self) -> u8 {83 pub fn id(&self) -> u8 {92 match self {84 match self {93 CollectionMode::Invalid => 0,94 CollectionMode::NFT => 1,85 CollectionMode::NFT => 1,95 CollectionMode::Fungible(_) => 2,86 CollectionMode::Fungible(_) => 2,96 CollectionMode::ReFungible => 3,87 CollectionMode::ReFungible => 3,186 pub limits: CollectionLimits<T::BlockNumber>, // Collection private restrictions177 pub limits: CollectionLimits<T::BlockNumber>, // Collection private restrictions187 pub variable_on_chain_schema: Vec<u8>, //178 pub variable_on_chain_schema: Vec<u8>, //188 pub const_on_chain_schema: Vec<u8>, //179 pub const_on_chain_schema: Vec<u8>, //180 pub meta_update_permission: MetaUpdatePermission,189 pub transfers_enabled: bool,181 pub transfers_enabled: bool,190}182}191183306 pub pieces: u128,298 pub pieces: u128,307}299}300301#[derive(Encode, Decode, Debug, Clone, PartialEq)]302#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]303pub enum MetaUpdatePermission {304 ItemOwner,305 Admin,306 None,307}308309impl Default for MetaUpdatePermission {310 fn default() -> Self {311 Self::ItemOwner312 }313}308314309#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug)]315#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug)]310#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]316#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]runtime/Cargo.tomldiffbeforeafterboth34]34]35std = [35std = [36 'codec/std',36 'codec/std',37 'max-encoded-len/std',38 'cumulus-pallet-aura-ext/std',37 'cumulus-pallet-aura-ext/std',39 'cumulus-pallet-parachain-system/std',38 'cumulus-pallet-parachain-system/std',40 'cumulus-pallet-xcm/std',39 'cumulus-pallet-xcm/std',101default-features = false97default-features = false102features = ['derive']98features = ['derive']103package = 'parity-scale-codec'99package = 'parity-scale-codec'104version = '2.0.0'100version = '2.3.0'105101106[dependencies.frame-benchmarking]102[dependencies.frame-benchmarking]107default-features = false103default-features = false108git = 'https://github.com/paritytech/substrate.git'104git = 'https://github.com/paritytech/substrate.git'109optional = true105optional = true110branch = 'polkadot-v0.9.8'106branch = 'polkadot-v0.9.10'111version = '3.0.0'107version = '4.0.0-dev'112108113[dependencies.frame-executive]109[dependencies.frame-executive]114default-features = false110default-features = false115git = 'https://github.com/paritytech/substrate.git'111git = 'https://github.com/paritytech/substrate.git'116branch = 'polkadot-v0.9.8'112branch = 'polkadot-v0.9.10'117version = '3.0.0'113version = '4.0.0-dev'118114119[dependencies.frame-support]115[dependencies.frame-support]120default-features = false116default-features = false121git = 'https://github.com/paritytech/substrate.git'117git = 'https://github.com/paritytech/substrate.git'122branch = 'polkadot-v0.9.8'118branch = 'polkadot-v0.9.10'123version = '3.0.0'119version = '4.0.0-dev'124120125[dependencies.frame-system]121[dependencies.frame-system]126default-features = false122default-features = false127git = 'https://github.com/paritytech/substrate.git'123git = 'https://github.com/paritytech/substrate.git'128branch = 'polkadot-v0.9.8'124branch = 'polkadot-v0.9.10'129version = '3.0.0'125version = '4.0.0-dev'130126131[dependencies.frame-system-benchmarking]127[dependencies.frame-system-benchmarking]132default-features = false128default-features = false133git = 'https://github.com/paritytech/substrate.git'129git = 'https://github.com/paritytech/substrate.git'134optional = true130optional = true135branch = 'polkadot-v0.9.8'131branch = 'polkadot-v0.9.10'136version = '3.0.0'132version = '4.0.0-dev'137133138[dependencies.frame-system-rpc-runtime-api]134[dependencies.frame-system-rpc-runtime-api]139default-features = false135default-features = false140git = 'https://github.com/paritytech/substrate.git'136git = 'https://github.com/paritytech/substrate.git'141branch = 'polkadot-v0.9.8'137branch = 'polkadot-v0.9.10'142version = '3.0.0'138version = '4.0.0-dev'143139144[dependencies.hex-literal]140[dependencies.hex-literal]145optional = true141optional = true146version = '0.3.1'142version = '0.3.3'147143148[dependencies.serde]144[dependencies.serde]149default-features = false145default-features = false150features = ['derive']146features = ['derive']151optional = true147optional = true152version = '1.0.119'148version = '1.0.130'153149154[dependencies.pallet-aura]150[dependencies.pallet-aura]155default-features = false151default-features = false156git = 'https://github.com/paritytech/substrate.git'152git = 'https://github.com/paritytech/substrate.git'157branch = 'polkadot-v0.9.8'153branch = 'polkadot-v0.9.10'158version = '3.0.0'154version = '4.0.0-dev'159155160[dependencies.pallet-balances]156[dependencies.pallet-balances]161default-features = false157default-features = false162git = 'https://github.com/paritytech/substrate.git'158git = 'https://github.com/paritytech/substrate.git'163branch = 'polkadot-v0.9.8'159branch = 'polkadot-v0.9.10'164version = '3.0.0'160version = '4.0.0-dev'165161166# Contracts specific packages162# Contracts specific packages167# [dependencies.pallet-contracts]163# [dependencies.pallet-contracts]168# git = 'https://github.com/paritytech/substrate.git'164# git = 'https://github.com/paritytech/substrate.git'169# default-features = false165# default-features = false170# branch = 'polkadot-v0.9.8'166# branch = 'polkadot-v0.9.9'171# version = '3.0.0'167# version = '4.0.0-dev'172168173# [dependencies.pallet-contracts-primitives]169# [dependencies.pallet-contracts-primitives]174# git = 'https://github.com/paritytech/substrate.git'170# git = 'https://github.com/paritytech/substrate.git'175# default-features = false171# default-features = false176# branch = 'polkadot-v0.9.8'172# branch = 'polkadot-v0.9.9'177# version = '3.0.0'173# version = '4.0.0-dev'178174179# [dependencies.pallet-contracts-rpc-runtime-api]175# [dependencies.pallet-contracts-rpc-runtime-api]180# git = 'https://github.com/paritytech/substrate.git'176# git = 'https://github.com/paritytech/substrate.git'181# default-features = false177# default-features = false182# branch = 'polkadot-v0.9.8'178# branch = 'polkadot-v0.9.9'183# version = '3.0.0'179# version = '4.0.0-dev'184180185[dependencies.pallet-randomness-collective-flip]181[dependencies.pallet-randomness-collective-flip]186default-features = false182default-features = false187git = 'https://github.com/paritytech/substrate.git'183git = 'https://github.com/paritytech/substrate.git'188branch = 'polkadot-v0.9.8'184branch = 'polkadot-v0.9.10'189version = '3.0.0'185version = '4.0.0-dev'190186191[dependencies.pallet-sudo]187[dependencies.pallet-sudo]192default-features = false188default-features = false193git = 'https://github.com/paritytech/substrate.git'189git = 'https://github.com/paritytech/substrate.git'194branch = 'polkadot-v0.9.8'190branch = 'polkadot-v0.9.10'195version = '3.0.0'191version = '4.0.0-dev'196192197[dependencies.pallet-timestamp]193[dependencies.pallet-timestamp]198default-features = false194default-features = false199git = 'https://github.com/paritytech/substrate.git'195git = 'https://github.com/paritytech/substrate.git'200branch = 'polkadot-v0.9.8'196branch = 'polkadot-v0.9.10'201version = '3.0.0'197version = '4.0.0-dev'202198203[dependencies.pallet-transaction-payment]199[dependencies.pallet-transaction-payment]204default-features = false200default-features = false205git = 'https://github.com/paritytech/substrate.git'201git = 'https://github.com/paritytech/substrate.git'206branch = 'polkadot-v0.9.8'202branch = 'polkadot-v0.9.10'207version = '3.0.0'203version = '4.0.0-dev'208204209[dependencies.pallet-transaction-payment-rpc-runtime-api]205[dependencies.pallet-transaction-payment-rpc-runtime-api]210default-features = false206default-features = false211git = 'https://github.com/paritytech/substrate.git'207git = 'https://github.com/paritytech/substrate.git'212branch = 'polkadot-v0.9.8'208branch = 'polkadot-v0.9.10'213version = '3.0.0'209version = '4.0.0-dev'214210215[dependencies.pallet-treasury]211[dependencies.pallet-treasury]216default-features = false212default-features = false217git = 'https://github.com/paritytech/substrate.git'213git = 'https://github.com/paritytech/substrate.git'218branch = 'polkadot-v0.9.8'214branch = 'polkadot-v0.9.10'219version = '3.0.0'215version = '4.0.0-dev'220216221[dependencies.pallet-vesting]217[dependencies.pallet-vesting]222default-features = false218default-features = false223git = 'https://github.com/paritytech/substrate.git'219git = 'https://github.com/paritytech/substrate.git'224branch = 'polkadot-v0.9.8'220branch = 'polkadot-v0.9.10'225version = '3.0.0'221version = '4.0.0-dev'226222227[dependencies.sp-arithmetic]223[dependencies.sp-arithmetic]228default-features = false224default-features = false229git = 'https://github.com/paritytech/substrate.git'225git = 'https://github.com/paritytech/substrate.git'230branch = 'polkadot-v0.9.8'226branch = 'polkadot-v0.9.10'231version = '3.0.0'227version = '4.0.0-dev'232228233[dependencies.sp-api]229[dependencies.sp-api]234default-features = false230default-features = false235git = 'https://github.com/paritytech/substrate.git'231git = 'https://github.com/paritytech/substrate.git'236branch = 'polkadot-v0.9.8'232branch = 'polkadot-v0.9.10'237version = '3.0.0'233version = '4.0.0-dev'238234239[dependencies.sp-block-builder]235[dependencies.sp-block-builder]240default-features = false236default-features = false241git = 'https://github.com/paritytech/substrate.git'237git = 'https://github.com/paritytech/substrate.git'242branch = 'polkadot-v0.9.8'238branch = 'polkadot-v0.9.10'243version = '3.0.0'239version = '4.0.0-dev'244240245[dependencies.sp-core]241[dependencies.sp-core]246default-features = false242default-features = false247git = 'https://github.com/paritytech/substrate.git'243git = 'https://github.com/paritytech/substrate.git'248branch = 'polkadot-v0.9.8'244branch = 'polkadot-v0.9.10'249version = '3.0.0'245version = '4.0.0-dev'250246251[dependencies.sp-consensus-aura]247[dependencies.sp-consensus-aura]252default-features = false248default-features = false253git = 'https://github.com/paritytech/substrate.git'249git = 'https://github.com/paritytech/substrate.git'254branch = 'polkadot-v0.9.8'250branch = 'polkadot-v0.9.10'255version = '0.9.0'251version = '0.10.0-dev'256252257[dependencies.sp-inherents]253[dependencies.sp-inherents]258default-features = false254default-features = false259git = 'https://github.com/paritytech/substrate.git'255git = 'https://github.com/paritytech/substrate.git'260branch = 'polkadot-v0.9.8'256branch = 'polkadot-v0.9.10'261version = '3.0.0'257version = '4.0.0-dev'262258263[dependencies.sp-io]259[dependencies.sp-io]264default-features = false260default-features = false265git = 'https://github.com/paritytech/substrate.git'261git = 'https://github.com/paritytech/substrate.git'266branch = 'polkadot-v0.9.8'262branch = 'polkadot-v0.9.10'267version = '3.0.0'263version = '4.0.0-dev'268264269[dependencies.sp-offchain]265[dependencies.sp-offchain]270default-features = false266default-features = false271git = 'https://github.com/paritytech/substrate.git'267git = 'https://github.com/paritytech/substrate.git'272branch = 'polkadot-v0.9.8'268branch = 'polkadot-v0.9.10'273version = '3.0.0'269version = '4.0.0-dev'274270275[dependencies.sp-runtime]271[dependencies.sp-runtime]276default-features = false272default-features = false277git = 'https://github.com/paritytech/substrate.git'273git = 'https://github.com/paritytech/substrate.git'278branch = 'polkadot-v0.9.8'274branch = 'polkadot-v0.9.10'279version = '3.0.0'275version = '4.0.0-dev'280276281[dependencies.sp-session]277[dependencies.sp-session]282default-features = false278default-features = false283git = 'https://github.com/paritytech/substrate.git'279git = 'https://github.com/paritytech/substrate.git'284branch = 'polkadot-v0.9.8'280branch = 'polkadot-v0.9.10'285version = '3.0.0'281version = '4.0.0-dev'286282287[dependencies.sp-std]283[dependencies.sp-std]288default-features = false284default-features = false289git = 'https://github.com/paritytech/substrate.git'285git = 'https://github.com/paritytech/substrate.git'290branch = 'polkadot-v0.9.8'286branch = 'polkadot-v0.9.10'291version = '3.0.0'287version = '4.0.0-dev'292288293[dependencies.sp-transaction-pool]289[dependencies.sp-transaction-pool]294default-features = false290default-features = false295git = 'https://github.com/paritytech/substrate.git'291git = 'https://github.com/paritytech/substrate.git'296branch = 'polkadot-v0.9.8'292branch = 'polkadot-v0.9.10'297version = '3.0.0'293version = '4.0.0-dev'298294299[dependencies.sp-version]295[dependencies.sp-version]300default-features = false296default-features = false301git = 'https://github.com/paritytech/substrate.git'297git = 'https://github.com/paritytech/substrate.git'302branch = 'polkadot-v0.9.8'298branch = 'polkadot-v0.9.10'303version = '3.0.0'299version = '4.0.0-dev'304300305[dependencies.smallvec]301[dependencies.smallvec]306version = '1.4.1'302version = '1.6.1'307303308################################################################################304################################################################################309# Cumulus dependencies305# Cumulus dependencies310306311[dependencies.parachain-info]307[dependencies.parachain-info]312default-features = false308default-features = false313git = 'https://github.com/paritytech/cumulus.git'309git = 'https://github.com/paritytech/cumulus.git'314branch = 'polkadot-v0.9.8'310branch = 'polkadot-v0.9.10'315version = '0.1.0'311version = '0.1.0'316312317[dependencies.cumulus-pallet-aura-ext]313[dependencies.cumulus-pallet-aura-ext]318git = 'https://github.com/paritytech/cumulus.git'314git = 'https://github.com/paritytech/cumulus.git'319branch = 'polkadot-v0.9.8'315branch = 'polkadot-v0.9.10'320default-features = false316default-features = false321317322[dependencies.cumulus-pallet-parachain-system]318[dependencies.cumulus-pallet-parachain-system]323git = 'https://github.com/paritytech/cumulus.git'319git = 'https://github.com/paritytech/cumulus.git'324branch = 'polkadot-v0.9.8'320branch = 'polkadot-v0.9.10'325default-features = false321default-features = false326322327[dependencies.cumulus-primitives-core]323[dependencies.cumulus-primitives-core]328git = 'https://github.com/paritytech/cumulus.git'324git = 'https://github.com/paritytech/cumulus.git'329branch = 'polkadot-v0.9.8'325branch = 'polkadot-v0.9.10'330default-features = false326default-features = false331327332[dependencies.cumulus-pallet-xcm]328[dependencies.cumulus-pallet-xcm]333git = 'https://github.com/paritytech/cumulus.git'329git = 'https://github.com/paritytech/cumulus.git'334branch = 'polkadot-v0.9.8'330branch = 'polkadot-v0.9.10'335default-features = false331default-features = false336332337[dependencies.cumulus-pallet-dmp-queue]333[dependencies.cumulus-pallet-dmp-queue]338git = 'https://github.com/paritytech/cumulus.git'334git = 'https://github.com/paritytech/cumulus.git'339branch = 'polkadot-v0.9.8'335branch = 'polkadot-v0.9.10'340default-features = false336default-features = false341337342[dependencies.cumulus-pallet-xcmp-queue]338[dependencies.cumulus-pallet-xcmp-queue]343git = 'https://github.com/paritytech/cumulus.git'339git = 'https://github.com/paritytech/cumulus.git'344branch = 'polkadot-v0.9.8'340branch = 'polkadot-v0.9.10'345default-features = false341default-features = false346342347[dependencies.cumulus-primitives-utility]343[dependencies.cumulus-primitives-utility]348git = 'https://github.com/paritytech/cumulus.git'344git = 'https://github.com/paritytech/cumulus.git'349branch = 'polkadot-v0.9.8'345branch = 'polkadot-v0.9.10'350default-features = false346default-features = false351347352[dependencies.cumulus-primitives-timestamp]348[dependencies.cumulus-primitives-timestamp]353git = 'https://github.com/paritytech/cumulus.git'349git = 'https://github.com/paritytech/cumulus.git'354branch = 'polkadot-v0.9.8'350branch = 'polkadot-v0.9.10'355default-features = false351default-features = false356352357################################################################################353################################################################################358# Polkadot dependencies354# Polkadot dependencies359355360[dependencies.polkadot-parachain]356[dependencies.polkadot-parachain]361git = 'https://github.com/paritytech/polkadot'357git = 'https://github.com/paritytech/polkadot'362branch = 'release-v0.9.8'358branch = 'release-v0.9.10'363default-features = false359default-features = false364360365[dependencies.xcm]361[dependencies.xcm]366git = 'https://github.com/paritytech/polkadot'362git = 'https://github.com/paritytech/polkadot'367branch = 'release-v0.9.8'363branch = 'release-v0.9.10'368default-features = false364default-features = false369365370[dependencies.xcm-builder]366[dependencies.xcm-builder]371git = 'https://github.com/paritytech/polkadot'367git = 'https://github.com/paritytech/polkadot'372branch = 'release-v0.9.8'368branch = 'release-v0.9.10'373default-features = false369default-features = false374370375[dependencies.xcm-executor]371[dependencies.xcm-executor]376git = 'https://github.com/paritytech/polkadot'372git = 'https://github.com/paritytech/polkadot'377branch = 'release-v0.9.8'373branch = 'release-v0.9.10'378default-features = false374default-features = false379375380[dependencies.pallet-xcm]376[dependencies.pallet-xcm]381git = 'https://github.com/paritytech/polkadot'377git = 'https://github.com/paritytech/polkadot'382branch = 'release-v0.9.8'378branch = 'release-v0.9.10'383default-features = false379default-features = false384380385381386################################################################################382################################################################################387# local dependencies383# local dependencies388384389[dependencies]385[dependencies]390max-encoded-len = { default-features = false, features = ['derive'], version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }391derivative = "2.2.0"386derivative = "2.2.0"392pallet-nft = { path = '../pallets/nft', default-features = false, version = '3.0.0' }387pallet-nft = { path = '../pallets/nft', default-features = false, version = '3.0.0' }393pallet-inflation = { path = '../pallets/inflation', default-features = false, version = '3.0.0' }388pallet-inflation = { path = '../pallets/inflation', default-features = false, version = '3.0.0' }401pallet-evm-transaction-payment = { path = '../pallets/evm-transaction-payment', default-features = false }396pallet-evm-transaction-payment = { path = '../pallets/evm-transaction-payment', default-features = false }402pallet-evm-coder-substrate = { default-features = false, path = "../pallets/evm-coder-substrate" }397pallet-evm-coder-substrate = { default-features = false, path = "../pallets/evm-coder-substrate" }403398404pallet-evm = { default-features = false, version = "5.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }399pallet-evm = { default-features = false, version = "6.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }405pallet-ethereum = { default-features = false, version = "3.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }400pallet-ethereum = { default-features = false, version = "4.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }406fp-rpc = { default-features = false, version = "2.0.0", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }401fp-rpc = { default-features = false, version = "3.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.10" }407402408################################################################################403################################################################################409# Build Dependencies404# Build Dependencies410405411[build-dependencies]406[build-dependencies.substrate-wasm-builder]407git = 'https://github.com/paritytech/substrate.git'408branch = 'polkadot-v0.9.10'412substrate-wasm-builder = '4.0.0'409version = '5.0.0-dev'413410runtime/src/lib.rsdiffbeforeafterboth45 dispatch::DispatchResult,45 dispatch::DispatchResult,46 PalletId, parameter_types, StorageValue, ConsensusEngineId,46 PalletId, parameter_types, StorageValue, ConsensusEngineId,47 traits::{47 traits::{48 All, Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,48 Everything, Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem,49 OnUnbalanced, Randomness, FindAuthor,49 LockIdentifier, OnUnbalanced, Randomness, FindAuthor,50 },50 },51 weights::{51 weights::{79// Polkadot imports79// Polkadot imports80use pallet_xcm::XcmPassthrough;80use pallet_xcm::XcmPassthrough;81use polkadot_parachain::primitives::Sibling;81use polkadot_parachain::primitives::Sibling;82use xcm::v0::Xcm;83use xcm::v0::{BodyId, Junction::*, MultiAsset, MultiLocation, MultiLocation::*, NetworkId};82use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};84use xcm_builder::{83use xcm_builder::{85 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,84 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,86 EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset,85 EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset,142141143/// This runtime version.142/// This runtime version.144pub const VERSION: RuntimeVersion = RuntimeVersion {143pub const VERSION: RuntimeVersion = RuntimeVersion {145 spec_name: create_runtime_str!("nft"),144 spec_name: create_runtime_str!("opal"),146 impl_name: create_runtime_str!("nft"),145 impl_name: create_runtime_str!("opal"),147 authoring_version: 1,146 authoring_version: 1,148 spec_version: 3,147 spec_version: 910000,149 impl_version: 1,148 impl_version: 1,150 apis: RUNTIME_API_VERSIONS,149 apis: RUNTIME_API_VERSIONS,151 transaction_version: 1,150 transaction_version: 1,238 pub const ChainId: u64 = 8888;237 pub const ChainId: u64 = 8888;239}238}239240pub struct FixedFee;241impl FeeCalculator for FixedFee {242 fn min_gas_price() -> U256 {243 1.into()244 }245}240246241impl pallet_evm::Config for Runtime {247impl pallet_evm::Config for Runtime {242 type BlockGasLimit = BlockGasLimit;248 type BlockGasLimit = BlockGasLimit;243 type FeeCalculator = ();249 type FeeCalculator = FixedFee;244 type GasWeightMapping = ();250 type GasWeightMapping = ();245 type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping;251 type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;246 type CallOrigin = EnsureAddressTruncated;252 type CallOrigin = EnsureAddressTruncated;247 type WithdrawOrigin = EnsureAddressTruncated;253 type WithdrawOrigin = EnsureAddressTruncated;248 type AddressMapping = HashedAddressMapping<Self::Hashing>;254 type AddressMapping = HashedAddressMapping<Self::Hashing>;298 /// The identifier used to distinguish between accounts.304 /// The identifier used to distinguish between accounts.299 type AccountId = AccountId;305 type AccountId = AccountId;300 /// The basic call filter to use in dispatchable.306 /// The basic call filter to use in dispatchable.301 type BaseCallFilter = ();307 type BaseCallFilter = Everything;302 /// Maximum number of block number to block hash mappings to keep (oldest pruned first).308 /// Maximum number of block number to block hash mappings to keep (oldest pruned first).303 type BlockHashCount = BlockHashCount;309 type BlockHashCount = BlockHashCount;304 /// The maximum length of a block (in bytes).310 /// The maximum length of a block (in bytes).540impl cumulus_pallet_aura_ext::Config for Runtime {}546impl cumulus_pallet_aura_ext::Config for Runtime {}541547542parameter_types! {548parameter_types! {543 pub const RelayLocation: MultiLocation = X1(Parent);549 pub const RelayLocation: MultiLocation = MultiLocation::parent();544 pub const RelayNetwork: NetworkId = NetworkId::Polkadot;550 pub const RelayNetwork: NetworkId = NetworkId::Polkadot;545 pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();551 pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();546 pub Ancestry: MultiLocation = X1(Parachain(ParachainInfo::parachain_id().into()));552 pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();547}553}548554549/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used555/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used600 // One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.606 // One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.601 pub UnitWeightCost: Weight = 1_000_000;607 pub UnitWeightCost: Weight = 1_000_000;602 // 1200 UNIQUEs buy 1 second of weight.608 // 1200 UNIQUEs buy 1 second of weight.603 pub const WeightPrice: (MultiLocation, u128) = (X1(Parent), 1_200 * UNIQUE);609 pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);604}610}605611606match_type! {612match_type! {607 pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {613 pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {608 X1(Parent) | X2(Parent, Plurality { id: BodyId::Unit, .. })614 MultiLocation { parents: 1, interior: Here } |615 MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }609 };616 };610}617}611618612pub type Barrier = (619pub type Barrier = (613 TakeWeightCredit,620 TakeWeightCredit,614 AllowTopLevelPaidExecutionFrom<All<MultiLocation>>,621 AllowTopLevelPaidExecutionFrom<Everything>,615 AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,622 AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,616 // ^^^ Parent & its unit plurality gets free execution623 // ^^^ Parent & its unit plurality gets free execution617);624);624 type AssetTransactor = LocalAssetTransactor;631 type AssetTransactor = LocalAssetTransactor;625 type OriginConverter = XcmOriginToTransactDispatchOrigin;632 type OriginConverter = XcmOriginToTransactDispatchOrigin;626 type IsReserve = NativeAsset;633 type IsReserve = NativeAsset;627 type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of ROC634 type IsTeleporter = (); // Teleportation is disabled628 type LocationInverter = LocationInverter<Ancestry>;635 type LocationInverter = LocationInverter<Ancestry>;629 type Barrier = Barrier;636 type Barrier = Barrier;630 type Weigher = FixedWeightBounds<UnitWeightCost, Call>;637 type Weigher = FixedWeightBounds<UnitWeightCost, Call>;631 type Trader = UsingComponents<IdentityFee<Balance>, RelayLocation, AccountId, Balances, ()>;638 type Trader = UsingComponents<IdentityFee<Balance>, RelayLocation, AccountId, Balances, ()>;632 type ResponseHandler = (); // Don't handle responses for now.639 type ResponseHandler = (); // Don't handle responses for now.640 type SubscriptionService = PolkadotXcm;633}641}634642635// parameter_types! {643// parameter_types! {643/// queues.651/// queues.644pub type XcmRouter = (652pub type XcmRouter = (645 // Two routers - use UMP to communicate with the relay chain:653 // Two routers - use UMP to communicate with the relay chain:646 cumulus_primitives_utility::ParentAsUmp<ParachainSystem>,654 cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,647 // ..and XCMP to communicate with the sibling chains.655 // ..and XCMP to communicate with the sibling chains.648 XcmpQueue,656 XcmpQueue,649);657);650658651impl pallet_evm_coder_substrate::Config for Runtime {659impl pallet_evm_coder_substrate::Config for Runtime {652 type EthereumTransactionSender = pallet_ethereum::Module<Self>;660 type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;653}661}654662655impl pallet_xcm::Config for Runtime {663impl pallet_xcm::Config for Runtime {656 type Event = Event;664 type Event = Event;657 type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;665 type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;658 type XcmRouter = XcmRouter;666 type XcmRouter = XcmRouter;659 type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;667 type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;660 type XcmExecuteFilter = All<(MultiLocation, Xcm<Call>)>;668 type XcmExecuteFilter = Everything;661 type XcmExecutor = XcmExecutor<XcmConfig>;669 type XcmExecutor = XcmExecutor<XcmConfig>;662 type XcmTeleportFilter = All<(MultiLocation, Vec<MultiAsset>)>;670 type XcmTeleportFilter = Everything;663 type XcmReserveTransferFilter = ();671 type XcmReserveTransferFilter = ();664 type Weigher = FixedWeightBounds<UnitWeightCost, Call>;672 type Weigher = FixedWeightBounds<UnitWeightCost, Call>;673 type LocationInverter = LocationInverter<Ancestry>;665}674}666675667impl cumulus_pallet_xcm::Config for Runtime {676impl cumulus_pallet_xcm::Config for Runtime {673 type Event = Event;682 type Event = Event;674 type XcmExecutor = XcmExecutor<XcmConfig>;683 type XcmExecutor = XcmExecutor<XcmConfig>;675 type ChannelInfo = ParachainSystem;684 type ChannelInfo = ParachainSystem;685 type VersionWrapper = ();676}686}677687678impl cumulus_pallet_dmp_queue::Config for Runtime {688impl cumulus_pallet_dmp_queue::Config for Runtime {683693684impl pallet_aura::Config for Runtime {694impl pallet_aura::Config for Runtime {685 type AuthorityId = AuraId;695 type AuthorityId = AuraId;696 type DisabledValidators = ();686}697}687698688parameter_types! {699parameter_types! {785 NodeBlock = opaque::Block,796 NodeBlock = opaque::Block,786 UncheckedExtrinsic = UncheckedExtrinsic797 UncheckedExtrinsic = UncheckedExtrinsic787 {798 {788 ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>} = 20,799 ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,789 ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,800 ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,790801791 Aura: pallet_aura::{Pallet, Config<T>} = 22,802 Aura: pallet_aura::{Pallet, Config<T>} = 22,978 }989 }979990980 fn author() -> H160 {991 fn author() -> H160 {981 <pallet_evm::Module<Runtime>>::find_author()992 <pallet_evm::Pallet<Runtime>>::find_author()982 }993 }983994984 fn storage_at(address: H160, index: U256) -> H256 {995 fn storage_at(address: H160, index: U256) -> H256 {runtime_types.jsondiffbeforeafterboth1{1{2 "AccountInfo": "AccountInfoWithTripleRefCount",2 "CrossAccountId": {3 "CrossAccountId": {3 "_enum": {4 "_enum": {4 "substrate": "AccountId",5 "substrate": "AccountId",18 "DecimalPoints": "u8",19 "DecimalPoints": "u8",19 "CollectionMode": {20 "CollectionMode": {20 "_enum": {21 "_enum": {21 "Invalid": null,22 "NFT": null,22 "NFT": null,23 "Fungible": "DecimalPoints",23 "Fungible": "DecimalPoints",24 "ReFungible": null24 "ReFungible": null63 "Limits": "CollectionLimits",63 "Limits": "CollectionLimits",64 "VariableOnChainSchema": "Vec<u8>",64 "VariableOnChainSchema": "Vec<u8>",65 "ConstOnChainSchema": "Vec<u8>",65 "ConstOnChainSchema": "Vec<u8>",66 "MetaUpdatePermission": "MetaUpdatePermission",66 "TransfersEnabled": "bool"67 "TransfersEnabled": "bool"67 },68 },68 "RawData": "Vec<u8>",69 "RawData": "Vec<u8>",94 "Unique"95 "Unique"95 ]96 ]96 },97 },98 "MetaUpdatePermission": {99 "_enum": [100 "ItemOwner",101 "Admin",102 "None" 103 ]104 },97 "CollectionId": "u32",105 "CollectionId": "u32",98 "TokenId": "u32",106 "TokenId": "u32",99 "ChainLimits": {107 "ChainLimits": {smart_contracs/transfer/Cargo.tomldiffbeforeafterboth13ink_storage = { default-features = false }13ink_storage = { default-features = false }14ink_lang = { default-features = false }14ink_lang = { default-features = false }151516scale = { package = "parity-scale-codec", version = "2.1.1", default-features = false, features = ["derive"] }16scale = { package = "parity-scale-codec", version = "2.3.0", default-features = false, features = ["derive"] }17scale-info = { version = "0.6.0", default-features = false, features = ["derive"] }17scale-info = { version = "0.6.0", default-features = false, features = ["derive"] }181819[lib]19[lib]tests/README.mddiffbeforeafterboth51. Checkout polkadot in sibling folder with this project51. Checkout polkadot in sibling folder with this project6```bash6```bash7git clone https://github.com/paritytech/polkadot.git && cd polkadot7git clone https://github.com/paritytech/polkadot.git && cd polkadot8git checkout aa38676098git checkout release-v0.9.99```9```1010112. Build with nightly-2021-04-23112. Build with nightly-2021-06-2812```bash12```bash13cargo build --release13cargo build --release14```14```tests/src/addCollectionAdmin.test.tsdiffbeforeafterboth4//4//556import { ApiPromise } from '@polkadot/api';6import { ApiPromise } from '@polkadot/api';7import BN from 'bn.js';8import chai from 'chai';7import chai from 'chai';9import chaiAsPromised from 'chai-as-promised';8import chaiAsPromised from 'chai-as-promised';10import privateKey from './substrate/privateKey';9import privateKey from './substrate/privateKey';tests/src/check-event/createItemEvent.test.tsdiffbeforeafterboth10import chaiAsPromised from 'chai-as-promised';10import chaiAsPromised from 'chai-as-promised';11import privateKey from '../substrate/privateKey';11import privateKey from '../substrate/privateKey';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';13import { createCollectionExpectSuccess, nftEventMessage } from '../util/helpers';13import { createCollectionExpectSuccess, nftEventMessage, normalizeAccountId } from '../util/helpers';141415chai.use(chaiAsPromised);15chai.use(chaiAsPromised);16const expect = chai.expect;16const expect = chai.expect;28 it('Check event from createItem(): ', async () => {28 it('Check event from createItem(): ', async () => {29 await usingApi(async (api: ApiPromise) => {29 await usingApi(async (api: ApiPromise) => {30 const collectionID = await createCollectionExpectSuccess();30 const collectionID = await createCollectionExpectSuccess();31 const createItem = api.tx.nft.createItem(collectionID, Alice.address, 'NFT');31 const createItem = api.tx.nft.createItem(collectionID, normalizeAccountId(Alice.address), 'NFT');32 const events = await submitTransactionAsync(Alice, createItem);32 const events = await submitTransactionAsync(Alice, createItem);33 const msg = JSON.stringify(nftEventMessage(events));33 const msg = JSON.stringify(nftEventMessage(events));34 expect(msg).to.be.contain(checkSection);34 expect(msg).to.be.contain(checkSection);tests/src/check-event/createMultipleItemsEvent.test.tsdiffbeforeafterboth10import chaiAsPromised from 'chai-as-promised';10import chaiAsPromised from 'chai-as-promised';11import privateKey from '../substrate/privateKey';11import privateKey from '../substrate/privateKey';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';13import { createCollectionExpectSuccess, nftEventMessage } from '../util/helpers';13import { createCollectionExpectSuccess, nftEventMessage, normalizeAccountId } from '../util/helpers';141415chai.use(chaiAsPromised);15chai.use(chaiAsPromised);16const expect = chai.expect;16const expect = chai.expect;29 await usingApi(async (api: ApiPromise) => {29 await usingApi(async (api: ApiPromise) => {30 const collectionID = await createCollectionExpectSuccess();30 const collectionID = await createCollectionExpectSuccess();31 const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];31 const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];32 const createMultipleItems = api.tx.nft.createMultipleItems(collectionID, Alice.address, args);32 const createMultipleItems = api.tx.nft.createMultipleItems(collectionID, normalizeAccountId(Alice.address), args);33 const events = await submitTransactionAsync(Alice, createMultipleItems);33 const events = await submitTransactionAsync(Alice, createMultipleItems);34 const msg = JSON.stringify(nftEventMessage(events));34 const msg = JSON.stringify(nftEventMessage(events));35 expect(msg).to.be.contain(checkSection);35 expect(msg).to.be.contain(checkSection);tests/src/check-event/transferEvent.test.tsdiffbeforeafterboth10import chaiAsPromised from 'chai-as-promised';10import chaiAsPromised from 'chai-as-promised';11import privateKey from '../substrate/privateKey';11import privateKey from '../substrate/privateKey';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';13import { createCollectionExpectSuccess, createItemExpectSuccess, nftEventMessage } from '../util/helpers';13import { createCollectionExpectSuccess, createItemExpectSuccess, nftEventMessage, normalizeAccountId } from '../util/helpers';141415chai.use(chaiAsPromised);15chai.use(chaiAsPromised);16const expect = chai.expect;16const expect = chai.expect;31 await usingApi(async (api: ApiPromise) => {31 await usingApi(async (api: ApiPromise) => {32 const collectionID = await createCollectionExpectSuccess();32 const collectionID = await createCollectionExpectSuccess();33 const itemID = await createItemExpectSuccess(Alice, collectionID, 'NFT');33 const itemID = await createItemExpectSuccess(Alice, collectionID, 'NFT');34 const transfer = api.tx.nft.transfer(Bob.address, collectionID, itemID, 1);34 const transfer = api.tx.nft.transfer(normalizeAccountId(Bob.address), collectionID, itemID, 1);35 const events = await submitTransactionAsync(Alice, transfer);35 const events = await submitTransactionAsync(Alice, transfer);36 const msg = JSON.stringify(nftEventMessage(events));36 const msg = JSON.stringify(nftEventMessage(events));37 expect(msg).to.be.contain(checkSection);37 expect(msg).to.be.contain(checkSection);tests/src/check-event/transferFromEvent.test.tsdiffbeforeafterboth10import chaiAsPromised from 'chai-as-promised';10import chaiAsPromised from 'chai-as-promised';11import privateKey from '../substrate/privateKey';11import privateKey from '../substrate/privateKey';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';13import { createCollectionExpectSuccess, createItemExpectSuccess, nftEventMessage } from '../util/helpers';13import { createCollectionExpectSuccess, createItemExpectSuccess, nftEventMessage, normalizeAccountId } from '../util/helpers';141415chai.use(chaiAsPromised);15chai.use(chaiAsPromised);16const expect = chai.expect;16const expect = chai.expect;31 await usingApi(async (api: ApiPromise) => {31 await usingApi(async (api: ApiPromise) => {32 const collectionID = await createCollectionExpectSuccess();32 const collectionID = await createCollectionExpectSuccess();33 const itemID = await createItemExpectSuccess(Alice, collectionID, 'NFT');33 const itemID = await createItemExpectSuccess(Alice, collectionID, 'NFT');34 const transferFrom = api.tx.nft.transferFrom(Alice.address, Bob.address, collectionID, itemID, 1);34 const transferFrom = api.tx.nft.transferFrom(normalizeAccountId(Alice.address), normalizeAccountId(Bob.address), collectionID, itemID, 1);35 const events = await submitTransactionAsync(Alice, transferFrom);35 const events = await submitTransactionAsync(Alice, transferFrom);36 const msg = JSON.stringify(nftEventMessage(events));36 const msg = JSON.stringify(nftEventMessage(events));37 expect(msg).to.be.contain(checkSection);37 expect(msg).to.be.contain(checkSection);tests/src/collision-tests/admVsOwnerChanges.test.tsdiffbeforeafterboth6import {6import {7 createCollectionExpectSuccess,7 createCollectionExpectSuccess,8 createItemExpectSuccess,8 createItemExpectSuccess,9 normalizeAccountId,10 waitNewBlocks,9} from '../util/helpers';11} from '../util/helpers';101211chai.use(chaiAsPromised);13chai.use(chaiAsPromised);30 28 await usingApi(async (api) => {31 await usingApi(async (api) => {29 const collectionId = await createCollectionExpectSuccess();32 const collectionId = await createCollectionExpectSuccess();30 const changeAdminTxBob = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);33 const changeAdminTxBob = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));31 await submitTransactionAsync(Alice, changeAdminTxBob);34 await submitTransactionAsync(Alice, changeAdminTxBob);32 const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));33 const changeAdminTxFerdie = api.tx.nft.addCollectionAdmin(collectionId, Ferdie.address);35 const changeAdminTxFerdie = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Ferdie.address));34 await submitTransactionAsync(Bob, changeAdminTxFerdie);36 await submitTransactionAsync(Bob, changeAdminTxFerdie);35 const itemId = await createItemExpectSuccess(Ferdie, collectionId, 'NFT');37 const itemId = await createItemExpectSuccess(Ferdie, collectionId, 'NFT');36 //38 37 const changeOwner = api.tx.nft.transferFrom(Ferdie.address, Bob.address, collectionId, itemId, 1);39 const changeOwner = api.tx.nft.transferFrom(normalizeAccountId(Ferdie.address), normalizeAccountId(Bob.address), collectionId, itemId, 1);38 const approve = api.tx.nft.approve(Bob.address, collectionId, itemId, 1);40 const approve = api.tx.nft.approve(normalizeAccountId(Bob.address), collectionId, itemId, 1);39 const sendItem = api.tx.nft.transfer(Alice.address, collectionId, itemId, 1);41 const sendItem = api.tx.nft.transfer(normalizeAccountId(Alice.address), collectionId, itemId, 1);40 await Promise.all([42 await Promise.all([41 changeOwner.signAndSend(Alice),43 changeOwner.signAndSend(Alice),42 approve.signAndSend(Bob),44 approve.signAndSend(Bob),43 sendItem.signAndSend(Ferdie),45 sendItem.signAndSend(Ferdie),44 ]);46 ]);45 const itemBefore: any = await api.query.nft.nftItemList(collectionId, itemId);47 const itemBefore: any = await api.query.nft.nftItemList(collectionId, itemId);46 expect(itemBefore.Owner).not.to.be.eq(Bob.address);48 expect(itemBefore.Owner).not.to.be.eq(Bob.address);47 await timeoutPromise(20000);49 await waitNewBlocks(2);48 });50 });49 });51 });50});52});tests/src/collision-tests/admVsOwnerData.test.tsdiffbeforeafterboth6import {6import {7 createCollectionExpectSuccess,7 createCollectionExpectSuccess,8 createItemExpectSuccess,8 createItemExpectSuccess,9 normalizeAccountId,10 waitNewBlocks,9} from '../util/helpers';11} from '../util/helpers';101211chai.use(chaiAsPromised);13chai.use(chaiAsPromised);26 const AliceData = 1;28 const AliceData = 1;27 const BobData = 2;29 const BobData = 2;28 const collectionId = await createCollectionExpectSuccess();30 const collectionId = await createCollectionExpectSuccess();29 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);31 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));30 await submitTransactionAsync(Alice, changeAdminTx);32 await submitTransactionAsync(Alice, changeAdminTx);31 const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));32 const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');33 const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');33 //34 //34 // tslint:disable-next-line: max-line-length35 // tslint:disable-next-line: max-line-length41 ]);42 ]);42 const item: any = await api.query.nft.nftItemList(collectionId, itemId);43 const item: any = await api.query.nft.nftItemList(collectionId, itemId);43 expect(item.VariableData).not.to.be.eq(null); // Pseudo-random selection of one of two values44 expect(item.VariableData).not.to.be.eq(null); // Pseudo-random selection of one of two values44 await timeoutPromise(20000);45 await waitNewBlocks(2);45 });46 });46 });47 });47});48});tests/src/collision-tests/admVsOwnerTake.test.tsdiffbeforeafterboth6import {6import {7 createCollectionExpectSuccess,7 createCollectionExpectSuccess,8 createItemExpectSuccess,8 createItemExpectSuccess,9 normalizeAccountId,10 waitNewBlocks,9} from '../util/helpers';11} from '../util/helpers';101211chai.use(chaiAsPromised);13chai.use(chaiAsPromised);27 it('The collection admin burns the token and in the same block the token owner performs a transaction on it ', async () => {29 it('The collection admin burns the token and in the same block the token owner performs a transaction on it ', async () => {28 await usingApi(async (api) => {30 await usingApi(async (api) => {29 const collectionId = await createCollectionExpectSuccess();31 const collectionId = await createCollectionExpectSuccess();30 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);32 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));31 await submitTransactionAsync(Alice, changeAdminTx);33 await submitTransactionAsync(Alice, changeAdminTx);32 const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));33 const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');34 const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');34 //35 //35 const sendItem = api.tx.nft.transfer(Ferdie.address, collectionId, itemId, 1);36 const sendItem = api.tx.nft.transfer(normalizeAccountId(Ferdie.address), collectionId, itemId, 1);36 const burnItem = api.tx.nft.burnItem(collectionId, itemId, 1);37 const burnItem = api.tx.nft.burnItem(collectionId, itemId, 1);37 await Promise.all([38 await Promise.all([38 sendItem.signAndSend(Bob),39 sendItem.signAndSend(Bob),39 burnItem.signAndSend(Alice),40 burnItem.signAndSend(Alice),40 ]);41 ]);41 await timeoutPromise(10000);42 await waitNewBlocks(2);42 let itemBurn = false;43 let itemBurn = false;43 itemBurn = (await (api.query.nft.nftItemList(collectionId, itemId))).toJSON() as boolean;44 itemBurn = (await (api.query.nft.nftItemList(collectionId, itemId))).toJSON() as boolean;44 // tslint:disable-next-line: no-unused-expression45 // tslint:disable-next-line: no-unused-expression45 expect(itemBurn).to.be.null;46 expect(itemBurn).to.be.null;46 await timeoutPromise(20000);47 await waitNewBlocks(2);47 });48 });48 });49 });49});50});tests/src/collision-tests/adminDestroyCollection.test.tsdiffbeforeafterboth5import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';5import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';6import {6import {7 createCollectionExpectSuccess,7 createCollectionExpectSuccess,8 normalizeAccountId,9 waitNewBlocks,8} from '../util/helpers';10} from '../util/helpers';91110chai.use(chaiAsPromised);12chai.use(chaiAsPromised);26 it('Adding an address to the collection whitelist in a block by the admin, and deleting the collection by the owner ', async () => {28 it('Adding an address to the collection whitelist in a block by the admin, and deleting the collection by the owner ', async () => {27 await usingApi(async (api) => {29 await usingApi(async (api) => {28 const collectionId = await createCollectionExpectSuccess();30 const collectionId = await createCollectionExpectSuccess();29 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);31 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));30 await submitTransactionAsync(Alice, changeAdminTx);32 await submitTransactionAsync(Alice, changeAdminTx);31 const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));32 await timeoutPromise(10000);33 await waitNewBlocks(1);33 //34 //34 const addWhitelistAdm = api.tx.nft.addToWhiteList(collectionId, Ferdie.address);35 const addWhitelistAdm = api.tx.nft.addToWhiteList(collectionId, normalizeAccountId(Ferdie.address));35 const destroyCollection = api.tx.nft.destroyCollection(collectionId);36 const destroyCollection = api.tx.nft.destroyCollection(collectionId);36 await Promise.all([37 await Promise.all([37 addWhitelistAdm.signAndSend(Bob),38 addWhitelistAdm.signAndSend(Bob),38 destroyCollection.signAndSend(Alice),39 destroyCollection.signAndSend(Alice),39 ]);40 ]);40 await timeoutPromise(10000);41 await waitNewBlocks(1);41 let whiteList = false;42 let whiteList = false;42 whiteList = (await api.query.nft.whiteList(collectionId, Ferdie.address)).toJSON() as boolean;43 whiteList = (await api.query.nft.whiteList(collectionId, Ferdie.address)).toJSON() as boolean;43 // tslint:disable-next-line: no-unused-expression44 // tslint:disable-next-line: no-unused-expression44 expect(whiteList).to.be.false;45 expect(whiteList).to.be.false;45 await timeoutPromise(20000);46 await waitNewBlocks(2);46 });47 });47 });48 });48});49});tests/src/collision-tests/adminLimitsOff.test.tsdiffbeforeafterboth1import { IKeyringPair } from '@polkadot/types/types';1import { IKeyringPair } from '@polkadot/types/types';2import BN from 'bn.js';3import chai from 'chai';2import chai from 'chai';4import chaiAsPromised from 'chai-as-promised';3import chaiAsPromised from 'chai-as-promised';5import privateKey from '../substrate/privateKey';4import privateKey from '../substrate/privateKey';6import usingApi, { submitTransactionAsync, submitTransactionExpectFailAsync } from '../substrate/substrate-api';5import usingApi, { submitTransactionAsync, submitTransactionExpectFailAsync } from '../substrate/substrate-api';7import {6import {8 createCollectionExpectSuccess,7 createCollectionExpectSuccess,8 normalizeAccountId,9 waitNewBlocks,9} from '../util/helpers';10} from '../util/helpers';101111chai.use(chaiAsPromised);12chai.use(chaiAsPromised);37 const chainAdminLimit = (api.consts.nft.collectionAdminsLimit as any).toNumber();38 const chainAdminLimit = (api.consts.nft.collectionAdminsLimit as any).toNumber();38 expect(chainAdminLimit).to.be.equal(5);39 expect(chainAdminLimit).to.be.equal(5);394040 const changeAdminTx1 = api.tx.nft.addCollectionAdmin(collectionId, Eve.address);41 const changeAdminTx1 = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Eve.address));41 await submitTransactionAsync(Alice, changeAdminTx1);42 await submitTransactionAsync(Alice, changeAdminTx1);42 const changeAdminTx2 = api.tx.nft.addCollectionAdmin(collectionId, Dave.address);43 const changeAdminTx2 = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Dave.address));43 await submitTransactionAsync(Alice, changeAdminTx2);44 await submitTransactionAsync(Alice, changeAdminTx2);44 const changeAdminTx3 = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);45 const changeAdminTx3 = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));45 await submitTransactionAsync(Alice, changeAdminTx3);46 await submitTransactionAsync(Alice, changeAdminTx3);464747 const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));48 const addAdmOne = api.tx.nft.addCollectionAdmin(collectionId, Ferdie.address);48 const addAdmOne = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Ferdie.address));49 const addAdmTwo = api.tx.nft.addCollectionAdmin(collectionId, Charlie.address);49 const addAdmTwo = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Charlie.address));50 await Promise.all([50 await Promise.all([51 addAdmOne.signAndSend(Bob),51 addAdmOne.signAndSend(Bob),52 addAdmTwo.signAndSend(Alice),52 addAdmTwo.signAndSend(Alice),53 ]);53 ]);54 await timeoutPromise(10000);54 await waitNewBlocks(2);55 const changeAdminTx4 = api.tx.nft.addCollectionAdmin(collectionId, Alice.address);55 const changeAdminTx4 = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Alice.address));56 // tslint:disable-next-line: no-unused-expression57 expect(submitTransactionExpectFailAsync(Alice, changeAdminTx4)).to.be.rejected;56 await expect(submitTransactionExpectFailAsync(Alice, changeAdminTx4)).to.be.rejected;585759 const adminListAfterAddAdmin: any = (await api.query.nft.adminList(collectionId));58 const adminListAfterAddAdmin: any = (await api.query.nft.adminList(collectionId));60 expect(adminListAfterAddAdmin).to.be.contains(Eve.address);59 expect(adminListAfterAddAdmin).to.be.contains(normalizeAccountId(Eve.address));61 expect(adminListAfterAddAdmin).to.be.contains(Ferdie.address);60 expect(adminListAfterAddAdmin).to.be.contains(normalizeAccountId(Ferdie.address));62 expect(adminListAfterAddAdmin).not.to.be.contains(Alice.address);61 expect(adminListAfterAddAdmin).not.to.be.contains(normalizeAccountId(Alice.address));63 await timeoutPromise(20000);62 await waitNewBlocks(2);64 });63 });65 });64 });66});65});tests/src/collision-tests/adminRightsOff.test.tsdiffbeforeafterboth6import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';6import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';7import {7import {8 createCollectionExpectSuccess,8 createCollectionExpectSuccess,9 normalizeAccountId,10 waitNewBlocks,9} from '../util/helpers';11} from '../util/helpers';101211chai.use(chaiAsPromised);13chai.use(chaiAsPromised);25 it('In the block, the collection admin adds a token or changes data, and the collection owner deprives the admin of rights ', async () => {27 it('In the block, the collection admin adds a token or changes data, and the collection owner deprives the admin of rights ', async () => {26 await usingApi(async (api) => {28 await usingApi(async (api) => {27 const collectionId = await createCollectionExpectSuccess();29 const collectionId = await createCollectionExpectSuccess();28 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);30 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));29 await submitTransactionAsync(Alice, changeAdminTx);31 await submitTransactionAsync(Alice, changeAdminTx);30 const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));31 await timeoutPromise(10000);32 await waitNewBlocks(1);32 const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];33 const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];33 const addItemAdm = api.tx.nft.createMultipleItems(collectionId, Bob.address, args);34 const addItemAdm = api.tx.nft.createMultipleItems(collectionId, normalizeAccountId(Bob.address), args);34 const removeAdm = api.tx.nft.removeCollectionAdmin(collectionId, Bob.address);35 const removeAdm = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(Bob.address));35 await Promise.all([36 await Promise.all([36 addItemAdm.signAndSend(Bob),37 addItemAdm.signAndSend(Bob),37 removeAdm.signAndSend(Alice),38 removeAdm.signAndSend(Alice),38 ]);39 ]);39 await timeoutPromise(10000);40 await waitNewBlocks(2);40 const itemsListIndex = await api.query.nft.itemListIndex(collectionId) as unknown as BN;41 const itemsListIndex = await api.query.nft.itemListIndex(collectionId) as unknown as BN;41 expect(itemsListIndex.toNumber()).to.be.equal(0);42 expect(itemsListIndex.toNumber()).to.be.equal(0);42 const adminList: any = (await api.query.nft.adminList(collectionId));43 const adminList: any = (await api.query.nft.adminList(collectionId));43 expect(adminList).not.to.be.contains(Bob.address);44 expect(adminList).not.to.be.contains(normalizeAccountId(Bob.address));44 await timeoutPromise(20000);45 await waitNewBlocks(2);45 });46 });46 });47 });47});48});tests/src/collision-tests/setSponsorNewOwner.test.tsdiffbeforeafterboth6import {6import {7 createCollectionExpectSuccess, setCollectionSponsorExpectSuccess,7 createCollectionExpectSuccess, 8 setCollectionSponsorExpectSuccess,9 waitNewBlocks,8} from '../util/helpers';10} from '../util/helpers';91110chai.use(chaiAsPromised);12chai.use(chaiAsPromised);27 await usingApi(async (api) => {29 await usingApi(async (api) => {28 const collectionId = await createCollectionExpectSuccess();30 const collectionId = await createCollectionExpectSuccess();29 await setCollectionSponsorExpectSuccess(collectionId, Bob.address);31 await setCollectionSponsorExpectSuccess(collectionId, Bob.address);30 const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));31 await timeoutPromise(10000);32 await waitNewBlocks(2);32 const confirmSponsorship = api.tx.nft.confirmSponsorship(collectionId);33 const confirmSponsorship = api.tx.nft.confirmSponsorship(collectionId);33 const changeCollectionOwner = api.tx.nft.changeCollectionOwner(collectionId, Ferdie.address);34 const changeCollectionOwner = api.tx.nft.changeCollectionOwner(collectionId, Ferdie.address);34 await Promise.all([35 await Promise.all([35 confirmSponsorship.signAndSend(Bob),36 confirmSponsorship.signAndSend(Bob),36 changeCollectionOwner.signAndSend(Alice),37 changeCollectionOwner.signAndSend(Alice),37 ]);38 ]);38 await timeoutPromise(10000);39 await waitNewBlocks(2);39 const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();40 const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();40 expect(collection.Sponsorship.Confirmed).to.be.eq(Bob.address);41 expect(collection.Sponsorship.confirmed).to.be.eq(Bob.address);41 expect(collection.Owner).to.be.eq(Ferdie.address);42 expect(collection.Owner).to.be.eq(Ferdie.address);42 await timeoutPromise(20000);43 await waitNewBlocks(2);43 });44 });44 });45 });45});46});tests/src/collision-tests/sponsorPayments.test.tsdiffbeforeafterboth10 createCollectionExpectSuccess,10 createCollectionExpectSuccess,11 createItemExpectSuccess,11 createItemExpectSuccess,12 setCollectionSponsorExpectSuccess,12 setCollectionSponsorExpectSuccess,13 normalizeAccountId,14 waitNewBlocks,13} from '../util/helpers';15} from '../util/helpers';141615chai.use(chaiAsPromised);17chai.use(chaiAsPromised);29 it('Payment of commission if one block contains transactions for payment from the sponsor\'s balance and his (sponsor\'s) exclusion from the collection ', async () => {31 it('Payment of commission if one block contains transactions for payment from the sponsor\'s balance and his (sponsor\'s) exclusion from the collection ', async () => {30 await usingApi(async (api) => {32 await usingApi(async (api) => {31 const collectionId = await createCollectionExpectSuccess();33 const collectionId = await createCollectionExpectSuccess();32 const changeAdminTxBob = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);34 const changeAdminTxBob = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));33 await submitTransactionAsync(Alice, changeAdminTxBob);35 await submitTransactionAsync(Alice, changeAdminTxBob);34 const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));35 const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');36 const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');36 await setCollectionSponsorExpectSuccess(collectionId, Bob.address);37 await setCollectionSponsorExpectSuccess(collectionId, Bob.address);37 await confirmSponsorshipExpectSuccess(collectionId, '//Bob');38 await confirmSponsorshipExpectSuccess(collectionId, '//Bob');383939 const [alicesBalanceBefore, bobsBalanceBefore] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);40 const [alicesBalanceBefore, bobsBalanceBefore] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);40 const sendItem = api.tx.nft.transfer(Alice.address, collectionId, itemId, 1);41 const sendItem = api.tx.nft.transfer(normalizeAccountId(Alice.address), collectionId, itemId, 1);41 const revokeSponsor = api.tx.nft.removeCollectionSponsor(collectionId);42 const revokeSponsor = api.tx.nft.removeCollectionSponsor(collectionId);42 await Promise.all([43 await Promise.all([43 sendItem.signAndSend(Bob),44 sendItem.signAndSend(Bob),48 expect(alicesBalanceAfter === alicesBalanceBefore).to.be.true;49 expect(alicesBalanceAfter === alicesBalanceBefore).to.be.true;49 // tslint:disable-next-line:no-unused-expression50 // tslint:disable-next-line:no-unused-expression50 expect(bobsBalanceAfter === bobsBalanceBefore).to.be.true;51 expect(bobsBalanceAfter === bobsBalanceBefore).to.be.true;51 await timeoutPromise(20000);52 await waitNewBlocks(2);52 });53 });53 });54 });54});55});tests/src/collision-tests/tokenLimitsOff.test.tsdiffbeforeafterboth9 createCollectionExpectSuccess,9 createCollectionExpectSuccess,10 getCreateItemResult,10 getCreateItemResult,11 setMintPermissionExpectSuccess,11 setMintPermissionExpectSuccess,12 normalizeAccountId,13 waitNewBlocks,12} from '../util/helpers';14} from '../util/helpers';131514chai.use(chaiAsPromised);16chai.use(chaiAsPromised);56 const subTxTesult = getCreateItemResult(subTx);58 const subTxTesult = getCreateItemResult(subTx);57 // tslint:disable-next-line:no-unused-expression59 // tslint:disable-next-line:no-unused-expression58 expect(subTxTesult.success).to.be.true;60 expect(subTxTesult.success).to.be.true;59 const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));60 await timeoutPromise(10000);61 await waitNewBlocks(2);616262 const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];63 const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];63 const mintItemOne = api.tx.nft64 const mintItemOne = api.tx.nft64 .createMultipleItems(collectionId, Ferdie.address, args);65 .createMultipleItems(collectionId, normalizeAccountId(Ferdie.address), args);65 const mintItemTwo = api.tx.nft66 const mintItemTwo = api.tx.nft66 .createMultipleItems(collectionId, Bob.address, args);67 .createMultipleItems(collectionId, normalizeAccountId(Bob.address), args);67 await Promise.all([68 await Promise.all([68 mintItemOne.signAndSend(Ferdie),69 mintItemOne.signAndSend(Ferdie),69 mintItemTwo.signAndSend(Bob),70 mintItemTwo.signAndSend(Bob),70 ]);71 ]);71 await timeoutPromise(10000);72 await waitNewBlocks(2);72 const itemsListIndexAfter = await api.query.nft.itemListIndex(collectionId) as unknown as BN;73 const itemsListIndexAfter = await api.query.nft.itemListIndex(collectionId) as unknown as BN;73 expect(itemsListIndexAfter.toNumber()).to.be.equal(3);74 expect(itemsListIndexAfter.toNumber()).to.be.equal(3);74 // TokenLimit = 4. The first transaction is successful. The second should fail.75 // TokenLimit = 4. The first transaction is successful. The second should fail.75 await timeoutPromise(10000);76 await waitNewBlocks(2);76 });77 });77 });78 });78});79});tests/src/collision-tests/turnsOffMinting.test.tsdiffbeforeafterboth7 addToWhiteListExpectSuccess,7 addToWhiteListExpectSuccess,8 createCollectionExpectSuccess,8 createCollectionExpectSuccess,9 setMintPermissionExpectSuccess,9 setMintPermissionExpectSuccess,10 normalizeAccountId,11 waitNewBlocks,10} from '../util/helpers';12} from '../util/helpers';111312chai.use(chaiAsPromised);14chai.use(chaiAsPromised);26 it('The collection owner turns off minting mode and there are minting transactions in the same block ', async () => {28 it('The collection owner turns off minting mode and there are minting transactions in the same block ', async () => {27 await usingApi(async (api) => {29 await usingApi(async (api) => {28 const collectionId = await createCollectionExpectSuccess();30 const collectionId = await createCollectionExpectSuccess();29 const timeoutPromise = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout));30 await setMintPermissionExpectSuccess(Alice, collectionId, true);31 await setMintPermissionExpectSuccess(Alice, collectionId, true);31 await addToWhiteListExpectSuccess(Alice, collectionId, Ferdie.address);32 await addToWhiteListExpectSuccess(Alice, collectionId, Ferdie.address);323333 const mintItem = api.tx.nft.createItem(collectionId, Ferdie.address, 'NFT');34 const mintItem = api.tx.nft.createItem(collectionId, normalizeAccountId(Ferdie.address), 'NFT');34 const offMinting = api.tx.nft.setMintPermission(collectionId, false);35 const offMinting = api.tx.nft.setMintPermission(collectionId, false);35 await Promise.all([36 await Promise.all([36 mintItem.signAndSend(Ferdie),37 mintItem.signAndSend(Ferdie),40 itemList = (await (api.query.nft.nftItemList(collectionId, mintItem))).toJSON() as boolean;41 itemList = (await (api.query.nft.nftItemList(collectionId, mintItem))).toJSON() as boolean;41 // tslint:disable-next-line: no-unused-expression42 // tslint:disable-next-line: no-unused-expression42 expect(itemList).to.be.null;43 expect(itemList).to.be.null;43 await timeoutPromise(20000);44 await waitNewBlocks(2);44 });45 });45 });46 });46});47});tests/src/createCollection.test.tsdiffbeforeafterboth33});33});343435describe('(!negative test!) integration test: ext. createCollection():', () => {35describe('(!negative test!) integration test: ext. createCollection():', () => {36 it('(!negative test!) create new NFT collection whith incorrect data (mode)', async () => {37 await usingApi(async (api) => {38 const AcollectionCount = parseInt((await api.query.nft.createdCollectionCount()).toString(), 10);3940 const badTransaction = async () => {41 await createCollectionExpectSuccess({mode: {type: 'Invalid'}});42 };43 // tslint:disable-next-line:no-unused-expression44 expect(badTransaction()).to.be.rejected;4546 const BcollectionCount = parseInt((await api.query.nft.createdCollectionCount()).toString(), 10);47 expect(BcollectionCount).to.be.equal(AcollectionCount, 'Error: Incorrect collection created.');48 });49 });50 it('(!negative test!) create new NFT collection whith incorrect data (collection_name)', async () => {36 it('(!negative test!) create new NFT collection whith incorrect data (collection_name)', async () => {51 await createCollectionExpectFailure({ name: 'A'.repeat(65), mode: {type: 'NFT'}});37 await createCollectionExpectFailure({ name: 'A'.repeat(65), mode: {type: 'NFT'}});52 });38 });tests/src/eth/api/ContractHelpers.soldiffbeforeafterboth9}9}101011interface ContractHelpers is Dummy {11interface ContractHelpers is Dummy {12 // Selector: contractOwner(address) 5152b14c12 function contractOwner(address contractAddress)13 function contractOwner(address contractAddress)13 external14 external14 view15 view15 returns (address);16 returns (address);161718 // Selector: sponsoringEnabled(address) 6027dc6117 function sponsoringEnabled(address contractAddress)19 function sponsoringEnabled(address contractAddress)18 external20 external19 view21 view20 returns (bool);22 returns (bool);212324 // Selector: toggleSponsoring(address,bool) fcac6d8622 function toggleSponsoring(address contractAddress, bool enabled) external;25 function toggleSponsoring(address contractAddress, bool enabled) external;232627 // Selector: setSponsoringRateLimit(address,uint32) 77b6c90824 function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)28 function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)25 external;29 external;263031 // Selector: getSponsoringRateLimit(address) 610cfabd32 function getSponsoringRateLimit(address contractAddress)33 external34 view35 returns (uint32);3637 // Selector: allowed(address,address) 5c65816527 function allowed(address contractAddress, address user)38 function allowed(address contractAddress, address user)28 external39 external29 view40 view30 returns (bool);41 returns (bool);314243 // Selector: allowlistEnabled(address) c772ef6c32 function allowlistEnabled(address contractAddress)44 function allowlistEnabled(address contractAddress)33 external45 external34 view46 view35 returns (bool);47 returns (bool);364849 // Selector: toggleAllowlist(address,bool) 36de20f537 function toggleAllowlist(address contractAddress, bool enabled) external;50 function toggleAllowlist(address contractAddress, bool enabled) external;385152 // Selector: toggleAllowed(address,address,bool) 4706cc1c39 function toggleAllowed(53 function toggleAllowed(40 address contractAddress,54 address contractAddress,41 address user,55 address user,tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth202021// Inline21// Inline22interface InlineNameSymbol is Dummy {22interface InlineNameSymbol is Dummy {23 // Selector: name() 06fdde0323 function name() external view returns (string memory);24 function name() external view returns (string memory);242526 // Selector: symbol() 95d89b4125 function symbol() external view returns (string memory);27 function symbol() external view returns (string memory);26}28}272928// Inline30// Inline29interface InlineTotalSupply is Dummy {31interface InlineTotalSupply is Dummy {32 // Selector: totalSupply() 18160ddd30 function totalSupply() external view returns (uint256);33 function totalSupply() external view returns (uint256);31}34}323533interface ERC165 is Dummy {36interface ERC165 is Dummy {37 // Selector: supportsInterface(bytes4) 01ffc9a734 function supportsInterface(uint32 interfaceId) external view returns (bool);38 function supportsInterface(uint32 interfaceId) external view returns (bool);35}39}364037interface ERC20 is Dummy, InlineNameSymbol, InlineTotalSupply, ERC20Events {41interface ERC20 is Dummy, InlineNameSymbol, InlineTotalSupply, ERC20Events {42 // Selector: decimals() 313ce56738 function decimals() external view returns (uint8);43 function decimals() external view returns (uint8);394445 // Selector: balanceOf(address) 70a0823140 function balanceOf(address owner) external view returns (uint256);46 function balanceOf(address owner) external view returns (uint256);414748 // Selector: transfer(address,uint256) a9059cbb42 function transfer(address to, uint256 amount) external returns (bool);49 function transfer(address to, uint256 amount) external returns (bool);435051 // Selector: transferFrom(address,address,uint256) 23b872dd44 function transferFrom(52 function transferFrom(45 address from,53 address from,46 address to,54 address to,47 uint256 amount55 uint256 amount48 ) external returns (bool);56 ) external returns (bool);495758 // Selector: approve(address,uint256) 095ea7b350 function approve(address spender, uint256 amount) external returns (bool);59 function approve(address spender, uint256 amount) external returns (bool);516061 // Selector: allowance(address,address) dd62ed3e52 function allowance(address owner, address spender)62 function allowance(address owner, address spender)53 external63 external54 view64 viewtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth334pragma solidity >=0.8.0 <0.9.0;4pragma solidity >=0.8.0 <0.9.0;56// Anonymous struct7struct Tuple0 {8 uint256 field_0;9 string field_1;10}5116// Common stubs holder12// Common stubs holder7interface Dummy {13interface Dummy {344035// Inline41// Inline36interface InlineNameSymbol is Dummy {42interface InlineNameSymbol is Dummy {43 // Selector: name() 06fdde0337 function name() external view returns (string memory);44 function name() external view returns (string memory);384546 // Selector: symbol() 95d89b4139 function symbol() external view returns (string memory);47 function symbol() external view returns (string memory);40}48}414942// Inline50// Inline43interface InlineTotalSupply is Dummy {51interface InlineTotalSupply is Dummy {52 // Selector: totalSupply() 18160ddd44 function totalSupply() external view returns (uint256);53 function totalSupply() external view returns (uint256);45}54}465547interface ERC165 is Dummy {56interface ERC165 is Dummy {57 // Selector: supportsInterface(bytes4) 01ffc9a748 function supportsInterface(uint32 interfaceId) external view returns (bool);58 function supportsInterface(uint32 interfaceId) external view returns (bool);49}59}506051interface ERC721 is Dummy, ERC165, ERC721Events {61interface ERC721 is Dummy, ERC165, ERC721Events {62 // Selector: balanceOf(address) 70a0823152 function balanceOf(address owner) external view returns (uint256);63 function balanceOf(address owner) external view returns (uint256);536465 // Selector: ownerOf(uint256) 6352211e54 function ownerOf(uint256 tokenId) external view returns (address);66 function ownerOf(uint256 tokenId) external view returns (address);556768 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a1167256 function safeTransferFromWithData(69 function safeTransferFromWithData(57 address from,70 address from,58 address to,71 address to,59 uint256 tokenId,72 uint256 tokenId,60 bytes memory data73 bytes memory data61 ) external;74 ) external;627576 // Selector: safeTransferFrom(address,address,uint256) 42842e0e63 function safeTransferFrom(77 function safeTransferFrom(64 address from,78 address from,65 address to,79 address to,66 uint256 tokenId80 uint256 tokenId67 ) external;81 ) external;688283 // Selector: transferFrom(address,address,uint256) 23b872dd69 function transferFrom(84 function transferFrom(70 address from,85 address from,71 address to,86 address to,72 uint256 tokenId87 uint256 tokenId73 ) external;88 ) external;748990 // Selector: approve(address,uint256) 095ea7b375 function approve(address approved, uint256 tokenId) external;91 function approve(address approved, uint256 tokenId) external;769293 // Selector: setApprovalForAll(address,bool) a22cb46577 function setApprovalForAll(address operator, bool approved) external;94 function setApprovalForAll(address operator, bool approved) external;789596 // Selector: getApproved(uint256) 081812fc79 function getApproved(uint256 tokenId) external view returns (address);97 function getApproved(uint256 tokenId) external view returns (address);809899 // Selector: isApprovedForAll(address,address) e985e9c581 function isApprovedForAll(address owner, address operator)100 function isApprovedForAll(address owner, address operator)82 external101 external83 view102 view84 returns (address);103 returns (address);85}104}8610587interface ERC721Burnable is Dummy {106interface ERC721Burnable is Dummy {107 // Selector: burn(uint256) 42966c6888 function burn(uint256 tokenId) external;108 function burn(uint256 tokenId) external;89}109}9011091interface ERC721Enumerable is Dummy, InlineTotalSupply {111interface ERC721Enumerable is Dummy, InlineTotalSupply {112 // Selector: tokenByIndex(uint256) 4f6ccce792 function tokenByIndex(uint256 index) external view returns (uint256);113 function tokenByIndex(uint256 index) external view returns (uint256);93114115 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c5994 function tokenOfOwnerByIndex(address owner, uint256 index)116 function tokenOfOwnerByIndex(address owner, uint256 index)95 external117 external96 view118 view97 returns (uint256);119 returns (uint256);98}120}99121100interface ERC721Metadata is Dummy, InlineNameSymbol {122interface ERC721Metadata is Dummy, InlineNameSymbol {123 // Selector: tokenURI(uint256) c87b56dd101 function tokenURI(uint256 tokenId) external view returns (string memory);124 function tokenURI(uint256 tokenId) external view returns (string memory);102}125}103126104interface ERC721Mintable is Dummy, ERC721MintableEvents {127interface ERC721Mintable is Dummy, ERC721MintableEvents {128 // Selector: mintingFinished() 05d2035b105 function mintingFinished() external view returns (bool);129 function mintingFinished() external view returns (bool);106130131 // Selector: mint(address,uint256) 40c10f19107 function mint(address to, uint256 tokenId) external returns (bool);132 function mint(address to, uint256 tokenId) external returns (bool);108133134 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f109 function mintWithTokenURI(135 function mintWithTokenURI(110 address to,136 address to,111 uint256 tokenId,137 uint256 tokenId,112 string memory tokenUri138 string memory tokenUri113 ) external returns (bool);139 ) external returns (bool);114140141 // Selector: finishMinting() 7d64bcb4115 function finishMinting() external returns (bool);142 function finishMinting() external returns (bool);116}143}117144118interface ERC721UniqueExtensions is Dummy {145interface ERC721UniqueExtensions is Dummy {146 // Selector: transfer(address,uint256) a9059cbb119 function transfer(address to, uint256 tokenId) external;147 function transfer(address to, uint256 tokenId) external;120148149 // Selector: nextTokenId() 75794a3c121 function nextTokenId() external view returns (uint256);150 function nextTokenId() external view returns (uint256);151152 // Selector: setVariableMetadata(uint256,bytes) d4eac26d153 function setVariableMetadata(uint256 tokenId, bytes memory data) external;154155 // Selector: getVariableMetadata(uint256) e6c5ce6f156 function getVariableMetadata(uint256 tokenId)157 external158 view159 returns (bytes memory);160161 // Selector: mintBulk(address,uint256[]) 44a9945e162 function mintBulk(address to, uint256[] memory tokenIds)163 external164 returns (bool);165166 // Selector: mintBulkWithTokenURI(address,(uint256,string)[]) 36543006167 function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)168 external169 returns (bool);122}170}123171124interface UniqueNFT is172interface UniqueNFT istests/src/eth/nonFungible.test.tsdiffbeforeafterboth4//4//556import privateKey from '../substrate/privateKey';6import privateKey from '../substrate/privateKey';7import { approveExpectSuccess, burnItemExpectSuccess, createCollectionExpectSuccess, createItemExpectSuccess, transferExpectSuccess, transferFromExpectSuccess, UNIQUE } from '../util/helpers';7import { approveExpectSuccess, burnItemExpectSuccess, createCollectionExpectSuccess, createItemExpectSuccess, setVariableMetaDataExpectSuccess, transferExpectSuccess, transferFromExpectSuccess, UNIQUE, setMetadataUpdatePermissionFlagExpectSuccess } from '../util/helpers';8import { collectionIdToAddress, createEthAccount, createEthAccountWithBalance, GAS_ARGS, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, transferBalanceToEth } from './util/helpers';8import { collectionIdToAddress, createEthAccount, createEthAccountWithBalance, GAS_ARGS, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, transferBalanceToEth } from './util/helpers';9import { evmToAddress } from '@polkadot/util-crypto';10import nonFungibleAbi from './nonFungibleAbi.json';9import nonFungibleAbi from './nonFungibleAbi.json';11import { expect } from 'chai';10import { expect } from 'chai';12import waitNewBlocks from '../substrate/wait-new-blocks';11import waitNewBlocks from '../substrate/wait-new-blocks';106 expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');105 expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');107 }106 }108 });107 });108 itWeb3('Can perform mintBulk()', async ({ web3, api }) => {109 const collection = await createCollectionExpectSuccess({110 mode: { type: 'NFT' },111 });112 const alice = privateKey('//Alice');113114 const caller = await createEthAccountWithBalance(api, web3);115 const changeAdminTx = api.tx.nft.addCollectionAdmin(collection, { ethereum: caller });116 await submitTransactionAsync(alice, changeAdminTx);117 const receiver = createEthAccount(web3);118119 const address = collectionIdToAddress(collection);120 const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS});121122 {123 const nextTokenId = await contract.methods.nextTokenId().call();124 expect(nextTokenId).to.be.equal('1');125 const result = await contract.methods.mintBulkWithTokenURI(126 receiver,127 [128 [nextTokenId, 'Test URI 0'],129 [+nextTokenId + 1, 'Test URI 1'],130 [+nextTokenId + 2, 'Test URI 2'],131 ],132 ).send({ from: caller });133 const events = normalizeEvents(result.events);134135 expect(events).to.be.deep.equal([136 {137 address,138 event: 'Transfer',139 args: {140 from: '0x0000000000000000000000000000000000000000',141 to: receiver,142 tokenId: nextTokenId,143 },144 },145 {146 address,147 event: 'Transfer',148 args: {149 from: '0x0000000000000000000000000000000000000000',150 to: receiver,151 tokenId: String(+nextTokenId + 1),152 },153 },154 {155 address,156 event: 'Transfer',157 args: {158 from: '0x0000000000000000000000000000000000000000',159 to: receiver,160 tokenId: String(+nextTokenId + 2),161 },162 },163 ]);164165 await waitNewBlocks(api, 1);166 expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI 0');167 expect(await contract.methods.tokenURI(+nextTokenId + 1).call()).to.be.equal('Test URI 1');168 expect(await contract.methods.tokenURI(+nextTokenId + 2).call()).to.be.equal('Test URI 2');169 }170 });109171110 itWeb3('Can perform burn()', async ({ web3, api }) => {172 itWeb3('Can perform burn()', async ({ web3, api }) => {111 const collection = await createCollectionExpectSuccess({173 const collection = await createCollectionExpectSuccess({265 }327 }266 });328 });329330 itWeb3('Can perform getVariableMetadata', async ({ web3, api }) => {331 const collection = await createCollectionExpectSuccess({332 mode: { type: 'NFT' },333 });334 const alice = privateKey('//Alice');335336 const owner = await createEthAccountWithBalance(api, web3);337338 const item = await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: owner });339 await setMetadataUpdatePermissionFlagExpectSuccess(alice, collection, 'Admin');340 await setVariableMetaDataExpectSuccess(alice, collection, item, [1, 2, 3]);341342 const address = collectionIdToAddress(collection);343 const contract = new web3.eth.Contract(nonFungibleAbi as any, address, { from: owner, ...GAS_ARGS });344 345 expect(await contract.methods.getVariableMetadata(item).call()).to.be.equal('0x010203');346 });347348 itWeb3('Can perform setVariableMetadata', async ({ web3, api }) => {349 const collection = await createCollectionExpectSuccess({350 mode: { type: 'NFT' },351 });352 const alice = privateKey('//Alice');353354 const owner = await createEthAccountWithBalance(api, web3);355356 const item = await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: owner });357358 const address = collectionIdToAddress(collection);359 const contract = new web3.eth.Contract(nonFungibleAbi as any, address, { from: owner, ...GAS_ARGS });360 361 expect(await contract.methods.setVariableMetadata(item, '0x010203').send({ from: owner }));362 await waitNewBlocks(api, 1);363 expect(await contract.methods.getVariableMetadata(item).call()).to.be.equal('0x010203');364 });267});365});268366269describe('NFT: Fees', () => {367describe('NFT: Fees', () => {tests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth50 "type": "event"50 "type": "event"51 },51 },52 {52 {53 "anonymous": true,53 "anonymous": false,54 "inputs": [],54 "inputs": [],55 "name": "MintingFinished",55 "name": "MintingFinished",56 "type": "event"56 "type": "event"162 "stateMutability": "view",162 "stateMutability": "view",163 "type": "function"163 "type": "function"164 },164 },165 {166 "inputs": [167 {168 "internalType": "uint256",169 "name": "tokenId",170 "type": "uint256"171 }172 ],173 "name": "getVariableMetadata",174 "outputs": [175 {176 "internalType": "bytes",177 "name": "",178 "type": "bytes"179 }180 ],181 "stateMutability": "view",182 "type": "function"183 },165 {184 {166 "inputs": [185 "inputs": [167 {186 {210 "stateMutability": "nonpayable",229 "stateMutability": "nonpayable",211 "type": "function"230 "type": "function"212 },231 },232 {233 "inputs": [234 {235 "internalType": "address",236 "name": "to",237 "type": "address"238 },239 {240 "internalType": "uint256[]",241 "name": "tokenIds",242 "type": "uint256[]"243 }244 ],245 "name": "mintBulk",246 "outputs": [247 {248 "internalType": "bool",249 "name": "",250 "type": "bool"251 }252 ],253 "stateMutability": "nonpayable",254 "type": "function"255 },256 {257 "inputs": [258 {259 "internalType": "address",260 "name": "to",261 "type": "address"262 },263 {264 "components": [265 {266 "internalType": "uint256",267 "name": "field_0",268 "type": "uint256"269 },270 {271 "internalType": "string",272 "name": "field_1",273 "type": "string"274 }275 ],276 "internalType": "struct Tuple0[]",277 "name": "tokens",278 "type": "tuple[]"279 }280 ],281 "name": "mintBulkWithTokenURI",282 "outputs": [283 {284 "internalType": "bool",285 "name": "",286 "type": "bool"287 }288 ],289 "stateMutability": "nonpayable",290 "type": "function"291 },213 {292 {214 "inputs": [293 "inputs": [215 {294 {224 },303 },225 {304 {226 "internalType": "string",305 "internalType": "string",227 "name": "tokenURI",306 "name": "tokenUri",228 "type": "string"307 "type": "string"229 }308 }230 ],309 ],366 "stateMutability": "nonpayable",445 "stateMutability": "nonpayable",367 "type": "function"446 "type": "function"368 },447 },448 {449 "inputs": [450 {451 "internalType": "uint256",452 "name": "tokenId",453 "type": "uint256"454 },455 {456 "internalType": "bytes",457 "name": "data",458 "type": "bytes"459 }460 ],461 "name": "setVariableMetadata",462 "outputs": [],463 "stateMutability": "nonpayable",464 "type": "function"465 },369 {466 {370 "inputs": [467 "inputs": [371 {468 {tests/src/eth/proxy/UniqueNFTProxy.abidiffbeforeafterboth1[{"inputs":[{"internalType":"address","name":"_proxied","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[],"name":"MintingFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"approved","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"finishMinting","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"mint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"tokenUri","type":"string"}],"name":"mintWithTokenURI","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintingFinished","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFromWithData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"interfaceId","type":"uint32"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"}]1[{"inputs":[{"internalType":"address","name":"_proxied","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[],"name":"MintingFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"approved","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"finishMinting","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getVariableMetadata","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"mint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"mintBulk","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"components":[{"internalType":"uint256","name":"field_0","type":"uint256"},{"internalType":"string","name":"field_1","type":"string"}],"internalType":"struct Tuple0[]","name":"tokens","type":"tuple[]"}],"name":"mintBulkWithTokenURI","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"tokenUri","type":"string"}],"name":"mintWithTokenURI","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintingFinished","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFromWithData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"setVariableMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"interfaceId","type":"uint32"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"}]tests/src/eth/proxy/UniqueNFTProxy.bindiffbeforeafterboth1608060405234801561001057600080fd5b506040516111e03803806111e083398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b61114d806100936000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c806350bb4e7f116100c357806395d89b411161007c57806395d89b41146102a8578063a22cb465146102b0578063a9059cbb146102c3578063c87b56dd146102d6578063e985e9c5146102e9578063f4f4b500146102fc57600080fd5b806350bb4e7f1461024c57806360a116721461025f5780636352211e1461027257806370a082311461028557806375794a3c146102985780637d64bcb4146102a057600080fd5b806323b872dd1161011557806323b872dd146101da5780632f745c59146101ed57806340c10f191461020057806342842e0e1461021357806342966c68146102265780634f6ccce71461023957600080fd5b806305d2035b1461015257806306fdde031461016f578063081812fc14610184578063095ea7b3146101af57806318160ddd146101c4575b600080fd5b61015a61030f565b60405190151581526020015b60405180910390f35b61017761039b565b6040516101669190611043565b610197610192366004610f5b565b61041b565b6040516001600160a01b039091168152602001610166565b6101c26101bd366004610e2e565b61049f565b005b6101cc61050a565b604051908152602001610166565b6101c26101e8366004610d3f565b610591565b6101cc6101fb366004610e2e565b610605565b61015a61020e366004610e2e565b610691565b6101c2610221366004610d3f565b610718565b6101c2610234366004610f5b565b610759565b6101cc610247366004610f5b565b6107ba565b61015a61025a366004610e5a565b610838565b6101c261026d366004610d80565b6108c7565b610197610280366004610f5b565b610936565b6101cc610293366004610ccc565b610968565b6101cc61099b565b61015a6109ea565b610177610a4f565b6101c26102be366004610e00565b610a93565b6101c26102d1366004610e2e565b610acd565b6101776102e4366004610f5b565b610b06565b6101976102f7366004610d06565b610b87565b61015a61030a366004610f8d565b610c0d565b60008060009054906101000a90046001600160a01b03166001600160a01b03166305d2035b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561035e57600080fd5b505afa158015610372573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103969190610ec7565b905090565b60008054604080516306fdde0360e01b815290516060936001600160a01b03909316926306fdde039260048082019391829003018186803b1580156103df57600080fd5b505afa1580156103f3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103969190810190610ee4565b6000805460405163020604bf60e21b8152600481018490526001600160a01b039091169063081812fc906024015b60206040518083038186803b15801561046157600080fd5b505afa158015610475573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104999190610ce9565b92915050565b60005460405163095ea7b360e01b81526001600160a01b038481166004830152602482018490529091169063095ea7b3906044015b600060405180830381600087803b1580156104ee57600080fd5b505af1158015610502573d6000803e3d6000fd5b505050505050565b60008060009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561055957600080fd5b505afa15801561056d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103969190610f74565b6000546040516323b872dd60e01b81526001600160a01b038581166004830152848116602483015260448201849052909116906323b872dd906064015b600060405180830381600087803b1580156105e857600080fd5b505af11580156105fc573d6000803e3d6000fd5b50505050505050565b60008054604051632f745c5960e01b81526001600160a01b0385811660048301526024820185905290911690632f745c599060440160206040518083038186803b15801561065257600080fd5b505afa158015610666573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068a9190610f74565b9392505050565b600080546040516340c10f1960e01b81526001600160a01b03858116600483015260248201859052909116906340c10f1990604401602060405180830381600087803b1580156106e057600080fd5b505af11580156106f4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068a9190610ec7565b600054604051632142170760e11b81526001600160a01b038581166004830152848116602483015260448201849052909116906342842e0e906064016105ce565b600054604051630852cd8d60e31b8152600481018390526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561079f57600080fd5b505af11580156107b3573d6000803e3d6000fd5b5050505050565b60008054604051634f6ccce760e01b8152600481018490526001600160a01b0390911690634f6ccce7906024015b60206040518083038186803b15801561080057600080fd5b505afa158015610814573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104999190610f74565b600080546040516350bb4e7f60e01b81526001600160a01b03909116906350bb4e7f9061086d9087908790879060040161101c565b602060405180830381600087803b15801561088757600080fd5b505af115801561089b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108bf9190610ec7565b949350505050565b6000546040516330508b3960e11b81526001600160a01b03909116906360a11672906108fd908790879087908790600401610fdf565b600060405180830381600087803b15801561091757600080fd5b505af115801561092b573d6000803e3d6000fd5b505050505b50505050565b600080546040516331a9108f60e11b8152600481018490526001600160a01b0390911690636352211e90602401610449565b600080546040516370a0823160e01b81526001600160a01b038481166004830152909116906370a08231906024016107e8565b60008060009054906101000a90046001600160a01b03166001600160a01b03166375794a3c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561055957600080fd5b60008060009054906101000a90046001600160a01b03166001600160a01b0316637d64bcb46040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610a3b57600080fd5b505af1158015610372573d6000803e3d6000fd5b60008054604080516395d89b4160e01b815290516060936001600160a01b03909316926395d89b419260048082019391829003018186803b1580156103df57600080fd5b60005460405163a22cb46560e01b81526001600160a01b03848116600483015283151560248301529091169063a22cb465906044016104d4565b60005460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb906044016104d4565b60005460405163c87b56dd60e01b8152600481018390526060916001600160a01b03169063c87b56dd9060240160006040518083038186803b158015610b4b57600080fd5b505afa158015610b5f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104999190810190610ee4565b6000805460405163e985e9c560e01b81526001600160a01b03858116600483015284811660248301529091169063e985e9c59060440160206040518083038186803b158015610bd557600080fd5b505afa158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068a9190610ce9565b6000805460405162f4f4b560e81b815263ffffffff841660048201526001600160a01b039091169063f4f4b5009060240160206040518083038186803b158015610c5657600080fd5b505afa158015610c6a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104999190610ec7565b6000610ca1610c9c84611087565b611056565b9050828152838383011115610cb557600080fd5b828260208301376000602084830101529392505050565b600060208284031215610cde57600080fd5b813561068a816110f1565b600060208284031215610cfb57600080fd5b815161068a816110f1565b60008060408385031215610d1957600080fd5b8235610d24816110f1565b91506020830135610d34816110f1565b809150509250929050565b600080600060608486031215610d5457600080fd5b8335610d5f816110f1565b92506020840135610d6f816110f1565b929592945050506040919091013590565b60008060008060808587031215610d9657600080fd5b8435610da1816110f1565b93506020850135610db1816110f1565b925060408501359150606085013567ffffffffffffffff811115610dd457600080fd5b8501601f81018713610de557600080fd5b610df487823560208401610c8e565b91505092959194509250565b60008060408385031215610e1357600080fd5b8235610e1e816110f1565b91506020830135610d3481611109565b60008060408385031215610e4157600080fd5b8235610e4c816110f1565b946020939093013593505050565b600080600060608486031215610e6f57600080fd5b8335610e7a816110f1565b925060208401359150604084013567ffffffffffffffff811115610e9d57600080fd5b8401601f81018613610eae57600080fd5b610ebd86823560208401610c8e565b9150509250925092565b600060208284031215610ed957600080fd5b815161068a81611109565b600060208284031215610ef657600080fd5b815167ffffffffffffffff811115610f0d57600080fd5b8201601f81018413610f1e57600080fd5b8051610f2c610c9c82611087565b818152856020838501011115610f4157600080fd5b610f528260208301602086016110af565b95945050505050565b600060208284031215610f6d57600080fd5b5035919050565b600060208284031215610f8657600080fd5b5051919050565b600060208284031215610f9f57600080fd5b813563ffffffff8116811461068a57600080fd5b60008151808452610fcb8160208601602086016110af565b601f01601f19169290920160200192915050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061101290830184610fb3565b9695505050505050565b60018060a01b0384168152826020820152606060408201526000610f526060830184610fb3565b60208152600061068a6020830184610fb3565b604051601f8201601f1916810167ffffffffffffffff8111828210171561107f5761107f6110db565b604052919050565b600067ffffffffffffffff8211156110a1576110a16110db565b50601f01601f191660200190565b60005b838110156110ca5781810151838201526020016110b2565b838111156109305750506000910152565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461110657600080fd5b50565b801515811461110657600080fdfea2646970667358221220cd50bb20b48b73eddb390585af8699a01cd5f49b79ab50aa532df41df639f36764736f6c634300080700331608060405234801561001057600080fd5b5060405161168d38038061168d83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b6115fa806100936000396000f3fe608060405234801561001057600080fd5b50600436106101a95760003560e01c806350bb4e7f116100f9578063a22cb46511610097578063d4eac26d11610071578063d4eac26d1461036b578063e6c5ce6f1461037e578063e985e9c514610391578063f4f4b500146103a457600080fd5b8063a22cb46514610332578063a9059cbb14610345578063c87b56dd1461035857600080fd5b806370a08231116100d357806370a082311461030757806375794a3c1461031a5780637d64bcb41461032257806395d89b411461032a57600080fd5b806350bb4e7f146102ce57806360a11672146102e15780636352211e146102f457600080fd5b80632f745c591161016657806342842e0e1161014057806342842e0e1461028257806342966c681461029557806344a9945e146102a85780634f6ccce7146102bb57600080fd5b80632f745c5914610249578063365430061461025c57806340c10f191461026f57600080fd5b806305d2035b146101ae57806306fdde03146101cb578063081812fc146101e0578063095ea7b31461020b57806318160ddd1461022057806323b872dd14610236575b600080fd5b6101b66103b7565b60405190151581526020015b60405180910390f35b6101d3610443565b6040516101c2919061148a565b6101f36101ee366004611277565b6104c3565b6040516001600160a01b0390911681526020016101c2565b61021e61021936600461118c565b610547565b005b6102286105b2565b6040519081526020016101c2565b61021e610244366004610eff565b610639565b61022861025736600461118c565b6106ad565b6101b661026a366004610fac565b610739565b6101b661027d36600461118c565b6107be565b61021e610290366004610eff565b6107f8565b61021e6102a3366004611277565b610839565b6101b66102b63660046110b1565b61089a565b6102286102c9366004611277565b6108cd565b6101b66102dc3660046111b8565b61094b565b61021e6102ef366004610f40565b6109da565b6101f3610302366004611277565b610a49565b610228610315366004610e8c565b610a7b565b610228610aae565b6101b6610afd565b6101d3610b62565b61021e61034036600461115e565b610ba6565b61021e61035336600461118c565b610be0565b6101d3610366366004611277565b610c19565b61021e6103793660046112a9565b610c9b565b6101d361038c366004611277565b610ccd565b6101f361039f366004610ec6565b610cff565b6101b66103b23660046112f0565b610d85565b60008060009054906101000a90046001600160a01b03166001600160a01b03166305d2035b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561040657600080fd5b505afa15801561041a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061043e9190611211565b905090565b60008054604080516306fdde0360e01b815290516060936001600160a01b03909316926306fdde039260048082019391829003018186803b15801561048757600080fd5b505afa15801561049b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261043e919081019061122e565b6000805460405163020604bf60e21b8152600481018490526001600160a01b039091169063081812fc906024015b60206040518083038186803b15801561050957600080fd5b505afa15801561051d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105419190610ea9565b92915050565b60005460405163095ea7b360e01b81526001600160a01b038481166004830152602482018490529091169063095ea7b3906044015b600060405180830381600087803b15801561059657600080fd5b505af11580156105aa573d6000803e3d6000fd5b505050505050565b60008060009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561060157600080fd5b505afa158015610615573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061043e9190611290565b6000546040516323b872dd60e01b81526001600160a01b038581166004830152848116602483015260448201849052909116906323b872dd906064015b600060405180830381600087803b15801561069057600080fd5b505af11580156106a4573d6000803e3d6000fd5b50505050505050565b60008054604051632f745c5960e01b81526001600160a01b0385811660048301526024820185905290911690632f745c599060440160206040518083038186803b1580156106fa57600080fd5b505afa15801561070e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107329190611290565b9392505050565b60008054604051631b2a180360e11b81526001600160a01b039091169063365430069061076c908690869060040161137f565b602060405180830381600087803b15801561078657600080fd5b505af115801561079a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107329190611211565b600080546040516340c10f1960e01b81526001600160a01b03858116600483015260248201859052909116906340c10f199060440161076c565b600054604051632142170760e11b81526001600160a01b038581166004830152848116602483015260448201849052909116906342842e0e90606401610676565b600054604051630852cd8d60e31b8152600481018390526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561087f57600080fd5b505af1158015610893573d6000803e3d6000fd5b5050505050565b60008054604051632254ca2f60e11b81526001600160a01b03909116906344a9945e9061076c9086908690600401611404565b60008054604051634f6ccce760e01b8152600481018490526001600160a01b0390911690634f6ccce7906024015b60206040518083038186803b15801561091357600080fd5b505afa158015610927573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105419190611290565b600080546040516350bb4e7f60e01b81526001600160a01b03909116906350bb4e7f906109809087908790879060040161145a565b602060405180830381600087803b15801561099a57600080fd5b505af11580156109ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d29190611211565b949350505050565b6000546040516330508b3960e11b81526001600160a01b03909116906360a1167290610a10908790879087908790600401611342565b600060405180830381600087803b158015610a2a57600080fd5b505af1158015610a3e573d6000803e3d6000fd5b505050505b50505050565b600080546040516331a9108f60e11b8152600481018490526001600160a01b0390911690636352211e906024016104f1565b600080546040516370a0823160e01b81526001600160a01b038481166004830152909116906370a08231906024016108fb565b60008060009054906101000a90046001600160a01b03166001600160a01b03166375794a3c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561060157600080fd5b60008060009054906101000a90046001600160a01b03166001600160a01b0316637d64bcb46040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610b4e57600080fd5b505af115801561041a573d6000803e3d6000fd5b60008054604080516395d89b4160e01b815290516060936001600160a01b03909316926395d89b419260048082019391829003018186803b15801561048757600080fd5b60005460405163a22cb46560e01b81526001600160a01b03848116600483015283151560248301529091169063a22cb4659060440161057c565b60005460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb9060440161057c565b60005460405163c87b56dd60e01b8152600481018390526060916001600160a01b03169063c87b56dd906024015b60006040518083038186803b158015610c5f57600080fd5b505afa158015610c73573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610541919081019061122e565b60005460405163d4eac26d60e01b81526001600160a01b039091169063d4eac26d9061057c908590859060040161149d565b60005460405163e6c5ce6f60e01b8152600481018390526060916001600160a01b03169063e6c5ce6f90602401610c47565b6000805460405163e985e9c560e01b81526001600160a01b03858116600483015284811660248301529091169063e985e9c59060440160206040518083038186803b158015610d4d57600080fd5b505afa158015610d61573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107329190610ea9565b6000805460405162f4f4b560e81b815263ffffffff841660048201526001600160a01b039091169063f4f4b5009060240160206040518083038186803b158015610dce57600080fd5b505afa158015610de2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105419190611211565b6000610e19610e1484611534565b6114df565b9050828152838383011115610e2d57600080fd5b61073283602083018461155c565b600082601f830112610e4c57600080fd5b8135610e5a610e1482611534565b818152846020838601011115610e6f57600080fd5b816020850160208301376000918101602001919091529392505050565b600060208284031215610e9e57600080fd5b81356107328161159e565b600060208284031215610ebb57600080fd5b81516107328161159e565b60008060408385031215610ed957600080fd5b8235610ee48161159e565b91506020830135610ef48161159e565b809150509250929050565b600080600060608486031215610f1457600080fd5b8335610f1f8161159e565b92506020840135610f2f8161159e565b929592945050506040919091013590565b60008060008060808587031215610f5657600080fd5b8435610f618161159e565b93506020850135610f718161159e565b925060408501359150606085013567ffffffffffffffff811115610f9457600080fd5b610fa087828801610e3b565b91505092959194509250565b60008060408385031215610fbf57600080fd5b8235610fca8161159e565b915060208381013567ffffffffffffffff80821115610fe857600080fd5b818601915086601f830112610ffc57600080fd5b813561100a610e1482611510565b8082825285820191508585018a878560051b880101111561102a57600080fd5b60005b848110156110a05781358681111561104457600080fd5b87016040818e03601f1901121561105a57600080fd5b6110626114b6565b89820135815260408201358881111561107a57600080fd5b6110888f8c83860101610e3b565b828c015250855250928701929087019060010161102d565b50979a909950975050505050505050565b600080604083850312156110c457600080fd5b82356110cf8161159e565b915060208381013567ffffffffffffffff8111156110ec57600080fd5b8401601f810186136110fd57600080fd5b803561110b610e1482611510565b80828252848201915084840189868560051b870101111561112b57600080fd5b600094505b8385101561114e578035835260019490940193918501918501611130565b5080955050505050509250929050565b6000806040838503121561117157600080fd5b823561117c8161159e565b91506020830135610ef4816115b6565b6000806040838503121561119f57600080fd5b82356111aa8161159e565b946020939093013593505050565b6000806000606084860312156111cd57600080fd5b83356111d88161159e565b925060208401359150604084013567ffffffffffffffff8111156111fb57600080fd5b61120786828701610e3b565b9150509250925092565b60006020828403121561122357600080fd5b8151610732816115b6565b60006020828403121561124057600080fd5b815167ffffffffffffffff81111561125757600080fd5b8201601f8101841361126857600080fd5b6109d284825160208401610e06565b60006020828403121561128957600080fd5b5035919050565b6000602082840312156112a257600080fd5b5051919050565b600080604083850312156112bc57600080fd5b82359150602083013567ffffffffffffffff8111156112da57600080fd5b6112e685828601610e3b565b9150509250929050565b60006020828403121561130257600080fd5b813563ffffffff8116811461073257600080fd5b6000815180845261132e81602086016020860161155c565b601f01601f19169290920160200192915050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061137590830184611316565b9695505050505050565b6001600160a01b0383168152604060208083018290528351828401819052600092916060600583901b860181019290860190878301865b828110156113f557888603605f190184528151805187528501518587018890526113e288880182611316565b96505092840192908401906001016113b6565b50939998505050505050505050565b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b8181101561144d57845183529383019391830191600101611431565b5090979650505050505050565b60018060a01b03841681528260208201526060604082015260006114816060830184611316565b95945050505050565b6020815260006107326020830184611316565b8281526040602082015260006109d26040830184611316565b6040805190810167ffffffffffffffff811182821017156114d9576114d9611588565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561150857611508611588565b604052919050565b600067ffffffffffffffff82111561152a5761152a611588565b5060051b60200190565b600067ffffffffffffffff82111561154e5761154e611588565b50601f01601f191660200190565b60005b8381101561157757818101518382015260200161155f565b83811115610a435750506000910152565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146115b357600080fd5b50565b80151581146115b357600080fdfea2646970667358221220669a75a3efcdc6b60606caa5c7e41cab1d727e89a03fd231d1cda27f4de159a064736f6c63430008070033tests/src/eth/proxy/UniqueNFTProxy.soldiffbeforeafterboth157 return proxied.supportsInterface(interfaceId);157 return proxied.supportsInterface(interfaceId);158 }158 }159160 function setVariableMetadata(uint256 tokenId, bytes memory data)161 external162 override163 {164 return proxied.setVariableMetadata(tokenId, data);165 }166167 function getVariableMetadata(uint256 tokenId)168 external169 view170 override171 returns (bytes memory)172 {173 return proxied.getVariableMetadata(tokenId);174 }175176 function mintBulk(address to, uint256[] memory tokenIds)177 external178 override179 returns (bool)180 {181 return proxied.mintBulk(to, tokenIds);182 }183184 function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)185 external186 override187 returns (bool)188 {189 return proxied.mintBulkWithTokenURI(to, tokens);190 }159}191}160192tests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth4//4//556import privateKey from '../../substrate/privateKey';6import privateKey from '../../substrate/privateKey';7import { createCollectionExpectSuccess, createItemExpectSuccess } from '../../util/helpers';7import { createCollectionExpectSuccess, createItemExpectSuccess, setVariableMetaDataExpectSuccess, setMetadataUpdatePermissionFlagExpectSuccess } from '../../util/helpers';8import { collectionIdToAddress, createEthAccount, createEthAccountWithBalance, GAS_ARGS, itWeb3, normalizeEvents } from '../util/helpers';8import { collectionIdToAddress, createEthAccount, createEthAccountWithBalance, GAS_ARGS, itWeb3, normalizeEvents } from '../util/helpers';9import nonFungibleAbi from '../nonFungibleAbi.json';9import nonFungibleAbi from '../nonFungibleAbi.json';10import { expect } from 'chai';10import { expect } from 'chai';96 {96 {97 const nextTokenId = await contract.methods.nextTokenId().call();97 const nextTokenId = await contract.methods.nextTokenId().call();98 expect(nextTokenId).to.be.equal('1');98 expect(nextTokenId).to.be.equal('1');99 console.log('Before mint');100 const result = await contract.methods.mintWithTokenURI(99 const result = await contract.methods.mintWithTokenURI(101 receiver,100 receiver,102 nextTokenId,101 nextTokenId,103 'Test URI',102 'Test URI',104 ).send({ from: caller });103 ).send({ from: caller });105 console.log('After mint');106 const events = normalizeEvents(result.events);104 const events = normalizeEvents(result.events);107105108 expect(events).to.be.deep.equal([106 expect(events).to.be.deep.equal([121 expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');119 expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');122 }120 }123 });121 });122 itWeb3('Can perform mintBulk()', async ({ web3, api }) => {123 const collection = await createCollectionExpectSuccess({124 mode: { type: 'NFT' },125 });126 const alice = privateKey('//Alice');127128 const caller = await createEthAccountWithBalance(api, web3);129 const receiver = createEthAccount(web3);130131 const address = collectionIdToAddress(collection);132 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, { from: caller, ...GAS_ARGS }));133 const changeAdminTx = api.tx.nft.addCollectionAdmin(collection, { ethereum: contract.options.address });134 await submitTransactionAsync(alice, changeAdminTx);135136 {137 const nextTokenId = await contract.methods.nextTokenId().call();138 expect(nextTokenId).to.be.equal('1');139 const result = await contract.methods.mintBulkWithTokenURI(140 receiver,141 [142 [nextTokenId, 'Test URI 0'],143 [+nextTokenId + 1, 'Test URI 1'],144 [+nextTokenId + 2, 'Test URI 2'],145 ],146 ).send({ from: caller });147 const events = normalizeEvents(result.events);148149 expect(events).to.be.deep.equal([150 {151 address,152 event: 'Transfer',153 args: {154 from: '0x0000000000000000000000000000000000000000',155 to: receiver,156 tokenId: nextTokenId,157 },158 },159 {160 address,161 event: 'Transfer',162 args: {163 from: '0x0000000000000000000000000000000000000000',164 to: receiver,165 tokenId: String(+nextTokenId + 1),166 },167 },168 {169 address,170 event: 'Transfer',171 args: {172 from: '0x0000000000000000000000000000000000000000',173 to: receiver,174 tokenId: String(+nextTokenId + 2),175 },176 },177 ]);178179 await waitNewBlocks(api, 1);180 expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI 0');181 expect(await contract.methods.tokenURI(+nextTokenId + 1).call()).to.be.equal('Test URI 1');182 expect(await contract.methods.tokenURI(+nextTokenId + 2).call()).to.be.equal('Test URI 2');183 }184 });124185125 itWeb3('Can perform burn()', async ({ web3, api }) => {186 itWeb3('Can perform burn()', async ({ web3, api }) => {126 const collection = await createCollectionExpectSuccess({187 const collection = await createCollectionExpectSuccess({268 }329 }269 });330 });331332 itWeb3('Can perform getVariableMetadata', async ({ web3, api }) => {333 const collection = await createCollectionExpectSuccess({334 mode: { type: 'NFT' },335 });336 const alice = privateKey('//Alice');337 const caller = await createEthAccountWithBalance(api, web3);338339 const address = collectionIdToAddress(collection);340 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, { from: caller, ...GAS_ARGS }));341 const item = await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: contract.options.address });342 await setMetadataUpdatePermissionFlagExpectSuccess(alice, collection, 'Admin');343 await setVariableMetaDataExpectSuccess(alice, collection, item, [1, 2, 3]);344 345 expect(await contract.methods.getVariableMetadata(item).call()).to.be.equal('0x010203');346 });347348 itWeb3('Can perform setVariableMetadata', async ({ web3, api }) => {349 const collection = await createCollectionExpectSuccess({350 mode: { type: 'NFT' },351 });352 const alice = privateKey('//Alice');353 const caller = await createEthAccountWithBalance(api, web3);354355 const address = collectionIdToAddress(collection);356 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, { from: caller, ...GAS_ARGS }));357 const item = await createItemExpectSuccess(alice, collection, 'NFT', { ethereum: contract.options.address });358 359 expect(await contract.methods.setVariableMetadata(item, '0x010203').send({ from: caller }));360 await waitNewBlocks(api, 1);361 expect(await contract.methods.getVariableMetadata(item).call()).to.be.equal('0x010203');362 });270});363});271364tests/src/eth/util/helpers.tsdiffbeforeafterbothno syntactic changes
tests/src/metadataUpdate.test.tsdiffbeforeafterbothno changes
tests/src/pallet-presence.test.tsdiffbeforeafterboth25 'evm',25 'evm',26 'evmcodersubstrate',26 'evmcodersubstrate',27 'evmcontracthelpers',27 'evmcontracthelpers',28 'evmmigration',28 'evmtransactionpayment',29 'evmtransactionpayment',29 'ethereum',30 'ethereum',30 'xcmpqueue',31 'xcmpqueue',tests/src/scheduler.test.tsdiffbeforeafterboth28 await setCollectionSponsorExpectSuccess(nftCollectionId, Alice.address);28 await setCollectionSponsorExpectSuccess(nftCollectionId, Alice.address);29 await confirmSponsorshipExpectSuccess(nftCollectionId);29 await confirmSponsorshipExpectSuccess(nftCollectionId);303031 await scheduleTransferExpectSuccess(nftCollectionId, newNftTokenId, Alice, Bob, 1, 6000, 4);31 await scheduleTransferExpectSuccess(nftCollectionId, newNftTokenId, Alice, Bob, 1, 12000, 4);32 });32 });33 });33 });34});34});tests/src/setChainLimits.test.tsdiffbeforeafterboth13 IChainLimits,13 IChainLimits,14} from './util/helpers';14} from './util/helpers';151516describe('Negative Integration Test setChainLimits', () => {16describe.skip('Negative Integration Test setChainLimits', () => {17 let alice: IKeyringPair;17 let alice: IKeyringPair;18 let bob: IKeyringPair;18 let bob: IKeyringPair;19 let dave: IKeyringPair;19 let dave: IKeyringPair;tests/src/setVariableMetaData.test.tsdiffbeforeafterboth17 setVariableMetaDataExpectFailure,17 setVariableMetaDataExpectFailure,18 setVariableMetaDataExpectSuccess,18 setVariableMetaDataExpectSuccess,19 addCollectionAdminExpectSuccess,19 addCollectionAdminExpectSuccess,20 setMetadataUpdatePermissionFlagExpectSuccess,20} from './util/helpers';21} from './util/helpers';212222chai.use(chaiAsPromised);23chai.use(chaiAsPromised);62 bob = privateKey('//Bob');63 bob = privateKey('//Bob');63 collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });64 collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });64 tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');65 tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');66 await setMetadataUpdatePermissionFlagExpectSuccess(alice, collectionId, 'Admin');65 await addCollectionAdminExpectSuccess(alice, collectionId, bob);67 await addCollectionAdminExpectSuccess(alice, collectionId, bob);66 });68 });67 });69 });tests/src/transfer.test.tsdiffbeforeafterboth60 // tslint:disable-next-line:no-unused-expression60 // tslint:disable-next-line:no-unused-expression61 expect(result.success).to.be.false;61 expect(result.success).to.be.false;62 };62 };63 expect(badTransaction()).to.be.rejectedWith('Inability to pay some fees , e.g. account balance too low');63 await expect(badTransaction()).to.be.rejectedWith('Inability to pay some fees , e.g. account balance too low');64 });64 });65 });65 });6666tests/src/util/helpers.tsdiffbeforeafterboth224 return result;224 return result;225}225}226227interface Invalid {228 type: 'Invalid';229}230226231interface Nft {227interface Nft {232 type: 'NFT';228 type: 'NFT';241 type: 'ReFungible';237 type: 'ReFungible';242}238}243239244type CollectionMode = Nft | Fungible | ReFungible | Invalid;240type CollectionMode = Nft | Fungible | ReFungible;245241246export type CreateCollectionParams = {242export type CreateCollectionParams = {247 mode: CollectionMode,243 mode: CollectionMode,275 modeprm = { fungible: mode.decimalPoints };271 modeprm = { fungible: mode.decimalPoints };276 } else if (mode.type === 'ReFungible') {272 } else if (mode.type === 'ReFungible') {277 modeprm = { refungible: null };273 modeprm = { refungible: null };278 } else if (mode.type === 'Invalid') {274 }279 modeprm = { invalid: null };280 }281275282 const tx = api.tx.nft.createCollection(strToUTF16(name), strToUTF16(description), strToUTF16(tokenPrefix), modeprm);276 const tx = api.tx.nft.createCollection(strToUTF16(name), strToUTF16(description), strToUTF16(tokenPrefix), modeprm);283 const events = await submitTransactionAsync(alicePrivateKey, tx);277 const events = await submitTransactionAsync(alicePrivateKey, tx);317 modeprm = { fungible: mode.decimalPoints };311 modeprm = { fungible: mode.decimalPoints };318 } else if (mode.type === 'ReFungible') {312 } else if (mode.type === 'ReFungible') {319 modeprm = { refungible: null };313 modeprm = { refungible: null };320 } else if (mode.type === 'Invalid') {314 }321 modeprm = { invalid: null };322 }323315324 await usingApi(async (api) => {316 await usingApi(async (api) => {325 // Get number of collections before the transaction317 // Get number of collections before the transaction525 });517 });526}518}519520export async function setMetadataUpdatePermissionFlagExpectSuccess(sender: IKeyringPair, collectionId: number, flag: string) {521522 await usingApi(async (api) => {523 const tx = api.tx.nft.setMetaUpdatePermissionFlag(collectionId, flag);524 const events = await submitTransactionAsync(sender, tx);525 const result = getGenericResult(events);526527 expect(result.success).to.be.true;528 });529}530531export async function setMetadataUpdatePermissionFlagExpectFailure(sender: IKeyringPair, collectionId: number, flag: string) {532533 await usingApi(async (api) => {534 const tx = api.tx.nft.setMetaUpdatePermissionFlag(collectionId, flag);535 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;536 const result = getGenericResult(events);537538 expect(result.success).to.be.false;539 });540}527541528export async function enableContractSponsoringExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, enable: boolean) {542export async function enableContractSponsoringExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, enable: boolean) {529 await usingApi(async (api) => {543 await usingApi(async (api) => {1173 return normalizeAccountId((await api.query.nft.nftItemList(collectionId, tokenId) as any).toJSON().Owner);1187 return normalizeAccountId((await api.query.nft.nftItemList(collectionId, tokenId) as any).toJSON().Owner);1174}1188}11891190export async function waitNewBlocks(blocksCount = 1): Promise<void> {1191 await usingApi(async (api) => {1192 const promise = new Promise<void>(async (resolve) => {11931194 const unsubscribe = await api.rpc.chain.subscribeNewHeads(() => {1195 if (blocksCount > 0) {1196 blocksCount--;1197 } else {1198 unsubscribe();1199 resolve();1200 }1201 });1202 });1203 return promise;1204 });1205}1206