difftreelog
Merge pull request #743 from UniqueNetwork/feature/mintCross
in: master
added `mintCross` function for `UniqueExtensoins` interfaces
39 files changed
Cargo.lockdiffbeforeafterboth608560856086[[package]]6086[[package]]6087name = "pallet-fungible"6087name = "pallet-fungible"6088version = "0.1.7"6088version = "0.1.9"6089dependencies = [6089dependencies = [6090 "ethereum 0.14.0",6090 "ethereum 0.14.0",6091 "evm-coder",6091 "evm-coder",634263426343[[package]]6343[[package]]6344name = "pallet-nonfungible"6344name = "pallet-nonfungible"6345version = "0.1.11"6345version = "0.1.12"6346dependencies = [6346dependencies = [6347 "ethereum 0.14.0",6347 "ethereum 0.14.0",6348 "evm-coder",6348 "evm-coder",650165016502[[package]]6502[[package]]6503name = "pallet-refungible"6503name = "pallet-refungible"6504version = "0.2.10"6504version = "0.2.11"6505dependencies = [6505dependencies = [6506 "derivative",6506 "derivative",6507 "ethereum 0.14.0",6507 "ethereum 0.14.0",pallets/common/src/erc.rsdiffbeforeafterboth36use crate::{36use crate::{37 Pallet, CollectionHandle, Config, CollectionProperties, SelfWeightOf,37 Pallet, CollectionHandle, Config, CollectionProperties, SelfWeightOf,38 eth::{38 eth::{39 EthCrossAccount, convert_cross_account_to_uint256, CollectionPermissions as EvmPermissions,39 EthCrossAccount, CollectionPermissions as EvmPermissions,40 CollectionLimits as EvmCollectionLimits,40 CollectionLimits as EvmCollectionLimits,41 },41 },42 weights::WeightInfo,42 weights::WeightInfo,289 /// Get current sponsor.289 /// Get current sponsor.290 ///290 ///291 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.291 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.292 fn collection_sponsor(&self) -> Result<(address, uint256)> {292 fn collection_sponsor(&self) -> Result<EthCrossAccount> {293 let sponsor = match self.collection.sponsorship.sponsor() {293 let sponsor = match self.collection.sponsorship.sponsor() {294 Some(sponsor) => sponsor,294 Some(sponsor) => sponsor,295 None => return Ok(Default::default()),295 None => return Ok(Default::default()),296 };296 };297297 let sponsor = T::CrossAccountId::from_sub(sponsor.clone());298 Ok(EthCrossAccount::from_sub::<T>(&sponsor))298 let result: (address, uint256) = if sponsor.is_canonical_substrate() {299 let sponsor = convert_cross_account_to_uint256::<T>(&sponsor);300 (Default::default(), sponsor)301 } else {302 let sponsor = *sponsor.as_eth();303 (sponsor, Default::default())304 };305 Ok(result)306 }299 }307300308 /// Get current collection limits.301 /// Get current collection limits.pallets/common/src/eth.rsdiffbeforeafterboth53 address[0..16] == ETH_COLLECTION_PREFIX53 address[0..16] == ETH_COLLECTION_PREFIX54}54}5556/// Convert `CrossAccountId` to `uint256`.57pub fn convert_cross_account_to_uint256<T: Config>(from: &T::CrossAccountId) -> uint25658where59 T::AccountId: AsRef<[u8; 32]>,60{61 let slice = from.as_sub().as_ref();62 uint256::from_big_endian(slice)63}645565/// Convert `uint256` to `CrossAccountId`.56/// Convert `uint256` to `CrossAccountId`.66pub fn convert_uint256_to_cross_account<T: Config>(from: uint256) -> T::CrossAccountId57pub fn convert_uint256_to_cross_account<T: Config>(from: uint256) -> T::CrossAccountId73 T::CrossAccountId::from_sub(account_id)64 T::CrossAccountId::from_sub(account_id)74}65}7576/// Convert `CrossAccountId` to `(address, uint256)`.77pub fn convert_cross_account_to_tuple<T: Config>(78 cross_account_id: &T::CrossAccountId,79) -> (address, uint256)80where81 T::AccountId: AsRef<[u8; 32]>,82{83 if cross_account_id.is_canonical_substrate() {84 let sub = convert_cross_account_to_uint256::<T>(cross_account_id);85 (Default::default(), sub)86 } else {87 let eth = *cross_account_id.as_eth();88 (eth, Default::default())89 }90}9192/// Convert tuple `(address, uint256)` to `CrossAccountId`.93///94/// If `address` in the tuple has *default* value, then the canonical form is substrate,95/// if `uint256` has *default* value, then the ethereum form is canonical,96/// if both values are *default* or *non default*, then this is considered an invalid address and `Error` is returned.97pub fn convert_tuple_to_cross_account<T: Config>(98 eth_cross_account_id: (address, uint256),99) -> evm_coder::execution::Result<T::CrossAccountId>100where101 T::AccountId: From<[u8; 32]>,102{103 if eth_cross_account_id == Default::default() {104 Err("All fields of cross account is zeroed".into())105 } else if eth_cross_account_id.0 == Default::default() {106 Ok(convert_uint256_to_cross_account::<T>(107 eth_cross_account_id.1,108 ))109 } else if eth_cross_account_id.1 == Default::default() {110 Ok(T::CrossAccountId::from_eth(eth_cross_account_id.0))111 } else {112 Err("All fields of cross account is non zeroed".into())113 }114}11566116/// Cross account struct67/// Cross account struct117#[derive(Debug, Default, AbiCoder)]68#[derive(Debug, Default, AbiCoder)]121}72}12273123impl EthCrossAccount {74impl EthCrossAccount {75 /// Converts `CrossAccountId` to `EthCrossAccountId`124 pub fn from_sub_cross_account<T>(cross_account_id: &T::CrossAccountId) -> Self76 pub fn from_sub_cross_account<T>(cross_account_id: &T::CrossAccountId) -> Self125 where77 where126 T: pallet_evm::Config,78 T: pallet_evm::Config,127 T::AccountId: AsRef<[u8; 32]>,79 T::AccountId: AsRef<[u8; 32]>,128 {80 {129 if cross_account_id.is_canonical_substrate() {81 if cross_account_id.is_canonical_substrate() {130 Self {82 Self::from_sub::<T>(cross_account_id.as_sub())131 eth: Default::default(),132 sub: convert_cross_account_to_uint256::<T>(cross_account_id),133 }134 } else {83 } else {135 Self {84 Self {136 eth: *cross_account_id.as_eth(),85 eth: *cross_account_id.as_eth(),137 sub: Default::default(),86 sub: Default::default(),138 }87 }139 }88 }140 }89 }14190 /// Creates `EthCrossAccount` from substrate account91 pub fn from_sub<T>(account_id: &T::AccountId) -> Self92 where93 T: pallet_evm::Config,94 T::AccountId: AsRef<[u8; 32]>,95 {96 Self {97 eth: Default::default(),98 sub: uint256::from_big_endian(account_id.as_ref()),99 }100 }101 /// Converts `EthCrossAccount` to `CrossAccountId`142 pub fn into_sub_cross_account<T>(&self) -> evm_coder::execution::Result<T::CrossAccountId>102 pub fn into_sub_cross_account<T>(&self) -> evm_coder::execution::Result<T::CrossAccountId>143 where103 where144 T: pallet_evm::Config,104 T: pallet_evm::Config,180 /// Is it possible to send tokens from this collection between users.148 /// Is it possible to send tokens from this collection between users.181 TransferEnabled,149 TransferEnabled,182}150}151/// Ethereum representation of `NestingPermissions` (see [`up_data_structs::NestingPermissions`]) fields as an enumeration.183#[derive(Default, Debug, Clone, Copy, AbiCoder)]152#[derive(Default, Debug, Clone, Copy, AbiCoder)]184#[repr(u8)]153#[repr(u8)]185pub enum CollectionPermissions {154pub enum CollectionPermissions {155 /// Owner of token can nest tokens under it.186 #[default]156 #[default]187 CollectionAdmin,188 TokenOwner,157 TokenOwner,158159 /// Admin of token collection can nest tokens under token.160 CollectionAdmin,189}161}190162191/// Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.163/// Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.pallets/evm-contract-helpers/Cargo.tomldiffbeforeafterboth50 "pallet-evm-coder-substrate/std",50 "pallet-evm-coder-substrate/std",51 "pallet-evm/std",51 "pallet-evm/std",52 "up-sponsorship/std",52 "up-sponsorship/std",53 "pallet-common/std",53]54]54try-runtime = ["frame-support/try-runtime"]55try-runtime = ["frame-support/try-runtime"]55stubgen = ["evm-coder/stubgen"]56stubgen = ["evm-coder/stubgen", "pallet-common/stubgen"]5657pallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth25 types::*,25 types::*,26 ToLog,26 ToLog,27};27};28use pallet_common::eth::EthCrossAccount;28use pallet_evm::{29use pallet_evm::{29 ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure, PrecompileHandle,30 ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure, PrecompileHandle,30 account::CrossAccountId,31 account::CrossAccountId,174 ///175 ///175 /// @param contractAddress The contract for which a sponsor is requested.176 /// @param contractAddress The contract for which a sponsor is requested.176 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.177 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.177 fn sponsor(&self, contract_address: address) -> Result<(address, uint256)> {178 fn sponsor(&self, contract_address: address) -> Result<EthCrossAccount> {178 let sponsor =179 Ok(EthCrossAccount::from_sub_cross_account::<T>(179 Pallet::<T>::get_sponsor(contract_address).ok_or("Contract has no sponsor")?;180 &Pallet::<T>::get_sponsor(contract_address).ok_or("Contract has no sponsor")?,180 Ok(pallet_common::eth::convert_cross_account_to_tuple::<T>(181 ))181 &sponsor,182 ))183 }182 }184183185 /// Check tat contract has confirmed sponsor.184 /// Check tat contract has confirmed sponsor.pallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterbothbinary blob — no preview
pallets/evm-contract-helpers/src/stubs/ContractHelpers.soldiffbeforeafterboth96 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.96 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.97 /// @dev EVM selector for this function is: 0x766c4f37,97 /// @dev EVM selector for this function is: 0x766c4f37,98 /// or in textual repr: sponsor(address)98 /// or in textual repr: sponsor(address)99 function sponsor(address contractAddress) public view returns (Tuple0 memory) {99 function sponsor(address contractAddress) public view returns (EthCrossAccount memory) {100 require(false, stub_error);100 require(false, stub_error);101 contractAddress;101 contractAddress;102 dummy;102 dummy;103 return Tuple0(0x0000000000000000000000000000000000000000, 0);103 return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);104 }104 }105105106 /// Check tat contract has confirmed sponsor.106 /// Check tat contract has confirmed sponsor.265 }265 }266}266}267267268/// @dev anonymous struct268/// @dev Cross account struct269struct Tuple0 {269struct EthCrossAccount {270 address field_0;270 address eth;271 uint256 field_1;271 uint256 sub;272}272}273273pallets/fungible/CHANGELOG.mddiffbeforeafterboth445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->667## [0.1.9] - 2022-12-0189### Added1011- The functions `mintCross` to `ERC20UniqueExtensions` interface.127## [0.1.8] - 2022-11-1813## [0.1.8] - 2022-11-188149### Added15### Addedpallets/fungible/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-fungible"2name = "pallet-fungible"3version = "0.1.7"3version = "0.1.9"4license = "GPLv3"4license = "GPLv3"5edition = "2021"5edition = "2021"66pallets/fungible/src/erc.rsdiffbeforeafterboth174 .collect::<string>())174 .collect::<string>())175 }175 }176177 #[weight(<SelfWeightOf<T>>::create_item())]178 fn mint_cross(&mut self, caller: caller, to: EthCrossAccount, amount: uint256) -> Result<bool> {179 let caller = T::CrossAccountId::from_eth(caller);180 let to = to.into_sub_cross_account::<T>()?;181 let amount = amount.try_into().map_err(|_| "amount overflow")?;182 let budget = self183 .recorder184 .weight_calls_budget(<StructureWeight<T>>::find_parent());185 <Pallet<T>>::create_item(&self, &caller, (to, amount), &budget)186 .map_err(dispatch_to_evm::<T>)?;187 Ok(true)188 }176189177 #[weight(<SelfWeightOf<T>>::approve())]190 #[weight(<SelfWeightOf<T>>::approve())]178 fn approve_cross(191 fn approve_cross(pallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth152 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.152 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.153 /// @dev EVM selector for this function is: 0x6ec0a9f1,153 /// @dev EVM selector for this function is: 0x6ec0a9f1,154 /// or in textual repr: collectionSponsor()154 /// or in textual repr: collectionSponsor()155 function collectionSponsor() public view returns (Tuple8 memory) {155 function collectionSponsor() public view returns (EthCrossAccount memory) {156 require(false, stub_error);156 require(false, stub_error);157 dummy;157 dummy;158 return Tuple8(0x0000000000000000000000000000000000000000, 0);158 return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);159 }159 }160160161 /// Get current collection limits.161 /// Get current collection limits.173 /// Return `false` if a limit not set.173 /// Return `false` if a limit not set.174 /// @dev EVM selector for this function is: 0xf63bc572,174 /// @dev EVM selector for this function is: 0xf63bc572,175 /// or in textual repr: collectionLimits()175 /// or in textual repr: collectionLimits()176 function collectionLimits() public view returns (Tuple20[] memory) {176 function collectionLimits() public view returns (Tuple23[] memory) {177 require(false, stub_error);177 require(false, stub_error);178 dummy;178 dummy;179 return new Tuple20[](0);179 return new Tuple23[](0);180 }180 }181181182 /// Set limits for the collection.182 /// Set limits for the collection.284 /// Returns nesting for a collection284 /// Returns nesting for a collection285 /// @dev EVM selector for this function is: 0x22d25bfe,285 /// @dev EVM selector for this function is: 0x22d25bfe,286 /// or in textual repr: collectionNestingRestrictedCollectionIds()286 /// or in textual repr: collectionNestingRestrictedCollectionIds()287 function collectionNestingRestrictedCollectionIds() public view returns (Tuple26 memory) {287 function collectionNestingRestrictedCollectionIds() public view returns (Tuple29 memory) {288 require(false, stub_error);288 require(false, stub_error);289 dummy;289 dummy;290 return Tuple26(false, new uint256[](0));290 return Tuple29(false, new uint256[](0));291 }291 }292292293 /// Returns permissions for a collection293 /// Returns permissions for a collection294 /// @dev EVM selector for this function is: 0x5b2eaf4b,294 /// @dev EVM selector for this function is: 0x5b2eaf4b,295 /// or in textual repr: collectionNestingPermissions()295 /// or in textual repr: collectionNestingPermissions()296 function collectionNestingPermissions() public view returns (Tuple29[] memory) {296 function collectionNestingPermissions() public view returns (Tuple32[] memory) {297 require(false, stub_error);297 require(false, stub_error);298 dummy;298 dummy;299 return new Tuple29[](0);299 return new Tuple32[](0);300 }300 }301301302 /// Set the collection access method.302 /// Set the collection access method.476}476}477477478/// @dev anonymous struct478/// @dev anonymous struct479struct Tuple29 {479struct Tuple32 {480 CollectionPermissions field_0;480 CollectionPermissions field_0;481 bool field_1;481 bool field_1;482}482}483483484/// @dev anonymous struct484/// @dev anonymous struct485struct Tuple26 {485struct Tuple29 {486 bool field_0;486 bool field_0;487 uint256[] field_1;487 uint256[] field_1;488}488}510}510}511511512/// @dev anonymous struct512/// @dev anonymous struct513struct Tuple20 {513struct Tuple23 {514 CollectionLimits field_0;514 CollectionLimits field_0;515 bool field_1;515 bool field_1;516 uint256 field_2;516 uint256 field_2;522 bytes value;522 bytes value;523}523}524524525/// @dev the ERC-165 identifier for this interface is 0x5b7038cf525/// @dev the ERC-165 identifier for this interface is 0x7dee5997526contract ERC20UniqueExtensions is Dummy, ERC165 {526contract ERC20UniqueExtensions is Dummy, ERC165 {527 /// @notice A description for the collection.527 /// @notice A description for the collection.528 /// @dev EVM selector for this function is: 0x7284e416,528 /// @dev EVM selector for this function is: 0x7284e416,533 return "";533 return "";534 }534 }535536 /// @dev EVM selector for this function is: 0x269e6158,537 /// or in textual repr: mintCross((address,uint256),uint256)538 function mintCross(EthCrossAccount memory to, uint256 amount) public returns (bool) {539 require(false, stub_error);540 to;541 amount;542 dummy = 0;543 return false;544 }535545536 /// @dev EVM selector for this function is: 0x0ecd0ab0,546 /// @dev EVM selector for this function is: 0x0ecd0ab0,537 /// or in textual repr: approveCross((address,uint256),uint256)547 /// or in textual repr: approveCross((address,uint256),uint256)577 /// @param amounts array of pairs of account address and amount587 /// @param amounts array of pairs of account address and amount578 /// @dev EVM selector for this function is: 0x1acf2d55,588 /// @dev EVM selector for this function is: 0x1acf2d55,579 /// or in textual repr: mintBulk((address,uint256)[])589 /// or in textual repr: mintBulk((address,uint256)[])580 function mintBulk(Tuple8[] memory amounts) public returns (bool) {590 function mintBulk(Tuple9[] memory amounts) public returns (bool) {581 require(false, stub_error);591 require(false, stub_error);582 amounts;592 amounts;583 dummy = 0;593 dummy = 0;611}621}612622613/// @dev anonymous struct623/// @dev anonymous struct614struct Tuple8 {624struct Tuple9 {615 address field_0;625 address field_0;616 uint256 field_1;626 uint256 field_1;617}627}pallets/nonfungible/CHANGELOG.mddiffbeforeafterboth445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->667## [0.1.11] - 2022-12-167## [0.1.12] - 2022-12-16889### Added9### Added1010141415- Hide `setTokenPropertyPermission` function in `TokenProperties` interface.15- Hide `setTokenPropertyPermission` function in `TokenProperties` interface.161617## [0.1.11] - 2022-12-011819### Added2021- The functions `mintCross` to `ERC721UniqueExtensions` interface.2217## [0.1.10] - 2022-11-1823## [0.1.10] - 2022-11-18182419### Added25### Addedpallets/nonfungible/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-nonfungible"2name = "pallet-nonfungible"3version = "0.1.11"3version = "0.1.12"4license = "GPLv3"4license = "GPLv3"5edition = "2021"5edition = "2021"66pallets/nonfungible/src/erc.rsdiffbeforeafterboth605 Ok(false)605 Ok(false)606 }606 }607607608 /// @notice Function to mint token.608 /// @notice Function to mint a token.609 /// @param to The new owner609 /// @param to The new owner610 /// @return uint256 The id of the newly minted token610 /// @return uint256 The id of the newly minted token611 #[weight(<SelfWeightOf<T>>::create_item())]611 #[weight(<SelfWeightOf<T>>::create_item())]618 Ok(token_id)618 Ok(token_id)619 }619 }620620621 /// @notice Function to mint token.621 /// @notice Function to mint a token.622 /// @dev `tokenId` should be obtained with `nextTokenId` method,622 /// @dev `tokenId` should be obtained with `nextTokenId` method,623 /// unlike standard, you can't specify it manually623 /// unlike standard, you can't specify it manually624 /// @param to The new owner624 /// @param to The new owner1070 Ok(true)1070 Ok(true)1071 }1071 }10721073 /// @notice Function to mint a token.1074 /// @param to The new owner crossAccountId1075 /// @param properties Properties of minted token1076 /// @return uint256 The id of the newly minted token1077 #[weight(<SelfWeightOf<T>>::create_item())]1078 fn mint_cross(1079 &mut self,1080 caller: caller,1081 to: EthCrossAccount,1082 properties: Vec<PropertyStruct>,1083 ) -> Result<uint256> {1084 let token_id = <TokensMinted<T>>::get(self.id)1085 .checked_add(1)1086 .ok_or("item id overflow")?;10871088 let to = to.into_sub_cross_account::<T>()?;10891090 let properties = properties1091 .into_iter()1092 .map(|PropertyStruct { key, value }| {1093 let key = <Vec<u8>>::from(key)1094 .try_into()1095 .map_err(|_| "key too large")?;10961097 let value = value.0.try_into().map_err(|_| "value too large")?;10981099 Ok(Property { key, value })1100 })1101 .collect::<Result<Vec<_>>>()?1102 .try_into()1103 .map_err(|_| Error::Revert(alloc::format!("too many properties")))?;11041105 let caller = T::CrossAccountId::from_eth(caller);11061107 let budget = self1108 .recorder1109 .weight_calls_budget(<StructureWeight<T>>::find_parent());11101111 <Pallet<T>>::create_item(1112 self,1113 &caller,1114 CreateItemData::<T> {1115 properties,1116 owner: to,1117 },1118 &budget,1119 )1120 .map_err(dispatch_to_evm::<T>)?;11211122 Ok(token_id.into())1123 }1072}1124}107311251074#[solidity_interface(1126#[solidity_interface(pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth42 /// @param permissions Permissions for keys.42 /// @param permissions Permissions for keys.43 /// @dev EVM selector for this function is: 0xbd92983a,43 /// @dev EVM selector for this function is: 0xbd92983a,44 /// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])44 /// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])45 function setTokenPropertyPermissions(Tuple59[] memory permissions) public {45 function setTokenPropertyPermissions(Tuple61[] memory permissions) public {46 require(false, stub_error);46 require(false, stub_error);47 permissions;47 permissions;48 dummy = 0;48 dummy = 0;51 /// @notice Get permissions for token properties.51 /// @notice Get permissions for token properties.52 /// @dev EVM selector for this function is: 0xf23d7790,52 /// @dev EVM selector for this function is: 0xf23d7790,53 /// or in textual repr: tokenPropertyPermissions()53 /// or in textual repr: tokenPropertyPermissions()54 function tokenPropertyPermissions() public view returns (Tuple59[] memory) {54 function tokenPropertyPermissions() public view returns (Tuple61[] memory) {55 require(false, stub_error);55 require(false, stub_error);56 dummy;56 dummy;57 return new Tuple59[](0);57 return new Tuple61[](0);58 }58 }595960 // /// @notice Set token property value.60 // /// @notice Set token property value.144}144}145145146/// @dev anonymous struct146/// @dev anonymous struct147struct Tuple59 {147struct Tuple61 {148 string field_0;148 string field_0;149 Tuple57[] field_1;149 Tuple59[] field_1;150}150}151151152/// @dev anonymous struct152/// @dev anonymous struct153struct Tuple57 {153struct Tuple59 {154 EthTokenPermissions field_0;154 EthTokenPermissions field_0;155 bool field_1;155 bool field_1;156}156}290 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.290 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.291 /// @dev EVM selector for this function is: 0x6ec0a9f1,291 /// @dev EVM selector for this function is: 0x6ec0a9f1,292 /// or in textual repr: collectionSponsor()292 /// or in textual repr: collectionSponsor()293 function collectionSponsor() public view returns (Tuple30 memory) {293 function collectionSponsor() public view returns (EthCrossAccount memory) {294 require(false, stub_error);294 require(false, stub_error);295 dummy;295 dummy;296 return Tuple30(0x0000000000000000000000000000000000000000, 0);296 return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);297 }297 }298298299 /// Get current collection limits.299 /// Get current collection limits.311 /// Return `false` if a limit not set.311 /// Return `false` if a limit not set.312 /// @dev EVM selector for this function is: 0xf63bc572,312 /// @dev EVM selector for this function is: 0xf63bc572,313 /// or in textual repr: collectionLimits()313 /// or in textual repr: collectionLimits()314 function collectionLimits() public view returns (Tuple33[] memory) {314 function collectionLimits() public view returns (Tuple35[] memory) {315 require(false, stub_error);315 require(false, stub_error);316 dummy;316 dummy;317 return new Tuple33[](0);317 return new Tuple35[](0);318 }318 }319319320 /// Set limits for the collection.320 /// Set limits for the collection.422 /// Returns nesting for a collection422 /// Returns nesting for a collection423 /// @dev EVM selector for this function is: 0x22d25bfe,423 /// @dev EVM selector for this function is: 0x22d25bfe,424 /// or in textual repr: collectionNestingRestrictedCollectionIds()424 /// or in textual repr: collectionNestingRestrictedCollectionIds()425 function collectionNestingRestrictedCollectionIds() public view returns (Tuple39 memory) {425 function collectionNestingRestrictedCollectionIds() public view returns (Tuple41 memory) {426 require(false, stub_error);426 require(false, stub_error);427 dummy;427 dummy;428 return Tuple39(false, new uint256[](0));428 return Tuple41(false, new uint256[](0));429 }429 }430430431 /// Returns permissions for a collection431 /// Returns permissions for a collection432 /// @dev EVM selector for this function is: 0x5b2eaf4b,432 /// @dev EVM selector for this function is: 0x5b2eaf4b,433 /// or in textual repr: collectionNestingPermissions()433 /// or in textual repr: collectionNestingPermissions()434 function collectionNestingPermissions() public view returns (Tuple42[] memory) {434 function collectionNestingPermissions() public view returns (Tuple44[] memory) {435 require(false, stub_error);435 require(false, stub_error);436 dummy;436 dummy;437 return new Tuple42[](0);437 return new Tuple44[](0);438 }438 }439439440 /// Set the collection access method.440 /// Set the collection access method.614}614}615615616/// @dev anonymous struct616/// @dev anonymous struct617struct Tuple42 {617struct Tuple44 {618 CollectionPermissions field_0;618 CollectionPermissions field_0;619 bool field_1;619 bool field_1;620}620}621621622/// @dev anonymous struct622/// @dev anonymous struct623struct Tuple39 {623struct Tuple41 {624 bool field_0;624 bool field_0;625 uint256[] field_1;625 uint256[] field_1;626}626}648}648}649649650/// @dev anonymous struct650/// @dev anonymous struct651struct Tuple33 {651struct Tuple35 {652 CollectionLimits field_0;652 CollectionLimits field_0;653 bool field_1;653 bool field_1;654 uint256 field_2;654 uint256 field_2;655}655}656657/// @dev anonymous struct658struct Tuple30 {659 address field_0;660 uint256 field_1;661}662656663/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension657/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension664/// @dev See https://eips.ethereum.org/EIPS/eip-721658/// @dev See https://eips.ethereum.org/EIPS/eip-721735 return false;729 return false;736 }730 }737731738 /// @notice Function to mint token.732 /// @notice Function to mint a token.739 /// @param to The new owner733 /// @param to The new owner740 /// @return uint256 The id of the newly minted token734 /// @return uint256 The id of the newly minted token741 /// @dev EVM selector for this function is: 0x6a627842,735 /// @dev EVM selector for this function is: 0x6a627842,747 return 0;741 return 0;748 }742 }749743750 // /// @notice Function to mint token.744 // /// @notice Function to mint a token.751 // /// @dev `tokenId` should be obtained with `nextTokenId` method,745 // /// @dev `tokenId` should be obtained with `nextTokenId` method,752 // /// unlike standard, you can't specify it manually746 // /// unlike standard, you can't specify it manually753 // /// @param to The new owner747 // /// @param to The new owner804}798}805799806/// @title Unique extensions for ERC721.800/// @title Unique extensions for ERC721.807/// @dev the ERC-165 identifier for this interface is 0xb74c26b7801/// @dev the ERC-165 identifier for this interface is 0x0e48fdb4808contract ERC721UniqueExtensions is Dummy, ERC165 {802contract ERC721UniqueExtensions is Dummy, ERC165 {809 /// @notice A descriptive name for a collection of NFTs in this contract803 /// @notice A descriptive name for a collection of NFTs in this contract810 /// @dev EVM selector for this function is: 0x06fdde03,804 /// @dev EVM selector for this function is: 0x06fdde03,991 // return false;986 // return false;992 // }987 // }993988989 /// @notice Function to mint a token.990 /// @param to The new owner crossAccountId991 /// @param properties Properties of minted token992 /// @return uint256 The id of the newly minted token993 /// @dev EVM selector for this function is: 0xb904db03,994 /// or in textual repr: mintCross((address,uint256),(string,bytes)[])995 function mintCross(EthCrossAccount memory to, Property[] memory properties) public returns (uint256) {996 require(false, stub_error);997 to;998 properties;999 dummy = 0;1000 return 0;1001 }994}1002}9951003996/// @dev anonymous struct1004/// @dev anonymous structpallets/refungible/CHANGELOG.mddiffbeforeafterboth445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->667## [0.2.10] - 2022-12-167## [0.2.11] - 2022-12-16889### Added9### Added1010141415- Hide `setTokenPropertyPermission` function in `TokenProperties` interface.15- Hide `setTokenPropertyPermission` function in `TokenProperties` interface.161617## [0.2.10] - 2022-12-011819### Added2021- The functions `mintCross` to `ERC721UniqueExtensions` interface.2217## [0.2.9] - 2022-11-1823## [0.2.9] - 2022-11-18182419### Added25### Addedpallets/refungible/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-refungible"2name = "pallet-refungible"3version = "0.2.10"3version = "0.2.11"4license = "GPLv3"4license = "GPLv3"5edition = "2021"5edition = "2021"66pallets/refungible/src/common.rsdiffbeforeafterboth165fn map_create_data<T: Config>(165fn map_create_data<T: Config>(166 data: up_data_structs::CreateItemData,166 data: up_data_structs::CreateItemData,167 to: &T::CrossAccountId,167 to: &T::CrossAccountId,168) -> Result<CreateItemData<T::CrossAccountId>, DispatchError> {168) -> Result<CreateItemData<T>, DispatchError> {169 match data {169 match data {170 up_data_structs::CreateItemData::ReFungible(data) => Ok(CreateItemData {170 up_data_structs::CreateItemData::ReFungible(data) => Ok(CreateItemData::<T> {171 users: {171 users: {172 let mut out = BTreeMap::new();172 let mut out = BTreeMap::new();173 out.insert(to.clone(), data.pieces);173 out.insert(to.clone(), data.pieces);230 CreateItemExData::RefungibleMultipleOwners(CreateRefungibleExMultipleOwners {230 CreateItemExData::RefungibleMultipleOwners(CreateRefungibleExMultipleOwners {231 users,231 users,232 properties,232 properties,233 }) => vec![CreateItemData { users, properties }],233 }) => vec![CreateItemData::<T> { users, properties }],234 CreateItemExData::RefungibleMultipleItems(r) => r234 CreateItemExData::RefungibleMultipleItems(r) => r235 .into_inner()235 .into_inner()236 .into_iter()236 .into_iter()239 user,239 user,240 pieces,240 pieces,241 properties,241 properties,242 }| CreateItemData {242 }| CreateItemData::<T> {243 users: BTreeMap::from([(user, pieces)])243 users: BTreeMap::from([(user, pieces)])244 .try_into()244 .try_into()245 .expect("limit >= 1"),245 .expect("limit >= 1"),pallets/refungible/src/erc.rsdiffbeforeafterboth637 Ok(false)637 Ok(false)638 }638 }639639640 /// @notice Function to mint token.640 /// @notice Function to mint a token.641 /// @param to The new owner641 /// @param to The new owner642 /// @return uint256 The id of the newly minted token642 /// @return uint256 The id of the newly minted token643 #[weight(<SelfWeightOf<T>>::create_item())]643 #[weight(<SelfWeightOf<T>>::create_item())]650 Ok(token_id)650 Ok(token_id)651 }651 }652652653 /// @notice Function to mint token.653 /// @notice Function to mint a token.654 /// @dev `tokenId` should be obtained with `nextTokenId` method,654 /// @dev `tokenId` should be obtained with `nextTokenId` method,655 /// unlike standard, you can't specify it manually655 /// unlike standard, you can't specify it manually656 /// @param to The new owner656 /// @param to The new owner681 <Pallet<T>>::create_item(681 <Pallet<T>>::create_item(682 self,682 self,683 &caller,683 &caller,684 CreateItemData::<T::CrossAccountId> {684 CreateItemData::<T> {685 users,685 users,686 properties: CollectionPropertiesVec::default(),686 properties: CollectionPropertiesVec::default(),687 },687 },767 <Pallet<T>>::create_item(767 <Pallet<T>>::create_item(768 self,768 self,769 &caller,769 &caller,770 CreateItemData::<T::CrossAccountId> { users, properties },770 CreateItemData::<T> { users, properties },771 &budget,771 &budget,772 )772 )773 .map_err(dispatch_to_evm::<T>)?;773 .map_err(dispatch_to_evm::<T>)?;1048 .collect::<BTreeMap<_, _>>()1048 .collect::<BTreeMap<_, _>>()1049 .try_into()1049 .try_into()1050 .unwrap();1050 .unwrap();1051 let create_item_data = CreateItemData::<T::CrossAccountId> {1051 let create_item_data = CreateItemData::<T> {1052 users,1052 users,1053 properties: CollectionPropertiesVec::default(),1053 properties: CollectionPropertiesVec::default(),1054 };1054 };1108 })1108 })1109 .map_err(|e| Error::Revert(alloc::format!("Can't add property: {:?}", e)))?;1109 .map_err(|e| Error::Revert(alloc::format!("Can't add property: {:?}", e)))?;111011101111 let create_item_data = CreateItemData::<T::CrossAccountId> {1111 let create_item_data = CreateItemData::<T> {1112 users: users.clone(),1112 users: users.clone(),1113 properties,1113 properties,1114 };1114 };1120 Ok(true)1120 Ok(true)1121 }1121 }11221123 /// @notice Function to mint a token.1124 /// @param to The new owner crossAccountId1125 /// @param properties Properties of minted token1126 /// @return uint256 The id of the newly minted token1127 #[weight(<SelfWeightOf<T>>::create_item())]1128 fn mint_cross(1129 &mut self,1130 caller: caller,1131 to: EthCrossAccount,1132 properties: Vec<PropertyStruct>,1133 ) -> Result<uint256> {1134 let token_id = <TokensMinted<T>>::get(self.id)1135 .checked_add(1)1136 .ok_or("item id overflow")?;11371138 let to = to.into_sub_cross_account::<T>()?;11391140 let properties = properties1141 .into_iter()1142 .map(|PropertyStruct { key, value }| {1143 let key = <Vec<u8>>::from(key)1144 .try_into()1145 .map_err(|_| "key too large")?;11461147 let value = value.0.try_into().map_err(|_| "value too large")?;11481149 Ok(Property { key, value })1150 })1151 .collect::<Result<Vec<_>>>()?1152 .try_into()1153 .map_err(|_| Error::Revert(alloc::format!("too many properties")))?;11541155 let caller = T::CrossAccountId::from_eth(caller);11561157 let budget = self1158 .recorder1159 .weight_calls_budget(<StructureWeight<T>>::find_parent());11601161 let users = [(to, 1)]1162 .into_iter()1163 .collect::<BTreeMap<_, _>>()1164 .try_into()1165 .unwrap();1166 <Pallet<T>>::create_item(1167 self,1168 &caller,1169 CreateItemData::<T> { users, properties },1170 &budget,1171 )1172 .map_err(dispatch_to_evm::<T>)?;11731174 Ok(token_id.into())1175 }112211761123 /// Returns EVM address for refungible token1177 /// Returns EVM address for refungible token1124 ///1178 ///pallets/refungible/src/lib.rsdiffbeforeafterboth114 CreateCollectionData, CustomDataLimit, mapping::TokenAddressMapping, MAX_ITEMS_PER_BATCH,114 CreateCollectionData, CustomDataLimit, mapping::TokenAddressMapping, MAX_ITEMS_PER_BATCH,115 MAX_REFUNGIBLE_PIECES, Property, PropertyKey, PropertyKeyPermission, PropertyPermission,115 MAX_REFUNGIBLE_PIECES, Property, PropertyKey, PropertyKeyPermission, PropertyPermission,116 PropertyScope, PropertyValue, TokenId, TrySetProperty, PropertiesPermissionMap,116 PropertyScope, PropertyValue, TokenId, TrySetProperty, PropertiesPermissionMap,117 CreateRefungibleExMultipleOwners,117};118};118119119pub use pallet::*;120pub use pallet::*;124pub mod erc_token;125pub mod erc_token;125pub mod weights;126pub mod weights;126127127#[derive(Derivative, Clone)]128pub struct CreateItemData<CrossAccountId> {128pub type CreateItemData<T> =129 #[derivative(Debug(format_with = "bounded::map_debug"))]130 pub users: BoundedBTreeMap<CrossAccountId, u128, ConstU32<MAX_ITEMS_PER_BATCH>>,129 CreateRefungibleExMultipleOwners<<T as pallet_evm::Config>::CrossAccountId>;131 #[derivative(Debug(format_with = "bounded::vec_debug"))]132 pub properties: CollectionPropertiesVec,133}134pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;130pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;135131136/// Token data, stored independently from other data used to describe it132/// Token data, stored independently from other data used to describe it913 pub fn create_multiple_items(909 pub fn create_multiple_items(914 collection: &RefungibleHandle<T>,910 collection: &RefungibleHandle<T>,915 sender: &T::CrossAccountId,911 sender: &T::CrossAccountId,916 data: Vec<CreateItemData<T::CrossAccountId>>,912 data: Vec<CreateItemData<T>>,917 nesting_budget: &dyn Budget,913 nesting_budget: &dyn Budget,918 ) -> DispatchResult {914 ) -> DispatchResult {919 if !collection.is_owner_or_admin(sender) {915 if !collection.is_owner_or_admin(sender) {1259 pub fn create_item(1255 pub fn create_item(1260 collection: &RefungibleHandle<T>,1256 collection: &RefungibleHandle<T>,1261 sender: &T::CrossAccountId,1257 sender: &T::CrossAccountId,1262 data: CreateItemData<T::CrossAccountId>,1258 data: CreateItemData<T>,1263 nesting_budget: &dyn Budget,1259 nesting_budget: &dyn Budget,1264 ) -> DispatchResult {1260 ) -> DispatchResult {1265 Self::create_multiple_items(collection, sender, vec![data], nesting_budget)1261 Self::create_multiple_items(collection, sender, vec![data], nesting_budget)pallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth42 /// @param permissions Permissions for keys.42 /// @param permissions Permissions for keys.43 /// @dev EVM selector for this function is: 0xbd92983a,43 /// @dev EVM selector for this function is: 0xbd92983a,44 /// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])44 /// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])45 function setTokenPropertyPermissions(Tuple58[] memory permissions) public {45 function setTokenPropertyPermissions(Tuple60[] memory permissions) public {46 require(false, stub_error);46 require(false, stub_error);47 permissions;47 permissions;48 dummy = 0;48 dummy = 0;51 /// @notice Get permissions for token properties.51 /// @notice Get permissions for token properties.52 /// @dev EVM selector for this function is: 0xf23d7790,52 /// @dev EVM selector for this function is: 0xf23d7790,53 /// or in textual repr: tokenPropertyPermissions()53 /// or in textual repr: tokenPropertyPermissions()54 function tokenPropertyPermissions() public view returns (Tuple58[] memory) {54 function tokenPropertyPermissions() public view returns (Tuple60[] memory) {55 require(false, stub_error);55 require(false, stub_error);56 dummy;56 dummy;57 return new Tuple58[](0);57 return new Tuple60[](0);58 }58 }595960 // /// @notice Set token property value.60 // /// @notice Set token property value.144}144}145145146/// @dev anonymous struct146/// @dev anonymous struct147struct Tuple58 {147struct Tuple60 {148 string field_0;148 string field_0;149 Tuple56[] field_1;149 Tuple58[] field_1;150}150}151151152/// @dev anonymous struct152/// @dev anonymous struct153struct Tuple56 {153struct Tuple58 {154 EthTokenPermissions field_0;154 EthTokenPermissions field_0;155 bool field_1;155 bool field_1;156}156}290 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.290 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.291 /// @dev EVM selector for this function is: 0x6ec0a9f1,291 /// @dev EVM selector for this function is: 0x6ec0a9f1,292 /// or in textual repr: collectionSponsor()292 /// or in textual repr: collectionSponsor()293 function collectionSponsor() public view returns (Tuple29 memory) {293 function collectionSponsor() public view returns (EthCrossAccount memory) {294 require(false, stub_error);294 require(false, stub_error);295 dummy;295 dummy;296 return Tuple29(0x0000000000000000000000000000000000000000, 0);296 return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);297 }297 }298298299 /// Get current collection limits.299 /// Get current collection limits.311 /// Return `false` if a limit not set.311 /// Return `false` if a limit not set.312 /// @dev EVM selector for this function is: 0xf63bc572,312 /// @dev EVM selector for this function is: 0xf63bc572,313 /// or in textual repr: collectionLimits()313 /// or in textual repr: collectionLimits()314 function collectionLimits() public view returns (Tuple32[] memory) {314 function collectionLimits() public view returns (Tuple34[] memory) {315 require(false, stub_error);315 require(false, stub_error);316 dummy;316 dummy;317 return new Tuple32[](0);317 return new Tuple34[](0);318 }318 }319319320 /// Set limits for the collection.320 /// Set limits for the collection.422 /// Returns nesting for a collection422 /// Returns nesting for a collection423 /// @dev EVM selector for this function is: 0x22d25bfe,423 /// @dev EVM selector for this function is: 0x22d25bfe,424 /// or in textual repr: collectionNestingRestrictedCollectionIds()424 /// or in textual repr: collectionNestingRestrictedCollectionIds()425 function collectionNestingRestrictedCollectionIds() public view returns (Tuple38 memory) {425 function collectionNestingRestrictedCollectionIds() public view returns (Tuple40 memory) {426 require(false, stub_error);426 require(false, stub_error);427 dummy;427 dummy;428 return Tuple38(false, new uint256[](0));428 return Tuple40(false, new uint256[](0));429 }429 }430430431 /// Returns permissions for a collection431 /// Returns permissions for a collection432 /// @dev EVM selector for this function is: 0x5b2eaf4b,432 /// @dev EVM selector for this function is: 0x5b2eaf4b,433 /// or in textual repr: collectionNestingPermissions()433 /// or in textual repr: collectionNestingPermissions()434 function collectionNestingPermissions() public view returns (Tuple41[] memory) {434 function collectionNestingPermissions() public view returns (Tuple43[] memory) {435 require(false, stub_error);435 require(false, stub_error);436 dummy;436 dummy;437 return new Tuple41[](0);437 return new Tuple43[](0);438 }438 }439439440 /// Set the collection access method.440 /// Set the collection access method.614}614}615615616/// @dev anonymous struct616/// @dev anonymous struct617struct Tuple41 {617struct Tuple43 {618 CollectionPermissions field_0;618 CollectionPermissions field_0;619 bool field_1;619 bool field_1;620}620}621621622/// @dev anonymous struct622/// @dev anonymous struct623struct Tuple38 {623struct Tuple40 {624 bool field_0;624 bool field_0;625 uint256[] field_1;625 uint256[] field_1;626}626}648}648}649649650/// @dev anonymous struct650/// @dev anonymous struct651struct Tuple32 {651struct Tuple34 {652 CollectionLimits field_0;652 CollectionLimits field_0;653 bool field_1;653 bool field_1;654 uint256 field_2;654 uint256 field_2;655}655}656657/// @dev anonymous struct658struct Tuple29 {659 address field_0;660 uint256 field_1;661}662656663/// @dev the ERC-165 identifier for this interface is 0x5b5e139f657/// @dev the ERC-165 identifier for this interface is 0x5b5e139f664contract ERC721Metadata is Dummy, ERC165 {658contract ERC721Metadata is Dummy, ERC165 {733 return false;727 return false;734 }728 }735729736 /// @notice Function to mint token.730 /// @notice Function to mint a token.737 /// @param to The new owner731 /// @param to The new owner738 /// @return uint256 The id of the newly minted token732 /// @return uint256 The id of the newly minted token739 /// @dev EVM selector for this function is: 0x6a627842,733 /// @dev EVM selector for this function is: 0x6a627842,745 return 0;739 return 0;746 }740 }747741748 // /// @notice Function to mint token.742 // /// @notice Function to mint a token.749 // /// @dev `tokenId` should be obtained with `nextTokenId` method,743 // /// @dev `tokenId` should be obtained with `nextTokenId` method,750 // /// unlike standard, you can't specify it manually744 // /// unlike standard, you can't specify it manually751 // /// @param to The new owner745 // /// @param to The new owner802}796}803797804/// @title Unique extensions for ERC721.798/// @title Unique extensions for ERC721.805/// @dev the ERC-165 identifier for this interface is 0x12f7d6c1799/// @dev the ERC-165 identifier for this interface is 0xabf30dc2806contract ERC721UniqueExtensions is Dummy, ERC165 {800contract ERC721UniqueExtensions is Dummy, ERC165 {807 /// @notice A descriptive name for a collection of NFTs in this contract801 /// @notice A descriptive name for a collection of NFTs in this contract808 /// @dev EVM selector for this function is: 0x06fdde03,802 /// @dev EVM selector for this function is: 0x06fdde03,979 // return false;973 // return false;980 // }974 // }975976 /// @notice Function to mint a token.977 /// @param to The new owner crossAccountId978 /// @param properties Properties of minted token979 /// @return uint256 The id of the newly minted token980 /// @dev EVM selector for this function is: 0xb904db03,981 /// or in textual repr: mintCross((address,uint256),(string,bytes)[])982 function mintCross(EthCrossAccount memory to, Property[] memory properties) public returns (uint256) {983 require(false, stub_error);984 to;985 properties;986 dummy = 0;987 return 0;988 }981989982 /// Returns EVM address for refungible token990 /// Returns EVM address for refungible token983 ///991 ///tests/src/eth/abi/contractHelpers.jsondiffbeforeafterboth223 "outputs": [223 "outputs": [224 {224 {225 "components": [225 "components": [226 { "internalType": "address", "name": "field_0", "type": "address" },226 { "internalType": "address", "name": "eth", "type": "address" },227 { "internalType": "uint256", "name": "field_1", "type": "uint256" }227 { "internalType": "uint256", "name": "sub", "type": "uint256" }228 ],228 ],229 "internalType": "struct Tuple0",229 "internalType": "struct EthCrossAccount",230 "name": "",230 "name": "",231 "type": "tuple"231 "type": "tuple"232 }232 }tests/src/eth/abi/fungible.jsondiffbeforeafterboth220 { "internalType": "bool", "name": "field_1", "type": "bool" },220 { "internalType": "bool", "name": "field_1", "type": "bool" },221 { "internalType": "uint256", "name": "field_2", "type": "uint256" }221 { "internalType": "uint256", "name": "field_2", "type": "uint256" }222 ],222 ],223 "internalType": "struct Tuple20[]",223 "internalType": "struct Tuple23[]",224 "name": "",224 "name": "",225 "type": "tuple[]"225 "type": "tuple[]"226 }226 }241 },241 },242 { "internalType": "bool", "name": "field_1", "type": "bool" }242 { "internalType": "bool", "name": "field_1", "type": "bool" }243 ],243 ],244 "internalType": "struct Tuple29[]",244 "internalType": "struct Tuple32[]",245 "name": "",245 "name": "",246 "type": "tuple[]"246 "type": "tuple[]"247 }247 }262 "type": "uint256[]"262 "type": "uint256[]"263 }263 }264 ],264 ],265 "internalType": "struct Tuple26",265 "internalType": "struct Tuple29",266 "name": "",266 "name": "",267 "type": "tuple"267 "type": "tuple"268 }268 }319 "outputs": [319 "outputs": [320 {320 {321 "components": [321 "components": [322 { "internalType": "address", "name": "field_0", "type": "address" },322 { "internalType": "address", "name": "eth", "type": "address" },323 { "internalType": "uint256", "name": "field_1", "type": "uint256" }323 { "internalType": "uint256", "name": "sub", "type": "uint256" }324 ],324 ],325 "internalType": "struct Tuple8",325 "internalType": "struct EthCrossAccount",326 "name": "",326 "name": "",327 "type": "tuple"327 "type": "tuple"328 }328 }408 { "internalType": "address", "name": "field_0", "type": "address" },408 { "internalType": "address", "name": "field_0", "type": "address" },409 { "internalType": "uint256", "name": "field_1", "type": "uint256" }409 { "internalType": "uint256", "name": "field_1", "type": "uint256" }410 ],410 ],411 "internalType": "struct Tuple8[]",411 "internalType": "struct Tuple9[]",412 "name": "amounts",412 "name": "amounts",413 "type": "tuple[]"413 "type": "tuple[]"414 }414 }418 "stateMutability": "nonpayable",418 "stateMutability": "nonpayable",419 "type": "function"419 "type": "function"420 },420 },421 {422 "inputs": [423 {424 "components": [425 { "internalType": "address", "name": "eth", "type": "address" },426 { "internalType": "uint256", "name": "sub", "type": "uint256" }427 ],428 "internalType": "struct EthCrossAccount",429 "name": "to",430 "type": "tuple"431 },432 { "internalType": "uint256", "name": "amount", "type": "uint256" }433 ],434 "name": "mintCross",435 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],436 "stateMutability": "nonpayable",437 "type": "function"438 },421 {439 {422 "inputs": [],440 "inputs": [],423 "name": "name",441 "name": "name",tests/src/eth/abi/nonFungible.jsondiffbeforeafterboth250 { "internalType": "bool", "name": "field_1", "type": "bool" },250 { "internalType": "bool", "name": "field_1", "type": "bool" },251 { "internalType": "uint256", "name": "field_2", "type": "uint256" }251 { "internalType": "uint256", "name": "field_2", "type": "uint256" }252 ],252 ],253 "internalType": "struct Tuple33[]",253 "internalType": "struct Tuple35[]",254 "name": "",254 "name": "",255 "type": "tuple[]"255 "type": "tuple[]"256 }256 }271 },271 },272 { "internalType": "bool", "name": "field_1", "type": "bool" }272 { "internalType": "bool", "name": "field_1", "type": "bool" }273 ],273 ],274 "internalType": "struct Tuple42[]",274 "internalType": "struct Tuple44[]",275 "name": "",275 "name": "",276 "type": "tuple[]"276 "type": "tuple[]"277 }277 }292 "type": "uint256[]"292 "type": "uint256[]"293 }293 }294 ],294 ],295 "internalType": "struct Tuple39",295 "internalType": "struct Tuple41",296 "name": "",296 "name": "",297 "type": "tuple"297 "type": "tuple"298 }298 }349 "outputs": [349 "outputs": [350 {350 {351 "components": [351 "components": [352 { "internalType": "address", "name": "field_0", "type": "address" },352 { "internalType": "address", "name": "eth", "type": "address" },353 { "internalType": "uint256", "name": "field_1", "type": "uint256" }353 { "internalType": "uint256", "name": "sub", "type": "uint256" }354 ],354 ],355 "internalType": "struct Tuple30",355 "internalType": "struct EthCrossAccount",356 "name": "",356 "name": "",357 "type": "tuple"357 "type": "tuple"358 }358 }476 "stateMutability": "nonpayable",476 "stateMutability": "nonpayable",477 "type": "function"477 "type": "function"478 },478 },479 {480 "inputs": [481 {482 "components": [483 { "internalType": "address", "name": "eth", "type": "address" },484 { "internalType": "uint256", "name": "sub", "type": "uint256" }485 ],486 "internalType": "struct EthCrossAccount",487 "name": "to",488 "type": "tuple"489 },490 {491 "components": [492 { "internalType": "string", "name": "key", "type": "string" },493 { "internalType": "bytes", "name": "value", "type": "bytes" }494 ],495 "internalType": "struct Property[]",496 "name": "properties",497 "type": "tuple[]"498 }499 ],500 "name": "mintCross",501 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],502 "stateMutability": "nonpayable",503 "type": "function"504 },479 {505 {480 "inputs": [506 "inputs": [481 { "internalType": "address", "name": "to", "type": "address" },507 { "internalType": "address", "name": "to", "type": "address" },736 },762 },737 { "internalType": "bool", "name": "field_1", "type": "bool" }763 { "internalType": "bool", "name": "field_1", "type": "bool" }738 ],764 ],739 "internalType": "struct Tuple57[]",765 "internalType": "struct Tuple59[]",740 "name": "field_1",766 "name": "field_1",741 "type": "tuple[]"767 "type": "tuple[]"742 }768 }743 ],769 ],744 "internalType": "struct Tuple59[]",770 "internalType": "struct Tuple61[]",745 "name": "permissions",771 "name": "permissions",746 "type": "tuple[]"772 "type": "tuple[]"747 }773 }802 },828 },803 { "internalType": "bool", "name": "field_1", "type": "bool" }829 { "internalType": "bool", "name": "field_1", "type": "bool" }804 ],830 ],805 "internalType": "struct Tuple57[]",831 "internalType": "struct Tuple59[]",806 "name": "field_1",832 "name": "field_1",807 "type": "tuple[]"833 "type": "tuple[]"808 }834 }809 ],835 ],810 "internalType": "struct Tuple59[]",836 "internalType": "struct Tuple61[]",811 "name": "",837 "name": "",812 "type": "tuple[]"838 "type": "tuple[]"813 }839 }tests/src/eth/abi/reFungible.jsondiffbeforeafterboth232 { "internalType": "bool", "name": "field_1", "type": "bool" },232 { "internalType": "bool", "name": "field_1", "type": "bool" },233 { "internalType": "uint256", "name": "field_2", "type": "uint256" }233 { "internalType": "uint256", "name": "field_2", "type": "uint256" }234 ],234 ],235 "internalType": "struct Tuple32[]",235 "internalType": "struct Tuple34[]",236 "name": "",236 "name": "",237 "type": "tuple[]"237 "type": "tuple[]"238 }238 }253 },253 },254 { "internalType": "bool", "name": "field_1", "type": "bool" }254 { "internalType": "bool", "name": "field_1", "type": "bool" }255 ],255 ],256 "internalType": "struct Tuple41[]",256 "internalType": "struct Tuple43[]",257 "name": "",257 "name": "",258 "type": "tuple[]"258 "type": "tuple[]"259 }259 }274 "type": "uint256[]"274 "type": "uint256[]"275 }275 }276 ],276 ],277 "internalType": "struct Tuple38",277 "internalType": "struct Tuple40",278 "name": "",278 "name": "",279 "type": "tuple"279 "type": "tuple"280 }280 }331 "outputs": [331 "outputs": [332 {332 {333 "components": [333 "components": [334 { "internalType": "address", "name": "field_0", "type": "address" },334 { "internalType": "address", "name": "eth", "type": "address" },335 { "internalType": "uint256", "name": "field_1", "type": "uint256" }335 { "internalType": "uint256", "name": "sub", "type": "uint256" }336 ],336 ],337 "internalType": "struct Tuple29",337 "internalType": "struct EthCrossAccount",338 "name": "",338 "name": "",339 "type": "tuple"339 "type": "tuple"340 }340 }458 "stateMutability": "nonpayable",458 "stateMutability": "nonpayable",459 "type": "function"459 "type": "function"460 },460 },461 {462 "inputs": [463 {464 "components": [465 { "internalType": "address", "name": "eth", "type": "address" },466 { "internalType": "uint256", "name": "sub", "type": "uint256" }467 ],468 "internalType": "struct EthCrossAccount",469 "name": "to",470 "type": "tuple"471 },472 {473 "components": [474 { "internalType": "string", "name": "key", "type": "string" },475 { "internalType": "bytes", "name": "value", "type": "bytes" }476 ],477 "internalType": "struct Property[]",478 "name": "properties",479 "type": "tuple[]"480 }481 ],482 "name": "mintCross",483 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],484 "stateMutability": "nonpayable",485 "type": "function"486 },461 {487 {462 "inputs": [488 "inputs": [463 { "internalType": "address", "name": "to", "type": "address" },489 { "internalType": "address", "name": "to", "type": "address" },718 },744 },719 { "internalType": "bool", "name": "field_1", "type": "bool" }745 { "internalType": "bool", "name": "field_1", "type": "bool" }720 ],746 ],721 "internalType": "struct Tuple56[]",747 "internalType": "struct Tuple58[]",722 "name": "field_1",748 "name": "field_1",723 "type": "tuple[]"749 "type": "tuple[]"724 }750 }725 ],751 ],726 "internalType": "struct Tuple58[]",752 "internalType": "struct Tuple60[]",727 "name": "permissions",753 "name": "permissions",728 "type": "tuple[]"754 "type": "tuple[]"729 }755 }793 },819 },794 { "internalType": "bool", "name": "field_1", "type": "bool" }820 { "internalType": "bool", "name": "field_1", "type": "bool" }795 ],821 ],796 "internalType": "struct Tuple56[]",822 "internalType": "struct Tuple58[]",797 "name": "field_1",823 "name": "field_1",798 "type": "tuple[]"824 "type": "tuple[]"799 }825 }800 ],826 ],801 "internalType": "struct Tuple58[]",827 "internalType": "struct Tuple60[]",802 "name": "",828 "name": "",803 "type": "tuple[]"829 "type": "tuple[]"804 }830 }tests/src/eth/api/ContractHelpers.soldiffbeforeafterboth69 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.69 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.70 /// @dev EVM selector for this function is: 0x766c4f37,70 /// @dev EVM selector for this function is: 0x766c4f37,71 /// or in textual repr: sponsor(address)71 /// or in textual repr: sponsor(address)72 function sponsor(address contractAddress) external view returns (Tuple0 memory);72 function sponsor(address contractAddress) external view returns (EthCrossAccount memory);737374 /// Check tat contract has confirmed sponsor.74 /// Check tat contract has confirmed sponsor.75 ///75 ///171 function toggleAllowlist(address contractAddress, bool enabled) external;171 function toggleAllowlist(address contractAddress, bool enabled) external;172}172}173173174/// @dev anonymous struct174/// @dev Cross account struct175struct Tuple0 {175struct EthCrossAccount {176 address field_0;176 address eth;177 uint256 field_1;177 uint256 sub;178}178}179179tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth102 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.102 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.103 /// @dev EVM selector for this function is: 0x6ec0a9f1,103 /// @dev EVM selector for this function is: 0x6ec0a9f1,104 /// or in textual repr: collectionSponsor()104 /// or in textual repr: collectionSponsor()105 function collectionSponsor() external view returns (Tuple8 memory);105 function collectionSponsor() external view returns (EthCrossAccount memory);106106107 /// Get current collection limits.107 /// Get current collection limits.108 ///108 ///119 /// Return `false` if a limit not set.119 /// Return `false` if a limit not set.120 /// @dev EVM selector for this function is: 0xf63bc572,120 /// @dev EVM selector for this function is: 0xf63bc572,121 /// or in textual repr: collectionLimits()121 /// or in textual repr: collectionLimits()122 function collectionLimits() external view returns (Tuple19[] memory);122 function collectionLimits() external view returns (Tuple21[] memory);123123124 /// Set limits for the collection.124 /// Set limits for the collection.125 /// @dev Throws error if limit not found.125 /// @dev Throws error if limit not found.191 /// Returns nesting for a collection191 /// Returns nesting for a collection192 /// @dev EVM selector for this function is: 0x22d25bfe,192 /// @dev EVM selector for this function is: 0x22d25bfe,193 /// or in textual repr: collectionNestingRestrictedCollectionIds()193 /// or in textual repr: collectionNestingRestrictedCollectionIds()194 function collectionNestingRestrictedCollectionIds() external view returns (Tuple24 memory);194 function collectionNestingRestrictedCollectionIds() external view returns (Tuple26 memory);195195196 /// Returns permissions for a collection196 /// Returns permissions for a collection197 /// @dev EVM selector for this function is: 0x5b2eaf4b,197 /// @dev EVM selector for this function is: 0x5b2eaf4b,198 /// or in textual repr: collectionNestingPermissions()198 /// or in textual repr: collectionNestingPermissions()199 function collectionNestingPermissions() external view returns (Tuple27[] memory);199 function collectionNestingPermissions() external view returns (Tuple29[] memory);200200201 /// Set the collection access method.201 /// Set the collection access method.202 /// @param mode Access mode202 /// @param mode Access mode311}311}312312313/// @dev anonymous struct313/// @dev anonymous struct314struct Tuple27 {314struct Tuple29 {315 CollectionPermissions field_0;315 CollectionPermissions field_0;316 bool field_1;316 bool field_1;317}317}322}322}323323324/// @dev anonymous struct324/// @dev anonymous struct325struct Tuple24 {325struct Tuple26 {326 bool field_0;326 bool field_0;327 uint256[] field_1;327 uint256[] field_1;328}328}350}350}351351352/// @dev anonymous struct352/// @dev anonymous struct353struct Tuple19 {353struct Tuple21 {354 CollectionLimits field_0;354 CollectionLimits field_0;355 bool field_1;355 bool field_1;356 uint256 field_2;356 uint256 field_2;362 bytes value;362 bytes value;363}363}364364365/// @dev the ERC-165 identifier for this interface is 0x5b7038cf365/// @dev the ERC-165 identifier for this interface is 0x7dee5997366interface ERC20UniqueExtensions is Dummy, ERC165 {366interface ERC20UniqueExtensions is Dummy, ERC165 {367 /// @notice A description for the collection.367 /// @notice A description for the collection.368 /// @dev EVM selector for this function is: 0x7284e416,368 /// @dev EVM selector for this function is: 0x7284e416,369 /// or in textual repr: description()369 /// or in textual repr: description()370 function description() external view returns (string memory);370 function description() external view returns (string memory);371372 /// @dev EVM selector for this function is: 0x269e6158,373 /// or in textual repr: mintCross((address,uint256),uint256)374 function mintCross(EthCrossAccount memory to, uint256 amount) external returns (bool);371375372 /// @dev EVM selector for this function is: 0x0ecd0ab0,376 /// @dev EVM selector for this function is: 0x0ecd0ab0,373 /// or in textual repr: approveCross((address,uint256),uint256)377 /// or in textual repr: approveCross((address,uint256),uint256)395 /// @param amounts array of pairs of account address and amount399 /// @param amounts array of pairs of account address and amount396 /// @dev EVM selector for this function is: 0x1acf2d55,400 /// @dev EVM selector for this function is: 0x1acf2d55,397 /// or in textual repr: mintBulk((address,uint256)[])401 /// or in textual repr: mintBulk((address,uint256)[])398 function mintBulk(Tuple8[] memory amounts) external returns (bool);402 function mintBulk(Tuple9[] memory amounts) external returns (bool);399403400 /// @dev EVM selector for this function is: 0x2ada85ff,404 /// @dev EVM selector for this function is: 0x2ada85ff,401 /// or in textual repr: transferCross((address,uint256),uint256)405 /// or in textual repr: transferCross((address,uint256),uint256)411}415}412416413/// @dev anonymous struct417/// @dev anonymous struct414struct Tuple8 {418struct Tuple9 {415 address field_0;419 address field_0;416 uint256 field_1;420 uint256 field_1;417}421}tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth30 /// @param permissions Permissions for keys.30 /// @param permissions Permissions for keys.31 /// @dev EVM selector for this function is: 0xbd92983a,31 /// @dev EVM selector for this function is: 0xbd92983a,32 /// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])32 /// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])33 function setTokenPropertyPermissions(Tuple52[] memory permissions) external;33 function setTokenPropertyPermissions(Tuple53[] memory permissions) external;343435 /// @notice Get permissions for token properties.35 /// @notice Get permissions for token properties.36 /// @dev EVM selector for this function is: 0xf23d7790,36 /// @dev EVM selector for this function is: 0xf23d7790,37 /// or in textual repr: tokenPropertyPermissions()37 /// or in textual repr: tokenPropertyPermissions()38 function tokenPropertyPermissions() external view returns (Tuple52[] memory);38 function tokenPropertyPermissions() external view returns (Tuple53[] memory);393940 // /// @notice Set token property value.40 // /// @notice Set token property value.41 // /// @dev Throws error if `msg.sender` has no permission to edit the property.41 // /// @dev Throws error if `msg.sender` has no permission to edit the property.97}97}989899/// @dev anonymous struct99/// @dev anonymous struct100struct Tuple52 {100struct Tuple53 {101 string field_0;101 string field_0;102 Tuple50[] field_1;102 Tuple51[] field_1;103}103}104104105/// @dev anonymous struct105/// @dev anonymous struct106struct Tuple50 {106struct Tuple51 {107 EthTokenPermissions field_0;107 EthTokenPermissions field_0;108 bool field_1;108 bool field_1;109}109}198 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.198 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.199 /// @dev EVM selector for this function is: 0x6ec0a9f1,199 /// @dev EVM selector for this function is: 0x6ec0a9f1,200 /// or in textual repr: collectionSponsor()200 /// or in textual repr: collectionSponsor()201 function collectionSponsor() external view returns (Tuple27 memory);201 function collectionSponsor() external view returns (EthCrossAccount memory);202202203 /// Get current collection limits.203 /// Get current collection limits.204 ///204 ///215 /// Return `false` if a limit not set.215 /// Return `false` if a limit not set.216 /// @dev EVM selector for this function is: 0xf63bc572,216 /// @dev EVM selector for this function is: 0xf63bc572,217 /// or in textual repr: collectionLimits()217 /// or in textual repr: collectionLimits()218 function collectionLimits() external view returns (Tuple30[] memory);218 function collectionLimits() external view returns (Tuple31[] memory);219219220 /// Set limits for the collection.220 /// Set limits for the collection.221 /// @dev Throws error if limit not found.221 /// @dev Throws error if limit not found.287 /// Returns nesting for a collection287 /// Returns nesting for a collection288 /// @dev EVM selector for this function is: 0x22d25bfe,288 /// @dev EVM selector for this function is: 0x22d25bfe,289 /// or in textual repr: collectionNestingRestrictedCollectionIds()289 /// or in textual repr: collectionNestingRestrictedCollectionIds()290 function collectionNestingRestrictedCollectionIds() external view returns (Tuple35 memory);290 function collectionNestingRestrictedCollectionIds() external view returns (Tuple36 memory);291291292 /// Returns permissions for a collection292 /// Returns permissions for a collection293 /// @dev EVM selector for this function is: 0x5b2eaf4b,293 /// @dev EVM selector for this function is: 0x5b2eaf4b,294 /// or in textual repr: collectionNestingPermissions()294 /// or in textual repr: collectionNestingPermissions()295 function collectionNestingPermissions() external view returns (Tuple38[] memory);295 function collectionNestingPermissions() external view returns (Tuple39[] memory);296296297 /// Set the collection access method.297 /// Set the collection access method.298 /// @param mode Access mode298 /// @param mode Access mode407}407}408408409/// @dev anonymous struct409/// @dev anonymous struct410struct Tuple38 {410struct Tuple39 {411 CollectionPermissions field_0;411 CollectionPermissions field_0;412 bool field_1;412 bool field_1;413}413}418}418}419419420/// @dev anonymous struct420/// @dev anonymous struct421struct Tuple35 {421struct Tuple36 {422 bool field_0;422 bool field_0;423 uint256[] field_1;423 uint256[] field_1;424}424}446}446}447447448/// @dev anonymous struct448/// @dev anonymous struct449struct Tuple30 {449struct Tuple31 {450 CollectionLimits field_0;450 CollectionLimits field_0;451 bool field_1;451 bool field_1;452 uint256 field_2;452 uint256 field_2;453}453}454455/// @dev anonymous struct456struct Tuple27 {457 address field_0;458 uint256 field_1;459}460454461/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension455/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension462/// @dev See https://eips.ethereum.org/EIPS/eip-721456/// @dev See https://eips.ethereum.org/EIPS/eip-721512 /// or in textual repr: mintingFinished()506 /// or in textual repr: mintingFinished()513 function mintingFinished() external view returns (bool);507 function mintingFinished() external view returns (bool);514508515 /// @notice Function to mint token.509 /// @notice Function to mint a token.516 /// @param to The new owner510 /// @param to The new owner517 /// @return uint256 The id of the newly minted token511 /// @return uint256 The id of the newly minted token518 /// @dev EVM selector for this function is: 0x6a627842,512 /// @dev EVM selector for this function is: 0x6a627842,519 /// or in textual repr: mint(address)513 /// or in textual repr: mint(address)520 function mint(address to) external returns (uint256);514 function mint(address to) external returns (uint256);521515522 // /// @notice Function to mint token.516 // /// @notice Function to mint a token.523 // /// @dev `tokenId` should be obtained with `nextTokenId` method,517 // /// @dev `tokenId` should be obtained with `nextTokenId` method,524 // /// unlike standard, you can't specify it manually518 // /// unlike standard, you can't specify it manually525 // /// @param to The new owner519 // /// @param to The new owner553}547}554548555/// @title Unique extensions for ERC721.549/// @title Unique extensions for ERC721.556/// @dev the ERC-165 identifier for this interface is 0xb74c26b7550/// @dev the ERC-165 identifier for this interface is 0x0e48fdb4557interface ERC721UniqueExtensions is Dummy, ERC165 {551interface ERC721UniqueExtensions is Dummy, ERC165 {558 /// @notice A descriptive name for a collection of NFTs in this contract552 /// @notice A descriptive name for a collection of NFTs in this contract559 /// @dev EVM selector for this function is: 0x06fdde03,553 /// @dev EVM selector for this function is: 0x06fdde03,670 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])665 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])671 // function mintBulkWithTokenURI(address to, Tuple13[] memory tokens) external returns (bool);666 // function mintBulkWithTokenURI(address to, Tuple13[] memory tokens) external returns (bool);672667668 /// @notice Function to mint a token.669 /// @param to The new owner crossAccountId670 /// @param properties Properties of minted token671 /// @return uint256 The id of the newly minted token672 /// @dev EVM selector for this function is: 0xb904db03,673 /// or in textual repr: mintCross((address,uint256),(string,bytes)[])674 function mintCross(EthCrossAccount memory to, Property[] memory properties) external returns (uint256);673}675}674676675/// @dev anonymous struct677/// @dev anonymous structtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth30 /// @param permissions Permissions for keys.30 /// @param permissions Permissions for keys.31 /// @dev EVM selector for this function is: 0xbd92983a,31 /// @dev EVM selector for this function is: 0xbd92983a,32 /// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])32 /// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])33 function setTokenPropertyPermissions(Tuple51[] memory permissions) external;33 function setTokenPropertyPermissions(Tuple52[] memory permissions) external;343435 /// @notice Get permissions for token properties.35 /// @notice Get permissions for token properties.36 /// @dev EVM selector for this function is: 0xf23d7790,36 /// @dev EVM selector for this function is: 0xf23d7790,37 /// or in textual repr: tokenPropertyPermissions()37 /// or in textual repr: tokenPropertyPermissions()38 function tokenPropertyPermissions() external view returns (Tuple51[] memory);38 function tokenPropertyPermissions() external view returns (Tuple52[] memory);393940 // /// @notice Set token property value.40 // /// @notice Set token property value.41 // /// @dev Throws error if `msg.sender` has no permission to edit the property.41 // /// @dev Throws error if `msg.sender` has no permission to edit the property.97}97}989899/// @dev anonymous struct99/// @dev anonymous struct100struct Tuple51 {100struct Tuple52 {101 string field_0;101 string field_0;102 Tuple49[] field_1;102 Tuple50[] field_1;103}103}104104105/// @dev anonymous struct105/// @dev anonymous struct106struct Tuple49 {106struct Tuple50 {107 EthTokenPermissions field_0;107 EthTokenPermissions field_0;108 bool field_1;108 bool field_1;109}109}198 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.198 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.199 /// @dev EVM selector for this function is: 0x6ec0a9f1,199 /// @dev EVM selector for this function is: 0x6ec0a9f1,200 /// or in textual repr: collectionSponsor()200 /// or in textual repr: collectionSponsor()201 function collectionSponsor() external view returns (Tuple26 memory);201 function collectionSponsor() external view returns (EthCrossAccount memory);202202203 /// Get current collection limits.203 /// Get current collection limits.204 ///204 ///215 /// Return `false` if a limit not set.215 /// Return `false` if a limit not set.216 /// @dev EVM selector for this function is: 0xf63bc572,216 /// @dev EVM selector for this function is: 0xf63bc572,217 /// or in textual repr: collectionLimits()217 /// or in textual repr: collectionLimits()218 function collectionLimits() external view returns (Tuple29[] memory);218 function collectionLimits() external view returns (Tuple30[] memory);219219220 /// Set limits for the collection.220 /// Set limits for the collection.221 /// @dev Throws error if limit not found.221 /// @dev Throws error if limit not found.287 /// Returns nesting for a collection287 /// Returns nesting for a collection288 /// @dev EVM selector for this function is: 0x22d25bfe,288 /// @dev EVM selector for this function is: 0x22d25bfe,289 /// or in textual repr: collectionNestingRestrictedCollectionIds()289 /// or in textual repr: collectionNestingRestrictedCollectionIds()290 function collectionNestingRestrictedCollectionIds() external view returns (Tuple34 memory);290 function collectionNestingRestrictedCollectionIds() external view returns (Tuple35 memory);291291292 /// Returns permissions for a collection292 /// Returns permissions for a collection293 /// @dev EVM selector for this function is: 0x5b2eaf4b,293 /// @dev EVM selector for this function is: 0x5b2eaf4b,294 /// or in textual repr: collectionNestingPermissions()294 /// or in textual repr: collectionNestingPermissions()295 function collectionNestingPermissions() external view returns (Tuple37[] memory);295 function collectionNestingPermissions() external view returns (Tuple38[] memory);296296297 /// Set the collection access method.297 /// Set the collection access method.298 /// @param mode Access mode298 /// @param mode Access mode407}407}408408409/// @dev anonymous struct409/// @dev anonymous struct410struct Tuple37 {410struct Tuple38 {411 CollectionPermissions field_0;411 CollectionPermissions field_0;412 bool field_1;412 bool field_1;413}413}418}418}419419420/// @dev anonymous struct420/// @dev anonymous struct421struct Tuple34 {421struct Tuple35 {422 bool field_0;422 bool field_0;423 uint256[] field_1;423 uint256[] field_1;424}424}446}446}447447448/// @dev anonymous struct448/// @dev anonymous struct449struct Tuple29 {449struct Tuple30 {450 CollectionLimits field_0;450 CollectionLimits field_0;451 bool field_1;451 bool field_1;452 uint256 field_2;452 uint256 field_2;453}453}454455/// @dev anonymous struct456struct Tuple26 {457 address field_0;458 uint256 field_1;459}460454461/// @dev the ERC-165 identifier for this interface is 0x5b5e139f455/// @dev the ERC-165 identifier for this interface is 0x5b5e139f462interface ERC721Metadata is Dummy, ERC165 {456interface ERC721Metadata is Dummy, ERC165 {510 /// or in textual repr: mintingFinished()504 /// or in textual repr: mintingFinished()511 function mintingFinished() external view returns (bool);505 function mintingFinished() external view returns (bool);512506513 /// @notice Function to mint token.507 /// @notice Function to mint a token.514 /// @param to The new owner508 /// @param to The new owner515 /// @return uint256 The id of the newly minted token509 /// @return uint256 The id of the newly minted token516 /// @dev EVM selector for this function is: 0x6a627842,510 /// @dev EVM selector for this function is: 0x6a627842,517 /// or in textual repr: mint(address)511 /// or in textual repr: mint(address)518 function mint(address to) external returns (uint256);512 function mint(address to) external returns (uint256);519513520 // /// @notice Function to mint token.514 // /// @notice Function to mint a token.521 // /// @dev `tokenId` should be obtained with `nextTokenId` method,515 // /// @dev `tokenId` should be obtained with `nextTokenId` method,522 // /// unlike standard, you can't specify it manually516 // /// unlike standard, you can't specify it manually523 // /// @param to The new owner517 // /// @param to The new owner551}545}552546553/// @title Unique extensions for ERC721.547/// @title Unique extensions for ERC721.554/// @dev the ERC-165 identifier for this interface is 0x12f7d6c1548/// @dev the ERC-165 identifier for this interface is 0xabf30dc2555interface ERC721UniqueExtensions is Dummy, ERC165 {549interface ERC721UniqueExtensions is Dummy, ERC165 {556 /// @notice A descriptive name for a collection of NFTs in this contract550 /// @notice A descriptive name for a collection of NFTs in this contract557 /// @dev EVM selector for this function is: 0x06fdde03,551 /// @dev EVM selector for this function is: 0x06fdde03,663 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])657 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])664 // function mintBulkWithTokenURI(address to, Tuple12[] memory tokens) external returns (bool);658 // function mintBulkWithTokenURI(address to, Tuple12[] memory tokens) external returns (bool);659660 /// @notice Function to mint a token.661 /// @param to The new owner crossAccountId662 /// @param properties Properties of minted token663 /// @return uint256 The id of the newly minted token664 /// @dev EVM selector for this function is: 0xb904db03,665 /// or in textual repr: mintCross((address,uint256),(string,bytes)[])666 function mintCross(EthCrossAccount memory to, Property[] memory properties) external returns (uint256);665667666 /// Returns EVM address for refungible token668 /// Returns EVM address for refungible token667 ///669 ///tests/src/eth/base.test.tsdiffbeforeafterboth116 await checkInterface(helper, '0x780e9d63', true, true);116 await checkInterface(helper, '0x780e9d63', true, true);117 });117 });118118119 itEth('ERC721UniqueExtensions support', async ({helper}) => {119 itEth.skip('ERC721UniqueExtensions support', async ({helper}) => {120 await checkInterface(helper, '0xb74c26b7', true, true);120 await checkInterface(helper, '0xb74c26b7', true, true);121 });121 });122122tests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth106 await collectionEvm.methods.removeCollectionSponsor().send({from: owner});106 await collectionEvm.methods.removeCollectionSponsor().send({from: owner});107 107 108 const sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});108 const sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});109 expect(sponsorTuple.field_0).to.be.eq('0x0000000000000000000000000000000000000000');109 expect(sponsorTuple.eth).to.be.eq('0x0000000000000000000000000000000000000000');110 }));110 }));111111112 [112 [tests/src/eth/fungible.test.tsdiffbeforeafterboth57 before(async function() {57 before(async function() {58 await usingEthPlaygrounds(async (helper, privateKey) => {58 await usingEthPlaygrounds(async (helper, privateKey) => {59 donor = await privateKey({filename: __filename});59 donor = await privateKey({filename: __filename});60 [alice, owner] = await helper.arrange.createAccounts([20n, 20n], donor);60 [alice, owner] = await helper.arrange.createAccounts([30n, 20n], donor);61 });61 });62 });62 });636380 });80 });81 82 83 itEth('Can perform mintCross()', async ({helper}) => {84 const receiverCross = helper.ethCrossAccount.fromKeyringPair(owner);85 const ethOwner = await helper.eth.createAccountWithBalance(donor);86 const collection = await helper.ft.mintCollection(alice);87 await collection.addAdmin(alice, {Ethereum: ethOwner});8889 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);90 const contract = helper.ethNativeContract.collection(collectionAddress, 'ft', ethOwner);9192 const result = await contract.methods.mintCross(receiverCross, 100).send();93 94 const event = result.events.Transfer;95 expect(event.address).to.equal(collectionAddress);96 expect(event.returnValues.from).to.equal('0x0000000000000000000000000000000000000000');97 expect(event.returnValues.to).to.equal(helper.address.substrateToEth(owner.address));98 expect(event.returnValues.value).to.equal('100');99 });8110082 itEth('Can perform mintBulk()', async ({helper}) => {101 itEth('Can perform mintBulk()', async ({helper}) => {83 const owner = await helper.eth.createAccountWithBalance(donor);102 const owner = await helper.eth.createAccountWithBalance(donor);tests/src/eth/nesting/nest.test.tsdiffbeforeafterboth62 expect(await contract.methods.collectionNestingRestrictedCollectionIds().call({from: owner})).to.be.like([true, []]);62 expect(await contract.methods.collectionNestingRestrictedCollectionIds().call({from: owner})).to.be.like([true, []]);63 await contract.methods.setCollectionNesting(true, [unnsetedCollectionAddress]).send({from: owner});63 await contract.methods.setCollectionNesting(true, [unnsetedCollectionAddress]).send({from: owner});64 expect(await contract.methods.collectionNestingRestrictedCollectionIds().call({from: owner})).to.be.like([true, [unnestedCollsectionId.toString()]]);64 expect(await contract.methods.collectionNestingRestrictedCollectionIds().call({from: owner})).to.be.like([true, [unnestedCollsectionId.toString()]]);65 expect(await contract.methods.collectionNestingPermissions().call({from: owner})).to.be.like([['0', false], ['1', true]]);65 expect(await contract.methods.collectionNestingPermissions().call({from: owner})).to.be.like([['1', false], ['0', true]]);66 await contract.methods.setCollectionNesting(false).send({from: owner});66 await contract.methods.setCollectionNesting(false).send({from: owner});67 expect(await contract.methods.collectionNestingPermissions().call({from: owner})).to.be.like([['0', false], ['1', false]]);67 expect(await contract.methods.collectionNestingPermissions().call({from: owner})).to.be.like([['1', false], ['0', false]]);68 });68 });69 69 70 itEth('NFT: allows an Owner to nest/unnest their token (Restricted nesting)', async ({helper}) => {70 itEth('NFT: allows an Owner to nest/unnest their token (Restricted nesting)', async ({helper}) => {tests/src/eth/nonFungible.test.tsdiffbeforeafterboth17import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper} from './util';17import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper} from './util';18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';19import {Contract} from 'web3-eth-contract';19import {Contract} from 'web3-eth-contract';20import {ITokenPropertyPermission} from '../util/playgrounds/types';2021212222describe('NFT: Information getting', () => {23describe('NFT: Information getting', () => {174 // expect(tokenUri).to.be.equal(`https://offchain-service.local/token-info/${nextTokenId}`);175 // expect(tokenUri).to.be.equal(`https://offchain-service.local/token-info/${nextTokenId}`);175 });176 });176177 178 itEth('Can perform mintCross()', async ({helper}) => {179 const caller = await helper.eth.createAccountWithBalance(donor);180 const receiverCross = helper.ethCrossAccount.fromKeyringPair(bob);181 const properties = Array(5).fill(0).map((_, i) => { return {key: `key_${i}`, value: Buffer.from(`value_${i}`)}; });182 const permissions: ITokenPropertyPermission[] = properties183 .map(p => {184 return {185 key: p.key, permission: {186 tokenOwner: true,187 collectionAdmin: true,188 mutable: true,189 },190 };191 });192 193 194 const collection = await helper.nft.mintCollection(minter, {195 tokenPrefix: 'ethp',196 tokenPropertyPermissions: permissions,197 });198 await collection.addAdmin(minter, {Ethereum: caller});199 200 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);201 const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', caller, true);202 let expectedTokenId = await contract.methods.nextTokenId().call();203 let result = await contract.methods.mintCross(receiverCross, []).send();204 let tokenId = result.events.Transfer.returnValues.tokenId;205 expect(tokenId).to.be.equal(expectedTokenId);206207 let event = result.events.Transfer;208 expect(event.address).to.be.equal(collectionAddress);209 expect(event.returnValues.from).to.be.equal('0x0000000000000000000000000000000000000000');210 expect(event.returnValues.to).to.be.equal(helper.address.substrateToEth(bob.address));211 expect(await contract.methods.properties(tokenId, []).call()).to.be.like([]);212 213 expectedTokenId = await contract.methods.nextTokenId().call();214 result = await contract.methods.mintCross(receiverCross, properties).send();215 event = result.events.Transfer;216 expect(event.address).to.be.equal(collectionAddress);217 expect(event.returnValues.from).to.be.equal('0x0000000000000000000000000000000000000000');218 expect(event.returnValues.to).to.be.equal(helper.address.substrateToEth(bob.address));219 expect(await contract.methods.properties(tokenId, []).call()).to.be.like([]);220 221 tokenId = result.events.Transfer.returnValues.tokenId;222 223 expect(tokenId).to.be.equal(expectedTokenId);224225 expect(await contract.methods.properties(tokenId, []).call()).to.be.like(properties226 .map(p => { return helper.ethProperty.property(p.key, p.value.toString()); }));227 });228 177 //TODO: CORE-302 add eth methods229 //TODO: CORE-302 add eth methods178 itEth.skip('Can perform mintBulk()', async ({helper}) => {230 itEth.skip('Can perform mintBulk()', async ({helper}) => {tests/src/eth/reFungible.test.tsdiffbeforeafterboth17import {Pallets, requirePalletsOrSkip} from '../util';17import {Pallets, requirePalletsOrSkip} from '../util';18import {expect, itEth, usingEthPlaygrounds} from './util';18import {expect, itEth, usingEthPlaygrounds} from './util';19import {IKeyringPair} from '@polkadot/types/types';19import {IKeyringPair} from '@polkadot/types/types';20import {ITokenPropertyPermission} from '../util/playgrounds/types';202121describe('Refungible: Information getting', () => {22describe('Refungible: Information getting', () => {22 let donor: IKeyringPair;23 let donor: IKeyringPair;136 expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');137 expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');137 });138 });139 140 itEth('Can perform mintCross()', async ({helper}) => {141 const caller = await helper.eth.createAccountWithBalance(donor);142 const receiverCross = helper.ethCrossAccount.fromKeyringPair(bob);143 const properties = Array(5).fill(0).map((_, i) => { return {key: `key_${i}`, value: Buffer.from(`value_${i}`)}; });144 const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.key, permission: {tokenOwner: true,145 collectionAdmin: true,146 mutable: true}}; });147 148 149 const collection = await helper.rft.mintCollection(minter, {150 tokenPrefix: 'ethp',151 tokenPropertyPermissions: permissions,152 });153 await collection.addAdmin(minter, {Ethereum: caller});154 155 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);156 const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller, true);157 let expectedTokenId = await contract.methods.nextTokenId().call();158 let result = await contract.methods.mintCross(receiverCross, []).send();159 let tokenId = result.events.Transfer.returnValues.tokenId;160 expect(tokenId).to.be.equal(expectedTokenId);161162 let event = result.events.Transfer;163 expect(event.address).to.be.equal(collectionAddress);164 expect(event.returnValues.from).to.be.equal('0x0000000000000000000000000000000000000000');165 expect(event.returnValues.to).to.be.equal(helper.address.substrateToEth(bob.address));166 expect(await contract.methods.properties(tokenId, []).call()).to.be.like([]);167 168 expectedTokenId = await contract.methods.nextTokenId().call();169 result = await contract.methods.mintCross(receiverCross, properties).send();170 event = result.events.Transfer;171 expect(event.address).to.be.equal(collectionAddress);172 expect(event.returnValues.from).to.be.equal('0x0000000000000000000000000000000000000000');173 expect(event.returnValues.to).to.be.equal(helper.address.substrateToEth(bob.address));174 expect(await contract.methods.properties(tokenId, []).call()).to.be.like([]);175 176 tokenId = result.events.Transfer.returnValues.tokenId;177178 expect(tokenId).to.be.equal(expectedTokenId);179 180 expect(await contract.methods.properties(tokenId, []).call()).to.be.like(properties181 .map(p => { return helper.ethProperty.property(p.key, p.value.toString()); }));182 });138183139 itEth.skip('Can perform mintBulk()', async ({helper}) => {184 itEth.skip('Can perform mintBulk()', async ({helper}) => {140 const owner = await helper.eth.createAccountWithBalance(donor);185 const owner = await helper.eth.createAccountWithBalance(donor);tests/src/interfaces/augment-api-consts.tsdiffbeforeafterboth83 dayRelayBlocks: u32 & AugmentedConst<ApiType>;83 dayRelayBlocks: u32 & AugmentedConst<ApiType>;84 defaultMinGasPrice: u64 & AugmentedConst<ApiType>;84 defaultMinGasPrice: u64 & AugmentedConst<ApiType>;85 defaultWeightToFeeCoefficient: u32 & AugmentedConst<ApiType>;85 defaultWeightToFeeCoefficient: u32 & AugmentedConst<ApiType>;86 maxOverridedAllowedLocations: u32 & AugmentedConst<ApiType>;86 maxXcmAllowedLocations: u32 & AugmentedConst<ApiType>;87 /**87 /**88 * Generic const88 * Generic const89 **/89 **/