difftreelog
feat Add custum signature with unlimited nesting.
in: master
17 files changed
crates/evm-coder/procedural/src/solidity_interface.rsdiffbeforeafterboth--- a/crates/evm-coder/procedural/src/solidity_interface.rs
+++ b/crates/evm-coder/procedural/src/solidity_interface.rs
@@ -21,7 +21,7 @@
// https://doc.rust-lang.org/reference/procedural-macros.html
use proc_macro2::{TokenStream, Group};
-use quote::{quote, ToTokens};
+use quote::{quote, ToTokens, format_ident};
use inflector::cases;
use std::fmt::Write;
use syn::{
@@ -725,25 +725,20 @@
}
}
- fn expand_selector(&self) -> proc_macro2::TokenStream {
- let custom_signature = self.expand_custom_signature();
- quote! {
- {
- let a = ::evm_coder::sha3_const::Keccak256::new()
- .update(#custom_signature.as_bytes())
- .finalize();
- [a[0], a[1], a[2], a[3]]
- }
- }
- }
-
fn expand_const(&self) -> proc_macro2::TokenStream {
let screaming_name = &self.screaming_name;
+ let screaming_name_signature = format_ident!("{}_SIGNATURE", &self.screaming_name);
let selector_str = &self.selector_str;
- let selector = &self.expand_selector();
+ let custom_signature = self.expand_custom_signature();
quote! {
+ const #screaming_name_signature: ::evm_coder::custom_signature::FunctionSignature = #custom_signature;
#[doc = #selector_str]
- const #screaming_name: ::evm_coder::types::bytes4 = #selector;
+ const #screaming_name: ::evm_coder::types::bytes4 = {
+ let a = ::evm_coder::sha3_const::Keccak256::new()
+ .update_with_size(&Self::#screaming_name_signature.signature, Self::#screaming_name_signature.signature_len)
+ .finalize();
+ [a[0], a[1], a[2], a[3]]
+ };
}
}
@@ -847,9 +842,8 @@
}
fn expand_custom_signature(&self) -> proc_macro2::TokenStream {
- let mut first_comma = true;
let mut custom_signature = TokenStream::new();
- let mut template = self.camel_name.clone() + "(";
+
self.args
.iter()
.filter_map(|a| {
@@ -863,39 +857,18 @@
}
})
.for_each(|ident| {
- if !first_comma {
- custom_signature.extend(quote!(,));
- template.push(',');
- } else {
- first_comma = false;
- };
- template.push_str("{}");
- let ident_str = ident.to_string();
- match ident_str.as_str() {
- "address" | "uint8" | "uint16" | "uint32" | "uint64" | "uint128"
- | "uint256" | "bytes4" | "topic" | "string" | "bytes" | "void" | "caller"
- | "bool" | "" => {
- custom_signature.extend(quote!(#ident_str));
- }
- _ => {
- custom_signature.extend(quote! {
- #ident::SIGNATURE_STRING
- });
- }
- }
+ custom_signature.extend(quote! {
+ (<#ident>::SIGNATURE, <#ident>::SIGNATURE_LEN)
+ });
});
- template.push(')');
- let mut template = quote!(#template);
- template.extend(quote!(,));
- template.extend(custom_signature);
- let custom_signature_group = Group::new(proc_macro2::Delimiter::Parenthesis, template);
- let mut custom_signature = quote! {
- ::evm_coder::const_format::formatcp!
- };
- custom_signature.extend(custom_signature_group.to_token_stream());
+ let func_name = self.camel_name.clone();
+ let func_name = quote!(FunctionName::new(#func_name));
+ custom_signature =
+ quote!({ ::evm_coder::make_signature!(new fn(& #func_name),#custom_signature) });
+
+ // println!("!!!!! {}", custom_signature);
- println!("!!!!! {}", custom_signature);
custom_signature
}
@@ -915,16 +888,23 @@
.map(MethodArg::expand_solidity_argument);
let docs = &self.docs;
let selector_str = &self.selector_str;
- let selector = &self.expand_selector();
+ let screaming_name = &self.screaming_name;
let hide = self.hide;
let custom_signature = self.expand_custom_signature();
+ let custom_signature = quote!(
+ {
+ const cs: FunctionSignature = #custom_signature;
+ cs
+ }
+ );
+ // println!("!!!!! {}", custom_signature);
let is_payable = self.has_value_args;
- quote! {
+ let out = quote! {
SolidityFunction {
docs: &[#(#docs),*],
selector_str: #selector_str,
hide: #hide,
- selector: u32::from_be_bytes(#selector),
+ selector: u32::from_be_bytes(Self::#screaming_name),
custom_signature: #custom_signature,
name: #camel_name,
mutability: #mutability,
@@ -936,7 +916,9 @@
),
result: <UnnamedArgument<#result>>::default(),
}
- }
+ };
+ // println!("@@@ {}", out);
+ out
}
}
crates/evm-coder/src/custom_signature.rsdiffbeforeafterboth--- /dev/null
+++ b/crates/evm-coder/src/custom_signature.rs
@@ -0,0 +1,336 @@
+use core::str::from_utf8;
+
+pub const SIGNATURE_SIZE_LIMIT: usize = 256;
+
+pub trait Name {
+ const SIGNATURE: [u8; SIGNATURE_SIZE_LIMIT];
+ const SIGNATURE_LEN: usize;
+
+ fn name() -> &'static str {
+ from_utf8(&Self::SIGNATURE[..Self::SIGNATURE_LEN]).expect("bad utf-8")
+ }
+}
+
+#[derive(Debug)]
+pub struct FunctionSignature {
+ pub signature: [u8; SIGNATURE_SIZE_LIMIT],
+ pub signature_len: usize,
+}
+
+impl FunctionSignature {
+ pub const fn new(name: &'static FunctionName) -> FunctionSignature {
+ let mut signature = [0_u8; SIGNATURE_SIZE_LIMIT];
+ let name_len = name.signature_len;
+ let name = name.signature;
+ let mut dst_offset = 0;
+ let bracket_open = {
+ let mut b = [0_u8; SIGNATURE_SIZE_LIMIT];
+ b[0] = b"("[0];
+ b
+ };
+ crate::make_signature!(@copy(name, signature, name_len, dst_offset));
+ crate::make_signature!(@copy(bracket_open, signature, 1, dst_offset));
+ FunctionSignature {
+ signature,
+ signature_len: dst_offset,
+ }
+ }
+
+ pub const fn add_param(
+ signature: FunctionSignature,
+ param: ([u8; SIGNATURE_SIZE_LIMIT], usize),
+ ) -> FunctionSignature {
+ let mut dst = signature.signature;
+ let mut dst_offset = signature.signature_len;
+ let (param_name, param_len) = param;
+ let comma = {
+ let mut b = [0_u8; SIGNATURE_SIZE_LIMIT];
+ b[0] = b","[0];
+ b
+ };
+ FunctionSignature {
+ signature: {
+ crate::make_signature!(@copy(param_name, dst, param_len, dst_offset));
+ crate::make_signature!(@copy(comma, dst, 1, dst_offset));
+ dst
+ },
+ signature_len: dst_offset,
+ }
+ }
+
+ pub const fn done(signature: FunctionSignature, owerride: bool) -> FunctionSignature {
+ let mut dst = signature.signature;
+ let mut dst_offset = signature.signature_len - if owerride { 1 } else { 0 };
+ let bracket_close = {
+ let mut b = [0_u8; SIGNATURE_SIZE_LIMIT];
+ b[0] = b")"[0];
+ b
+ };
+ FunctionSignature {
+ signature: {
+ crate::make_signature!(@copy(bracket_close, dst, 1, dst_offset));
+ dst
+ },
+ signature_len: dst_offset,
+ }
+ }
+
+ // fn as_str(&self) -> &'static str {
+ // from_utf8(&self.signature[..self.signature_len]).expect("bad utf-8")
+ // }
+}
+
+#[derive(Debug)]
+pub struct FunctionName {
+ signature: [u8; SIGNATURE_SIZE_LIMIT],
+ signature_len: usize,
+}
+
+impl FunctionName {
+ pub const fn new(name: &'static str) -> FunctionName {
+ let mut signature = [0_u8; SIGNATURE_SIZE_LIMIT];
+ let name = name.as_bytes();
+ let name_len = name.len();
+ let mut dst_offset = 0;
+ crate::make_signature!(@copy(name, signature, name_len, dst_offset));
+ FunctionName {
+ signature,
+ signature_len: name_len,
+ }
+ }
+}
+
+#[macro_export]
+#[allow(missing_docs)]
+macro_rules! make_signature { // May be "define_signature"?
+ (new fn($func:expr)$(,)+) => {
+ {
+ let fs = FunctionSignature::new(& $func);
+ let fs = FunctionSignature::done(fs, false);
+ fs
+ }
+ };
+ (new fn($func:expr), $($tt:tt)*) => {
+ {
+ let fs = FunctionSignature::new(& $func);
+ let fs = make_signature!(@param; fs, $($tt),*);
+ fs
+ }
+ };
+
+ (@param; $func:expr) => {
+ FunctionSignature::done($func, true)
+ };
+ (@param; $func:expr, $param:expr) => {
+ make_signature!(@param; FunctionSignature::add_param($func, $param))
+ };
+ (@param; $func:expr, $param:expr, $($tt:tt),*) => {
+ make_signature!(@param; FunctionSignature::add_param($func, $param), $($tt),*)
+ };
+
+ (new $($tt:tt)*) => {
+ const SIGNATURE: [u8; SIGNATURE_SIZE_LIMIT] = {
+ let mut out = [0u8; SIGNATURE_SIZE_LIMIT];
+ let mut dst_offset = 0;
+ make_signature!(@data(out, dst_offset); $($tt)*);
+ out
+ };
+ const SIGNATURE_LEN: usize = 0 + make_signature!(@size; $($tt)*);
+ };
+
+ // (@bytes)
+
+ (@size;) => {
+ 0
+ };
+ (@size; fixed($expr:expr) $($tt:tt)*) => {
+ $expr.len() + make_signature!(@size; $($tt)*)
+ };
+ (@size; nameof($expr:ty) $($tt:tt)*) => {
+ <$expr>::SIGNATURE_LEN + make_signature!(@size; $($tt)*)
+ };
+
+ (@data($dst:ident, $dst_offset:ident);) => {};
+ (@data($dst:ident, $dst_offset:ident); fixed($expr:expr) $($tt:tt)*) => {
+ {
+ let data = $expr.as_bytes();
+ let data_len = data.len();
+ make_signature!(@copy(data, $dst, data_len, $dst_offset));
+ }
+ make_signature!(@data($dst, $dst_offset); $($tt)*)
+ };
+ (@data($dst:ident, $dst_offset:ident); nameof($expr:ty) $($tt:tt)*) => {
+ {
+ let data = &<$expr>::SIGNATURE;
+ let data_len = <$expr>::SIGNATURE_LEN;
+ make_signature!(@copy(data, $dst, data_len, $dst_offset));
+ }
+ make_signature!(@data($dst, $dst_offset); $($tt)*)
+ };
+
+ (@copy($src:ident, $dst:ident, $src_len:expr, $dst_offset:ident)) => {
+ {
+ let mut src_offset = 0;
+ let src_len: usize = $src_len;
+ while src_offset < src_len {
+ $dst[$dst_offset] = $src[src_offset];
+ $dst_offset += 1;
+ src_offset += 1;
+ }
+ }
+ }
+}
+
+#[cfg(test)]
+mod test {
+ use core::str::from_utf8;
+
+ use frame_support::sp_runtime::app_crypto::sp_core::hexdisplay::AsBytesRef;
+
+ use super::{Name, SIGNATURE_SIZE_LIMIT, FunctionName, FunctionSignature};
+
+ impl Name for u8 {
+ make_signature!(new fixed("uint8"));
+ }
+ impl Name for u32 {
+ make_signature!(new fixed("uint32"));
+ }
+ impl<T: Name> Name for Vec<T> {
+ make_signature!(new nameof(T) fixed("[]"));
+ }
+ impl<A: Name, B: Name> Name for (A, B) {
+ make_signature!(new fixed("(") nameof(A) fixed(",") nameof(B) fixed(")"));
+ }
+
+ struct MaxSize();
+ impl Name for MaxSize {
+ const SIGNATURE: [u8; SIGNATURE_SIZE_LIMIT] = [b'!'; SIGNATURE_SIZE_LIMIT];
+ const SIGNATURE_LEN: usize = SIGNATURE_SIZE_LIMIT;
+ }
+
+ #[test]
+ fn simple() {
+ assert_eq!(u8::name(), "uint8");
+ assert_eq!(u32::name(), "uint32");
+ }
+
+ #[test]
+ fn vector_of_simple() {
+ assert_eq!(<Vec<u8>>::name(), "uint8[]");
+ assert_eq!(<Vec<u32>>::name(), "uint32[]");
+ }
+
+ #[test]
+ fn vector_of_vector() {
+ assert_eq!(<Vec<Vec<u8>>>::name(), "uint8[][]");
+ }
+
+ #[test]
+ fn tuple_of_simple() {
+ assert_eq!(<(u32, u8)>::name(), "(uint32,uint8)");
+ }
+
+ #[test]
+ fn tuple_of_tuple() {
+ assert_eq!(
+ <((u32, u8), (u8, u32))>::name(),
+ "((uint32,uint8),(uint8,uint32))"
+ );
+ }
+
+ #[test]
+ fn vector_of_tuple() {
+ assert_eq!(<Vec<(u32, u8)>>::name(), "(uint32,uint8)[]");
+ }
+
+ #[test]
+ fn tuple_of_vector() {
+ assert_eq!(<(Vec<u32>, u8)>::name(), "(uint32[],uint8)");
+ }
+
+ #[test]
+ fn complex() {
+ assert_eq!(
+ <(Vec<u32>, (u32, Vec<u8>))>::name(),
+ "(uint32[],(uint32,uint8[]))"
+ );
+ }
+
+ #[test]
+ fn max_size() {
+ assert_eq!(<MaxSize>::name(), "!".repeat(SIGNATURE_SIZE_LIMIT));
+ }
+
+ // This test must NOT compile!
+ // #[test]
+ // fn over_max_size() {
+ // assert_eq!(<Vec<MaxSize>>::name(), "!".repeat(SIZE_LIMIT) + "[]");
+ // }
+
+ #[test]
+ fn make_func_without_args() {
+ const SOME_FUNK_NAME: FunctionName = FunctionName::new("some_funk");
+ const SIG: FunctionSignature = make_signature!(
+ new fn(&SOME_FUNK_NAME),
+ );
+ let name = from_utf8(&SIG.signature[..SIG.signature_len]).unwrap();
+ assert_eq!(name, "some_funk()");
+ }
+
+ #[test]
+ fn make_func_with_1_args() {
+ const SOME_FUNK_NAME: FunctionName = FunctionName::new("some_funk");
+ const SIG: FunctionSignature = make_signature!(
+ new fn(&SOME_FUNK_NAME),
+ (u8::SIGNATURE, u8::SIGNATURE_LEN)
+ );
+ let name = from_utf8(&SIG.signature[..SIG.signature_len]).unwrap();
+ assert_eq!(name, "some_funk(uint8)");
+ }
+
+ #[test]
+ fn make_func_with_2_args() {
+ const SOME_FUNK_NAME: FunctionName = FunctionName::new("some_funk");
+ const SIG: FunctionSignature = make_signature!(
+ new fn(&SOME_FUNK_NAME),
+ (u8::SIGNATURE, u8::SIGNATURE_LEN)
+ (<Vec<u32>>::SIGNATURE, <Vec<u32>>::SIGNATURE_LEN)
+ );
+ let name = from_utf8(&SIG.signature[..SIG.signature_len]).unwrap();
+ assert_eq!(name, "some_funk(uint8,uint32[])");
+ }
+
+ #[test]
+ fn make_func_with_3_args() {
+ const SOME_FUNK_NAME: FunctionName = FunctionName::new("some_funk");
+ const SIG: FunctionSignature = make_signature!(
+ new fn(&SOME_FUNK_NAME),
+ (u8::SIGNATURE, u8::SIGNATURE_LEN)
+ (u32::SIGNATURE, u32::SIGNATURE_LEN)
+ (<Vec<u32>>::SIGNATURE, <Vec<u32>>::SIGNATURE_LEN)
+ );
+ let name = from_utf8(&SIG.signature[..SIG.signature_len]).unwrap();
+ assert_eq!(name, "some_funk(uint8,uint32,uint32[])");
+ }
+
+ #[test]
+ fn make_slice_from_signature() {
+ const SOME_FUNK_NAME: FunctionName = FunctionName::new("some_funk");
+ const SIG: FunctionSignature = make_signature!(
+ new fn(&SOME_FUNK_NAME),
+ (u8::SIGNATURE, u8::SIGNATURE_LEN)
+ (u32::SIGNATURE, u32::SIGNATURE_LEN)
+ (<Vec<u32>>::SIGNATURE, <Vec<u32>>::SIGNATURE_LEN)
+ );
+ const NAME: [u8; SIG.signature_len] = {
+ let mut name: [u8; SIG.signature_len] = [0; SIG.signature_len];
+ let mut i = 0;
+ while i < SIG.signature_len {
+ name[i] = SIG.signature[i];
+ i += 1;
+ }
+ name
+ };
+ assert_eq!(&NAME, b"some_funk(uint8,uint32,uint32[])");
+ }
+}
crates/evm-coder/src/lib.rsdiffbeforeafterboth--- a/crates/evm-coder/src/lib.rs
+++ b/crates/evm-coder/src/lib.rs
@@ -15,7 +15,9 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
#![doc = include_str!("../README.md")]
-#![deny(missing_docs)]
+// #![deny(missing_docs)]
+#![warn(missing_docs)]
+#![macro_use]
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(not(feature = "std"))]
extern crate alloc;
@@ -26,6 +28,8 @@
pub use events::{ToLog, ToTopic};
use execution::DispatchInfo;
pub mod execution;
+#[macro_use]
+pub mod custom_signature;
/// Derives call enum implementing [`crate::Callable`], [`crate::Weighted`]
/// and [`crate::Call`] from impl block.
@@ -118,27 +122,54 @@
use alloc::{vec::Vec};
use pallet_evm::account::CrossAccountId;
use primitive_types::{U256, H160, H256};
+ use core::str::from_utf8;
- pub type address = H160;
+ use crate::custom_signature::SIGNATURE_SIZE_LIMIT;
- pub type uint8 = u8;
- pub type uint16 = u16;
- pub type uint32 = u32;
- pub type uint64 = u64;
- pub type uint128 = u128;
- pub type uint256 = U256;
+ pub trait Signature {
+ const SIGNATURE: [u8; SIGNATURE_SIZE_LIMIT];
+ const SIGNATURE_LEN: usize;
- pub type bytes4 = [u8; 4];
+ fn as_str() -> &'static str {
+ from_utf8(&Self::SIGNATURE[..Self::SIGNATURE_LEN]).expect("bad utf-8")
+ }
+ }
- pub type topic = H256;
+ impl Signature for bool {
+ make_signature!(new fixed("bool"));
+ }
+ macro_rules! define_simple_type {
+ (type $ident:ident = $ty:ty) => {
+ pub type $ident = $ty;
+ impl Signature for $ty {
+ make_signature!(new fixed(stringify!($ident)));
+ }
+ };
+ }
+
+ define_simple_type!(type address = H160);
+
+ define_simple_type!(type uint8 = u8);
+ define_simple_type!(type uint16 = u16);
+ define_simple_type!(type uint32 = u32);
+ define_simple_type!(type uint64 = u64);
+ define_simple_type!(type uint128 = u128);
+ define_simple_type!(type uint256 = U256);
+ define_simple_type!(type bytes4 = [u8; 4]);
+
+ define_simple_type!(type topic = H256);
+
#[cfg(not(feature = "std"))]
- pub type string = ::alloc::string::String;
+ define_simple_type!(type string = ::alloc::string::String);
#[cfg(feature = "std")]
- pub type string = ::std::string::String;
+ define_simple_type!(type string = ::std::string::String);
#[derive(Default, Debug)]
pub struct bytes(pub Vec<u8>);
+ impl Signature for bytes {
+ make_signature!(new fixed("bytes"));
+ }
/// Solidity doesn't have `void` type, however we have special implementation
/// for empty tuple return type
@@ -230,12 +261,8 @@
}
}
- impl SignatureString for EthCrossAccount {
- const SIGNATURE_STRING: &'static str = "(address,uint256)";
- }
-
- pub trait SignatureString {
- const SIGNATURE_STRING: &'static str;
+ impl Signature for EthCrossAccount {
+ make_signature!(new fixed("(address,uint256)"));
}
/// Convert `CrossAccountId` to `uint256`.
crates/evm-coder/src/solidity.rsdiffbeforeafterboth--- a/crates/evm-coder/src/solidity.rs
+++ b/crates/evm-coder/src/solidity.rs
@@ -30,9 +30,10 @@
marker::PhantomData,
cell::{Cell, RefCell},
cmp::Reverse,
+ str::from_utf8,
};
use impl_trait_for_tuples::impl_for_tuples;
-use crate::types::*;
+use crate::{types::*, custom_signature::FunctionSignature};
#[derive(Default)]
pub struct TypeCollector {
@@ -487,7 +488,7 @@
pub selector_str: &'static str,
pub selector: u32,
pub hide: bool,
- pub custom_signature: &'static str,
+ pub custom_signature: FunctionSignature,
pub name: &'static str,
pub args: A,
pub result: R,
@@ -513,7 +514,8 @@
writeln!(
writer,
"\t{hide_comment}/// or in textual repr: {}",
- self.custom_signature
+ // from_utf8(self.custom_signature.as_str()).expect("bad utf8")
+ self.selector_str
)?;
write!(writer, "\t{hide_comment}function {}(", self.name)?;
self.args.solidity_name(writer, tc)?;
pallets/common/src/erc.rsdiffbeforeafterboth--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -21,6 +21,8 @@
types::*,
execution::{Result, Error},
weight,
+ custom_signature::{FunctionName, FunctionSignature},
+ make_signature,
};
pub use pallet_evm::{PrecompileOutput, PrecompileResult, PrecompileHandle, account::CrossAccountId};
use pallet_evm_coder_substrate::dispatch_to_evm;
pallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -20,7 +20,13 @@
use alloc::{format, string::ToString};
use core::marker::PhantomData;
use evm_coder::{
- abi::AbiWriter, execution::Result, generate_stubgen, solidity_interface, types::*, ToLog,
+ abi::AbiWriter,
+ execution::Result,
+ generate_stubgen, solidity_interface,
+ types::*,
+ ToLog,
+ custom_signature::{FunctionName, FunctionSignature},
+ make_signature,
};
use pallet_evm::{
ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure, PrecompileHandle,
pallets/fungible/src/erc.rsdiffbeforeafterboth--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -20,7 +20,15 @@
use alloc::{format, string::ToString};
use core::char::{REPLACEMENT_CHARACTER, decode_utf16};
use core::convert::TryInto;
-use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight};
+use evm_coder::{
+ ToLog,
+ execution::*,
+ generate_stubgen, solidity_interface,
+ types::*,
+ weight,
+ custom_signature::{FunctionName, FunctionSignature},
+ make_signature,
+};
use pallet_common::eth::convert_tuple_to_cross_account;
use up_data_structs::CollectionMode;
use pallet_common::erc::{CommonEvmHandler, PrecompileResult};
pallets/nonfungible/src/erc.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -25,7 +25,15 @@
char::{REPLACEMENT_CHARACTER, decode_utf16},
convert::TryInto,
};
-use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};
+use evm_coder::{
+ ToLog,
+ execution::*,
+ generate_stubgen, solidity, solidity_interface,
+ types::*,
+ weight,
+ custom_signature::{FunctionName, FunctionSignature},
+ make_signature,
+};
use frame_support::BoundedVec;
use up_data_structs::{
TokenId, PropertyPermission, PropertyKeyPermission, Property, CollectionId, PropertyKey,
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56/// @dev common stubs holder7contract Dummy {8 uint8 dummy;9 string stub_error = "this contract is implemented in native";10}1112contract ERC165 is Dummy {13 function supportsInterface(bytes4 interfaceID) external view returns (bool) {14 require(false, stub_error);15 interfaceID;16 return true;17 }18}1920/// @title A contract that allows to set and delete token properties and change token property permissions.21/// @dev the ERC-165 identifier for this interface is 0x55dba91922contract TokenProperties is Dummy, ERC165 {23 /// @notice Set permissions for token property.24 /// @dev Throws error if `msg.sender` is not admin or owner of the collection.25 /// @param key Property key.26 /// @param isMutable Permission to mutate property.27 /// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.28 /// @param tokenOwner Permission to mutate property by token owner if property is mutable.29 /// @dev EVM selector for this function is: 0x222d97fa,30 /// or in textual repr: setTokenPropertyPermission(string,bool,bool,bool)31 function setTokenPropertyPermission(32 string memory key,33 bool isMutable,34 bool collectionAdmin,35 bool tokenOwner36 ) public {37 require(false, stub_error);38 key;39 isMutable;40 collectionAdmin;41 tokenOwner;42 dummy = 0;43 }4445 /// @notice Set token property value.46 /// @dev Throws error if `msg.sender` has no permission to edit the property.47 /// @param tokenId ID of the token.48 /// @param key Property key.49 /// @param value Property value.50 /// @dev EVM selector for this function is: 0x1752d67b,51 /// or in textual repr: setProperty(uint256,string,bytes)52 function setProperty(53 uint256 tokenId,54 string memory key,55 bytes memory value56 ) public {57 require(false, stub_error);58 tokenId;59 key;60 value;61 dummy = 0;62 }6364 /// @notice Set token properties value.65 /// @dev Throws error if `msg.sender` has no permission to edit the property.66 /// @param tokenId ID of the token.67 /// @param properties settable properties68 /// @dev EVM selector for this function is: 0x14ed3a6e,69 /// or in textual repr: setProperties(uint256,(string,bytes)[])70 function setProperties(uint256 tokenId, Tuple19[] memory properties) public {71 require(false, stub_error);72 tokenId;73 properties;74 dummy = 0;75 }7677 /// @notice Delete token property value.78 /// @dev Throws error if `msg.sender` has no permission to edit the property.79 /// @param tokenId ID of the token.80 /// @param key Property key.81 /// @dev EVM selector for this function is: 0x066111d1,82 /// or in textual repr: deleteProperty(uint256,string)83 function deleteProperty(uint256 tokenId, string memory key) public {84 require(false, stub_error);85 tokenId;86 key;87 dummy = 0;88 }8990 /// @notice Get token property value.91 /// @dev Throws error if key not found92 /// @param tokenId ID of the token.93 /// @param key Property key.94 /// @return Property value bytes95 /// @dev EVM selector for this function is: 0x7228c327,96 /// or in textual repr: property(uint256,string)97 function property(uint256 tokenId, string memory key) public view returns (bytes memory) {98 require(false, stub_error);99 tokenId;100 key;101 dummy;102 return hex"";103 }104}105106/// @title A contract that allows you to work with collections.107/// @dev the ERC-165 identifier for this interface is 0xb3152af3108contract Collection is Dummy, ERC165 {109 /// Set collection property.110 ///111 /// @param key Property key.112 /// @param value Propery value.113 /// @dev EVM selector for this function is: 0x2f073f66,114 /// or in textual repr: setCollectionProperty(string,bytes)115 function setCollectionProperty(string memory key, bytes memory value) public {116 require(false, stub_error);117 key;118 value;119 dummy = 0;120 }121122 /// Set collection properties.123 ///124 /// @param properties Vector of properties key/value pair.125 /// @dev EVM selector for this function is: 0x50b26b2a,126 /// or in textual repr: setCollectionProperties((string,bytes)[])127 function setCollectionProperties(Tuple19[] memory properties) public {128 require(false, stub_error);129 properties;130 dummy = 0;131 }132133 /// Delete collection property.134 ///135 /// @param key Property key.136 /// @dev EVM selector for this function is: 0x7b7debce,137 /// or in textual repr: deleteCollectionProperty(string)138 function deleteCollectionProperty(string memory key) public {139 require(false, stub_error);140 key;141 dummy = 0;142 }143144 /// Delete collection properties.145 ///146 /// @param keys Properties keys.147 /// @dev EVM selector for this function is: 0xee206ee3,148 /// or in textual repr: deleteCollectionProperties(string[])149 function deleteCollectionProperties(string[] memory keys) public {150 require(false, stub_error);151 keys;152 dummy = 0;153 }154155 /// Get collection property.156 ///157 /// @dev Throws error if key not found.158 ///159 /// @param key Property key.160 /// @return bytes The property corresponding to the key.161 /// @dev EVM selector for this function is: 0xcf24fd6d,162 /// or in textual repr: collectionProperty(string)163 function collectionProperty(string memory key) public view returns (bytes memory) {164 require(false, stub_error);165 key;166 dummy;167 return hex"";168 }169170 /// Get collection properties.171 ///172 /// @param keys Properties keys. Empty keys for all propertyes.173 /// @return Vector of properties key/value pairs.174 /// @dev EVM selector for this function is: 0x285fb8e6,175 /// or in textual repr: collectionProperties(string[])176 function collectionProperties(string[] memory keys) public view returns (Tuple19[] memory) {177 require(false, stub_error);178 keys;179 dummy;180 return new Tuple19[](0);181 }182183 /// Set the sponsor of the collection.184 ///185 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.186 ///187 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.188 /// @dev EVM selector for this function is: 0x7623402e,189 /// or in textual repr: setCollectionSponsor(address)190 function setCollectionSponsor(address sponsor) public {191 require(false, stub_error);192 sponsor;193 dummy = 0;194 }195196 /// Set the sponsor of the collection.197 ///198 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.199 ///200 /// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.201 /// @dev EVM selector for this function is: 0x84a1d5a8,202 /// or in textual repr: setCollectionSponsorCross((address,uint256))203 function setCollectionSponsorCross(Tuple6 memory sponsor) public {204 require(false, stub_error);205 sponsor;206 dummy = 0;207 }208209 /// Whether there is a pending sponsor.210 /// @dev EVM selector for this function is: 0x058ac185,211 /// or in textual repr: hasCollectionPendingSponsor()212 function hasCollectionPendingSponsor() public view returns (bool) {213 require(false, stub_error);214 dummy;215 return false;216 }217218 /// Collection sponsorship confirmation.219 ///220 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.221 /// @dev EVM selector for this function is: 0x3c50e97a,222 /// or in textual repr: confirmCollectionSponsorship()223 function confirmCollectionSponsorship() public {224 require(false, stub_error);225 dummy = 0;226 }227228 /// Remove collection sponsor.229 /// @dev EVM selector for this function is: 0x6e0326a3,230 /// or in textual repr: removeCollectionSponsor()231 function removeCollectionSponsor() public {232 require(false, stub_error);233 dummy = 0;234 }235236 /// Get current sponsor.237 ///238 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.239 /// @dev EVM selector for this function is: 0x6ec0a9f1,240 /// or in textual repr: collectionSponsor()241<<<<<<< HEAD242 function collectionSponsor() public view returns (Tuple6 memory) {243 require(false, stub_error);244 dummy;245 return Tuple6(0x0000000000000000000000000000000000000000, 0);246=======247 function collectionSponsor() public view returns (Tuple19 memory) {248 require(false, stub_error);249 dummy;250 return Tuple19(0x0000000000000000000000000000000000000000, 0);251>>>>>>> feat: add `EthCrossAccount` type252 }253254 /// Set limits for the collection.255 /// @dev Throws error if limit not found.256 /// @param limit Name of the limit. Valid names:257 /// "accountTokenOwnershipLimit",258 /// "sponsoredDataSize",259 /// "sponsoredDataRateLimit",260 /// "tokenLimit",261 /// "sponsorTransferTimeout",262 /// "sponsorApproveTimeout"263 /// @param value Value of the limit.264 /// @dev EVM selector for this function is: 0x6a3841db,265 /// or in textual repr: setCollectionLimit(string,uint32)266 function setCollectionLimit(string memory limit, uint32 value) public {267 require(false, stub_error);268 limit;269 value;270 dummy = 0;271 }272273 /// Set limits for the collection.274 /// @dev Throws error if limit not found.275 /// @param limit Name of the limit. Valid names:276 /// "ownerCanTransfer",277 /// "ownerCanDestroy",278 /// "transfersEnabled"279 /// @param value Value of the limit.280 /// @dev EVM selector for this function is: 0x993b7fba,281 /// or in textual repr: setCollectionLimit(string,bool)282 function setCollectionLimit(string memory limit, bool value) public {283 require(false, stub_error);284 limit;285 value;286 dummy = 0;287 }288289 /// Get contract address.290 /// @dev EVM selector for this function is: 0xf6b4dfb4,291 /// or in textual repr: contractAddress()292 function contractAddress() public view returns (address) {293 require(false, stub_error);294 dummy;295 return 0x0000000000000000000000000000000000000000;296 }297298 /// Add collection admin.299 /// @param newAdmin Cross account administrator address.300 /// @dev EVM selector for this function is: 0x859aa7d6,301 /// or in textual repr: addCollectionAdminCross((address,uint256))302 function addCollectionAdminCross(Tuple6 memory newAdmin) public {303 require(false, stub_error);304 newAdmin;305 dummy = 0;306 }307308 /// Remove collection admin.309 /// @param admin Cross account administrator address.310 /// @dev EVM selector for this function is: 0x6c0cd173,311 /// or in textual repr: removeCollectionAdminCross((address,uint256))312 function removeCollectionAdminCross(Tuple6 memory admin) public {313 require(false, stub_error);314 admin;315 dummy = 0;316 }317318 /// Add collection admin.319 /// @param newAdmin Address of the added administrator.320 /// @dev EVM selector for this function is: 0x92e462c7,321 /// or in textual repr: addCollectionAdmin(address)322 function addCollectionAdmin(address newAdmin) public {323 require(false, stub_error);324 newAdmin;325 dummy = 0;326 }327328 /// Remove collection admin.329 ///330 /// @param admin Address of the removed administrator.331 /// @dev EVM selector for this function is: 0xfafd7b42,332 /// or in textual repr: removeCollectionAdmin(address)333 function removeCollectionAdmin(address admin) public {334 require(false, stub_error);335 admin;336 dummy = 0;337 }338339 /// Toggle accessibility of collection nesting.340 ///341 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'342 /// @dev EVM selector for this function is: 0x112d4586,343 /// or in textual repr: setCollectionNesting(bool)344 function setCollectionNesting(bool enable) public {345 require(false, stub_error);346 enable;347 dummy = 0;348 }349350 /// Toggle accessibility of collection nesting.351 ///352 /// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'353 /// @param collections Addresses of collections that will be available for nesting.354 /// @dev EVM selector for this function is: 0x64872396,355 /// or in textual repr: setCollectionNesting(bool,address[])356 function setCollectionNesting(bool enable, address[] memory collections) public {357 require(false, stub_error);358 enable;359 collections;360 dummy = 0;361 }362363 /// Set the collection access method.364 /// @param mode Access mode365 /// 0 for Normal366 /// 1 for AllowList367 /// @dev EVM selector for this function is: 0x41835d4c,368 /// or in textual repr: setCollectionAccess(uint8)369 function setCollectionAccess(uint8 mode) public {370 require(false, stub_error);371 mode;372 dummy = 0;373 }374375 /// Checks that user allowed to operate with collection.376 ///377 /// @param user User address to check.378 /// @dev EVM selector for this function is: 0xd63a8e11,379 /// or in textual repr: allowed(address)380 function allowed(address user) public view returns (bool) {381 require(false, stub_error);382 user;383 dummy;384 return false;385 }386387 /// Add the user to the allowed list.388 ///389 /// @param user Address of a trusted user.390 /// @dev EVM selector for this function is: 0x67844fe6,391 /// or in textual repr: addToCollectionAllowList(address)392 function addToCollectionAllowList(address user) public {393 require(false, stub_error);394 user;395 dummy = 0;396 }397398 /// Add user to allowed list.399 ///400 /// @param user User cross account address.401 /// @dev EVM selector for this function is: 0xa0184a3a,402 /// or in textual repr: addToCollectionAllowListCross((address,uint256))403 function addToCollectionAllowListCross(Tuple6 memory user) public {404 require(false, stub_error);405 user;406 dummy = 0;407 }408409 /// Remove the user from the allowed list.410 ///411 /// @param user Address of a removed user.412 /// @dev EVM selector for this function is: 0x85c51acb,413 /// or in textual repr: removeFromCollectionAllowList(address)414 function removeFromCollectionAllowList(address user) public {415 require(false, stub_error);416 user;417 dummy = 0;418 }419420 /// Remove user from allowed list.421 ///422 /// @param user User cross account address.423 /// @dev EVM selector for this function is: 0x09ba452a,424 /// or in textual repr: removeFromCollectionAllowListCross((address,uint256))425 function removeFromCollectionAllowListCross(Tuple6 memory user) public {426 require(false, stub_error);427 user;428 dummy = 0;429 }430431 /// Switch permission for minting.432 ///433 /// @param mode Enable if "true".434 /// @dev EVM selector for this function is: 0x00018e84,435 /// or in textual repr: setCollectionMintMode(bool)436 function setCollectionMintMode(bool mode) public {437 require(false, stub_error);438 mode;439 dummy = 0;440 }441442 /// Check that account is the owner or admin of the collection443 ///444 /// @param user account to verify445 /// @return "true" if account is the owner or admin446 /// @dev EVM selector for this function is: 0x9811b0c7,447 /// or in textual repr: isOwnerOrAdmin(address)448 function isOwnerOrAdmin(address user) public view returns (bool) {449 require(false, stub_error);450 user;451 dummy;452 return false;453 }454455 /// Check that account is the owner or admin of the collection456 ///457 /// @param user User cross account to verify458 /// @return "true" if account is the owner or admin459 /// @dev EVM selector for this function is: 0x3e75a905,460 /// or in textual repr: isOwnerOrAdminCross((address,uint256))461 function isOwnerOrAdminCross(Tuple6 memory user) public view returns (bool) {462 require(false, stub_error);463 user;464 dummy;465 return false;466 }467468 /// Returns collection type469 ///470 /// @return `Fungible` or `NFT` or `ReFungible`471 /// @dev EVM selector for this function is: 0xd34b55b8,472 /// or in textual repr: uniqueCollectionType()473 function uniqueCollectionType() public view returns (string memory) {474 require(false, stub_error);475 dummy;476 return "";477 }478479 /// Get collection owner.480 ///481 /// @return Tuble with sponsor address and his substrate mirror.482 /// If address is canonical then substrate mirror is zero and vice versa.483 /// @dev EVM selector for this function is: 0xdf727d3b,484 /// or in textual repr: collectionOwner()485<<<<<<< HEAD486 function collectionOwner() public view returns (Tuple6 memory) {487 require(false, stub_error);488 dummy;489 return Tuple6(0x0000000000000000000000000000000000000000, 0);490=======491 function collectionOwner() public view returns (Tuple19 memory) {492 require(false, stub_error);493 dummy;494 return Tuple19(0x0000000000000000000000000000000000000000, 0);495>>>>>>> feat: add `EthCrossAccount` type496 }497498 /// Changes collection owner to another account499 ///500 /// @dev Owner can be changed only by current owner501 /// @param newOwner new owner account502 /// @dev EVM selector for this function is: 0x4f53e226,503 /// or in textual repr: changeCollectionOwner(address)504 function changeCollectionOwner(address newOwner) public {505 require(false, stub_error);506 newOwner;507 dummy = 0;508 }509510 /// Get collection administrators511 ///512 /// @return Vector of tuples with admins address and his substrate mirror.513 /// If address is canonical then substrate mirror is zero and vice versa.514 /// @dev EVM selector for this function is: 0x5813216b,515 /// or in textual repr: collectionAdmins()516 function collectionAdmins() public view returns (Tuple6[] memory) {517 require(false, stub_error);518 dummy;519 return new Tuple6[](0);520 }521522 /// Changes collection owner to another account523 ///524 /// @dev Owner can be changed only by current owner525 /// @param newOwner new owner cross account526 /// @dev EVM selector for this function is: 0xe5c9913f,527 /// or in textual repr: setOwnerCross((address,uint256))528 function setOwnerCross(Tuple6 memory newOwner) public {529 require(false, stub_error);530 newOwner;531 dummy = 0;532 }533}534535/// @dev anonymous struct536struct Tuple19 {537 address field_0;538 uint256 field_1;539}540541/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension542/// @dev See https://eips.ethereum.org/EIPS/eip-721543/// @dev the ERC-165 identifier for this interface is 0x5b5e139f544contract ERC721Metadata is Dummy, ERC165 {545 // /// @notice A descriptive name for a collection of NFTs in this contract546 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`547 // /// @dev EVM selector for this function is: 0x06fdde03,548 // /// or in textual repr: name()549 // function name() public view returns (string memory) {550 // require(false, stub_error);551 // dummy;552 // return "";553 // }554555 // /// @notice An abbreviated name for NFTs in this contract556 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`557 // /// @dev EVM selector for this function is: 0x95d89b41,558 // /// or in textual repr: symbol()559 // function symbol() public view returns (string memory) {560 // require(false, stub_error);561 // dummy;562 // return "";563 // }564565 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.566 ///567 /// @dev If the token has a `url` property and it is not empty, it is returned.568 /// Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.569 /// If the collection property `baseURI` is empty or absent, return "" (empty string)570 /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix571 /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).572 ///573 /// @return token's const_metadata574 /// @dev EVM selector for this function is: 0xc87b56dd,575 /// or in textual repr: tokenURI(uint256)576 function tokenURI(uint256 tokenId) public view returns (string memory) {577 require(false, stub_error);578 tokenId;579 dummy;580 return "";581 }582}583584/// @title ERC721 Token that can be irreversibly burned (destroyed).585/// @dev the ERC-165 identifier for this interface is 0x42966c68586contract ERC721Burnable is Dummy, ERC165 {587 /// @notice Burns a specific ERC721 token.588 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized589 /// operator of the current owner.590 /// @param tokenId The NFT to approve591 /// @dev EVM selector for this function is: 0x42966c68,592 /// or in textual repr: burn(uint256)593 function burn(uint256 tokenId) public {594 require(false, stub_error);595 tokenId;596 dummy = 0;597 }598}599600/// @dev inlined interface601contract ERC721UniqueMintableEvents {602 event MintingFinished();603}604605/// @title ERC721 minting logic.606/// @dev the ERC-165 identifier for this interface is 0x476ff149607contract ERC721UniqueMintable is Dummy, ERC165, ERC721UniqueMintableEvents {608 /// @dev EVM selector for this function is: 0x05d2035b,609 /// or in textual repr: mintingFinished()610 function mintingFinished() public view returns (bool) {611 require(false, stub_error);612 dummy;613 return false;614 }615616 /// @notice Function to mint token.617 /// @param to The new owner618 /// @return uint256 The id of the newly minted token619 /// @dev EVM selector for this function is: 0x6a627842,620 /// or in textual repr: mint(address)621 function mint(address to) public returns (uint256) {622 require(false, stub_error);623 to;624 dummy = 0;625 return 0;626 }627628 // /// @notice Function to mint token.629 // /// @dev `tokenId` should be obtained with `nextTokenId` method,630 // /// unlike standard, you can't specify it manually631 // /// @param to The new owner632 // /// @param tokenId ID of the minted NFT633 // /// @dev EVM selector for this function is: 0x40c10f19,634 // /// or in textual repr: mint(address,uint256)635 // function mint(address to, uint256 tokenId) public returns (bool) {636 // require(false, stub_error);637 // to;638 // tokenId;639 // dummy = 0;640 // return false;641 // }642643 /// @notice Function to mint token with the given tokenUri.644 /// @param to The new owner645 /// @param tokenUri Token URI that would be stored in the NFT properties646 /// @return uint256 The id of the newly minted token647 /// @dev EVM selector for this function is: 0x45c17782,648 /// or in textual repr: mintWithTokenURI(address,string)649 function mintWithTokenURI(address to, string memory tokenUri) public returns (uint256) {650 require(false, stub_error);651 to;652 tokenUri;653 dummy = 0;654 return 0;655 }656657 // /// @notice Function to mint token with the given tokenUri.658 // /// @dev `tokenId` should be obtained with `nextTokenId` method,659 // /// unlike standard, you can't specify it manually660 // /// @param to The new owner661 // /// @param tokenId ID of the minted NFT662 // /// @param tokenUri Token URI that would be stored in the NFT properties663 // /// @dev EVM selector for this function is: 0x50bb4e7f,664 // /// or in textual repr: mintWithTokenURI(address,uint256,string)665 // function mintWithTokenURI(address to, uint256 tokenId, string memory tokenUri) public returns (bool) {666 // require(false, stub_error);667 // to;668 // tokenId;669 // tokenUri;670 // dummy = 0;671 // return false;672 // }673674 /// @dev Not implemented675 /// @dev EVM selector for this function is: 0x7d64bcb4,676 /// or in textual repr: finishMinting()677 function finishMinting() public returns (bool) {678 require(false, stub_error);679 dummy = 0;680 return false;681 }682}683684/// @title Unique extensions for ERC721.685/// @dev the ERC-165 identifier for this interface is 0x244543ee686contract ERC721UniqueExtensions is Dummy, ERC165 {687 /// @notice A descriptive name for a collection of NFTs in this contract688 /// @dev EVM selector for this function is: 0x06fdde03,689 /// or in textual repr: name()690 function name() public view returns (string memory) {691 require(false, stub_error);692 dummy;693 return "";694 }695696 /// @notice An abbreviated name for NFTs in this contract697 /// @dev EVM selector for this function is: 0x95d89b41,698 /// or in textual repr: symbol()699 function symbol() public view returns (string memory) {700 require(false, stub_error);701 dummy;702 return "";703 }704705 /// @notice Set or reaffirm the approved address for an NFT706 /// @dev The zero address indicates there is no approved address.707 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized708 /// operator of the current owner.709 /// @param approved The new substrate address approved NFT controller710 /// @param tokenId The NFT to approve711 /// @dev EVM selector for this function is: 0x0ecd0ab0,712 /// or in textual repr: approveCross((address,uint256),uint256)713 function approveCross(Tuple6 memory approved, uint256 tokenId) public {714 require(false, stub_error);715 approved;716 tokenId;717 dummy = 0;718 }719720 /// @notice Transfer ownership of an NFT721 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`722 /// is the zero address. Throws if `tokenId` is not a valid NFT.723 /// @param to The new owner724 /// @param tokenId The NFT to transfer725 /// @dev EVM selector for this function is: 0xa9059cbb,726 /// or in textual repr: transfer(address,uint256)727 function transfer(address to, uint256 tokenId) public {728 require(false, stub_error);729 to;730 tokenId;731 dummy = 0;732 }733734 /// @notice Transfer ownership of an NFT from cross account address to cross account address735 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`736 /// is the zero address. Throws if `tokenId` is not a valid NFT.737 /// @param from Cross acccount address of current owner738 /// @param to Cross acccount address of new owner739 /// @param tokenId The NFT to transfer740 /// @dev EVM selector for this function is: 0xd5cf430b,741 /// or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)742 function transferFromCross(743 Tuple6 memory from,744 Tuple6 memory to,745 uint256 tokenId746 ) public {747 require(false, stub_error);748 from;749 to;750 tokenId;751 dummy = 0;752 }753754 /// @notice Burns a specific ERC721 token.755 /// @dev Throws unless `msg.sender` is the current owner or an authorized756 /// operator for this NFT. Throws if `from` is not the current owner. Throws757 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.758 /// @param from The current owner of the NFT759 /// @param tokenId The NFT to transfer760 /// @dev EVM selector for this function is: 0x79cc6790,761 /// or in textual repr: burnFrom(address,uint256)762 function burnFrom(address from, uint256 tokenId) public {763 require(false, stub_error);764 from;765 tokenId;766 dummy = 0;767 }768769 /// @notice Burns a specific ERC721 token.770 /// @dev Throws unless `msg.sender` is the current owner or an authorized771 /// operator for this NFT. Throws if `from` is not the current owner. Throws772 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.773 /// @param from The current owner of the NFT774 /// @param tokenId The NFT to transfer775 /// @dev EVM selector for this function is: 0xbb2f5a58,776 /// or in textual repr: burnFromCross((address,uint256),uint256)777 function burnFromCross(Tuple6 memory from, uint256 tokenId) public {778 require(false, stub_error);779 from;780 tokenId;781 dummy = 0;782 }783784 /// @notice Returns next free NFT ID.785 /// @dev EVM selector for this function is: 0x75794a3c,786 /// or in textual repr: nextTokenId()787 function nextTokenId() public view returns (uint256) {788 require(false, stub_error);789 dummy;790 return 0;791 }792 // /// @notice Function to mint multiple tokens.793 // /// @dev `tokenIds` should be an array of consecutive numbers and first number794 // /// should be obtained with `nextTokenId` method795 // /// @param to The new owner796 // /// @param tokenIds IDs of the minted NFTs797 // /// @dev EVM selector for this function is: 0x44a9945e,798 // /// or in textual repr: mintBulk(address,uint256[])799 // function mintBulk(address to, uint256[] memory tokenIds) public returns (bool) {800 // require(false, stub_error);801 // to;802 // tokenIds;803 // dummy = 0;804 // return false;805 // }806807 // /// @notice Function to mint multiple tokens with the given tokenUris.808 // /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive809 // /// numbers and first number should be obtained with `nextTokenId` method810 // /// @param to The new owner811 // /// @param tokens array of pairs of token ID and token URI for minted tokens812 // /// @dev EVM selector for this function is: 0x36543006,813 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])814 // function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) public returns (bool) {815 // require(false, stub_error);816 // to;817 // tokens;818 // dummy = 0;819 // return false;820 // }821822}823824/// @dev anonymous struct825struct Tuple8 {826 uint256 field_0;827 string field_1;828}829830<<<<<<< HEAD831/// @dev anonymous struct832struct Tuple6 {833 address field_0;834 uint256 field_1;835=======836/// @dev Cross account struct837struct EthCrossAccount {838 address eth;839 uint256 sub;840>>>>>>> feat: add `EthCrossAccount` type841}842843/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension844/// @dev See https://eips.ethereum.org/EIPS/eip-721845/// @dev the ERC-165 identifier for this interface is 0x780e9d63846contract ERC721Enumerable is Dummy, ERC165 {847 /// @notice Enumerate valid NFTs848 /// @param index A counter less than `totalSupply()`849 /// @return The token identifier for the `index`th NFT,850 /// (sort order not specified)851 /// @dev EVM selector for this function is: 0x4f6ccce7,852 /// or in textual repr: tokenByIndex(uint256)853 function tokenByIndex(uint256 index) public view returns (uint256) {854 require(false, stub_error);855 index;856 dummy;857 return 0;858 }859860 /// @dev Not implemented861 /// @dev EVM selector for this function is: 0x2f745c59,862 /// or in textual repr: tokenOfOwnerByIndex(address,uint256)863 function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {864 require(false, stub_error);865 owner;866 index;867 dummy;868 return 0;869 }870871 /// @notice Count NFTs tracked by this contract872 /// @return A count of valid NFTs tracked by this contract, where each one of873 /// them has an assigned and queryable owner not equal to the zero address874 /// @dev EVM selector for this function is: 0x18160ddd,875 /// or in textual repr: totalSupply()876 function totalSupply() public view returns (uint256) {877 require(false, stub_error);878 dummy;879 return 0;880 }881}882883/// @dev inlined interface884contract ERC721Events {885 event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);886 event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);887 event ApprovalForAll(address indexed owner, address indexed operator, bool approved);888}889890/// @title ERC-721 Non-Fungible Token Standard891/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md892/// @dev the ERC-165 identifier for this interface is 0x80ac58cd893contract ERC721 is Dummy, ERC165, ERC721Events {894 /// @notice Count all NFTs assigned to an owner895 /// @dev NFTs assigned to the zero address are considered invalid, and this896 /// function throws for queries about the zero address.897 /// @param owner An address for whom to query the balance898 /// @return The number of NFTs owned by `owner`, possibly zero899 /// @dev EVM selector for this function is: 0x70a08231,900 /// or in textual repr: balanceOf(address)901 function balanceOf(address owner) public view returns (uint256) {902 require(false, stub_error);903 owner;904 dummy;905 return 0;906 }907908 /// @notice Find the owner of an NFT909 /// @dev NFTs assigned to zero address are considered invalid, and queries910 /// about them do throw.911 /// @param tokenId The identifier for an NFT912 /// @return The address of the owner of the NFT913 /// @dev EVM selector for this function is: 0x6352211e,914 /// or in textual repr: ownerOf(uint256)915 function ownerOf(uint256 tokenId) public view returns (address) {916 require(false, stub_error);917 tokenId;918 dummy;919 return 0x0000000000000000000000000000000000000000;920 }921922 /// @dev Not implemented923 /// @dev EVM selector for this function is: 0xb88d4fde,924 /// or in textual repr: safeTransferFrom(address,address,uint256,bytes)925 function safeTransferFrom(926 address from,927 address to,928 uint256 tokenId,929 bytes memory data930 ) public {931 require(false, stub_error);932 from;933 to;934 tokenId;935 data;936 dummy = 0;937 }938939 /// @dev Not implemented940 /// @dev EVM selector for this function is: 0x42842e0e,941 /// or in textual repr: safeTransferFrom(address,address,uint256)942 function safeTransferFrom(943 address from,944 address to,945 uint256 tokenId946 ) public {947 require(false, stub_error);948 from;949 to;950 tokenId;951 dummy = 0;952 }953954 /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE955 /// TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE956 /// THEY MAY BE PERMANENTLY LOST957 /// @dev Throws unless `msg.sender` is the current owner or an authorized958 /// operator for this NFT. Throws if `from` is not the current owner. Throws959 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.960 /// @param from The current owner of the NFT961 /// @param to The new owner962 /// @param tokenId The NFT to transfer963 /// @dev EVM selector for this function is: 0x23b872dd,964 /// or in textual repr: transferFrom(address,address,uint256)965 function transferFrom(966 address from,967 address to,968 uint256 tokenId969 ) public {970 require(false, stub_error);971 from;972 to;973 tokenId;974 dummy = 0;975 }976977 /// @notice Set or reaffirm the approved address for an NFT978 /// @dev The zero address indicates there is no approved address.979 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized980 /// operator of the current owner.981 /// @param approved The new approved NFT controller982 /// @param tokenId The NFT to approve983 /// @dev EVM selector for this function is: 0x095ea7b3,984 /// or in textual repr: approve(address,uint256)985 function approve(address approved, uint256 tokenId) public {986 require(false, stub_error);987 approved;988 tokenId;989 dummy = 0;990 }991992 /// @dev Not implemented993 /// @dev EVM selector for this function is: 0xa22cb465,994 /// or in textual repr: setApprovalForAll(address,bool)995 function setApprovalForAll(address operator, bool approved) public {996 require(false, stub_error);997 operator;998 approved;999 dummy = 0;1000 }10011002 /// @dev Not implemented1003 /// @dev EVM selector for this function is: 0x081812fc,1004 /// or in textual repr: getApproved(uint256)1005 function getApproved(uint256 tokenId) public view returns (address) {1006 require(false, stub_error);1007 tokenId;1008 dummy;1009 return 0x0000000000000000000000000000000000000000;1010 }10111012 /// @dev Not implemented1013 /// @dev EVM selector for this function is: 0xe985e9c5,1014 /// or in textual repr: isApprovedForAll(address,address)1015 function isApprovedForAll(address owner, address operator) public view returns (address) {1016 require(false, stub_error);1017 owner;1018 operator;1019 dummy;1020 return 0x0000000000000000000000000000000000000000;1021 }1022}10231024contract UniqueNFT is1025 Dummy,1026 ERC165,1027 ERC721,1028 ERC721Enumerable,1029 ERC721UniqueExtensions,1030 ERC721UniqueMintable,1031 ERC721Burnable,1032 ERC721Metadata,1033 Collection,1034 TokenProperties1035{}1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56/// @dev common stubs holder7contract Dummy {8 uint8 dummy;9 string stub_error = "this contract is implemented in native";10}1112contract ERC165 is Dummy {13 function supportsInterface(bytes4 interfaceID) external view returns (bool) {14 require(false, stub_error);15 interfaceID;16 return true;17 }18}1920/// @title A contract that allows to set and delete token properties and change token property permissions.21/// @dev the ERC-165 identifier for this interface is 0x55dba91922contract TokenProperties is Dummy, ERC165 {23 /// @notice Set permissions for token property.24 /// @dev Throws error if `msg.sender` is not admin or owner of the collection.25 /// @param key Property key.26 /// @param isMutable Permission to mutate property.27 /// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.28 /// @param tokenOwner Permission to mutate property by token owner if property is mutable.29 /// @dev EVM selector for this function is: 0x222d97fa,30 /// or in textual repr: setTokenPropertyPermission(string,bool,bool,bool)31 function setTokenPropertyPermission(32 string memory key,33 bool isMutable,34 bool collectionAdmin,35 bool tokenOwner36 ) public {37 require(false, stub_error);38 key;39 isMutable;40 collectionAdmin;41 tokenOwner;42 dummy = 0;43 }4445 /// @notice Set token property value.46 /// @dev Throws error if `msg.sender` has no permission to edit the property.47 /// @param tokenId ID of the token.48 /// @param key Property key.49 /// @param value Property value.50 /// @dev EVM selector for this function is: 0x1752d67b,51 /// or in textual repr: setProperty(uint256,string,bytes)52 function setProperty(53 uint256 tokenId,54 string memory key,55 bytes memory value56 ) public {57 require(false, stub_error);58 tokenId;59 key;60 value;61 dummy = 0;62 }6364 /// @notice Set token properties value.65 /// @dev Throws error if `msg.sender` has no permission to edit the property.66 /// @param tokenId ID of the token.67 /// @param properties settable properties68 /// @dev EVM selector for this function is: 0x14ed3a6e,69 /// or in textual repr: setProperties(uint256,(string,bytes)[])70 function setProperties(uint256 tokenId, Tuple19[] memory properties) public {71 require(false, stub_error);72 tokenId;73 properties;74 dummy = 0;75 }7677 /// @notice Delete token property value.78 /// @dev Throws error if `msg.sender` has no permission to edit the property.79 /// @param tokenId ID of the token.80 /// @param key Property key.81 /// @dev EVM selector for this function is: 0x066111d1,82 /// or in textual repr: deleteProperty(uint256,string)83 function deleteProperty(uint256 tokenId, string memory key) public {84 require(false, stub_error);85 tokenId;86 key;87 dummy = 0;88 }8990 /// @notice Get token property value.91 /// @dev Throws error if key not found92 /// @param tokenId ID of the token.93 /// @param key Property key.94 /// @return Property value bytes95 /// @dev EVM selector for this function is: 0x7228c327,96 /// or in textual repr: property(uint256,string)97 function property(uint256 tokenId, string memory key) public view returns (bytes memory) {98 require(false, stub_error);99 tokenId;100 key;101 dummy;102 return hex"";103 }104}105106/// @title A contract that allows you to work with collections.107<<<<<<< HEAD108/// @dev the ERC-165 identifier for this interface is 0xb3152af3109=======110/// @dev the ERC-165 identifier for this interface is 0x674be726111>>>>>>> feat: Add custum signature with unlimited nesting.112contract Collection is Dummy, ERC165 {113 /// Set collection property.114 ///115 /// @param key Property key.116 /// @param value Propery value.117 /// @dev EVM selector for this function is: 0x2f073f66,118 /// or in textual repr: setCollectionProperty(string,bytes)119 function setCollectionProperty(string memory key, bytes memory value) public {120 require(false, stub_error);121 key;122 value;123 dummy = 0;124 }125126 /// Set collection properties.127 ///128 /// @param properties Vector of properties key/value pair.129 /// @dev EVM selector for this function is: 0x50b26b2a,130 /// or in textual repr: setCollectionProperties((string,bytes)[])131 function setCollectionProperties(Tuple19[] memory properties) public {132 require(false, stub_error);133 properties;134 dummy = 0;135 }136137 /// Delete collection property.138 ///139 /// @param key Property key.140 /// @dev EVM selector for this function is: 0x7b7debce,141 /// or in textual repr: deleteCollectionProperty(string)142 function deleteCollectionProperty(string memory key) public {143 require(false, stub_error);144 key;145 dummy = 0;146 }147148 /// Delete collection properties.149 ///150 /// @param keys Properties keys.151 /// @dev EVM selector for this function is: 0xee206ee3,152 /// or in textual repr: deleteCollectionProperties(string[])153 function deleteCollectionProperties(string[] memory keys) public {154 require(false, stub_error);155 keys;156 dummy = 0;157 }158159 /// Get collection property.160 ///161 /// @dev Throws error if key not found.162 ///163 /// @param key Property key.164 /// @return bytes The property corresponding to the key.165 /// @dev EVM selector for this function is: 0xcf24fd6d,166 /// or in textual repr: collectionProperty(string)167 function collectionProperty(string memory key) public view returns (bytes memory) {168 require(false, stub_error);169 key;170 dummy;171 return hex"";172 }173174 /// Get collection properties.175 ///176 /// @param keys Properties keys. Empty keys for all propertyes.177 /// @return Vector of properties key/value pairs.178 /// @dev EVM selector for this function is: 0x285fb8e6,179 /// or in textual repr: collectionProperties(string[])180 function collectionProperties(string[] memory keys) public view returns (Tuple19[] memory) {181 require(false, stub_error);182 keys;183 dummy;184 return new Tuple19[](0);185 }186187 /// Set the sponsor of the collection.188 ///189 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.190 ///191 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.192 /// @dev EVM selector for this function is: 0x7623402e,193 /// or in textual repr: setCollectionSponsor(address)194 function setCollectionSponsor(address sponsor) public {195 require(false, stub_error);196 sponsor;197 dummy = 0;198 }199200 /// Set the sponsor of the collection.201 ///202 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.203 ///204 /// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.205 /// @dev EVM selector for this function is: 0x403e96a7,206 /// or in textual repr: setCollectionSponsorCross((address,uint256))207 function setCollectionSponsorCross(Tuple6 memory sponsor) public {208 require(false, stub_error);209 sponsor;210 dummy = 0;211 }212213 /// Whether there is a pending sponsor.214 /// @dev EVM selector for this function is: 0x058ac185,215 /// or in textual repr: hasCollectionPendingSponsor()216 function hasCollectionPendingSponsor() public view returns (bool) {217 require(false, stub_error);218 dummy;219 return false;220 }221222 /// Collection sponsorship confirmation.223 ///224 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.225 /// @dev EVM selector for this function is: 0x3c50e97a,226 /// or in textual repr: confirmCollectionSponsorship()227 function confirmCollectionSponsorship() public {228 require(false, stub_error);229 dummy = 0;230 }231232 /// Remove collection sponsor.233 /// @dev EVM selector for this function is: 0x6e0326a3,234 /// or in textual repr: removeCollectionSponsor()235 function removeCollectionSponsor() public {236 require(false, stub_error);237 dummy = 0;238 }239240 /// Get current sponsor.241 ///242 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.243 /// @dev EVM selector for this function is: 0x6ec0a9f1,244 /// or in textual repr: collectionSponsor()245<<<<<<< HEAD246<<<<<<< HEAD247 function collectionSponsor() public view returns (Tuple6 memory) {248 require(false, stub_error);249 dummy;250 return Tuple6(0x0000000000000000000000000000000000000000, 0);251=======252 function collectionSponsor() public view returns (Tuple19 memory) {253 require(false, stub_error);254 dummy;255 return Tuple19(0x0000000000000000000000000000000000000000, 0);256>>>>>>> feat: add `EthCrossAccount` type257=======258 function collectionSponsor() public view returns (Tuple8 memory) {259 require(false, stub_error);260 dummy;261 return Tuple8(0x0000000000000000000000000000000000000000, 0);262>>>>>>> feat: Add custum signature with unlimited nesting.263 }264265 /// Set limits for the collection.266 /// @dev Throws error if limit not found.267 /// @param limit Name of the limit. Valid names:268 /// "accountTokenOwnershipLimit",269 /// "sponsoredDataSize",270 /// "sponsoredDataRateLimit",271 /// "tokenLimit",272 /// "sponsorTransferTimeout",273 /// "sponsorApproveTimeout"274 /// @param value Value of the limit.275 /// @dev EVM selector for this function is: 0x6a3841db,276 /// or in textual repr: setCollectionLimit(string,uint32)277 function setCollectionLimit(string memory limit, uint32 value) public {278 require(false, stub_error);279 limit;280 value;281 dummy = 0;282 }283284 /// Set limits for the collection.285 /// @dev Throws error if limit not found.286 /// @param limit Name of the limit. Valid names:287 /// "ownerCanTransfer",288 /// "ownerCanDestroy",289 /// "transfersEnabled"290 /// @param value Value of the limit.291 /// @dev EVM selector for this function is: 0x993b7fba,292 /// or in textual repr: setCollectionLimit(string,bool)293 function setCollectionLimit(string memory limit, bool value) public {294 require(false, stub_error);295 limit;296 value;297 dummy = 0;298 }299300 /// Get contract address.301 /// @dev EVM selector for this function is: 0xf6b4dfb4,302 /// or in textual repr: contractAddress()303 function contractAddress() public view returns (address) {304 require(false, stub_error);305 dummy;306 return 0x0000000000000000000000000000000000000000;307 }308309 /// Add collection admin.310 /// @param newAdmin Cross account administrator address.311 /// @dev EVM selector for this function is: 0x62e3c7c2,312 /// or in textual repr: addCollectionAdminCross((address,uint256))313 function addCollectionAdminCross(Tuple6 memory newAdmin) public {314 require(false, stub_error);315 newAdmin;316 dummy = 0;317 }318319 /// Remove collection admin.320 /// @param admin Cross account administrator address.321 /// @dev EVM selector for this function is: 0x810d1503,322 /// or in textual repr: removeCollectionAdminCross((address,uint256))323 function removeCollectionAdminCross(Tuple6 memory admin) public {324 require(false, stub_error);325 admin;326 dummy = 0;327 }328329 /// Add collection admin.330 /// @param newAdmin Address of the added administrator.331 /// @dev EVM selector for this function is: 0x92e462c7,332 /// or in textual repr: addCollectionAdmin(address)333 function addCollectionAdmin(address newAdmin) public {334 require(false, stub_error);335 newAdmin;336 dummy = 0;337 }338339 /// Remove collection admin.340 ///341 /// @param admin Address of the removed administrator.342 /// @dev EVM selector for this function is: 0xfafd7b42,343 /// or in textual repr: removeCollectionAdmin(address)344 function removeCollectionAdmin(address admin) public {345 require(false, stub_error);346 admin;347 dummy = 0;348 }349350 /// Toggle accessibility of collection nesting.351 ///352 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'353 /// @dev EVM selector for this function is: 0x112d4586,354 /// or in textual repr: setCollectionNesting(bool)355 function setCollectionNesting(bool enable) public {356 require(false, stub_error);357 enable;358 dummy = 0;359 }360361 /// Toggle accessibility of collection nesting.362 ///363 /// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'364 /// @param collections Addresses of collections that will be available for nesting.365 /// @dev EVM selector for this function is: 0x112d4586,366 /// or in textual repr: setCollectionNesting(bool,address[])367 function setCollectionNesting(bool enable, address[] memory collections) public {368 require(false, stub_error);369 enable;370 collections;371 dummy = 0;372 }373374 /// Set the collection access method.375 /// @param mode Access mode376 /// 0 for Normal377 /// 1 for AllowList378 /// @dev EVM selector for this function is: 0x41835d4c,379 /// or in textual repr: setCollectionAccess(uint8)380 function setCollectionAccess(uint8 mode) public {381 require(false, stub_error);382 mode;383 dummy = 0;384 }385386 /// Checks that user allowed to operate with collection.387 ///388 /// @param user User address to check.389 /// @dev EVM selector for this function is: 0xd63a8e11,390 /// or in textual repr: allowed(address)391 function allowed(address user) public view returns (bool) {392 require(false, stub_error);393 user;394 dummy;395 return false;396 }397398 /// Add the user to the allowed list.399 ///400 /// @param user Address of a trusted user.401 /// @dev EVM selector for this function is: 0x67844fe6,402 /// or in textual repr: addToCollectionAllowList(address)403 function addToCollectionAllowList(address user) public {404 require(false, stub_error);405 user;406 dummy = 0;407 }408409 /// Add user to allowed list.410 ///411 /// @param user User cross account address.412 /// @dev EVM selector for this function is: 0xf074da88,413 /// or in textual repr: addToCollectionAllowListCross((address,uint256))414 function addToCollectionAllowListCross(Tuple6 memory user) public {415 require(false, stub_error);416 user;417 dummy = 0;418 }419420 /// Remove the user from the allowed list.421 ///422 /// @param user Address of a removed user.423 /// @dev EVM selector for this function is: 0x85c51acb,424 /// or in textual repr: removeFromCollectionAllowList(address)425 function removeFromCollectionAllowList(address user) public {426 require(false, stub_error);427 user;428 dummy = 0;429 }430431 /// Remove user from allowed list.432 ///433 /// @param user User cross account address.434 /// @dev EVM selector for this function is: 0xc00df45c,435 /// or in textual repr: removeFromCollectionAllowListCross((address,uint256))436 function removeFromCollectionAllowListCross(Tuple6 memory user) public {437 require(false, stub_error);438 user;439 dummy = 0;440 }441442 /// Switch permission for minting.443 ///444 /// @param mode Enable if "true".445 /// @dev EVM selector for this function is: 0x00018e84,446 /// or in textual repr: setCollectionMintMode(bool)447 function setCollectionMintMode(bool mode) public {448 require(false, stub_error);449 mode;450 dummy = 0;451 }452453 /// Check that account is the owner or admin of the collection454 ///455 /// @param user account to verify456 /// @return "true" if account is the owner or admin457 /// @dev EVM selector for this function is: 0x9811b0c7,458 /// or in textual repr: isOwnerOrAdmin(address)459 function isOwnerOrAdmin(address user) public view returns (bool) {460 require(false, stub_error);461 user;462 dummy;463 return false;464 }465466 /// Check that account is the owner or admin of the collection467 ///468 /// @param user User cross account to verify469 /// @return "true" if account is the owner or admin470 /// @dev EVM selector for this function is: 0x5aba3351,471 /// or in textual repr: isOwnerOrAdminCross((address,uint256))472 function isOwnerOrAdminCross(Tuple6 memory user) public view returns (bool) {473 require(false, stub_error);474 user;475 dummy;476 return false;477 }478479 /// Returns collection type480 ///481 /// @return `Fungible` or `NFT` or `ReFungible`482 /// @dev EVM selector for this function is: 0xd34b55b8,483 /// or in textual repr: uniqueCollectionType()484 function uniqueCollectionType() public view returns (string memory) {485 require(false, stub_error);486 dummy;487 return "";488 }489490 /// Get collection owner.491 ///492 /// @return Tuble with sponsor address and his substrate mirror.493 /// If address is canonical then substrate mirror is zero and vice versa.494 /// @dev EVM selector for this function is: 0xdf727d3b,495 /// or in textual repr: collectionOwner()496<<<<<<< HEAD497<<<<<<< HEAD498 function collectionOwner() public view returns (Tuple6 memory) {499 require(false, stub_error);500 dummy;501 return Tuple6(0x0000000000000000000000000000000000000000, 0);502=======503 function collectionOwner() public view returns (Tuple19 memory) {504 require(false, stub_error);505 dummy;506 return Tuple19(0x0000000000000000000000000000000000000000, 0);507>>>>>>> feat: add `EthCrossAccount` type508=======509 function collectionOwner() public view returns (Tuple8 memory) {510 require(false, stub_error);511 dummy;512 return Tuple8(0x0000000000000000000000000000000000000000, 0);513>>>>>>> feat: Add custum signature with unlimited nesting.514 }515516 /// Changes collection owner to another account517 ///518 /// @dev Owner can be changed only by current owner519 /// @param newOwner new owner account520 /// @dev EVM selector for this function is: 0x4f53e226,521 /// or in textual repr: changeCollectionOwner(address)522 function changeCollectionOwner(address newOwner) public {523 require(false, stub_error);524 newOwner;525 dummy = 0;526 }527528 /// Get collection administrators529 ///530 /// @return Vector of tuples with admins address and his substrate mirror.531 /// If address is canonical then substrate mirror is zero and vice versa.532 /// @dev EVM selector for this function is: 0x5813216b,533 /// or in textual repr: collectionAdmins()534 function collectionAdmins() public view returns (Tuple6[] memory) {535 require(false, stub_error);536 dummy;537 return new Tuple6[](0);538 }539540 /// Changes collection owner to another account541 ///542 /// @dev Owner can be changed only by current owner543 /// @param newOwner new owner cross account544 /// @dev EVM selector for this function is: 0xbdff793d,545 /// or in textual repr: setOwnerCross((address,uint256))546 function setOwnerCross(Tuple6 memory newOwner) public {547 require(false, stub_error);548 newOwner;549 dummy = 0;550 }551}552553<<<<<<< HEAD554/// @dev anonymous struct555struct Tuple19 {556 address field_0;557 uint256 field_1;558}559560/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension561/// @dev See https://eips.ethereum.org/EIPS/eip-721562/// @dev the ERC-165 identifier for this interface is 0x5b5e139f563contract ERC721Metadata is Dummy, ERC165 {564 // /// @notice A descriptive name for a collection of NFTs in this contract565 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`566 // /// @dev EVM selector for this function is: 0x06fdde03,567 // /// or in textual repr: name()568 // function name() public view returns (string memory) {569 // require(false, stub_error);570 // dummy;571 // return "";572 // }573574 // /// @notice An abbreviated name for NFTs in this contract575 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`576 // /// @dev EVM selector for this function is: 0x95d89b41,577 // /// or in textual repr: symbol()578 // function symbol() public view returns (string memory) {579 // require(false, stub_error);580 // dummy;581 // return "";582 // }583584 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.585 ///586 /// @dev If the token has a `url` property and it is not empty, it is returned.587 /// Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.588 /// If the collection property `baseURI` is empty or absent, return "" (empty string)589 /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix590 /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).591 ///592 /// @return token's const_metadata593 /// @dev EVM selector for this function is: 0xc87b56dd,594 /// or in textual repr: tokenURI(uint256)595 function tokenURI(uint256 tokenId) public view returns (string memory) {596 require(false, stub_error);597 tokenId;598 dummy;599 return "";600 }601}602603=======604>>>>>>> feat: Add custum signature with unlimited nesting.605/// @title ERC721 Token that can be irreversibly burned (destroyed).606/// @dev the ERC-165 identifier for this interface is 0x42966c68607contract ERC721Burnable is Dummy, ERC165 {608 /// @notice Burns a specific ERC721 token.609 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized610 /// operator of the current owner.611 /// @param tokenId The NFT to approve612 /// @dev EVM selector for this function is: 0x42966c68,613 /// or in textual repr: burn(uint256)614 function burn(uint256 tokenId) public {615 require(false, stub_error);616 tokenId;617 dummy = 0;618 }619}620621/// @dev inlined interface622contract ERC721UniqueMintableEvents {623 event MintingFinished();624}625626/// @title ERC721 minting logic.627/// @dev the ERC-165 identifier for this interface is 0x476ff149628contract ERC721UniqueMintable is Dummy, ERC165, ERC721UniqueMintableEvents {629 /// @dev EVM selector for this function is: 0x05d2035b,630 /// or in textual repr: mintingFinished()631 function mintingFinished() public view returns (bool) {632 require(false, stub_error);633 dummy;634 return false;635 }636637 /// @notice Function to mint token.638 /// @param to The new owner639 /// @return uint256 The id of the newly minted token640 /// @dev EVM selector for this function is: 0x6a627842,641 /// or in textual repr: mint(address)642 function mint(address to) public returns (uint256) {643 require(false, stub_error);644 to;645 dummy = 0;646 return 0;647 }648649 // /// @notice Function to mint token.650 // /// @dev `tokenId` should be obtained with `nextTokenId` method,651 // /// unlike standard, you can't specify it manually652 // /// @param to The new owner653 // /// @param tokenId ID of the minted NFT654 // /// @dev EVM selector for this function is: 0x40c10f19,655 // /// or in textual repr: mint(address,uint256)656 // function mint(address to, uint256 tokenId) public returns (bool) {657 // require(false, stub_error);658 // to;659 // tokenId;660 // dummy = 0;661 // return false;662 // }663664 /// @notice Function to mint token with the given tokenUri.665 /// @param to The new owner666 /// @param tokenUri Token URI that would be stored in the NFT properties667 /// @return uint256 The id of the newly minted token668 /// @dev EVM selector for this function is: 0x45c17782,669 /// or in textual repr: mintWithTokenURI(address,string)670 function mintWithTokenURI(address to, string memory tokenUri) public returns (uint256) {671 require(false, stub_error);672 to;673 tokenUri;674 dummy = 0;675 return 0;676 }677678 // /// @notice Function to mint token with the given tokenUri.679 // /// @dev `tokenId` should be obtained with `nextTokenId` method,680 // /// unlike standard, you can't specify it manually681 // /// @param to The new owner682 // /// @param tokenId ID of the minted NFT683 // /// @param tokenUri Token URI that would be stored in the NFT properties684 // /// @dev EVM selector for this function is: 0x50bb4e7f,685 // /// or in textual repr: mintWithTokenURI(address,uint256,string)686 // function mintWithTokenURI(address to, uint256 tokenId, string memory tokenUri) public returns (bool) {687 // require(false, stub_error);688 // to;689 // tokenId;690 // tokenUri;691 // dummy = 0;692 // return false;693 // }694695 /// @dev Not implemented696 /// @dev EVM selector for this function is: 0x7d64bcb4,697 /// or in textual repr: finishMinting()698 function finishMinting() public returns (bool) {699 require(false, stub_error);700 dummy = 0;701 return false;702 }703}704705/// @title Unique extensions for ERC721.706<<<<<<< HEAD707/// @dev the ERC-165 identifier for this interface is 0x244543ee708=======709/// @dev the ERC-165 identifier for this interface is 0xcc97cb35710>>>>>>> feat: Add custum signature with unlimited nesting.711contract ERC721UniqueExtensions is Dummy, ERC165 {712 /// @notice A descriptive name for a collection of NFTs in this contract713 /// @dev EVM selector for this function is: 0x06fdde03,714 /// or in textual repr: name()715 function name() public view returns (string memory) {716 require(false, stub_error);717 dummy;718 return "";719 }720721 /// @notice An abbreviated name for NFTs in this contract722 /// @dev EVM selector for this function is: 0x95d89b41,723 /// or in textual repr: symbol()724 function symbol() public view returns (string memory) {725 require(false, stub_error);726 dummy;727 return "";728 }729730 /// @notice Set or reaffirm the approved address for an NFT731 /// @dev The zero address indicates there is no approved address.732 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized733 /// operator of the current owner.734 /// @param approved The new substrate address approved NFT controller735 /// @param tokenId The NFT to approve736 /// @dev EVM selector for this function is: 0x106fdb59,737 /// or in textual repr: approveCross((address,uint256),uint256)738 function approveCross(Tuple6 memory approved, uint256 tokenId) public {739 require(false, stub_error);740 approved;741 tokenId;742 dummy = 0;743 }744745 /// @notice Transfer ownership of an NFT746 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`747 /// is the zero address. Throws if `tokenId` is not a valid NFT.748 /// @param to The new owner749 /// @param tokenId The NFT to transfer750 /// @dev EVM selector for this function is: 0xa9059cbb,751 /// or in textual repr: transfer(address,uint256)752 function transfer(address to, uint256 tokenId) public {753 require(false, stub_error);754 to;755 tokenId;756 dummy = 0;757 }758759 /// @notice Transfer ownership of an NFT from cross account address to cross account address760 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`761 /// is the zero address. Throws if `tokenId` is not a valid NFT.762 /// @param from Cross acccount address of current owner763 /// @param to Cross acccount address of new owner764 /// @param tokenId The NFT to transfer765 /// @dev EVM selector for this function is: 0xd5cf430b,766 /// or in textual repr: transferFromCross(EthCrossAccount,EthCrossAccount,uint256)767 function transferFromCross(768<<<<<<< HEAD769 Tuple6 memory from,770 Tuple6 memory to,771=======772 EthCrossAccount memory from,773 EthCrossAccount memory to,774>>>>>>> feat: Add custum signature with unlimited nesting.775 uint256 tokenId776 ) public {777 require(false, stub_error);778 from;779 to;780 tokenId;781 dummy = 0;782 }783784 /// @notice Burns a specific ERC721 token.785 /// @dev Throws unless `msg.sender` is the current owner or an authorized786 /// operator for this NFT. Throws if `from` is not the current owner. Throws787 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.788 /// @param from The current owner of the NFT789 /// @param tokenId The NFT to transfer790 /// @dev EVM selector for this function is: 0x79cc6790,791 /// or in textual repr: burnFrom(address,uint256)792 function burnFrom(address from, uint256 tokenId) public {793 require(false, stub_error);794 from;795 tokenId;796 dummy = 0;797 }798799 /// @notice Burns a specific ERC721 token.800 /// @dev Throws unless `msg.sender` is the current owner or an authorized801 /// operator for this NFT. Throws if `from` is not the current owner. Throws802 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.803 /// @param from The current owner of the NFT804 /// @param tokenId The NFT to transfer805 /// @dev EVM selector for this function is: 0xa8106d4a,806 /// or in textual repr: burnFromCross((address,uint256),uint256)807 function burnFromCross(Tuple6 memory from, uint256 tokenId) public {808 require(false, stub_error);809 from;810 tokenId;811 dummy = 0;812 }813814 /// @notice Returns next free NFT ID.815 /// @dev EVM selector for this function is: 0x75794a3c,816 /// or in textual repr: nextTokenId()817 function nextTokenId() public view returns (uint256) {818 require(false, stub_error);819 dummy;820 return 0;821 }822 // /// @notice Function to mint multiple tokens.823 // /// @dev `tokenIds` should be an array of consecutive numbers and first number824 // /// should be obtained with `nextTokenId` method825 // /// @param to The new owner826 // /// @param tokenIds IDs of the minted NFTs827 // /// @dev EVM selector for this function is: 0x44a9945e,828 // /// or in textual repr: mintBulk(address,uint256[])829 // function mintBulk(address to, uint256[] memory tokenIds) public returns (bool) {830 // require(false, stub_error);831 // to;832 // tokenIds;833 // dummy = 0;834 // return false;835 // }836837 // /// @notice Function to mint multiple tokens with the given tokenUris.838 // /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive839 // /// numbers and first number should be obtained with `nextTokenId` method840 // /// @param to The new owner841 // /// @param tokens array of pairs of token ID and token URI for minted tokens842 // /// @dev EVM selector for this function is: 0x36543006,843 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])844 // function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) public returns (bool) {845 // require(false, stub_error);846 // to;847 // tokens;848 // dummy = 0;849 // return false;850 // }851852<<<<<<< HEAD853}854855/// @dev anonymous struct856struct Tuple8 {857=======858 /// @notice Function to mint multiple tokens.859 /// @dev `tokenIds` should be an array of consecutive numbers and first number860 /// should be obtained with `nextTokenId` method861 /// @param to The new owner862 /// @param tokenIds IDs of the minted NFTs863 /// @dev EVM selector for this function is: 0xf9d9a5a3,864 /// or in textual repr: mintBulk(address,uint256[])865 function mintBulk(address to, uint256[] memory tokenIds) public returns (bool) {866 require(false, stub_error);867 to;868 tokenIds;869 dummy = 0;870 return false;871 }872873 /// @notice Function to mint multiple tokens with the given tokenUris.874 /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive875 /// numbers and first number should be obtained with `nextTokenId` method876 /// @param to The new owner877 /// @param tokens array of pairs of token ID and token URI for minted tokens878 /// @dev EVM selector for this function is: 0xfd4e2a99,879 /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])880 function mintBulkWithTokenURI(address to, Tuple12[] memory tokens) public returns (bool) {881 require(false, stub_error);882 to;883 tokens;884 dummy = 0;885 return false;886 }887}888889/// @dev anonymous struct890struct Tuple12 {891>>>>>>> feat: Add custum signature with unlimited nesting.892 uint256 field_0;893 string field_1;894}895896<<<<<<< HEAD897/// @dev anonymous struct898struct Tuple6 {899 address field_0;900 uint256 field_1;901=======902/// @dev Cross account struct903struct EthCrossAccount {904 address eth;905 uint256 sub;906>>>>>>> feat: add `EthCrossAccount` type907}908909/// @dev anonymous struct910struct Tuple8 {911 address field_0;912 uint256 field_1;913}914915/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension916/// @dev See https://eips.ethereum.org/EIPS/eip-721917/// @dev the ERC-165 identifier for this interface is 0x780e9d63918contract ERC721Enumerable is Dummy, ERC165 {919 /// @notice Enumerate valid NFTs920 /// @param index A counter less than `totalSupply()`921 /// @return The token identifier for the `index`th NFT,922 /// (sort order not specified)923 /// @dev EVM selector for this function is: 0x4f6ccce7,924 /// or in textual repr: tokenByIndex(uint256)925 function tokenByIndex(uint256 index) public view returns (uint256) {926 require(false, stub_error);927 index;928 dummy;929 return 0;930 }931932 /// @dev Not implemented933 /// @dev EVM selector for this function is: 0x2f745c59,934 /// or in textual repr: tokenOfOwnerByIndex(address,uint256)935 function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {936 require(false, stub_error);937 owner;938 index;939 dummy;940 return 0;941 }942943 /// @notice Count NFTs tracked by this contract944 /// @return A count of valid NFTs tracked by this contract, where each one of945 /// them has an assigned and queryable owner not equal to the zero address946 /// @dev EVM selector for this function is: 0x18160ddd,947 /// or in textual repr: totalSupply()948 function totalSupply() public view returns (uint256) {949 require(false, stub_error);950 dummy;951 return 0;952 }953}954955/// @dev inlined interface956contract ERC721Events {957 event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);958 event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);959 event ApprovalForAll(address indexed owner, address indexed operator, bool approved);960}961962/// @title ERC-721 Non-Fungible Token Standard963/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md964/// @dev the ERC-165 identifier for this interface is 0x80ac58cd965contract ERC721 is Dummy, ERC165, ERC721Events {966 /// @notice Count all NFTs assigned to an owner967 /// @dev NFTs assigned to the zero address are considered invalid, and this968 /// function throws for queries about the zero address.969 /// @param owner An address for whom to query the balance970 /// @return The number of NFTs owned by `owner`, possibly zero971 /// @dev EVM selector for this function is: 0x70a08231,972 /// or in textual repr: balanceOf(address)973 function balanceOf(address owner) public view returns (uint256) {974 require(false, stub_error);975 owner;976 dummy;977 return 0;978 }979980 /// @notice Find the owner of an NFT981 /// @dev NFTs assigned to zero address are considered invalid, and queries982 /// about them do throw.983 /// @param tokenId The identifier for an NFT984 /// @return The address of the owner of the NFT985 /// @dev EVM selector for this function is: 0x6352211e,986 /// or in textual repr: ownerOf(uint256)987 function ownerOf(uint256 tokenId) public view returns (address) {988 require(false, stub_error);989 tokenId;990 dummy;991 return 0x0000000000000000000000000000000000000000;992 }993994 /// @dev Not implemented995 /// @dev EVM selector for this function is: 0xb88d4fde,996 /// or in textual repr: safeTransferFrom(address,address,uint256,bytes)997 function safeTransferFrom(998 address from,999 address to,1000 uint256 tokenId,1001 bytes memory data1002 ) public {1003 require(false, stub_error);1004 from;1005 to;1006 tokenId;1007 data;1008 dummy = 0;1009 }10101011 /// @dev Not implemented1012 /// @dev EVM selector for this function is: 0x42842e0e,1013 /// or in textual repr: safeTransferFrom(address,address,uint256)1014 function safeTransferFrom(1015 address from,1016 address to,1017 uint256 tokenId1018 ) public {1019 require(false, stub_error);1020 from;1021 to;1022 tokenId;1023 dummy = 0;1024 }10251026 /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE1027 /// TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE1028 /// THEY MAY BE PERMANENTLY LOST1029 /// @dev Throws unless `msg.sender` is the current owner or an authorized1030 /// operator for this NFT. Throws if `from` is not the current owner. Throws1031 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.1032 /// @param from The current owner of the NFT1033 /// @param to The new owner1034 /// @param tokenId The NFT to transfer1035 /// @dev EVM selector for this function is: 0x23b872dd,1036 /// or in textual repr: transferFrom(address,address,uint256)1037 function transferFrom(1038 address from,1039 address to,1040 uint256 tokenId1041 ) public {1042 require(false, stub_error);1043 from;1044 to;1045 tokenId;1046 dummy = 0;1047 }10481049 /// @notice Set or reaffirm the approved address for an NFT1050 /// @dev The zero address indicates there is no approved address.1051 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized1052 /// operator of the current owner.1053 /// @param approved The new approved NFT controller1054 /// @param tokenId The NFT to approve1055 /// @dev EVM selector for this function is: 0x095ea7b3,1056 /// or in textual repr: approve(address,uint256)1057 function approve(address approved, uint256 tokenId) public {1058 require(false, stub_error);1059 approved;1060 tokenId;1061 dummy = 0;1062 }10631064 /// @dev Not implemented1065 /// @dev EVM selector for this function is: 0xa22cb465,1066 /// or in textual repr: setApprovalForAll(address,bool)1067 function setApprovalForAll(address operator, bool approved) public {1068 require(false, stub_error);1069 operator;1070 approved;1071 dummy = 0;1072 }10731074 /// @dev Not implemented1075 /// @dev EVM selector for this function is: 0x081812fc,1076 /// or in textual repr: getApproved(uint256)1077 function getApproved(uint256 tokenId) public view returns (address) {1078 require(false, stub_error);1079 tokenId;1080 dummy;1081 return 0x0000000000000000000000000000000000000000;1082 }10831084 /// @dev Not implemented1085 /// @dev EVM selector for this function is: 0xe985e9c5,1086 /// or in textual repr: isApprovedForAll(address,address)1087 function isApprovedForAll(address owner, address operator) public view returns (address) {1088 require(false, stub_error);1089 owner;1090 operator;1091 dummy;1092 return 0x0000000000000000000000000000000000000000;1093 }1094}10951096contract UniqueNFT is1097 Dummy,1098 ERC165,1099 ERC721,1100 ERC721Enumerable,1101 ERC721UniqueExtensions,1102 ERC721UniqueMintable,1103 ERC721Burnable,1104 ERC721Metadata,1105 Collection,1106 TokenProperties1107{}pallets/refungible/src/erc.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -26,7 +26,15 @@
char::{REPLACEMENT_CHARACTER, decode_utf16},
convert::TryInto,
};
-use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};
+use evm_coder::{
+ ToLog,
+ execution::*,
+ generate_stubgen, solidity, solidity_interface,
+ types::*,
+ weight,
+ custom_signature::{FunctionName, FunctionSignature},
+ make_signature,
+};
use frame_support::{BoundedBTreeMap, BoundedVec};
use pallet_common::{
CollectionHandle, CollectionPropertyPermissions,
pallets/refungible/src/erc_token.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc_token.rs
+++ b/pallets/refungible/src/erc_token.rs
@@ -29,7 +29,15 @@
convert::TryInto,
ops::Deref,
};
-use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight};
+use evm_coder::{
+ ToLog,
+ execution::*,
+ generate_stubgen, solidity_interface,
+ types::*,
+ weight,
+ custom_signature::{FunctionName, FunctionSignature},
+ make_signature,
+};
use pallet_common::{
CommonWeightInfo,
erc::{CommonEvmHandler, PrecompileResult},
pallets/unique/src/eth/mod.rsdiffbeforeafterboth--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -18,7 +18,13 @@
use core::marker::PhantomData;
use ethereum as _;
-use evm_coder::{execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};
+use evm_coder::{
+ execution::*,
+ generate_stubgen, solidity, solidity_interface,
+ types::*,
+ custom_signature::{FunctionName, FunctionSignature},
+ make_signature,
+, weight};
use frame_support::{traits::Get, storage::StorageNMap};
use crate::sp_api_hidden_includes_decl_storage::hidden_include::StorageDoubleMap;
use crate::Pallet;
tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -70,7 +70,11 @@
}
/// @title A contract that allows you to work with collections.
+<<<<<<< HEAD
/// @dev the ERC-165 identifier for this interface is 0xb3152af3
+=======
+/// @dev the ERC-165 identifier for this interface is 0x674be726
+>>>>>>> feat: Add custum signature with unlimited nesting.
interface Collection is Dummy, ERC165 {
/// Set collection property.
///
@@ -133,7 +137,7 @@
/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
///
/// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.
- /// @dev EVM selector for this function is: 0x84a1d5a8,
+ /// @dev EVM selector for this function is: 0x403e96a7,
/// or in textual repr: setCollectionSponsorCross((address,uint256))
function setCollectionSponsorCross(Tuple6 memory sponsor) external;
@@ -193,13 +197,13 @@
/// Add collection admin.
/// @param newAdmin Cross account administrator address.
- /// @dev EVM selector for this function is: 0x859aa7d6,
+ /// @dev EVM selector for this function is: 0x62e3c7c2,
/// or in textual repr: addCollectionAdminCross((address,uint256))
function addCollectionAdminCross(Tuple6 memory newAdmin) external;
/// Remove collection admin.
/// @param admin Cross account administrator address.
- /// @dev EVM selector for this function is: 0x6c0cd173,
+ /// @dev EVM selector for this function is: 0x810d1503,
/// or in textual repr: removeCollectionAdminCross((address,uint256))
function removeCollectionAdminCross(Tuple6 memory admin) external;
@@ -227,7 +231,7 @@
///
/// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
/// @param collections Addresses of collections that will be available for nesting.
- /// @dev EVM selector for this function is: 0x64872396,
+ /// @dev EVM selector for this function is: 0x112d4586,
/// or in textual repr: setCollectionNesting(bool,address[])
function setCollectionNesting(bool enable, address[] memory collections) external;
@@ -256,7 +260,7 @@
/// Add user to allowed list.
///
/// @param user User cross account address.
- /// @dev EVM selector for this function is: 0xa0184a3a,
+ /// @dev EVM selector for this function is: 0xf074da88,
/// or in textual repr: addToCollectionAllowListCross((address,uint256))
function addToCollectionAllowListCross(Tuple6 memory user) external;
@@ -270,7 +274,7 @@
/// Remove user from allowed list.
///
/// @param user User cross account address.
- /// @dev EVM selector for this function is: 0x09ba452a,
+ /// @dev EVM selector for this function is: 0xc00df45c,
/// or in textual repr: removeFromCollectionAllowListCross((address,uint256))
function removeFromCollectionAllowListCross(Tuple6 memory user) external;
@@ -293,7 +297,7 @@
///
/// @param user User cross account to verify
/// @return "true" if account is the owner or admin
- /// @dev EVM selector for this function is: 0x3e75a905,
+ /// @dev EVM selector for this function is: 0x5aba3351,
/// or in textual repr: isOwnerOrAdminCross((address,uint256))
function isOwnerOrAdminCross(Tuple6 memory user) external view returns (bool);
@@ -332,11 +336,12 @@
///
/// @dev Owner can be changed only by current owner
/// @param newOwner new owner cross account
- /// @dev EVM selector for this function is: 0xe5c9913f,
+ /// @dev EVM selector for this function is: 0xbdff793d,
/// or in textual repr: setOwnerCross((address,uint256))
function setOwnerCross(Tuple6 memory newOwner) external;
}
+<<<<<<< HEAD
/// @dev anonymous struct
struct Tuple19 {
address field_0;
@@ -373,6 +378,8 @@
function tokenURI(uint256 tokenId) external view returns (string memory);
}
+=======
+>>>>>>> feat: Add custum signature with unlimited nesting.
/// @title ERC721 Token that can be irreversibly burned (destroyed).
/// @dev the ERC-165 identifier for this interface is 0x42966c68
interface ERC721Burnable is Dummy, ERC165 {
@@ -438,7 +445,11 @@
}
/// @title Unique extensions for ERC721.
+<<<<<<< HEAD
/// @dev the ERC-165 identifier for this interface is 0x244543ee
+=======
+/// @dev the ERC-165 identifier for this interface is 0xcc97cb35
+>>>>>>> feat: Add custum signature with unlimited nesting.
interface ERC721UniqueExtensions is Dummy, ERC165 {
/// @notice A descriptive name for a collection of NFTs in this contract
/// @dev EVM selector for this function is: 0x06fdde03,
@@ -456,7 +467,7 @@
/// operator of the current owner.
/// @param approved The new substrate address approved NFT controller
/// @param tokenId The NFT to approve
- /// @dev EVM selector for this function is: 0x0ecd0ab0,
+ /// @dev EVM selector for this function is: 0x106fdb59,
/// or in textual repr: approveCross((address,uint256),uint256)
function approveCross(Tuple6 memory approved, uint256 tokenId) external;
@@ -476,10 +487,15 @@
/// @param to Cross acccount address of new owner
/// @param tokenId The NFT to transfer
/// @dev EVM selector for this function is: 0xd5cf430b,
- /// or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)
+ /// or in textual repr: transferFromCross(EthCrossAccount,EthCrossAccount,uint256)
function transferFromCross(
+<<<<<<< HEAD
Tuple6 memory from,
Tuple6 memory to,
+=======
+ EthCrossAccount memory from,
+ EthCrossAccount memory to,
+>>>>>>> feat: Add custum signature with unlimited nesting.
uint256 tokenId
) external;
@@ -499,7 +515,7 @@
/// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.
/// @param from The current owner of the NFT
/// @param tokenId The NFT to transfer
- /// @dev EVM selector for this function is: 0xbb2f5a58,
+ /// @dev EVM selector for this function is: 0xa8106d4a,
/// or in textual repr: burnFromCross((address,uint256),uint256)
function burnFromCross(Tuple6 memory from, uint256 tokenId) external;
@@ -507,6 +523,7 @@
/// @dev EVM selector for this function is: 0x75794a3c,
/// or in textual repr: nextTokenId()
function nextTokenId() external view returns (uint256);
+<<<<<<< HEAD
// /// @notice Function to mint multiple tokens.
// /// @dev `tokenIds` should be an array of consecutive numbers and first number
// /// should be obtained with `nextTokenId` method
@@ -528,6 +545,30 @@
/// @dev anonymous struct
struct Tuple8 {
+=======
+
+ /// @notice Function to mint multiple tokens.
+ /// @dev `tokenIds` should be an array of consecutive numbers and first number
+ /// should be obtained with `nextTokenId` method
+ /// @param to The new owner
+ /// @param tokenIds IDs of the minted NFTs
+ /// @dev EVM selector for this function is: 0xf9d9a5a3,
+ /// or in textual repr: mintBulk(address,uint256[])
+ function mintBulk(address to, uint256[] memory tokenIds) external returns (bool);
+
+ /// @notice Function to mint multiple tokens with the given tokenUris.
+ /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive
+ /// numbers and first number should be obtained with `nextTokenId` method
+ /// @param to The new owner
+ /// @param tokens array of pairs of token ID and token URI for minted tokens
+ /// @dev EVM selector for this function is: 0xfd4e2a99,
+ /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
+ function mintBulkWithTokenURI(address to, Tuple12[] memory tokens) external returns (bool);
+}
+
+/// @dev anonymous struct
+struct Tuple12 {
+>>>>>>> feat: Add custum signature with unlimited nesting.
uint256 field_0;
string field_1;
}
@@ -538,6 +579,12 @@
uint256 field_1;
}
+/// @dev anonymous struct
+struct Tuple8 {
+ address field_0;
+ uint256 field_1;
+}
+
/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
/// @dev See https://eips.ethereum.org/EIPS/eip-721
/// @dev the ERC-165 identifier for this interface is 0x780e9d63
tests/src/eth/nonFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -409,7 +409,7 @@
expect(cost < BigInt(0.2 * Number(helper.balance.getOneTokenNominal())));
});
- itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {
+ itEth.only('Can perform transferFromCross()', async ({helper, privateKey}) => {
const alice = privateKey('//Alice');
const collection = await helper.nft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
tests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -251,10 +251,14 @@
{ "internalType": "uint256", "name": "field_1", "type": "uint256" }
],
<<<<<<< HEAD
+<<<<<<< HEAD
"internalType": "struct Tuple6",
=======
"internalType": "struct Tuple19",
>>>>>>> feat: add `EthCrossAccount` type
+=======
+ "internalType": "struct Tuple8",
+>>>>>>> feat: Add custum signature with unlimited nesting.
"name": "",
"type": "tuple"
}
@@ -263,6 +267,7 @@
"type": "function"
},
{
+<<<<<<< HEAD
"inputs": [
{ "internalType": "string[]", "name": "keys", "type": "string[]" }
],
@@ -278,6 +283,11 @@
"type": "tuple[]"
}
],
+=======
+ "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
+ "name": "collectionProperty",
+ "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
+>>>>>>> feat: Add custum signature with unlimited nesting.
"stateMutability": "view",
"type": "function"
},
@@ -298,10 +308,14 @@
{ "internalType": "uint256", "name": "field_1", "type": "uint256" }
],
<<<<<<< HEAD
+<<<<<<< HEAD
"internalType": "struct Tuple6",
=======
"internalType": "struct Tuple19",
>>>>>>> feat: add `EthCrossAccount` type
+=======
+ "internalType": "struct Tuple8",
+>>>>>>> feat: Add custum signature with unlimited nesting.
"name": "",
"type": "tuple"
}
@@ -324,6 +338,7 @@
"type": "function"
},
{
+<<<<<<< HEAD
"inputs": [
{ "internalType": "string[]", "name": "keys", "type": "string[]" }
],
@@ -333,6 +348,8 @@
"type": "function"
},
{
+=======
+>>>>>>> feat: Add custum signature with unlimited nesting.
"inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
"name": "deleteCollectionProperty",
"outputs": [],
@@ -409,19 +426,64 @@
"type": "function"
},
{
+<<<<<<< HEAD
"inputs": [{ "internalType": "address", "name": "to", "type": "address" }],
"name": "mint",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+=======
+ "inputs": [
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "mint",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+>>>>>>> feat: Add custum signature with unlimited nesting.
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "to", "type": "address" },
+<<<<<<< HEAD
{ "internalType": "string", "name": "tokenUri", "type": "string" }
],
"name": "mintWithTokenURI",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+=======
+ { "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 Tuple12[]",
+ "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" }],
+>>>>>>> feat: Add custum signature with unlimited nesting.
"stateMutability": "nonpayable",
"type": "function"
},
@@ -614,6 +676,7 @@
},
{
"inputs": [
+<<<<<<< HEAD
{
"components": [
{ "internalType": "string", "name": "field_0", "type": "string" },
@@ -623,6 +686,10 @@
"name": "properties",
"type": "tuple[]"
}
+=======
+ { "internalType": "string", "name": "key", "type": "string" },
+ { "internalType": "bytes", "name": "value", "type": "bytes" }
+>>>>>>> feat: Add custum signature with unlimited nesting.
],
"name": "setCollectionProperties",
"outputs": [],
@@ -667,6 +734,7 @@
},
{
"inputs": [
+<<<<<<< HEAD
{
"components": [
{ "internalType": "address", "name": "field_0", "type": "address" },
@@ -676,6 +744,9 @@
"name": "newOwner",
"type": "tuple"
}
+=======
+ { "internalType": "address", "name": "newOwner", "type": "address" }
+>>>>>>> feat: Add custum signature with unlimited nesting.
],
"name": "setOwnerCross",
"outputs": [],
@@ -687,8 +758,13 @@
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" },
{
"components": [
+<<<<<<< HEAD
{ "internalType": "string", "name": "field_0", "type": "string" },
{ "internalType": "bytes", "name": "field_1", "type": "bytes" }
+=======
+ { "internalType": "address", "name": "field_0", "type": "address" },
+ { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+>>>>>>> feat: Add custum signature with unlimited nesting.
],
"internalType": "struct Tuple19[]",
"name": "properties",
@@ -799,8 +875,13 @@
"inputs": [
{
"components": [
+<<<<<<< HEAD
{ "internalType": "address", "name": "field_0", "type": "address" },
{ "internalType": "uint256", "name": "field_1", "type": "uint256" }
+=======
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+>>>>>>> feat: Add custum signature with unlimited nesting.
],
<<<<<<< HEAD
"internalType": "struct Tuple6",
@@ -812,8 +893,13 @@
},
{
"components": [
+<<<<<<< HEAD
{ "internalType": "address", "name": "field_0", "type": "address" },
{ "internalType": "uint256", "name": "field_1", "type": "uint256" }
+=======
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+>>>>>>> feat: Add custum signature with unlimited nesting.
],
<<<<<<< HEAD
"internalType": "struct Tuple6",
tests/src/eth/util/playgrounds/types.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/types.ts
+++ b/tests/src/eth/util/playgrounds/types.ts
@@ -14,10 +14,8 @@
args: { [key: string]: string }
};
export interface TEthCrossAccount {
- readonly 0: string,
- readonly 1: string | Uint8Array,
- readonly field_0: string,
- readonly field_1: string | Uint8Array,
+ readonly eth: string,
+ readonly sub: string | Uint8Array,
}
export type EthProperty = string[];
tests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -364,19 +364,15 @@
export class EthCrossAccountGroup extends EthGroupBase {
fromAddress(address: TEthereumAccount): TEthCrossAccount {
return {
- 0: address,
- 1: '0',
- field_0: address,
- field_1: '0',
+ eth: address,
+ sub: '0',
};
}
fromKeyringPair(keyring: IKeyringPair): TEthCrossAccount {
return {
- 0: '0x0000000000000000000000000000000000000000',
- 1: keyring.addressRaw,
- field_0: '0x0000000000000000000000000000000000000000',
- field_1: keyring.addressRaw,
+ eth: '0x0000000000000000000000000000000000000000',
+ sub: keyring.addressRaw,
};
}
}
@@ -429,7 +425,6 @@
ethAddress: EthAddressGroup;
ethNativeContract: NativeContractGroup;
ethContract: ContractGroup;
- ethCrossAccount: EthCrossAccountGroup;
ethProperty: EthPropertyGroup;
constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {