difftreelog
Merge pull request #723 from UniqueNetwork/feature/deprecate-non-cross-methods
in: master
51 files changed
Makefilediffbeforeafterboth7 @echo " bench-unique"7 @echo " bench-unique"889FUNGIBLE_EVM_STUBS=./pallets/fungible/src/stubs9FUNGIBLE_EVM_STUBS=./pallets/fungible/src/stubs10FUNGIBLE_EVM_ABI=./tests/src/eth/fungibleAbi.json10FUNGIBLE_EVM_ABI=./tests/src/eth/abi/fungible.json1112REFUNGIBLE_EVM_STUBS=./pallets/refungible/src/stubs13REFUNGIBLE_EVM_ABI=./tests/src/eth/refungibleAbi.json141115NONFUNGIBLE_EVM_STUBS=./pallets/nonfungible/src/stubs12NONFUNGIBLE_EVM_STUBS=./pallets/nonfungible/src/stubs16NONFUNGIBLE_EVM_ABI=./tests/src/eth/nonFungibleAbi.json13NONFUNGIBLE_EVM_ABI=./tests/src/eth/abi/nonFungible.json171418REFUNGIBLE_EVM_STUBS=./pallets/refungible/src/stubs15REFUNGIBLE_EVM_STUBS=./pallets/refungible/src/stubs19REFUNGIBLE_EVM_ABI=./tests/src/eth/reFungibleAbi.json16REFUNGIBLE_EVM_ABI=./tests/src/eth/abi/reFungible.json20REFUNGIBLE_TOKEN_EVM_ABI=./tests/src/eth/reFungibleTokenAbi.json17REFUNGIBLE_TOKEN_EVM_ABI=./tests/src/eth/abi/reFungibleToken.json211822CONTRACT_HELPERS_STUBS=./pallets/evm-contract-helpers/src/stubs/19CONTRACT_HELPERS_STUBS=./pallets/evm-contract-helpers/src/stubs/23CONTRACT_HELPERS_ABI=./tests/src/eth/util/contractHelpersAbi.json20CONTRACT_HELPERS_ABI=./tests/src/eth/abi/contractHelpers.json242125COLLECTION_HELPER_STUBS=./pallets/unique/src/eth/stubs/22COLLECTION_HELPER_STUBS=./pallets/unique/src/eth/stubs/26COLLECTION_HELPER_ABI=./tests/src/eth/collectionHelpersAbi.json23COLLECTION_HELPER_ABI=./tests/src/eth/abi/collectionHelpers.json272428TESTS_API=./tests/src/eth/api/25TESTS_API=./tests/src/eth/api/2926crates/evm-coder/src/abi/impls.rsdiffbeforeafterboth153 }153 }154}154}155156impl sealed::CanBePlacedInVec for Property {}157158impl AbiType for Property {159 const SIGNATURE: SignatureUnit = make_signature!(new fixed("(string,bytes)"));160161 fn is_dynamic() -> bool {162 string::is_dynamic() || bytes::is_dynamic()163 }164165 fn size() -> usize {166 <string as AbiType>::size() + <bytes as AbiType>::size()167 }168}169170impl AbiRead for Property {171 fn abi_read(reader: &mut AbiReader) -> Result<Property> {172 let size = if !Property::is_dynamic() {173 Some(<Property as AbiType>::size())174 } else {175 None176 };177 let mut subresult = reader.subresult(size)?;178 let key = <string>::abi_read(&mut subresult)?;179 let value = <bytes>::abi_read(&mut subresult)?;180181 Ok(Property { key, value })182 }183}184185impl AbiWrite for Property {186 fn abi_write(&self, writer: &mut AbiWriter) {187 self.key.abi_write(writer);188 self.value.abi_write(writer);189 }190}155191156macro_rules! impl_abi_writeable {192macro_rules! impl_abi_writeable {157 ($ty:ty, $method:ident) => {193 ($ty:ty, $method:ident) => {crates/evm-coder/src/lib.rsdiffbeforeafterboth254 T::CrossAccountId::from_sub(account_id)254 T::CrossAccountId::from_sub(account_id)255 }255 }256257 #[derive(Debug, Default)]258 pub struct Property {259 pub key: string,260 pub value: bytes,261 }256}262}257263258/// Parseable EVM call, this trait should be implemented with [`solidity_interface`] macro264/// Parseable EVM call, this trait should be implemented with [`solidity_interface`] macrocrates/evm-coder/src/solidity.rsdiffbeforeafterboth157impl sealed::CanBePlacedInVec for string {}157impl sealed::CanBePlacedInVec for string {}158impl sealed::CanBePlacedInVec for address {}158impl sealed::CanBePlacedInVec for address {}159impl sealed::CanBePlacedInVec for EthCrossAccount {}159impl sealed::CanBePlacedInVec for EthCrossAccount {}160impl sealed::CanBePlacedInVec for Property {}160161161impl<T: SolidityTypeName + sealed::CanBePlacedInVec> SolidityTypeName for Vec<T> {162impl<T: SolidityTypeName + sealed::CanBePlacedInVec> SolidityTypeName for Vec<T> {162 fn solidity_name(writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {163 fn solidity_name(writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {227 }229 }228}230}231232impl StructCollect for Property {233 fn name() -> String {234 "Property".into()235 }236237 fn declaration() -> String {238 let mut str = String::new();239 writeln!(str, "/// @dev Property struct").unwrap();240 writeln!(str, "struct {} {{", Self::name()).unwrap();241 writeln!(str, "\tstring key;").unwrap();242 writeln!(str, "\tbytes value;").unwrap();243 writeln!(str, "}}").unwrap();244 str245 }246}247248impl SolidityTypeName for Property {249 fn solidity_name(writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {250 write!(writer, "{}", tc.collect_struct::<Self>())251 }252253 fn is_simple() -> bool {254 false255 }256257 fn solidity_default(writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {258 write!(writer, "{}(", tc.collect_struct::<Self>())?;259 address::solidity_default(writer, tc)?;260 write!(writer, ",")?;261 uint256::solidity_default(writer, tc)?;262 write!(writer, ")")263 }264}265266impl SolidityTupleType for Property {267 fn names(tc: &TypeCollector) -> Vec<string> {268 let mut collected = Vec::with_capacity(Self::len());269 {270 let mut out = string::new();271 string::solidity_name(&mut out, tc).expect("no fmt error");272 collected.push(out);273 }274 {275 let mut out = string::new();276 bytes::solidity_name(&mut out, tc).expect("no fmt error");277 collected.push(out);278 }279 collected280 }281282 fn len() -> usize {283 2284 }285}229286230pub trait SolidityTupleType {287pub trait SolidityTupleType {231 fn names(tc: &TypeCollector) -> Vec<String>;288 fn names(tc: &TypeCollector) -> Vec<String>;pallets/common/src/erc.rsdiffbeforeafterboth20 abi::AbiType,20 abi::AbiType,21 solidity_interface, solidity, ToLog,21 solidity_interface, solidity, ToLog,22 types::*,22 types::*,23 types::Property as PropertyStruct,23 execution::{Result, Error},24 execution::{Result, Error},24 weight,25 weight,25};26};78 ///79 ///79 /// @param key Property key.80 /// @param key Property key.80 /// @param value Propery value.81 /// @param value Propery value.82 #[solidity(hide)]81 #[weight(<SelfWeightOf<T>>::set_collection_properties(1))]83 #[weight(<SelfWeightOf<T>>::set_collection_properties(1))]82 fn set_collection_property(84 fn set_collection_property(83 &mut self,85 &mut self,102 fn set_collection_properties(104 fn set_collection_properties(103 &mut self,105 &mut self,104 caller: caller,106 caller: caller,105 properties: Vec<(string, bytes)>,107 properties: Vec<PropertyStruct>,106 ) -> Result<void> {108 ) -> Result<void> {107 let caller = T::CrossAccountId::from_eth(caller);109 let caller = T::CrossAccountId::from_eth(caller);108110109 let properties = properties111 let properties = properties110 .into_iter()112 .into_iter()111 .map(|(key, value)| {113 .map(|PropertyStruct { key, value }| {112 let key = <Vec<u8>>::from(key)114 let key = <Vec<u8>>::from(key)113 .try_into()115 .try_into()114 .map_err(|_| "key too large")?;116 .map_err(|_| "key too large")?;126 /// Delete collection property.128 /// Delete collection property.127 ///129 ///128 /// @param key Property key.130 /// @param key Property key.131 #[solidity(hide)]129 #[weight(<SelfWeightOf<T>>::delete_collection_properties(1))]132 #[weight(<SelfWeightOf<T>>::delete_collection_properties(1))]130 fn delete_collection_property(&mut self, caller: caller, key: string) -> Result<()> {133 fn delete_collection_property(&mut self, caller: caller, key: string) -> Result<()> {131 let caller = T::CrossAccountId::from_eth(caller);134 let caller = T::CrossAccountId::from_eth(caller);208 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.211 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.209 ///212 ///210 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.213 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.214 #[solidity(hide)]211 fn set_collection_sponsor(&mut self, caller: caller, sponsor: address) -> Result<void> {215 fn set_collection_sponsor(&mut self, caller: caller, sponsor: address) -> Result<void> {212 self.consume_store_reads_and_writes(1, 1)?;216 self.consume_store_reads_and_writes(1, 1)?;213217411415412 /// Add collection admin.416 /// Add collection admin.413 /// @param newAdmin Address of the added administrator.417 /// @param newAdmin Address of the added administrator.418 #[solidity(hide)]414 fn add_collection_admin(&mut self, caller: caller, new_admin: address) -> Result<void> {419 fn add_collection_admin(&mut self, caller: caller, new_admin: address) -> Result<void> {415 self.consume_store_writes(2)?;420 self.consume_store_writes(2)?;416421423 /// Remove collection admin.428 /// Remove collection admin.424 ///429 ///425 /// @param admin Address of the removed administrator.430 /// @param admin Address of the removed administrator.431 #[solidity(hide)]426 fn remove_collection_admin(&mut self, caller: caller, admin: address) -> Result<void> {432 fn remove_collection_admin(&mut self, caller: caller, admin: address) -> Result<void> {427 self.consume_store_writes(2)?;433 self.consume_store_writes(2)?;428434547 /// Add the user to the allowed list.553 /// Add the user to the allowed list.548 ///554 ///549 /// @param user Address of a trusted user.555 /// @param user Address of a trusted user.556 #[solidity(hide)]550 fn add_to_collection_allow_list(&mut self, caller: caller, user: address) -> Result<void> {557 fn add_to_collection_allow_list(&mut self, caller: caller, user: address) -> Result<void> {551 self.consume_store_writes(1)?;558 self.consume_store_writes(1)?;552559575 /// Remove the user from the allowed list.582 /// Remove the user from the allowed list.576 ///583 ///577 /// @param user Address of a removed user.584 /// @param user Address of a removed user.585 #[solidity(hide)]578 fn remove_from_collection_allow_list(&mut self, caller: caller, user: address) -> Result<void> {586 fn remove_from_collection_allow_list(&mut self, caller: caller, user: address) -> Result<void> {579 self.consume_store_writes(1)?;587 self.consume_store_writes(1)?;580588625 ///633 ///626 /// @param user account to verify634 /// @param user account to verify627 /// @return "true" if account is the owner or admin635 /// @return "true" if account is the owner or admin628 #[solidity(rename_selector = "isOwnerOrAdmin")]636 #[solidity(hide, rename_selector = "isOwnerOrAdmin")]629 fn is_owner_or_admin_eth(&self, user: address) -> Result<bool> {637 fn is_owner_or_admin_eth(&self, user: address) -> Result<bool> {630 let user = T::CrossAccountId::from_eth(user);638 let user = T::CrossAccountId::from_eth(user);631 Ok(self.is_owner_or_admin(&user))639 Ok(self.is_owner_or_admin(&user))666 ///674 ///667 /// @dev Owner can be changed only by current owner675 /// @dev Owner can be changed only by current owner668 /// @param newOwner new owner account676 /// @param newOwner new owner account669 #[solidity(rename_selector = "changeCollectionOwner")]677 #[solidity(hide, rename_selector = "changeCollectionOwner")]670 fn set_owner(&mut self, caller: caller, new_owner: address) -> Result<void> {678 fn set_owner(&mut self, caller: caller, new_owner: address) -> Result<void> {671 self.consume_store_writes(1)?;679 self.consume_store_writes(1)?;672680691 ///699 ///692 /// @dev Owner can be changed only by current owner700 /// @dev Owner can be changed only by current owner693 /// @param newOwner new owner cross account701 /// @param newOwner new owner cross account694 fn set_owner_cross(&mut self, caller: caller, new_owner: EthCrossAccount) -> Result<void> {702 fn change_collection_owner_cross(703 &mut self,704 caller: caller,705 new_owner: EthCrossAccount,pallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/erc.rsdiffbeforeafterboth20use core::char::{REPLACEMENT_CHARACTER, decode_utf16};20use core::char::{REPLACEMENT_CHARACTER, decode_utf16};21use core::convert::TryInto;21use core::convert::TryInto;22use evm_coder::{22use evm_coder::{23 abi::AbiType, ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight,23 abi::AbiType, ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*,24 weight,24};25};25use up_data_structs::CollectionMode;26use up_data_structs::CollectionMode;178 /// deducting from the sender's allowance for said account.179 /// deducting from the sender's allowance for said account.179 /// @param from The account whose tokens will be burnt.180 /// @param from The account whose tokens will be burnt.180 /// @param amount The amount that will be burnt.181 /// @param amount The amount that will be burnt.182 #[solidity(hide)]181 #[weight(<SelfWeightOf<T>>::burn_from())]183 #[weight(<SelfWeightOf<T>>::burn_from())]182 fn burn_from(&mut self, caller: caller, from: address, amount: uint256) -> Result<bool> {184 fn burn_from(&mut self, caller: caller, from: address, amount: uint256) -> Result<bool> {183 let caller = T::CrossAccountId::from_eth(caller);185 let caller = T::CrossAccountId::from_eth(caller);pallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth18}18}191920/// @title A contract that allows you to work with collections.20/// @title A contract that allows you to work with collections.21/// @dev the ERC-165 identifier for this interface is 0xb3152af321/// @dev the ERC-165 identifier for this interface is 0x324a7f5b22contract Collection is Dummy, ERC165 {22contract Collection is Dummy, ERC165 {23 /// Set collection property.23 // /// Set collection property.24 ///24 // ///25 /// @param key Property key.25 // /// @param key Property key.26 /// @param value Propery value.26 // /// @param value Propery value.27 /// @dev EVM selector for this function is: 0x2f073f66,27 // /// @dev EVM selector for this function is: 0x2f073f66,28 /// or in textual repr: setCollectionProperty(string,bytes)28 // /// or in textual repr: setCollectionProperty(string,bytes)29 function setCollectionProperty(string memory key, bytes memory value) public {29 // function setCollectionProperty(string memory key, bytes memory value) public {30 require(false, stub_error);30 // require(false, stub_error);31 key;31 // key;32 value;32 // value;33 dummy = 0;33 // dummy = 0;34 }34 // }353536 /// Set collection properties.36 /// Set collection properties.37 ///37 ///38 /// @param properties Vector of properties key/value pair.38 /// @param properties Vector of properties key/value pair.39 /// @dev EVM selector for this function is: 0x50b26b2a,39 /// @dev EVM selector for this function is: 0x50b26b2a,40 /// or in textual repr: setCollectionProperties((string,bytes)[])40 /// or in textual repr: setCollectionProperties((string,bytes)[])41 function setCollectionProperties(Tuple15[] memory properties) public {41 function setCollectionProperties(Property[] memory properties) public {42 require(false, stub_error);42 require(false, stub_error);43 properties;43 properties;44 dummy = 0;44 dummy = 0;45 }45 }464647 /// Delete collection property.47 // /// Delete collection property.48 ///48 // ///49 /// @param key Property key.49 // /// @param key Property key.50 /// @dev EVM selector for this function is: 0x7b7debce,50 // /// @dev EVM selector for this function is: 0x7b7debce,51 /// or in textual repr: deleteCollectionProperty(string)51 // /// or in textual repr: deleteCollectionProperty(string)52 function deleteCollectionProperty(string memory key) public {52 // function deleteCollectionProperty(string memory key) public {53 require(false, stub_error);53 // require(false, stub_error);54 key;54 // key;55 dummy = 0;55 // dummy = 0;56 }56 // }575758 /// Delete collection properties.58 /// Delete collection properties.59 ///59 ///87 /// @return Vector of properties key/value pairs.87 /// @return Vector of properties key/value pairs.88 /// @dev EVM selector for this function is: 0x285fb8e6,88 /// @dev EVM selector for this function is: 0x285fb8e6,89 /// or in textual repr: collectionProperties(string[])89 /// or in textual repr: collectionProperties(string[])90 function collectionProperties(string[] memory keys) public view returns (Tuple15[] memory) {90 function collectionProperties(string[] memory keys) public view returns (Tuple16[] memory) {91 require(false, stub_error);91 require(false, stub_error);92 keys;92 keys;93 dummy;93 dummy;94 return new Tuple15[](0);94 return new Tuple16[](0);95 }95 }969697 /// Set the sponsor of the collection.97 // /// Set the sponsor of the collection.98 ///98 // ///99 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.99 // /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.100 ///100 // ///101 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.101 // /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.102 /// @dev EVM selector for this function is: 0x7623402e,102 // /// @dev EVM selector for this function is: 0x7623402e,103 /// or in textual repr: setCollectionSponsor(address)103 // /// or in textual repr: setCollectionSponsor(address)104 function setCollectionSponsor(address sponsor) public {104 // function setCollectionSponsor(address sponsor) public {105 require(false, stub_error);105 // require(false, stub_error);106 sponsor;106 // sponsor;107 dummy = 0;107 // dummy = 0;108 }108 // }109109110 /// Set the sponsor of the collection.110 /// Set the sponsor of the collection.111 ///111 ///222 dummy = 0;222 dummy = 0;223 }223 }224224225 /// Add collection admin.225 // /// Add collection admin.226 /// @param newAdmin Address of the added administrator.226 // /// @param newAdmin Address of the added administrator.227 /// @dev EVM selector for this function is: 0x92e462c7,227 // /// @dev EVM selector for this function is: 0x92e462c7,228 /// or in textual repr: addCollectionAdmin(address)228 // /// or in textual repr: addCollectionAdmin(address)229 function addCollectionAdmin(address newAdmin) public {229 // function addCollectionAdmin(address newAdmin) public {230 require(false, stub_error);230 // require(false, stub_error);231 newAdmin;231 // newAdmin;232 dummy = 0;232 // dummy = 0;233 }233 // }234234235 /// Remove collection admin.235 // /// Remove collection admin.236 ///236 // ///237 /// @param admin Address of the removed administrator.237 // /// @param admin Address of the removed administrator.238 /// @dev EVM selector for this function is: 0xfafd7b42,238 // /// @dev EVM selector for this function is: 0xfafd7b42,239 /// or in textual repr: removeCollectionAdmin(address)239 // /// or in textual repr: removeCollectionAdmin(address)240 function removeCollectionAdmin(address admin) public {240 // function removeCollectionAdmin(address admin) public {241 require(false, stub_error);241 // require(false, stub_error);242 admin;242 // admin;243 dummy = 0;243 // dummy = 0;244 }244 // }245245246 /// Toggle accessibility of collection nesting.246 /// Toggle accessibility of collection nesting.247 ///247 ///291 return false;291 return false;292 }292 }293293294 /// Add the user to the allowed list.294 // /// Add the user to the allowed list.295 ///295 // ///296 /// @param user Address of a trusted user.296 // /// @param user Address of a trusted user.297 /// @dev EVM selector for this function is: 0x67844fe6,297 // /// @dev EVM selector for this function is: 0x67844fe6,298 /// or in textual repr: addToCollectionAllowList(address)298 // /// or in textual repr: addToCollectionAllowList(address)299 function addToCollectionAllowList(address user) public {299 // function addToCollectionAllowList(address user) public {300 require(false, stub_error);300 // require(false, stub_error);301 user;301 // user;302 dummy = 0;302 // dummy = 0;303 }303 // }304304305 /// Add user to allowed list.305 /// Add user to allowed list.306 ///306 ///313 dummy = 0;313 dummy = 0;314 }314 }315315316 /// Remove the user from the allowed list.316 // /// Remove the user from the allowed list.317 ///317 // ///318 /// @param user Address of a removed user.318 // /// @param user Address of a removed user.319 /// @dev EVM selector for this function is: 0x85c51acb,319 // /// @dev EVM selector for this function is: 0x85c51acb,320 /// or in textual repr: removeFromCollectionAllowList(address)320 // /// or in textual repr: removeFromCollectionAllowList(address)321 function removeFromCollectionAllowList(address user) public {321 // function removeFromCollectionAllowList(address user) public {322 require(false, stub_error);322 // require(false, stub_error);323 user;323 // user;324 dummy = 0;324 // dummy = 0;325 }325 // }326326327 /// Remove user from allowed list.327 /// Remove user from allowed list.328 ///328 ///346 dummy = 0;346 dummy = 0;347 }347 }348348349 /// Check that account is the owner or admin of the collection349 // /// Check that account is the owner or admin of the collection350 ///350 // ///351 /// @param user account to verify351 // /// @param user account to verify352 /// @return "true" if account is the owner or admin352 // /// @return "true" if account is the owner or admin353 /// @dev EVM selector for this function is: 0x9811b0c7,353 // /// @dev EVM selector for this function is: 0x9811b0c7,354 /// or in textual repr: isOwnerOrAdmin(address)354 // /// or in textual repr: isOwnerOrAdmin(address)355 function isOwnerOrAdmin(address user) public view returns (bool) {355 // function isOwnerOrAdmin(address user) public view returns (bool) {356 require(false, stub_error);356 // require(false, stub_error);357 user;357 // user;358 dummy;358 // dummy;359 return false;359 // return false;360 }360 // }361361362 /// Check that account is the owner or admin of the collection362 /// Check that account is the owner or admin of the collection363 ///363 ///395 return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);395 return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);396 }396 }397397398 /// Changes collection owner to another account398 // /// Changes collection owner to another account399 ///399 // ///400 /// @dev Owner can be changed only by current owner400 // /// @dev Owner can be changed only by current owner401 /// @param newOwner new owner account401 // /// @param newOwner new owner account402 /// @dev EVM selector for this function is: 0x4f53e226,402 // /// @dev EVM selector for this function is: 0x4f53e226,403 /// or in textual repr: changeCollectionOwner(address)403 // /// or in textual repr: changeCollectionOwner(address)404 function changeCollectionOwner(address newOwner) public {404 // function changeCollectionOwner(address newOwner) public {405 require(false, stub_error);405 // require(false, stub_error);406 newOwner;406 // newOwner;407 dummy = 0;407 // dummy = 0;408 }408 // }409409410 /// Get collection administrators410 /// Get collection administrators411 ///411 ///423 ///423 ///424 /// @dev Owner can be changed only by current owner424 /// @dev Owner can be changed only by current owner425 /// @param newOwner new owner cross account425 /// @param newOwner new owner cross account426 /// @dev EVM selector for this function is: 0xe5c9913f,426 /// @dev EVM selector for this function is: 0x6496c497,427 /// or in textual repr: setOwnerCross((address,uint256))427 /// or in textual repr: changeCollectionOwnerCross((address,uint256))428 function setOwnerCross(EthCrossAccount memory newOwner) public {428 function changeCollectionOwnerCross(EthCrossAccount memory newOwner) public {429 require(false, stub_error);429 require(false, stub_error);430 newOwner;430 newOwner;431 dummy = 0;431 dummy = 0;439}439}440440441/// @dev anonymous struct441/// @dev anonymous struct442struct Tuple15 {442struct Tuple16 {443 string field_0;443 string field_0;444 bytes field_1;444 bytes field_1;445}445}446447/// @dev Property struct448struct Property {449 string key;450 bytes value;451}446452447/// @dev the ERC-165 identifier for this interface is 0x29f4dcd9453/// @dev the ERC-165 identifier for this interface is 0x29f4dcd9448contract ERC20UniqueExtensions is Dummy, ERC165 {454contract ERC20UniqueExtensions is Dummy, ERC165 {456 return false;462 return false;457 }463 }458464459 /// Burn tokens from account465 // /// Burn tokens from account460 /// @dev Function that burns an `amount` of the tokens of a given account,466 // /// @dev Function that burns an `amount` of the tokens of a given account,461 /// deducting from the sender's allowance for said account.467 // /// deducting from the sender's allowance for said account.462 /// @param from The account whose tokens will be burnt.468 // /// @param from The account whose tokens will be burnt.463 /// @param amount The amount that will be burnt.469 // /// @param amount The amount that will be burnt.464 /// @dev EVM selector for this function is: 0x79cc6790,470 // /// @dev EVM selector for this function is: 0x79cc6790,465 /// or in textual repr: burnFrom(address,uint256)471 // /// or in textual repr: burnFrom(address,uint256)466 function burnFrom(address from, uint256 amount) public returns (bool) {472 // function burnFrom(address from, uint256 amount) public returns (bool) {467 require(false, stub_error);473 // require(false, stub_error);468 from;474 // from;469 amount;475 // amount;470 dummy = 0;476 // dummy = 0;471 return false;477 // return false;472 }478 // }473479474 /// Burn tokens from account480 /// Burn tokens from account475 /// @dev Function that burns an `amount` of the tokens of a given account,481 /// @dev Function that burns an `amount` of the tokens of a given account,pallets/nonfungible/src/erc.rsdiffbeforeafterboth26};26};27use evm_coder::{27use evm_coder::{28 abi::AbiType, ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*,28 abi::AbiType, ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*,29 weight,29 types::Property as PropertyStruct, weight,30};30};31use frame_support::BoundedVec;31use frame_support::BoundedVec;32use up_data_structs::{32use up_data_structs::{88 /// @param tokenId ID of the token.88 /// @param tokenId ID of the token.89 /// @param key Property key.89 /// @param key Property key.90 /// @param value Property value.90 /// @param value Property value.91 #[solidity(hide)]91 fn set_property(92 fn set_property(92 &mut self,93 &mut self,93 caller: caller,94 caller: caller,125 &mut self,126 &mut self,126 caller: caller,127 caller: caller,127 token_id: uint256,128 token_id: uint256,128 properties: Vec<(string, bytes)>,129 properties: Vec<PropertyStruct>,129 ) -> Result<()> {130 ) -> Result<()> {130 let caller = T::CrossAccountId::from_eth(caller);131 let caller = T::CrossAccountId::from_eth(caller);131 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;132 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;136137137 let properties = properties138 let properties = properties138 .into_iter()139 .into_iter()139 .map(|(key, value)| {140 .map(|PropertyStruct { key, value }| {140 let key = <Vec<u8>>::from(key)141 let key = <Vec<u8>>::from(key)141 .try_into()142 .try_into()142 .map_err(|_| "key too large")?;143 .map_err(|_| "key too large")?;794 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.795 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.795 /// @param from The current owner of the NFT796 /// @param from The current owner of the NFT796 /// @param tokenId The NFT to transfer797 /// @param tokenId The NFT to transfer798 #[solidity(hide)]797 #[weight(<SelfWeightOf<T>>::burn_from())]799 #[weight(<SelfWeightOf<T>>::burn_from())]798 fn burn_from(&mut self, caller: caller, from: address, token_id: uint256) -> Result<void> {800 fn burn_from(&mut self, caller: caller, from: address, token_id: uint256) -> Result<void> {799 let caller = T::CrossAccountId::from_eth(caller);801 let caller = T::CrossAccountId::from_eth(caller);pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth42 dummy = 0;42 dummy = 0;43 }43 }444445 /// @notice Set token property value.45 // /// @notice Set token property value.46 /// @dev Throws error if `msg.sender` has no permission to edit the property.46 // /// @dev Throws error if `msg.sender` has no permission to edit the property.47 /// @param tokenId ID of the token.47 // /// @param tokenId ID of the token.48 /// @param key Property key.48 // /// @param key Property key.49 /// @param value Property value.49 // /// @param value Property value.50 /// @dev EVM selector for this function is: 0x1752d67b,50 // /// @dev EVM selector for this function is: 0x1752d67b,51 /// or in textual repr: setProperty(uint256,string,bytes)51 // /// or in textual repr: setProperty(uint256,string,bytes)52 function setProperty(52 // function setProperty(uint256 tokenId, string memory key, bytes memory value) public {53 uint256 tokenId,53 // require(false, stub_error);54 string memory key,54 // tokenId;55 bytes memory value55 // key;56 ) public {56 // value;57 require(false, stub_error);57 // dummy = 0;58 tokenId;58 // }59 key;60 value;61 dummy = 0;62 }635964 /// @notice Set token properties value.60 /// @notice Set token properties value.65 /// @dev Throws error if `msg.sender` has no permission to edit the property.61 /// @dev Throws error if `msg.sender` has no permission to edit the property.66 /// @param tokenId ID of the token.62 /// @param tokenId ID of the token.67 /// @param properties settable properties63 /// @param properties settable properties68 /// @dev EVM selector for this function is: 0x14ed3a6e,64 /// @dev EVM selector for this function is: 0x14ed3a6e,69 /// or in textual repr: setProperties(uint256,(string,bytes)[])65 /// or in textual repr: setProperties(uint256,(string,bytes)[])70 function setProperties(uint256 tokenId, Tuple22[] memory properties) public {66 function setProperties(uint256 tokenId, Property[] memory properties) public {71 require(false, stub_error);67 require(false, stub_error);72 tokenId;68 tokenId;73 properties;69 properties;116 }112 }117}113}114115/// @dev Property struct116struct Property {117 string key;118 bytes value;119}118120119/// @title A contract that allows you to work with collections.121/// @title A contract that allows you to work with collections.120/// @dev the ERC-165 identifier for this interface is 0xb3152af3122/// @dev the ERC-165 identifier for this interface is 0x324a7f5b121contract Collection is Dummy, ERC165 {123contract Collection is Dummy, ERC165 {122 /// Set collection property.124 // /// Set collection property.123 ///125 // ///124 /// @param key Property key.126 // /// @param key Property key.125 /// @param value Propery value.127 // /// @param value Propery value.126 /// @dev EVM selector for this function is: 0x2f073f66,128 // /// @dev EVM selector for this function is: 0x2f073f66,127 /// or in textual repr: setCollectionProperty(string,bytes)129 // /// or in textual repr: setCollectionProperty(string,bytes)128 function setCollectionProperty(string memory key, bytes memory value) public {130 // function setCollectionProperty(string memory key, bytes memory value) public {129 require(false, stub_error);131 // require(false, stub_error);130 key;132 // key;131 value;133 // value;132 dummy = 0;134 // dummy = 0;133 }135 // }134136135 /// Set collection properties.137 /// Set collection properties.136 ///138 ///137 /// @param properties Vector of properties key/value pair.139 /// @param properties Vector of properties key/value pair.138 /// @dev EVM selector for this function is: 0x50b26b2a,140 /// @dev EVM selector for this function is: 0x50b26b2a,139 /// or in textual repr: setCollectionProperties((string,bytes)[])141 /// or in textual repr: setCollectionProperties((string,bytes)[])140 function setCollectionProperties(Tuple22[] memory properties) public {142 function setCollectionProperties(Property[] memory properties) public {141 require(false, stub_error);143 require(false, stub_error);142 properties;144 properties;143 dummy = 0;145 dummy = 0;144 }146 }145147146 /// Delete collection property.148 // /// Delete collection property.147 ///149 // ///148 /// @param key Property key.150 // /// @param key Property key.149 /// @dev EVM selector for this function is: 0x7b7debce,151 // /// @dev EVM selector for this function is: 0x7b7debce,150 /// or in textual repr: deleteCollectionProperty(string)152 // /// or in textual repr: deleteCollectionProperty(string)151 function deleteCollectionProperty(string memory key) public {153 // function deleteCollectionProperty(string memory key) public {152 require(false, stub_error);154 // require(false, stub_error);153 key;155 // key;154 dummy = 0;156 // dummy = 0;155 }157 // }156158157 /// Delete collection properties.159 /// Delete collection properties.158 ///160 ///186 /// @return Vector of properties key/value pairs.188 /// @return Vector of properties key/value pairs.187 /// @dev EVM selector for this function is: 0x285fb8e6,189 /// @dev EVM selector for this function is: 0x285fb8e6,188 /// or in textual repr: collectionProperties(string[])190 /// or in textual repr: collectionProperties(string[])189 function collectionProperties(string[] memory keys) public view returns (Tuple22[] memory) {191 function collectionProperties(string[] memory keys) public view returns (Tuple23[] memory) {190 require(false, stub_error);192 require(false, stub_error);191 keys;193 keys;192 dummy;194 dummy;193 return new Tuple22[](0);195 return new Tuple23[](0);194 }196 }195197196 /// Set the sponsor of the collection.198 // /// Set the sponsor of the collection.197 ///199 // ///198 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.200 // /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.199 ///201 // ///200 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.202 // /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.201 /// @dev EVM selector for this function is: 0x7623402e,203 // /// @dev EVM selector for this function is: 0x7623402e,202 /// or in textual repr: setCollectionSponsor(address)204 // /// or in textual repr: setCollectionSponsor(address)203 function setCollectionSponsor(address sponsor) public {205 // function setCollectionSponsor(address sponsor) public {204 require(false, stub_error);206 // require(false, stub_error);205 sponsor;207 // sponsor;206 dummy = 0;208 // dummy = 0;207 }209 // }208210209 /// Set the sponsor of the collection.211 /// Set the sponsor of the collection.210 ///212 ///251 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.253 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.252 /// @dev EVM selector for this function is: 0x6ec0a9f1,254 /// @dev EVM selector for this function is: 0x6ec0a9f1,253 /// or in textual repr: collectionSponsor()255 /// or in textual repr: collectionSponsor()254 function collectionSponsor() public view returns (Tuple25 memory) {256 function collectionSponsor() public view returns (Tuple26 memory) {255 require(false, stub_error);257 require(false, stub_error);256 dummy;258 dummy;257 return Tuple25(0x0000000000000000000000000000000000000000, 0);259 return Tuple26(0x0000000000000000000000000000000000000000, 0);258 }260 }259261260 /// Set limits for the collection.262 /// Set limits for the collection.321 dummy = 0;323 dummy = 0;322 }324 }323325324 /// Add collection admin.326 // /// Add collection admin.325 /// @param newAdmin Address of the added administrator.327 // /// @param newAdmin Address of the added administrator.326 /// @dev EVM selector for this function is: 0x92e462c7,328 // /// @dev EVM selector for this function is: 0x92e462c7,327 /// or in textual repr: addCollectionAdmin(address)329 // /// or in textual repr: addCollectionAdmin(address)328 function addCollectionAdmin(address newAdmin) public {330 // function addCollectionAdmin(address newAdmin) public {329 require(false, stub_error);331 // require(false, stub_error);330 newAdmin;332 // newAdmin;331 dummy = 0;333 // dummy = 0;332 }334 // }333335334 /// Remove collection admin.336 // /// Remove collection admin.335 ///337 // ///336 /// @param admin Address of the removed administrator.338 // /// @param admin Address of the removed administrator.337 /// @dev EVM selector for this function is: 0xfafd7b42,339 // /// @dev EVM selector for this function is: 0xfafd7b42,338 /// or in textual repr: removeCollectionAdmin(address)340 // /// or in textual repr: removeCollectionAdmin(address)339 function removeCollectionAdmin(address admin) public {341 // function removeCollectionAdmin(address admin) public {340 require(false, stub_error);342 // require(false, stub_error);341 admin;343 // admin;342 dummy = 0;344 // dummy = 0;343 }345 // }344346345 /// Toggle accessibility of collection nesting.347 /// Toggle accessibility of collection nesting.346 ///348 ///390 return false;392 return false;391 }393 }392394393 /// Add the user to the allowed list.395 // /// Add the user to the allowed list.394 ///396 // ///395 /// @param user Address of a trusted user.397 // /// @param user Address of a trusted user.396 /// @dev EVM selector for this function is: 0x67844fe6,398 // /// @dev EVM selector for this function is: 0x67844fe6,397 /// or in textual repr: addToCollectionAllowList(address)399 // /// or in textual repr: addToCollectionAllowList(address)398 function addToCollectionAllowList(address user) public {400 // function addToCollectionAllowList(address user) public {399 require(false, stub_error);401 // require(false, stub_error);400 user;402 // user;401 dummy = 0;403 // dummy = 0;402 }404 // }403405404 /// Add user to allowed list.406 /// Add user to allowed list.405 ///407 ///412 dummy = 0;414 dummy = 0;413 }415 }414416415 /// Remove the user from the allowed list.417 // /// Remove the user from the allowed list.416 ///418 // ///417 /// @param user Address of a removed user.419 // /// @param user Address of a removed user.418 /// @dev EVM selector for this function is: 0x85c51acb,420 // /// @dev EVM selector for this function is: 0x85c51acb,419 /// or in textual repr: removeFromCollectionAllowList(address)421 // /// or in textual repr: removeFromCollectionAllowList(address)420 function removeFromCollectionAllowList(address user) public {422 // function removeFromCollectionAllowList(address user) public {421 require(false, stub_error);423 // require(false, stub_error);422 user;424 // user;423 dummy = 0;425 // dummy = 0;424 }426 // }425427426 /// Remove user from allowed list.428 /// Remove user from allowed list.427 ///429 ///445 dummy = 0;447 dummy = 0;446 }448 }447449448 /// Check that account is the owner or admin of the collection450 // /// Check that account is the owner or admin of the collection449 ///451 // ///450 /// @param user account to verify452 // /// @param user account to verify451 /// @return "true" if account is the owner or admin453 // /// @return "true" if account is the owner or admin452 /// @dev EVM selector for this function is: 0x9811b0c7,454 // /// @dev EVM selector for this function is: 0x9811b0c7,453 /// or in textual repr: isOwnerOrAdmin(address)455 // /// or in textual repr: isOwnerOrAdmin(address)454 function isOwnerOrAdmin(address user) public view returns (bool) {456 // function isOwnerOrAdmin(address user) public view returns (bool) {455 require(false, stub_error);457 // require(false, stub_error);456 user;458 // user;457 dummy;459 // dummy;458 return false;460 // return false;459 }461 // }460462461 /// Check that account is the owner or admin of the collection463 /// Check that account is the owner or admin of the collection462 ///464 ///494 return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);496 return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);495 }497 }496498497 /// Changes collection owner to another account499 // /// Changes collection owner to another account498 ///500 // ///499 /// @dev Owner can be changed only by current owner501 // /// @dev Owner can be changed only by current owner500 /// @param newOwner new owner account502 // /// @param newOwner new owner account501 /// @dev EVM selector for this function is: 0x4f53e226,503 // /// @dev EVM selector for this function is: 0x4f53e226,502 /// or in textual repr: changeCollectionOwner(address)504 // /// or in textual repr: changeCollectionOwner(address)503 function changeCollectionOwner(address newOwner) public {505 // function changeCollectionOwner(address newOwner) public {504 require(false, stub_error);506 // require(false, stub_error);505 newOwner;507 // newOwner;506 dummy = 0;508 // dummy = 0;507 }509 // }508510509 /// Get collection administrators511 /// Get collection administrators510 ///512 ///522 ///524 ///523 /// @dev Owner can be changed only by current owner525 /// @dev Owner can be changed only by current owner524 /// @param newOwner new owner cross account526 /// @param newOwner new owner cross account525 /// @dev EVM selector for this function is: 0xe5c9913f,527 /// @dev EVM selector for this function is: 0x6496c497,526 /// or in textual repr: setOwnerCross((address,uint256))528 /// or in textual repr: changeCollectionOwnerCross((address,uint256))527 function setOwnerCross(EthCrossAccount memory newOwner) public {529 function changeCollectionOwnerCross(EthCrossAccount memory newOwner) public {528 require(false, stub_error);530 require(false, stub_error);529 newOwner;531 newOwner;530 dummy = 0;532 dummy = 0;538}540}539541540/// @dev anonymous struct542/// @dev anonymous struct541struct Tuple25 {543struct Tuple26 {542 address field_0;544 address field_0;543 uint256 field_1;545 uint256 field_1;544}546}545547546/// @dev anonymous struct548/// @dev anonymous struct547struct Tuple22 {549struct Tuple23 {548 string field_0;550 string field_0;549 bytes field_1;551 bytes field_1;550}552}776 dummy = 0;778 dummy = 0;777 }779 }778780779 /// @notice Burns a specific ERC721 token.781 // /// @notice Burns a specific ERC721 token.780 /// @dev Throws unless `msg.sender` is the current owner or an authorized782 // /// @dev Throws unless `msg.sender` is the current owner or an authorized781 /// operator for this NFT. Throws if `from` is not the current owner. Throws783 // /// operator for this NFT. Throws if `from` is not the current owner. Throws782 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.784 // /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.783 /// @param from The current owner of the NFT785 // /// @param from The current owner of the NFT784 /// @param tokenId The NFT to transfer786 // /// @param tokenId The NFT to transfer785 /// @dev EVM selector for this function is: 0x79cc6790,787 // /// @dev EVM selector for this function is: 0x79cc6790,786 /// or in textual repr: burnFrom(address,uint256)788 // /// or in textual repr: burnFrom(address,uint256)787 function burnFrom(address from, uint256 tokenId) public {789 // function burnFrom(address from, uint256 tokenId) public {788 require(false, stub_error);790 // require(false, stub_error);789 from;791 // from;790 tokenId;792 // tokenId;791 dummy = 0;793 // dummy = 0;792 }794 // }793795794 /// @notice Burns a specific ERC721 token.796 /// @notice Burns a specific ERC721 token.795 /// @dev Throws unless `msg.sender` is the current owner or an authorized797 /// @dev Throws unless `msg.sender` is the current owner or an authorizedpallets/refungible/src/erc.rsdiffbeforeafterboth27};27};28use evm_coder::{28use evm_coder::{29 abi::AbiType, ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*,29 abi::AbiType, ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*,30 weight,30 types::Property as PropertyStruct, weight,31};31};32use frame_support::{BoundedBTreeMap, BoundedVec};32use frame_support::{BoundedBTreeMap, BoundedVec};33use pallet_common::{33use pallet_common::{91 /// @param tokenId ID of the token.91 /// @param tokenId ID of the token.92 /// @param key Property key.92 /// @param key Property key.93 /// @param value Property value.93 /// @param value Property value.94 #[solidity(hide)]94 fn set_property(95 fn set_property(95 &mut self,96 &mut self,96 caller: caller,97 caller: caller,127 &mut self,128 &mut self,128 caller: caller,129 caller: caller,129 token_id: uint256,130 token_id: uint256,130 properties: Vec<(string, bytes)>,131 properties: Vec<PropertyStruct>,131 ) -> Result<()> {132 ) -> Result<()> {132 let caller = T::CrossAccountId::from_eth(caller);133 let caller = T::CrossAccountId::from_eth(caller);133 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;134 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;138139139 let properties = properties140 let properties = properties140 .into_iter()141 .into_iter()141 .map(|(key, value)| {142 .map(|PropertyStruct { key, value }| {142 let key = <Vec<u8>>::from(key)143 let key = <Vec<u8>>::from(key)143 .try_into()144 .try_into()144 .map_err(|_| "key too large")?;145 .map_err(|_| "key too large")?;814 /// Throws if RFT pieces have multiple owners.815 /// Throws if RFT pieces have multiple owners.815 /// @param from The current owner of the RFT816 /// @param from The current owner of the RFT816 /// @param tokenId The RFT to transfer817 /// @param tokenId The RFT to transfer818 #[solidity(hide)]817 #[weight(<SelfWeightOf<T>>::burn_from())]819 #[weight(<SelfWeightOf<T>>::burn_from())]818 fn burn_from(&mut self, caller: caller, from: address, token_id: uint256) -> Result<void> {820 fn burn_from(&mut self, caller: caller, from: address, token_id: uint256) -> Result<void> {819 let caller = T::CrossAccountId::from_eth(caller);821 let caller = T::CrossAccountId::from_eth(caller);pallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth42 dummy = 0;42 dummy = 0;43 }43 }444445 /// @notice Set token property value.45 // /// @notice Set token property value.46 /// @dev Throws error if `msg.sender` has no permission to edit the property.46 // /// @dev Throws error if `msg.sender` has no permission to edit the property.47 /// @param tokenId ID of the token.47 // /// @param tokenId ID of the token.48 /// @param key Property key.48 // /// @param key Property key.49 /// @param value Property value.49 // /// @param value Property value.50 /// @dev EVM selector for this function is: 0x1752d67b,50 // /// @dev EVM selector for this function is: 0x1752d67b,51 /// or in textual repr: setProperty(uint256,string,bytes)51 // /// or in textual repr: setProperty(uint256,string,bytes)52 function setProperty(52 // function setProperty(uint256 tokenId, string memory key, bytes memory value) public {53 uint256 tokenId,53 // require(false, stub_error);54 string memory key,54 // tokenId;55 bytes memory value55 // key;56 ) public {56 // value;57 require(false, stub_error);57 // dummy = 0;58 tokenId;58 // }59 key;60 value;61 dummy = 0;62 }635964 /// @notice Set token properties value.60 /// @notice Set token properties value.65 /// @dev Throws error if `msg.sender` has no permission to edit the property.61 /// @dev Throws error if `msg.sender` has no permission to edit the property.66 /// @param tokenId ID of the token.62 /// @param tokenId ID of the token.67 /// @param properties settable properties63 /// @param properties settable properties68 /// @dev EVM selector for this function is: 0x14ed3a6e,64 /// @dev EVM selector for this function is: 0x14ed3a6e,69 /// or in textual repr: setProperties(uint256,(string,bytes)[])65 /// or in textual repr: setProperties(uint256,(string,bytes)[])70 function setProperties(uint256 tokenId, Tuple21[] memory properties) public {66 function setProperties(uint256 tokenId, Property[] memory properties) public {71 require(false, stub_error);67 require(false, stub_error);72 tokenId;68 tokenId;73 properties;69 properties;116 }112 }117}113}114115/// @dev Property struct116struct Property {117 string key;118 bytes value;119}118120119/// @title A contract that allows you to work with collections.121/// @title A contract that allows you to work with collections.120/// @dev the ERC-165 identifier for this interface is 0xb3152af3122/// @dev the ERC-165 identifier for this interface is 0x324a7f5b121contract Collection is Dummy, ERC165 {123contract Collection is Dummy, ERC165 {122 /// Set collection property.124 // /// Set collection property.123 ///125 // ///124 /// @param key Property key.126 // /// @param key Property key.125 /// @param value Propery value.127 // /// @param value Propery value.126 /// @dev EVM selector for this function is: 0x2f073f66,128 // /// @dev EVM selector for this function is: 0x2f073f66,127 /// or in textual repr: setCollectionProperty(string,bytes)129 // /// or in textual repr: setCollectionProperty(string,bytes)128 function setCollectionProperty(string memory key, bytes memory value) public {130 // function setCollectionProperty(string memory key, bytes memory value) public {129 require(false, stub_error);131 // require(false, stub_error);130 key;132 // key;131 value;133 // value;132 dummy = 0;134 // dummy = 0;133 }135 // }134136135 /// Set collection properties.137 /// Set collection properties.136 ///138 ///137 /// @param properties Vector of properties key/value pair.139 /// @param properties Vector of properties key/value pair.138 /// @dev EVM selector for this function is: 0x50b26b2a,140 /// @dev EVM selector for this function is: 0x50b26b2a,139 /// or in textual repr: setCollectionProperties((string,bytes)[])141 /// or in textual repr: setCollectionProperties((string,bytes)[])140 function setCollectionProperties(Tuple21[] memory properties) public {142 function setCollectionProperties(Property[] memory properties) public {141 require(false, stub_error);143 require(false, stub_error);142 properties;144 properties;143 dummy = 0;145 dummy = 0;144 }146 }145147146 /// Delete collection property.148 // /// Delete collection property.147 ///149 // ///148 /// @param key Property key.150 // /// @param key Property key.149 /// @dev EVM selector for this function is: 0x7b7debce,151 // /// @dev EVM selector for this function is: 0x7b7debce,150 /// or in textual repr: deleteCollectionProperty(string)152 // /// or in textual repr: deleteCollectionProperty(string)151 function deleteCollectionProperty(string memory key) public {153 // function deleteCollectionProperty(string memory key) public {152 require(false, stub_error);154 // require(false, stub_error);153 key;155 // key;154 dummy = 0;156 // dummy = 0;155 }157 // }156158157 /// Delete collection properties.159 /// Delete collection properties.158 ///160 ///186 /// @return Vector of properties key/value pairs.188 /// @return Vector of properties key/value pairs.187 /// @dev EVM selector for this function is: 0x285fb8e6,189 /// @dev EVM selector for this function is: 0x285fb8e6,188 /// or in textual repr: collectionProperties(string[])190 /// or in textual repr: collectionProperties(string[])189 function collectionProperties(string[] memory keys) public view returns (Tuple21[] memory) {191 function collectionProperties(string[] memory keys) public view returns (Tuple22[] memory) {190 require(false, stub_error);192 require(false, stub_error);191 keys;193 keys;192 dummy;194 dummy;193 return new Tuple21[](0);195 return new Tuple22[](0);194 }196 }195197196 /// Set the sponsor of the collection.198 // /// Set the sponsor of the collection.197 ///199 // ///198 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.200 // /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.199 ///201 // ///200 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.202 // /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.201 /// @dev EVM selector for this function is: 0x7623402e,203 // /// @dev EVM selector for this function is: 0x7623402e,202 /// or in textual repr: setCollectionSponsor(address)204 // /// or in textual repr: setCollectionSponsor(address)203 function setCollectionSponsor(address sponsor) public {205 // function setCollectionSponsor(address sponsor) public {204 require(false, stub_error);206 // require(false, stub_error);205 sponsor;207 // sponsor;206 dummy = 0;208 // dummy = 0;207 }209 // }208210209 /// Set the sponsor of the collection.211 /// Set the sponsor of the collection.210 ///212 ///251 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.253 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.252 /// @dev EVM selector for this function is: 0x6ec0a9f1,254 /// @dev EVM selector for this function is: 0x6ec0a9f1,253 /// or in textual repr: collectionSponsor()255 /// or in textual repr: collectionSponsor()254 function collectionSponsor() public view returns (Tuple24 memory) {256 function collectionSponsor() public view returns (Tuple25 memory) {255 require(false, stub_error);257 require(false, stub_error);256 dummy;258 dummy;257 return Tuple24(0x0000000000000000000000000000000000000000, 0);259 return Tuple25(0x0000000000000000000000000000000000000000, 0);258 }260 }259261260 /// Set limits for the collection.262 /// Set limits for the collection.321 dummy = 0;323 dummy = 0;322 }324 }323325324 /// Add collection admin.326 // /// Add collection admin.325 /// @param newAdmin Address of the added administrator.327 // /// @param newAdmin Address of the added administrator.326 /// @dev EVM selector for this function is: 0x92e462c7,328 // /// @dev EVM selector for this function is: 0x92e462c7,327 /// or in textual repr: addCollectionAdmin(address)329 // /// or in textual repr: addCollectionAdmin(address)328 function addCollectionAdmin(address newAdmin) public {330 // function addCollectionAdmin(address newAdmin) public {329 require(false, stub_error);331 // require(false, stub_error);330 newAdmin;332 // newAdmin;331 dummy = 0;333 // dummy = 0;332 }334 // }333335334 /// Remove collection admin.336 // /// Remove collection admin.335 ///337 // ///336 /// @param admin Address of the removed administrator.338 // /// @param admin Address of the removed administrator.337 /// @dev EVM selector for this function is: 0xfafd7b42,339 // /// @dev EVM selector for this function is: 0xfafd7b42,338 /// or in textual repr: removeCollectionAdmin(address)340 // /// or in textual repr: removeCollectionAdmin(address)339 function removeCollectionAdmin(address admin) public {341 // function removeCollectionAdmin(address admin) public {340 require(false, stub_error);342 // require(false, stub_error);341 admin;343 // admin;342 dummy = 0;344 // dummy = 0;343 }345 // }344346345 /// Toggle accessibility of collection nesting.347 /// Toggle accessibility of collection nesting.346 ///348 ///390 return false;392 return false;391 }393 }392394393 /// Add the user to the allowed list.395 // /// Add the user to the allowed list.394 ///396 // ///395 /// @param user Address of a trusted user.397 // /// @param user Address of a trusted user.396 /// @dev EVM selector for this function is: 0x67844fe6,398 // /// @dev EVM selector for this function is: 0x67844fe6,397 /// or in textual repr: addToCollectionAllowList(address)399 // /// or in textual repr: addToCollectionAllowList(address)398 function addToCollectionAllowList(address user) public {400 // function addToCollectionAllowList(address user) public {399 require(false, stub_error);401 // require(false, stub_error);400 user;402 // user;401 dummy = 0;403 // dummy = 0;402 }404 // }403405404 /// Add user to allowed list.406 /// Add user to allowed list.405 ///407 ///412 dummy = 0;414 dummy = 0;413 }415 }414416415 /// Remove the user from the allowed list.417 // /// Remove the user from the allowed list.416 ///418 // ///417 /// @param user Address of a removed user.419 // /// @param user Address of a removed user.418 /// @dev EVM selector for this function is: 0x85c51acb,420 // /// @dev EVM selector for this function is: 0x85c51acb,419 /// or in textual repr: removeFromCollectionAllowList(address)421 // /// or in textual repr: removeFromCollectionAllowList(address)420 function removeFromCollectionAllowList(address user) public {422 // function removeFromCollectionAllowList(address user) public {421 require(false, stub_error);423 // require(false, stub_error);422 user;424 // user;423 dummy = 0;425 // dummy = 0;424 }426 // }425427426 /// Remove user from allowed list.428 /// Remove user from allowed list.427 ///429 ///445 dummy = 0;447 dummy = 0;446 }448 }447449448 /// Check that account is the owner or admin of the collection450 // /// Check that account is the owner or admin of the collection449 ///451 // ///450 /// @param user account to verify452 // /// @param user account to verify451 /// @return "true" if account is the owner or admin453 // /// @return "true" if account is the owner or admin452 /// @dev EVM selector for this function is: 0x9811b0c7,454 // /// @dev EVM selector for this function is: 0x9811b0c7,453 /// or in textual repr: isOwnerOrAdmin(address)455 // /// or in textual repr: isOwnerOrAdmin(address)454 function isOwnerOrAdmin(address user) public view returns (bool) {456 // function isOwnerOrAdmin(address user) public view returns (bool) {455 require(false, stub_error);457 // require(false, stub_error);456 user;458 // user;457 dummy;459 // dummy;458 return false;460 // return false;459 }461 // }460462461 /// Check that account is the owner or admin of the collection463 /// Check that account is the owner or admin of the collection462 ///464 ///494 return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);496 return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);495 }497 }496498497 /// Changes collection owner to another account499 // /// Changes collection owner to another account498 ///500 // ///499 /// @dev Owner can be changed only by current owner501 // /// @dev Owner can be changed only by current owner500 /// @param newOwner new owner account502 // /// @param newOwner new owner account501 /// @dev EVM selector for this function is: 0x4f53e226,503 // /// @dev EVM selector for this function is: 0x4f53e226,502 /// or in textual repr: changeCollectionOwner(address)504 // /// or in textual repr: changeCollectionOwner(address)503 function changeCollectionOwner(address newOwner) public {505 // function changeCollectionOwner(address newOwner) public {504 require(false, stub_error);506 // require(false, stub_error);505 newOwner;507 // newOwner;506 dummy = 0;508 // dummy = 0;507 }509 // }508510509 /// Get collection administrators511 /// Get collection administrators510 ///512 ///522 ///524 ///523 /// @dev Owner can be changed only by current owner525 /// @dev Owner can be changed only by current owner524 /// @param newOwner new owner cross account526 /// @param newOwner new owner cross account525 /// @dev EVM selector for this function is: 0xe5c9913f,527 /// @dev EVM selector for this function is: 0x6496c497,526 /// or in textual repr: setOwnerCross((address,uint256))528 /// or in textual repr: changeCollectionOwnerCross((address,uint256))527 function setOwnerCross(EthCrossAccount memory newOwner) public {529 function changeCollectionOwnerCross(EthCrossAccount memory newOwner) public {528 require(false, stub_error);530 require(false, stub_error);529 newOwner;531 newOwner;530 dummy = 0;532 dummy = 0;538}540}539541540/// @dev anonymous struct542/// @dev anonymous struct541struct Tuple24 {543struct Tuple25 {542 address field_0;544 address field_0;543 uint256 field_1;545 uint256 field_1;544}546}545547546/// @dev anonymous struct548/// @dev anonymous struct547struct Tuple21 {549struct Tuple22 {548 string field_0;550 string field_0;549 bytes field_1;551 bytes field_1;550}552}761 dummy = 0;763 dummy = 0;762 }764 }763765764 /// @notice Burns a specific ERC721 token.766 // /// @notice Burns a specific ERC721 token.765 /// @dev Throws unless `msg.sender` is the current owner or an authorized767 // /// @dev Throws unless `msg.sender` is the current owner or an authorized766 /// operator for this RFT. Throws if `from` is not the current owner. Throws768 // /// operator for this RFT. Throws if `from` is not the current owner. Throws767 /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.769 // /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.768 /// Throws if RFT pieces have multiple owners.770 // /// Throws if RFT pieces have multiple owners.769 /// @param from The current owner of the RFT771 // /// @param from The current owner of the RFT770 /// @param tokenId The RFT to transfer772 // /// @param tokenId The RFT to transfer771 /// @dev EVM selector for this function is: 0x79cc6790,773 // /// @dev EVM selector for this function is: 0x79cc6790,772 /// or in textual repr: burnFrom(address,uint256)774 // /// or in textual repr: burnFrom(address,uint256)773 function burnFrom(address from, uint256 tokenId) public {775 // function burnFrom(address from, uint256 tokenId) public {774 require(false, stub_error);776 // require(false, stub_error);775 from;777 // from;776 tokenId;778 // tokenId;777 dummy = 0;779 // dummy = 0;778 }780 // }779781780 /// @notice Burns a specific ERC721 token.782 /// @notice Burns a specific ERC721 token.781 /// @dev Throws unless `msg.sender` is the current owner or an authorized783 /// @dev Throws unless `msg.sender` is the current owner or an authorizedpallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterbothbinary blob — no preview
pallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterbothbinary blob — no preview
tests/src/eth/abi/collectionHelpers.jsondiffbeforeafterbothno changes
tests/src/eth/abi/contractHelpers.jsondiffbeforeafterbothno changes
tests/src/eth/abi/fungible.jsondiffbeforeafterbothno changes
tests/src/eth/abi/fungibleDeprecated.jsondiffbeforeafterbothno changes
tests/src/eth/abi/nonFungible.jsondiffbeforeafterbothno changes
tests/src/eth/abi/nonFungibleDeprecated.jsondiffbeforeafterbothno changes
tests/src/eth/abi/reFungible.jsondiffbeforeafterbothno changes
tests/src/eth/abi/reFungibleDeprecated.jsondiffbeforeafterbothno changes
tests/src/eth/abi/reFungibleToken.jsondiffbeforeafterbothno changes
tests/src/eth/allowlist.test.tsdiffbeforeafterboth74 });74 });75 });75 });767677 // Soft-deprecated77 itEth('Collection allowlist can be added and removed by [eth] address', async ({helper}) => {78 itEth('Collection allowlist can be added and removed by [eth] address', async ({helper}) => {78 const owner = await helper.eth.createAccountWithBalance(donor);79 const owner = await helper.eth.createAccountWithBalance(donor);79 const user = helper.eth.createAccount();80 const user = helper.eth.createAccount();808181 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');82 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');82 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);83 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);838484 expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.false;85 expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.false;85 await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});86 await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});105 expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;106 expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;106 });107 });107108109 // Soft-deprecated108 itEth('Collection allowlist can not be add and remove [eth] address by not owner', async ({helper}) => {110 itEth('Collection allowlist can not be add and remove [eth] address by not owner', async ({helper}) => {109 const owner = await helper.eth.createAccountWithBalance(donor);111 const owner = await helper.eth.createAccountWithBalance(donor);110 const notOwner = await helper.eth.createAccountWithBalance(donor);112 const notOwner = await helper.eth.createAccountWithBalance(donor);111 const user = helper.eth.createAccount();113 const user = helper.eth.createAccount();112114113 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');115 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');114 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);116 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);115117116 expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.false;118 expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.false;117 await expect(collectionEvm.methods.addToCollectionAllowList(user).call({from: notOwner})).to.be.rejectedWith('NoPermission');119 await expect(collectionEvm.methods.addToCollectionAllowList(user).call({from: notOwner})).to.be.rejectedWith('NoPermission');tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth13}13}141415/// @title A contract that allows you to work with collections.15/// @title A contract that allows you to work with collections.16/// @dev the ERC-165 identifier for this interface is 0xb3152af316/// @dev the ERC-165 identifier for this interface is 0x324a7f5b17interface Collection is Dummy, ERC165 {17interface Collection is Dummy, ERC165 {18 /// Set collection property.18 // /// Set collection property.19 ///19 // ///20 /// @param key Property key.20 // /// @param key Property key.21 /// @param value Propery value.21 // /// @param value Propery value.22 /// @dev EVM selector for this function is: 0x2f073f66,22 // /// @dev EVM selector for this function is: 0x2f073f66,23 /// or in textual repr: setCollectionProperty(string,bytes)23 // /// or in textual repr: setCollectionProperty(string,bytes)24 function setCollectionProperty(string memory key, bytes memory value) external;24 // function setCollectionProperty(string memory key, bytes memory value) external;252526 /// Set collection properties.26 /// Set collection properties.27 ///27 ///28 /// @param properties Vector of properties key/value pair.28 /// @param properties Vector of properties key/value pair.29 /// @dev EVM selector for this function is: 0x50b26b2a,29 /// @dev EVM selector for this function is: 0x50b26b2a,30 /// or in textual repr: setCollectionProperties((string,bytes)[])30 /// or in textual repr: setCollectionProperties((string,bytes)[])31 function setCollectionProperties(Tuple15[] memory properties) external;31 function setCollectionProperties(Property[] memory properties) external;323233 /// Delete collection property.33 // /// Delete collection property.34 ///34 // ///35 /// @param key Property key.35 // /// @param key Property key.36 /// @dev EVM selector for this function is: 0x7b7debce,36 // /// @dev EVM selector for this function is: 0x7b7debce,37 /// or in textual repr: deleteCollectionProperty(string)37 // /// or in textual repr: deleteCollectionProperty(string)38 function deleteCollectionProperty(string memory key) external;38 // function deleteCollectionProperty(string memory key) external;393940 /// Delete collection properties.40 /// Delete collection properties.41 ///41 ///60 /// @return Vector of properties key/value pairs.60 /// @return Vector of properties key/value pairs.61 /// @dev EVM selector for this function is: 0x285fb8e6,61 /// @dev EVM selector for this function is: 0x285fb8e6,62 /// or in textual repr: collectionProperties(string[])62 /// or in textual repr: collectionProperties(string[])63 function collectionProperties(string[] memory keys) external view returns (Tuple15[] memory);63 function collectionProperties(string[] memory keys) external view returns (Tuple16[] memory);646465 /// Set the sponsor of the collection.65 // /// Set the sponsor of the collection.66 ///66 // ///67 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.67 // /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.68 ///68 // ///69 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.69 // /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.70 /// @dev EVM selector for this function is: 0x7623402e,70 // /// @dev EVM selector for this function is: 0x7623402e,71 /// or in textual repr: setCollectionSponsor(address)71 // /// or in textual repr: setCollectionSponsor(address)72 function setCollectionSponsor(address sponsor) external;72 // function setCollectionSponsor(address sponsor) external;737374 /// Set the sponsor of the collection.74 /// Set the sponsor of the collection.75 ///75 ///146 /// or in textual repr: removeCollectionAdminCross((address,uint256))146 /// or in textual repr: removeCollectionAdminCross((address,uint256))147 function removeCollectionAdminCross(EthCrossAccount memory admin) external;147 function removeCollectionAdminCross(EthCrossAccount memory admin) external;148148149 /// Add collection admin.149 // /// Add collection admin.150 /// @param newAdmin Address of the added administrator.150 // /// @param newAdmin Address of the added administrator.151 /// @dev EVM selector for this function is: 0x92e462c7,151 // /// @dev EVM selector for this function is: 0x92e462c7,152 /// or in textual repr: addCollectionAdmin(address)152 // /// or in textual repr: addCollectionAdmin(address)153 function addCollectionAdmin(address newAdmin) external;153 // function addCollectionAdmin(address newAdmin) external;154154155 /// Remove collection admin.155 // /// Remove collection admin.156 ///156 // ///157 /// @param admin Address of the removed administrator.157 // /// @param admin Address of the removed administrator.158 /// @dev EVM selector for this function is: 0xfafd7b42,158 // /// @dev EVM selector for this function is: 0xfafd7b42,159 /// or in textual repr: removeCollectionAdmin(address)159 // /// or in textual repr: removeCollectionAdmin(address)160 function removeCollectionAdmin(address admin) external;160 // function removeCollectionAdmin(address admin) external;161161162 /// Toggle accessibility of collection nesting.162 /// Toggle accessibility of collection nesting.163 ///163 ///189 /// or in textual repr: allowed(address)189 /// or in textual repr: allowed(address)190 function allowed(address user) external view returns (bool);190 function allowed(address user) external view returns (bool);191191192 /// Add the user to the allowed list.192 // /// Add the user to the allowed list.193 ///193 // ///194 /// @param user Address of a trusted user.194 // /// @param user Address of a trusted user.195 /// @dev EVM selector for this function is: 0x67844fe6,195 // /// @dev EVM selector for this function is: 0x67844fe6,196 /// or in textual repr: addToCollectionAllowList(address)196 // /// or in textual repr: addToCollectionAllowList(address)197 function addToCollectionAllowList(address user) external;197 // function addToCollectionAllowList(address user) external;198198199 /// Add user to allowed list.199 /// Add user to allowed list.200 ///200 ///203 /// or in textual repr: addToCollectionAllowListCross((address,uint256))203 /// or in textual repr: addToCollectionAllowListCross((address,uint256))204 function addToCollectionAllowListCross(EthCrossAccount memory user) external;204 function addToCollectionAllowListCross(EthCrossAccount memory user) external;205205206 /// Remove the user from the allowed list.206 // /// Remove the user from the allowed list.207 ///207 // ///208 /// @param user Address of a removed user.208 // /// @param user Address of a removed user.209 /// @dev EVM selector for this function is: 0x85c51acb,209 // /// @dev EVM selector for this function is: 0x85c51acb,210 /// or in textual repr: removeFromCollectionAllowList(address)210 // /// or in textual repr: removeFromCollectionAllowList(address)211 function removeFromCollectionAllowList(address user) external;211 // function removeFromCollectionAllowList(address user) external;212212213 /// Remove user from allowed list.213 /// Remove user from allowed list.214 ///214 ///224 /// or in textual repr: setCollectionMintMode(bool)224 /// or in textual repr: setCollectionMintMode(bool)225 function setCollectionMintMode(bool mode) external;225 function setCollectionMintMode(bool mode) external;226226227 /// Check that account is the owner or admin of the collection227 // /// Check that account is the owner or admin of the collection228 ///228 // ///229 /// @param user account to verify229 // /// @param user account to verify230 /// @return "true" if account is the owner or admin230 // /// @return "true" if account is the owner or admin231 /// @dev EVM selector for this function is: 0x9811b0c7,231 // /// @dev EVM selector for this function is: 0x9811b0c7,232 /// or in textual repr: isOwnerOrAdmin(address)232 // /// or in textual repr: isOwnerOrAdmin(address)233 function isOwnerOrAdmin(address user) external view returns (bool);233 // function isOwnerOrAdmin(address user) external view returns (bool);234234235 /// Check that account is the owner or admin of the collection235 /// Check that account is the owner or admin of the collection236 ///236 ///255 /// or in textual repr: collectionOwner()255 /// or in textual repr: collectionOwner()256 function collectionOwner() external view returns (EthCrossAccount memory);256 function collectionOwner() external view returns (EthCrossAccount memory);257257258 /// Changes collection owner to another account258 // /// Changes collection owner to another account259 ///259 // ///260 /// @dev Owner can be changed only by current owner260 // /// @dev Owner can be changed only by current owner261 /// @param newOwner new owner account261 // /// @param newOwner new owner account262 /// @dev EVM selector for this function is: 0x4f53e226,262 // /// @dev EVM selector for this function is: 0x4f53e226,263 /// or in textual repr: changeCollectionOwner(address)263 // /// or in textual repr: changeCollectionOwner(address)264 function changeCollectionOwner(address newOwner) external;264 // function changeCollectionOwner(address newOwner) external;265265266 /// Get collection administrators266 /// Get collection administrators267 ///267 ///275 ///275 ///276 /// @dev Owner can be changed only by current owner276 /// @dev Owner can be changed only by current owner277 /// @param newOwner new owner cross account277 /// @param newOwner new owner cross account278 /// @dev EVM selector for this function is: 0xe5c9913f,278 /// @dev EVM selector for this function is: 0x6496c497,279 /// or in textual repr: setOwnerCross((address,uint256))279 /// or in textual repr: changeCollectionOwnerCross((address,uint256))280 function setOwnerCross(EthCrossAccount memory newOwner) external;280 function changeCollectionOwnerCross(EthCrossAccount memory newOwner) external;281}281}282282283/// @dev Cross account struct283/// @dev Cross account struct287}287}288288289/// @dev anonymous struct289/// @dev anonymous struct290struct Tuple15 {290struct Tuple16 {291 string field_0;291 string field_0;292 bytes field_1;292 bytes field_1;293}293}294295/// @dev Property struct296struct Property {297 string key;298 bytes value;299}294300295/// @dev the ERC-165 identifier for this interface is 0x29f4dcd9301/// @dev the ERC-165 identifier for this interface is 0x29f4dcd9296interface ERC20UniqueExtensions is Dummy, ERC165 {302interface ERC20UniqueExtensions is Dummy, ERC165 {297 /// @dev EVM selector for this function is: 0x0ecd0ab0,303 /// @dev EVM selector for this function is: 0x0ecd0ab0,298 /// or in textual repr: approveCross((address,uint256),uint256)304 /// or in textual repr: approveCross((address,uint256),uint256)299 function approveCross(EthCrossAccount memory spender, uint256 amount) external returns (bool);305 function approveCross(EthCrossAccount memory spender, uint256 amount) external returns (bool);300306301 /// Burn tokens from account307 // /// Burn tokens from account302 /// @dev Function that burns an `amount` of the tokens of a given account,308 // /// @dev Function that burns an `amount` of the tokens of a given account,303 /// deducting from the sender's allowance for said account.309 // /// deducting from the sender's allowance for said account.304 /// @param from The account whose tokens will be burnt.310 // /// @param from The account whose tokens will be burnt.305 /// @param amount The amount that will be burnt.311 // /// @param amount The amount that will be burnt.306 /// @dev EVM selector for this function is: 0x79cc6790,312 // /// @dev EVM selector for this function is: 0x79cc6790,307 /// or in textual repr: burnFrom(address,uint256)313 // /// or in textual repr: burnFrom(address,uint256)308 function burnFrom(address from, uint256 amount) external returns (bool);314 // function burnFrom(address from, uint256 amount) external returns (bool);309315310 /// Burn tokens from account316 /// Burn tokens from account311 /// @dev Function that burns an `amount` of the tokens of a given account,317 /// @dev Function that burns an `amount` of the tokens of a given account,tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth30 bool tokenOwner30 bool tokenOwner31 ) external;31 ) external;323233 /// @notice Set token property value.33 // /// @notice Set token property value.34 /// @dev Throws error if `msg.sender` has no permission to edit the property.34 // /// @dev Throws error if `msg.sender` has no permission to edit the property.35 /// @param tokenId ID of the token.35 // /// @param tokenId ID of the token.36 /// @param key Property key.36 // /// @param key Property key.37 /// @param value Property value.37 // /// @param value Property value.38 /// @dev EVM selector for this function is: 0x1752d67b,38 // /// @dev EVM selector for this function is: 0x1752d67b,39 /// or in textual repr: setProperty(uint256,string,bytes)39 // /// or in textual repr: setProperty(uint256,string,bytes)40 function setProperty(40 // function setProperty(uint256 tokenId, string memory key, bytes memory value) external;41 uint256 tokenId,42 string memory key,43 bytes memory value44 ) external;454146 /// @notice Set token properties value.42 /// @notice Set token properties value.47 /// @dev Throws error if `msg.sender` has no permission to edit the property.43 /// @dev Throws error if `msg.sender` has no permission to edit the property.48 /// @param tokenId ID of the token.44 /// @param tokenId ID of the token.49 /// @param properties settable properties45 /// @param properties settable properties50 /// @dev EVM selector for this function is: 0x14ed3a6e,46 /// @dev EVM selector for this function is: 0x14ed3a6e,51 /// or in textual repr: setProperties(uint256,(string,bytes)[])47 /// or in textual repr: setProperties(uint256,(string,bytes)[])52 function setProperties(uint256 tokenId, Tuple22[] memory properties) external;48 function setProperties(uint256 tokenId, Property[] memory properties) external;534954 // /// @notice Delete token property value.50 // /// @notice Delete token property value.55 // /// @dev Throws error if `msg.sender` has no permission to edit the property.51 // /// @dev Throws error if `msg.sender` has no permission to edit the property.77 function property(uint256 tokenId, string memory key) external view returns (bytes memory);73 function property(uint256 tokenId, string memory key) external view returns (bytes memory);78}74}7576/// @dev Property struct77struct Property {78 string key;79 bytes value;80}798180/// @title A contract that allows you to work with collections.82/// @title A contract that allows you to work with collections.81/// @dev the ERC-165 identifier for this interface is 0xb3152af383/// @dev the ERC-165 identifier for this interface is 0x324a7f5b82interface Collection is Dummy, ERC165 {84interface Collection is Dummy, ERC165 {83 /// Set collection property.85 // /// Set collection property.84 ///86 // ///85 /// @param key Property key.87 // /// @param key Property key.86 /// @param value Propery value.88 // /// @param value Propery value.87 /// @dev EVM selector for this function is: 0x2f073f66,89 // /// @dev EVM selector for this function is: 0x2f073f66,88 /// or in textual repr: setCollectionProperty(string,bytes)90 // /// or in textual repr: setCollectionProperty(string,bytes)89 function setCollectionProperty(string memory key, bytes memory value) external;91 // function setCollectionProperty(string memory key, bytes memory value) external;909291 /// Set collection properties.93 /// Set collection properties.92 ///94 ///93 /// @param properties Vector of properties key/value pair.95 /// @param properties Vector of properties key/value pair.94 /// @dev EVM selector for this function is: 0x50b26b2a,96 /// @dev EVM selector for this function is: 0x50b26b2a,95 /// or in textual repr: setCollectionProperties((string,bytes)[])97 /// or in textual repr: setCollectionProperties((string,bytes)[])96 function setCollectionProperties(Tuple22[] memory properties) external;98 function setCollectionProperties(Property[] memory properties) external;979998 /// Delete collection property.100 // /// Delete collection property.99 ///101 // ///100 /// @param key Property key.102 // /// @param key Property key.101 /// @dev EVM selector for this function is: 0x7b7debce,103 // /// @dev EVM selector for this function is: 0x7b7debce,102 /// or in textual repr: deleteCollectionProperty(string)104 // /// or in textual repr: deleteCollectionProperty(string)103 function deleteCollectionProperty(string memory key) external;105 // function deleteCollectionProperty(string memory key) external;104106105 /// Delete collection properties.107 /// Delete collection properties.106 ///108 ///125 /// @return Vector of properties key/value pairs.127 /// @return Vector of properties key/value pairs.126 /// @dev EVM selector for this function is: 0x285fb8e6,128 /// @dev EVM selector for this function is: 0x285fb8e6,127 /// or in textual repr: collectionProperties(string[])129 /// or in textual repr: collectionProperties(string[])128 function collectionProperties(string[] memory keys) external view returns (Tuple22[] memory);130 function collectionProperties(string[] memory keys) external view returns (Tuple23[] memory);129131130 /// Set the sponsor of the collection.132 // /// Set the sponsor of the collection.131 ///133 // ///132 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.134 // /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.133 ///135 // ///134 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.136 // /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.135 /// @dev EVM selector for this function is: 0x7623402e,137 // /// @dev EVM selector for this function is: 0x7623402e,136 /// or in textual repr: setCollectionSponsor(address)138 // /// or in textual repr: setCollectionSponsor(address)137 function setCollectionSponsor(address sponsor) external;139 // function setCollectionSponsor(address sponsor) external;138140139 /// Set the sponsor of the collection.141 /// Set the sponsor of the collection.140 ///142 ///167 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.169 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.168 /// @dev EVM selector for this function is: 0x6ec0a9f1,170 /// @dev EVM selector for this function is: 0x6ec0a9f1,169 /// or in textual repr: collectionSponsor()171 /// or in textual repr: collectionSponsor()170 function collectionSponsor() external view returns (Tuple25 memory);172 function collectionSponsor() external view returns (Tuple26 memory);171173172 /// Set limits for the collection.174 /// Set limits for the collection.173 /// @dev Throws error if limit not found.175 /// @dev Throws error if limit not found.211 /// or in textual repr: removeCollectionAdminCross((address,uint256))213 /// or in textual repr: removeCollectionAdminCross((address,uint256))212 function removeCollectionAdminCross(EthCrossAccount memory admin) external;214 function removeCollectionAdminCross(EthCrossAccount memory admin) external;213215214 /// Add collection admin.216 // /// Add collection admin.215 /// @param newAdmin Address of the added administrator.217 // /// @param newAdmin Address of the added administrator.216 /// @dev EVM selector for this function is: 0x92e462c7,218 // /// @dev EVM selector for this function is: 0x92e462c7,217 /// or in textual repr: addCollectionAdmin(address)219 // /// or in textual repr: addCollectionAdmin(address)218 function addCollectionAdmin(address newAdmin) external;220 // function addCollectionAdmin(address newAdmin) external;219221220 /// Remove collection admin.222 // /// Remove collection admin.221 ///223 // ///222 /// @param admin Address of the removed administrator.224 // /// @param admin Address of the removed administrator.223 /// @dev EVM selector for this function is: 0xfafd7b42,225 // /// @dev EVM selector for this function is: 0xfafd7b42,224 /// or in textual repr: removeCollectionAdmin(address)226 // /// or in textual repr: removeCollectionAdmin(address)225 function removeCollectionAdmin(address admin) external;227 // function removeCollectionAdmin(address admin) external;226228227 /// Toggle accessibility of collection nesting.229 /// Toggle accessibility of collection nesting.228 ///230 ///254 /// or in textual repr: allowed(address)256 /// or in textual repr: allowed(address)255 function allowed(address user) external view returns (bool);257 function allowed(address user) external view returns (bool);256258257 /// Add the user to the allowed list.259 // /// Add the user to the allowed list.258 ///260 // ///259 /// @param user Address of a trusted user.261 // /// @param user Address of a trusted user.260 /// @dev EVM selector for this function is: 0x67844fe6,262 // /// @dev EVM selector for this function is: 0x67844fe6,261 /// or in textual repr: addToCollectionAllowList(address)263 // /// or in textual repr: addToCollectionAllowList(address)262 function addToCollectionAllowList(address user) external;264 // function addToCollectionAllowList(address user) external;263265264 /// Add user to allowed list.266 /// Add user to allowed list.265 ///267 ///268 /// or in textual repr: addToCollectionAllowListCross((address,uint256))270 /// or in textual repr: addToCollectionAllowListCross((address,uint256))269 function addToCollectionAllowListCross(EthCrossAccount memory user) external;271 function addToCollectionAllowListCross(EthCrossAccount memory user) external;270272271 /// Remove the user from the allowed list.273 // /// Remove the user from the allowed list.272 ///274 // ///273 /// @param user Address of a removed user.275 // /// @param user Address of a removed user.274 /// @dev EVM selector for this function is: 0x85c51acb,276 // /// @dev EVM selector for this function is: 0x85c51acb,275 /// or in textual repr: removeFromCollectionAllowList(address)277 // /// or in textual repr: removeFromCollectionAllowList(address)276 function removeFromCollectionAllowList(address user) external;278 // function removeFromCollectionAllowList(address user) external;277279278 /// Remove user from allowed list.280 /// Remove user from allowed list.279 ///281 ///289 /// or in textual repr: setCollectionMintMode(bool)291 /// or in textual repr: setCollectionMintMode(bool)290 function setCollectionMintMode(bool mode) external;292 function setCollectionMintMode(bool mode) external;291293292 /// Check that account is the owner or admin of the collection294 // /// Check that account is the owner or admin of the collection293 ///295 // ///294 /// @param user account to verify296 // /// @param user account to verify295 /// @return "true" if account is the owner or admin297 // /// @return "true" if account is the owner or admin296 /// @dev EVM selector for this function is: 0x9811b0c7,298 // /// @dev EVM selector for this function is: 0x9811b0c7,297 /// or in textual repr: isOwnerOrAdmin(address)299 // /// or in textual repr: isOwnerOrAdmin(address)298 function isOwnerOrAdmin(address user) external view returns (bool);300 // function isOwnerOrAdmin(address user) external view returns (bool);299301300 /// Check that account is the owner or admin of the collection302 /// Check that account is the owner or admin of the collection301 ///303 ///320 /// or in textual repr: collectionOwner()322 /// or in textual repr: collectionOwner()321 function collectionOwner() external view returns (EthCrossAccount memory);323 function collectionOwner() external view returns (EthCrossAccount memory);322324323 /// Changes collection owner to another account325 // /// Changes collection owner to another account324 ///326 // ///325 /// @dev Owner can be changed only by current owner327 // /// @dev Owner can be changed only by current owner326 /// @param newOwner new owner account328 // /// @param newOwner new owner account327 /// @dev EVM selector for this function is: 0x4f53e226,329 // /// @dev EVM selector for this function is: 0x4f53e226,328 /// or in textual repr: changeCollectionOwner(address)330 // /// or in textual repr: changeCollectionOwner(address)329 function changeCollectionOwner(address newOwner) external;331 // function changeCollectionOwner(address newOwner) external;330332331 /// Get collection administrators333 /// Get collection administrators332 ///334 ///340 ///342 ///341 /// @dev Owner can be changed only by current owner343 /// @dev Owner can be changed only by current owner342 /// @param newOwner new owner cross account344 /// @param newOwner new owner cross account343 /// @dev EVM selector for this function is: 0xe5c9913f,345 /// @dev EVM selector for this function is: 0x6496c497,344 /// or in textual repr: setOwnerCross((address,uint256))346 /// or in textual repr: changeCollectionOwnerCross((address,uint256))345 function setOwnerCross(EthCrossAccount memory newOwner) external;347 function changeCollectionOwnerCross(EthCrossAccount memory newOwner) external;346}348}347349348/// @dev Cross account struct350/// @dev Cross account struct352}354}353355354/// @dev anonymous struct356/// @dev anonymous struct355struct Tuple25 {357struct Tuple26 {356 address field_0;358 address field_0;357 uint256 field_1;359 uint256 field_1;358}360}359361360/// @dev anonymous struct362/// @dev anonymous struct361struct Tuple22 {363struct Tuple23 {362 string field_0;364 string field_0;363 bytes field_1;365 bytes field_1;364}366}512 uint256 tokenId514 uint256 tokenId513 ) external;515 ) external;514516515 /// @notice Burns a specific ERC721 token.517 // /// @notice Burns a specific ERC721 token.516 /// @dev Throws unless `msg.sender` is the current owner or an authorized518 // /// @dev Throws unless `msg.sender` is the current owner or an authorized517 /// operator for this NFT. Throws if `from` is not the current owner. Throws519 // /// operator for this NFT. Throws if `from` is not the current owner. Throws518 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.520 // /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.519 /// @param from The current owner of the NFT521 // /// @param from The current owner of the NFT520 /// @param tokenId The NFT to transfer522 // /// @param tokenId The NFT to transfer521 /// @dev EVM selector for this function is: 0x79cc6790,523 // /// @dev EVM selector for this function is: 0x79cc6790,522 /// or in textual repr: burnFrom(address,uint256)524 // /// or in textual repr: burnFrom(address,uint256)523 function burnFrom(address from, uint256 tokenId) external;525 // function burnFrom(address from, uint256 tokenId) external;524526525 /// @notice Burns a specific ERC721 token.527 /// @notice Burns a specific ERC721 token.526 /// @dev Throws unless `msg.sender` is the current owner or an authorized528 /// @dev Throws unless `msg.sender` is the current owner or an authorizedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth30 bool tokenOwner30 bool tokenOwner31 ) external;31 ) external;323233 /// @notice Set token property value.33 // /// @notice Set token property value.34 /// @dev Throws error if `msg.sender` has no permission to edit the property.34 // /// @dev Throws error if `msg.sender` has no permission to edit the property.35 /// @param tokenId ID of the token.35 // /// @param tokenId ID of the token.36 /// @param key Property key.36 // /// @param key Property key.37 /// @param value Property value.37 // /// @param value Property value.38 /// @dev EVM selector for this function is: 0x1752d67b,38 // /// @dev EVM selector for this function is: 0x1752d67b,39 /// or in textual repr: setProperty(uint256,string,bytes)39 // /// or in textual repr: setProperty(uint256,string,bytes)40 function setProperty(40 // function setProperty(uint256 tokenId, string memory key, bytes memory value) external;41 uint256 tokenId,42 string memory key,43 bytes memory value44 ) external;454146 /// @notice Set token properties value.42 /// @notice Set token properties value.47 /// @dev Throws error if `msg.sender` has no permission to edit the property.43 /// @dev Throws error if `msg.sender` has no permission to edit the property.48 /// @param tokenId ID of the token.44 /// @param tokenId ID of the token.49 /// @param properties settable properties45 /// @param properties settable properties50 /// @dev EVM selector for this function is: 0x14ed3a6e,46 /// @dev EVM selector for this function is: 0x14ed3a6e,51 /// or in textual repr: setProperties(uint256,(string,bytes)[])47 /// or in textual repr: setProperties(uint256,(string,bytes)[])52 function setProperties(uint256 tokenId, Tuple21[] memory properties) external;48 function setProperties(uint256 tokenId, Property[] memory properties) external;534954 // /// @notice Delete token property value.50 // /// @notice Delete token property value.55 // /// @dev Throws error if `msg.sender` has no permission to edit the property.51 // /// @dev Throws error if `msg.sender` has no permission to edit the property.77 function property(uint256 tokenId, string memory key) external view returns (bytes memory);73 function property(uint256 tokenId, string memory key) external view returns (bytes memory);78}74}7576/// @dev Property struct77struct Property {78 string key;79 bytes value;80}798180/// @title A contract that allows you to work with collections.82/// @title A contract that allows you to work with collections.81/// @dev the ERC-165 identifier for this interface is 0xb3152af383/// @dev the ERC-165 identifier for this interface is 0x324a7f5b82interface Collection is Dummy, ERC165 {84interface Collection is Dummy, ERC165 {83 /// Set collection property.85 // /// Set collection property.84 ///86 // ///85 /// @param key Property key.87 // /// @param key Property key.86 /// @param value Propery value.88 // /// @param value Propery value.87 /// @dev EVM selector for this function is: 0x2f073f66,89 // /// @dev EVM selector for this function is: 0x2f073f66,88 /// or in textual repr: setCollectionProperty(string,bytes)90 // /// or in textual repr: setCollectionProperty(string,bytes)89 function setCollectionProperty(string memory key, bytes memory value) external;91 // function setCollectionProperty(string memory key, bytes memory value) external;909291 /// Set collection properties.93 /// Set collection properties.92 ///94 ///93 /// @param properties Vector of properties key/value pair.95 /// @param properties Vector of properties key/value pair.94 /// @dev EVM selector for this function is: 0x50b26b2a,96 /// @dev EVM selector for this function is: 0x50b26b2a,95 /// or in textual repr: setCollectionProperties((string,bytes)[])97 /// or in textual repr: setCollectionProperties((string,bytes)[])96 function setCollectionProperties(Tuple21[] memory properties) external;98 function setCollectionProperties(Property[] memory properties) external;979998 /// Delete collection property.100 // /// Delete collection property.99 ///101 // ///100 /// @param key Property key.102 // /// @param key Property key.101 /// @dev EVM selector for this function is: 0x7b7debce,103 // /// @dev EVM selector for this function is: 0x7b7debce,102 /// or in textual repr: deleteCollectionProperty(string)104 // /// or in textual repr: deleteCollectionProperty(string)103 function deleteCollectionProperty(string memory key) external;105 // function deleteCollectionProperty(string memory key) external;104106105 /// Delete collection properties.107 /// Delete collection properties.106 ///108 ///125 /// @return Vector of properties key/value pairs.127 /// @return Vector of properties key/value pairs.126 /// @dev EVM selector for this function is: 0x285fb8e6,128 /// @dev EVM selector for this function is: 0x285fb8e6,127 /// or in textual repr: collectionProperties(string[])129 /// or in textual repr: collectionProperties(string[])128 function collectionProperties(string[] memory keys) external view returns (Tuple21[] memory);130 function collectionProperties(string[] memory keys) external view returns (Tuple22[] memory);129131130 /// Set the sponsor of the collection.132 // /// Set the sponsor of the collection.131 ///133 // ///132 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.134 // /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.133 ///135 // ///134 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.136 // /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.135 /// @dev EVM selector for this function is: 0x7623402e,137 // /// @dev EVM selector for this function is: 0x7623402e,136 /// or in textual repr: setCollectionSponsor(address)138 // /// or in textual repr: setCollectionSponsor(address)137 function setCollectionSponsor(address sponsor) external;139 // function setCollectionSponsor(address sponsor) external;138140139 /// Set the sponsor of the collection.141 /// Set the sponsor of the collection.140 ///142 ///167 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.169 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.168 /// @dev EVM selector for this function is: 0x6ec0a9f1,170 /// @dev EVM selector for this function is: 0x6ec0a9f1,169 /// or in textual repr: collectionSponsor()171 /// or in textual repr: collectionSponsor()170 function collectionSponsor() external view returns (Tuple24 memory);172 function collectionSponsor() external view returns (Tuple25 memory);171173172 /// Set limits for the collection.174 /// Set limits for the collection.173 /// @dev Throws error if limit not found.175 /// @dev Throws error if limit not found.211 /// or in textual repr: removeCollectionAdminCross((address,uint256))213 /// or in textual repr: removeCollectionAdminCross((address,uint256))212 function removeCollectionAdminCross(EthCrossAccount memory admin) external;214 function removeCollectionAdminCross(EthCrossAccount memory admin) external;213215214 /// Add collection admin.216 // /// Add collection admin.215 /// @param newAdmin Address of the added administrator.217 // /// @param newAdmin Address of the added administrator.216 /// @dev EVM selector for this function is: 0x92e462c7,218 // /// @dev EVM selector for this function is: 0x92e462c7,217 /// or in textual repr: addCollectionAdmin(address)219 // /// or in textual repr: addCollectionAdmin(address)218 function addCollectionAdmin(address newAdmin) external;220 // function addCollectionAdmin(address newAdmin) external;219221220 /// Remove collection admin.222 // /// Remove collection admin.221 ///223 // ///222 /// @param admin Address of the removed administrator.224 // /// @param admin Address of the removed administrator.223 /// @dev EVM selector for this function is: 0xfafd7b42,225 // /// @dev EVM selector for this function is: 0xfafd7b42,224 /// or in textual repr: removeCollectionAdmin(address)226 // /// or in textual repr: removeCollectionAdmin(address)225 function removeCollectionAdmin(address admin) external;227 // function removeCollectionAdmin(address admin) external;226228227 /// Toggle accessibility of collection nesting.229 /// Toggle accessibility of collection nesting.228 ///230 ///254 /// or in textual repr: allowed(address)256 /// or in textual repr: allowed(address)255 function allowed(address user) external view returns (bool);257 function allowed(address user) external view returns (bool);256258257 /// Add the user to the allowed list.259 // /// Add the user to the allowed list.258 ///260 // ///259 /// @param user Address of a trusted user.261 // /// @param user Address of a trusted user.260 /// @dev EVM selector for this function is: 0x67844fe6,262 // /// @dev EVM selector for this function is: 0x67844fe6,261 /// or in textual repr: addToCollectionAllowList(address)263 // /// or in textual repr: addToCollectionAllowList(address)262 function addToCollectionAllowList(address user) external;264 // function addToCollectionAllowList(address user) external;263265264 /// Add user to allowed list.266 /// Add user to allowed list.265 ///267 ///268 /// or in textual repr: addToCollectionAllowListCross((address,uint256))270 /// or in textual repr: addToCollectionAllowListCross((address,uint256))269 function addToCollectionAllowListCross(EthCrossAccount memory user) external;271 function addToCollectionAllowListCross(EthCrossAccount memory user) external;270272271 /// Remove the user from the allowed list.273 // /// Remove the user from the allowed list.272 ///274 // ///273 /// @param user Address of a removed user.275 // /// @param user Address of a removed user.274 /// @dev EVM selector for this function is: 0x85c51acb,276 // /// @dev EVM selector for this function is: 0x85c51acb,275 /// or in textual repr: removeFromCollectionAllowList(address)277 // /// or in textual repr: removeFromCollectionAllowList(address)276 function removeFromCollectionAllowList(address user) external;278 // function removeFromCollectionAllowList(address user) external;277279278 /// Remove user from allowed list.280 /// Remove user from allowed list.279 ///281 ///289 /// or in textual repr: setCollectionMintMode(bool)291 /// or in textual repr: setCollectionMintMode(bool)290 function setCollectionMintMode(bool mode) external;292 function setCollectionMintMode(bool mode) external;291293292 /// Check that account is the owner or admin of the collection294 // /// Check that account is the owner or admin of the collection293 ///295 // ///294 /// @param user account to verify296 // /// @param user account to verify295 /// @return "true" if account is the owner or admin297 // /// @return "true" if account is the owner or admin296 /// @dev EVM selector for this function is: 0x9811b0c7,298 // /// @dev EVM selector for this function is: 0x9811b0c7,297 /// or in textual repr: isOwnerOrAdmin(address)299 // /// or in textual repr: isOwnerOrAdmin(address)298 function isOwnerOrAdmin(address user) external view returns (bool);300 // function isOwnerOrAdmin(address user) external view returns (bool);299301300 /// Check that account is the owner or admin of the collection302 /// Check that account is the owner or admin of the collection301 ///303 ///320 /// or in textual repr: collectionOwner()322 /// or in textual repr: collectionOwner()321 function collectionOwner() external view returns (EthCrossAccount memory);323 function collectionOwner() external view returns (EthCrossAccount memory);322324323 /// Changes collection owner to another account325 // /// Changes collection owner to another account324 ///326 // ///325 /// @dev Owner can be changed only by current owner327 // /// @dev Owner can be changed only by current owner326 /// @param newOwner new owner account328 // /// @param newOwner new owner account327 /// @dev EVM selector for this function is: 0x4f53e226,329 // /// @dev EVM selector for this function is: 0x4f53e226,328 /// or in textual repr: changeCollectionOwner(address)330 // /// or in textual repr: changeCollectionOwner(address)329 function changeCollectionOwner(address newOwner) external;331 // function changeCollectionOwner(address newOwner) external;330332331 /// Get collection administrators333 /// Get collection administrators332 ///334 ///340 ///342 ///341 /// @dev Owner can be changed only by current owner343 /// @dev Owner can be changed only by current owner342 /// @param newOwner new owner cross account344 /// @param newOwner new owner cross account343 /// @dev EVM selector for this function is: 0xe5c9913f,345 /// @dev EVM selector for this function is: 0x6496c497,344 /// or in textual repr: setOwnerCross((address,uint256))346 /// or in textual repr: changeCollectionOwnerCross((address,uint256))345 function setOwnerCross(EthCrossAccount memory newOwner) external;347 function changeCollectionOwnerCross(EthCrossAccount memory newOwner) external;346}348}347349348/// @dev Cross account struct350/// @dev Cross account struct352}354}353355354/// @dev anonymous struct356/// @dev anonymous struct355struct Tuple24 {357struct Tuple25 {356 address field_0;358 address field_0;357 uint256 field_1;359 uint256 field_1;358}360}359361360/// @dev anonymous struct362/// @dev anonymous struct361struct Tuple21 {363struct Tuple22 {362 string field_0;364 string field_0;363 bytes field_1;365 bytes field_1;364}366}502 uint256 tokenId504 uint256 tokenId503 ) external;505 ) external;504506505 /// @notice Burns a specific ERC721 token.507 // /// @notice Burns a specific ERC721 token.506 /// @dev Throws unless `msg.sender` is the current owner or an authorized508 // /// @dev Throws unless `msg.sender` is the current owner or an authorized507 /// operator for this RFT. Throws if `from` is not the current owner. Throws509 // /// operator for this RFT. Throws if `from` is not the current owner. Throws508 /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.510 // /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.509 /// Throws if RFT pieces have multiple owners.511 // /// Throws if RFT pieces have multiple owners.510 /// @param from The current owner of the RFT512 // /// @param from The current owner of the RFT511 /// @param tokenId The RFT to transfer513 // /// @param tokenId The RFT to transfer512 /// @dev EVM selector for this function is: 0x79cc6790,514 // /// @dev EVM selector for this function is: 0x79cc6790,513 /// or in textual repr: burnFrom(address,uint256)515 // /// or in textual repr: burnFrom(address,uint256)514 function burnFrom(address from, uint256 tokenId) external;516 // function burnFrom(address from, uint256 tokenId) external;515517516 /// @notice Burns a specific ERC721 token.518 /// @notice Burns a specific ERC721 token.517 /// @dev Throws unless `msg.sender` is the current owner or an authorized519 /// @dev Throws unless `msg.sender` is the current owner or an authorizedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth39 });39 });40 });40 });414142 // Soft-deprecated42 itEth('Add admin by owner', async ({helper}) => {43 itEth('Add admin by owner', async ({helper}) => {43 const owner = await helper.eth.createAccountWithBalance(donor);44 const owner = await helper.eth.createAccountWithBalance(donor);44 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');45 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');45 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);46 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);464747 const newAdmin = helper.eth.createAccount();48 const newAdmin = helper.eth.createAccount();484970 const owner = await helper.eth.createAccountWithBalance(donor);71 const owner = await helper.eth.createAccountWithBalance(donor);71 72 72 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');73 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');73 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);74 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);747575 const admin1 = helper.eth.createAccount();76 const admin1 = helper.eth.createAccount();76 const admin2 = await privateKey('admin');77 const admin2 = await privateKey('admin');77 const admin2Cross = helper.ethCrossAccount.fromKeyringPair(admin2);78 const admin2Cross = helper.ethCrossAccount.fromKeyringPair(admin2);79 80 // Soft-deprecated78 await collectionEvm.methods.addCollectionAdmin(admin1).send();81 await collectionEvm.methods.addCollectionAdmin(admin1).send();79 await collectionEvm.methods.addCollectionAdminCross(admin2Cross).send();82 await collectionEvm.methods.addCollectionAdminCross(admin2Cross).send();808386 expect(adminListRpc).to.be.like(adminListEth);89 expect(adminListRpc).to.be.like(adminListEth);87 });90 });889192 // Soft-deprecated89 itEth('Verify owner or admin', async ({helper}) => {93 itEth('Verify owner or admin', async ({helper}) => {90 const owner = await helper.eth.createAccountWithBalance(donor);94 const owner = await helper.eth.createAccountWithBalance(donor);91 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');95 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');929693 const newAdmin = helper.eth.createAccount();97 const newAdmin = helper.eth.createAccount();94 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);98 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);95 99 96 expect(await collectionEvm.methods.isOwnerOrAdmin(newAdmin).call()).to.be.false;100 expect(await collectionEvm.methods.isOwnerOrAdmin(newAdmin).call()).to.be.false;97 await collectionEvm.methods.addCollectionAdmin(newAdmin).send();101 await collectionEvm.methods.addCollectionAdmin(newAdmin).send();98 expect(await collectionEvm.methods.isOwnerOrAdmin(newAdmin).call()).to.be.true;102 expect(await collectionEvm.methods.isOwnerOrAdmin(newAdmin).call()).to.be.true;99 });103 });100 104105 itEth('Verify owner or admin cross', async ({helper, privateKey}) => {106 const owner = await helper.eth.createAccountWithBalance(donor);107 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');108109 const newAdmin = await privateKey('admin');110 const newAdminCross = helper.ethCrossAccount.fromKeyringPair(newAdmin);111 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);112 113 expect(await collectionEvm.methods.isOwnerOrAdminCross(newAdminCross).call()).to.be.false;114 await collectionEvm.methods.addCollectionAdminCross(newAdminCross).send();115 expect(await collectionEvm.methods.isOwnerOrAdminCross(newAdminCross).call()).to.be.true;116 });117118 // Soft-deprecated101 itEth('(!negative tests!) Add admin by ADMIN is not allowed', async ({helper}) => {119 itEth('(!negative tests!) Add admin by ADMIN is not allowed', async ({helper}) => {102 const owner = await helper.eth.createAccountWithBalance(donor);120 const owner = await helper.eth.createAccountWithBalance(donor);103 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');121 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');104122105 const admin = await helper.eth.createAccountWithBalance(donor);123 const admin = await helper.eth.createAccountWithBalance(donor);106 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);124 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);107 await collectionEvm.methods.addCollectionAdmin(admin).send();125 await collectionEvm.methods.addCollectionAdmin(admin).send();108126109 const user = helper.eth.createAccount();127 const user = helper.eth.createAccount();116 .to.be.eq(admin.toLocaleLowerCase());134 .to.be.eq(admin.toLocaleLowerCase());117 });135 });118136137 // Soft-deprecated119 itEth('(!negative tests!) Add admin by USER is not allowed', async ({helper}) => {138 itEth('(!negative tests!) Add admin by USER is not allowed', async ({helper}) => {120 const owner = await helper.eth.createAccountWithBalance(donor);139 const owner = await helper.eth.createAccountWithBalance(donor);121 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');140 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');122141123 const notAdmin = await helper.eth.createAccountWithBalance(donor);142 const notAdmin = await helper.eth.createAccountWithBalance(donor);124 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);143 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);125144126 const user = helper.eth.createAccount();145 const user = helper.eth.createAccount();127 await expect(collectionEvm.methods.addCollectionAdmin(user).call({from: notAdmin}))146 await expect(collectionEvm.methods.addCollectionAdmin(user).call({from: notAdmin}))135 const owner = await helper.eth.createAccountWithBalance(donor);154 const owner = await helper.eth.createAccountWithBalance(donor);136 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');155 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');137156138 const admin = await helper.eth.createAccountWithBalance(donor);157 const [admin] = await helper.arrange.createAccounts([10n], donor);158 const adminCross = helper.ethCrossAccount.fromKeyringPair(admin);139 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);159 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);140 await collectionEvm.methods.addCollectionAdmin(admin).send();160 await collectionEvm.methods.addCollectionAdminCross(adminCross).send();141161142 const [notAdmin] = await helper.arrange.createAccounts([10n], donor);162 const [notAdmin] = await helper.arrange.createAccounts([10n], donor);143 const notAdminCross = helper.ethCrossAccount.fromKeyringPair(notAdmin);163 const notAdminCross = helper.ethCrossAccount.fromKeyringPair(notAdmin);144 await expect(collectionEvm.methods.addCollectionAdminCross(notAdminCross).call({from: admin}))164 await expect(collectionEvm.methods.addCollectionAdminCross(notAdminCross).call({from: adminCross.eth}))145 .to.be.rejectedWith('NoPermission');165 .to.be.rejectedWith('NoPermission');146166147 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);167 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);148 expect(adminList.length).to.be.eq(1);168 expect(adminList.length).to.be.eq(1);169 170 const admin0Cross = helper.ethCrossAccount.fromKeyringPair(adminList[0]);149 expect(adminList[0].asEthereum.toString().toLocaleLowerCase())171 expect(admin0Cross.eth.toLocaleLowerCase())150 .to.be.eq(admin.toLocaleLowerCase());172 .to.be.eq(adminCross.eth.toLocaleLowerCase());151 });173 });152174153 itEth('(!negative tests!) Add [cross] admin by USER is not allowed', async ({helper}) => {175 itEth('(!negative tests!) Add [cross] admin by USER is not allowed', async ({helper}) => {175 });197 });176 });198 });177199200 // Soft-deprecated178 itEth('Remove admin by owner', async ({helper}) => {201 itEth('Remove admin by owner', async ({helper}) => {179 const owner = await helper.eth.createAccountWithBalance(donor);202 const owner = await helper.eth.createAccountWithBalance(donor);180 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');203 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');181204182 const newAdmin = helper.eth.createAccount();205 const newAdmin = helper.eth.createAccount();183 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);206 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);184 await collectionEvm.methods.addCollectionAdmin(newAdmin).send();207 await collectionEvm.methods.addCollectionAdmin(newAdmin).send();185208186 {209 {214 expect(adminList.length).to.be.eq(0);237 expect(adminList.length).to.be.eq(0);215 });238 });216239240 // Soft-deprecated217 itEth('(!negative tests!) Remove admin by ADMIN is not allowed', async ({helper}) => {241 itEth('(!negative tests!) Remove admin by ADMIN is not allowed', async ({helper}) => {218 const owner = await helper.eth.createAccountWithBalance(donor);242 const owner = await helper.eth.createAccountWithBalance(donor);219 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');243 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');220244221 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);245 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);222246223 const admin0 = await helper.eth.createAccountWithBalance(donor);247 const admin0 = await helper.eth.createAccountWithBalance(donor);224 await collectionEvm.methods.addCollectionAdmin(admin0).send();248 await collectionEvm.methods.addCollectionAdmin(admin0).send();236 }260 }237 });261 });238262263 // Soft-deprecated239 itEth('(!negative tests!) Remove admin by USER is not allowed', async ({helper}) => {264 itEth('(!negative tests!) Remove admin by USER is not allowed', async ({helper}) => {240 const owner = await helper.eth.createAccountWithBalance(donor);265 const owner = await helper.eth.createAccountWithBalance(donor);241 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');266 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');242267243 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);268 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);244269245 const admin = await helper.eth.createAccountWithBalance(donor);270 const admin = await helper.eth.createAccountWithBalance(donor);246 await collectionEvm.methods.addCollectionAdmin(admin).send();271 await collectionEvm.methods.addCollectionAdmin(admin).send();260 const owner = await helper.eth.createAccountWithBalance(donor);285 const owner = await helper.eth.createAccountWithBalance(donor);261 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');286 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');262287263 const [adminSub] = await helper.arrange.createAccounts([10n], donor);288 const [admin1] = await helper.arrange.createAccounts([10n], donor);264 const adminSubCross = helper.ethCrossAccount.fromKeyringPair(adminSub);289 const admin1Cross = helper.ethCrossAccount.fromKeyringPair(admin1);265 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);290 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);266 await collectionEvm.methods.addCollectionAdminCross(adminSubCross).send();291 await collectionEvm.methods.addCollectionAdminCross(admin1Cross).send();292 267 const adminEth = await helper.eth.createAccountWithBalance(donor);293 const [admin2] = await helper.arrange.createAccounts([10n], donor);294 const admin2Cross = helper.ethCrossAccount.fromKeyringPair(admin2);268 await collectionEvm.methods.addCollectionAdmin(adminEth).send();295 await collectionEvm.methods.addCollectionAdminCross(admin2Cross).send();269296270 await expect(collectionEvm.methods.removeCollectionAdminCross(adminSubCross).call({from: adminEth}))297 await expect(collectionEvm.methods.removeCollectionAdminCross(admin1Cross).call({from: admin2Cross.eth}))271 .to.be.rejectedWith('NoPermission');298 .to.be.rejectedWith('NoPermission');272299273 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);300 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);274 expect(adminList.length).to.be.eq(2);301 expect(adminList.length).to.be.eq(2);275 expect(adminList.toString().toLocaleLowerCase())302 expect(adminList.toString().toLocaleLowerCase())276 .to.be.deep.contains(adminSub.address.toLocaleLowerCase())303 .to.be.deep.contains(admin1.address.toLocaleLowerCase())277 .to.be.deep.contains(adminEth.toLocaleLowerCase());304 .to.be.deep.contains(admin2.address.toLocaleLowerCase());278 });305 });279306280 itEth('(!negative tests!) Remove [cross] admin by USER is not allowed', async ({helper}) => {307 itEth('(!negative tests!) Remove [cross] admin by USER is not allowed', async ({helper}) => {297 });324 });298});325});299326327// Soft-deprecated300describe('Change owner tests', () => {328describe('Change owner tests', () => {301 let donor: IKeyringPair;329 let donor: IKeyringPair;302330310 const owner = await helper.eth.createAccountWithBalance(donor);338 const owner = await helper.eth.createAccountWithBalance(donor);311 const newOwner = await helper.eth.createAccountWithBalance(donor);339 const newOwner = await helper.eth.createAccountWithBalance(donor);312 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');340 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');313 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);341 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);314342315 await collectionEvm.methods.changeCollectionOwner(newOwner).send();343 await collectionEvm.methods.changeCollectionOwner(newOwner).send();316344322 const owner = await helper.eth.createAccountWithBalance(donor);350 const owner = await helper.eth.createAccountWithBalance(donor);323 const newOwner = await helper.eth.createAccountWithBalance(donor);351 const newOwner = await helper.eth.createAccountWithBalance(donor);324 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');352 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');325 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);353 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);326 const cost = await recordEthFee(helper, owner, () => collectionEvm.methods.changeCollectionOwner(newOwner).send());354 const cost = await recordEthFee(helper, owner, () => collectionEvm.methods.changeCollectionOwner(newOwner).send());327 expect(cost < BigInt(0.2 * Number(helper.balance.getOneTokenNominal())));355 expect(cost < BigInt(0.2 * Number(helper.balance.getOneTokenNominal())));328 expect(cost > 0);356 expect(cost > 0);332 const owner = await helper.eth.createAccountWithBalance(donor);360 const owner = await helper.eth.createAccountWithBalance(donor);333 const newOwner = await helper.eth.createAccountWithBalance(donor);361 const newOwner = await helper.eth.createAccountWithBalance(donor);334 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');362 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');335 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);363 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);336364337 await expect(collectionEvm.methods.changeCollectionOwner(newOwner).send({from: newOwner})).to.be.rejected;365 await expect(collectionEvm.methods.changeCollectionOwner(newOwner).send({from: newOwner})).to.be.rejected;338 expect(await collectionEvm.methods.isOwnerOrAdmin(newOwner).call()).to.be.false;366 expect(await collectionEvm.methods.isOwnerOrAdmin(newOwner).call()).to.be.false;355 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');383 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');356 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);384 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);357385358 expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.true;359 expect(await collectionEvm.methods.isOwnerOrAdminCross(newOwnerCross).call()).to.be.false;386 expect(await collectionEvm.methods.isOwnerOrAdminCross(newOwnerCross).call()).to.be.false;360387361 await collectionEvm.methods.setOwnerCross(newOwnerCross).send();388 await collectionEvm.methods.changeCollectionOwnerCross(newOwnerCross).send();362389363 expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.false;364 expect(await collectionEvm.methods.isOwnerOrAdminCross(newOwnerCross).call()).to.be.true;390 expect(await collectionEvm.methods.isOwnerOrAdminCross(newOwnerCross).call()).to.be.true;365 });391 });366392383 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');409 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');384 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);410 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);385411386 await expect(collectionEvm.methods.setOwnerCross(newOwnerCross).send({from: otherReceiver})).to.be.rejected;412 await expect(collectionEvm.methods.changeCollectionOwnerCross(newOwnerCross).send({from: otherReceiver})).to.be.rejected;387 expect(await collectionEvm.methods.isOwnerOrAdminCross(newOwnerCross).call()).to.be.false;413 expect(await collectionEvm.methods.isOwnerOrAdminCross(newOwnerCross).call()).to.be.false;388 });414 });389});415});tests/src/eth/collectionHelpersAbi.jsondiffbeforeafterbothno changes
tests/src/eth/collectionProperties.test.tsdiffbeforeafterboth27 before(async function() {27 before(async function() {28 await usingEthPlaygrounds(async (_helper, privateKey) => {28 await usingEthPlaygrounds(async (_helper, privateKey) => {29 donor = await privateKey({filename: __filename});29 donor = await privateKey({filename: __filename});30 [alice] = await _helper.arrange.createAccounts([10n], donor);30 [alice] = await _helper.arrange.createAccounts([20n], donor);31 });31 });32 });32 });333339 const address = helper.ethAddress.fromCollectionId(collection.collectionId);39 const address = helper.ethAddress.fromCollectionId(collection.collectionId);40 const contract = helper.ethNativeContract.collection(address, 'nft', caller);40 const contract = helper.ethNativeContract.collection(address, 'nft', caller);414142 await contract.methods.setCollectionProperty('testKey', Buffer.from('testValue')).send({from: caller});42 await contract.methods.setCollectionProperties([{key: 'testKey', value: Buffer.from('testValue')}]).send({from: caller});434344 const raw = (await collection.getData())?.raw;44 const raw = (await collection.getData())?.raw;454555 const address = helper.ethAddress.fromCollectionId(collection.collectionId);55 const address = helper.ethAddress.fromCollectionId(collection.collectionId);56 const contract = helper.ethNativeContract.collection(address, 'nft', caller);56 const contract = helper.ethNativeContract.collection(address, 'nft', caller);575758 await contract.methods.deleteCollectionProperty('testKey').send({from: caller});58 await contract.methods.deleteCollectionProperties(['testKey']).send({from: caller});595960 const raw = (await collection.getData())?.raw;60 const raw = (await collection.getData())?.raw;616173 expect(value).to.equal(helper.getWeb3().utils.toHex('testValue'));73 expect(value).to.equal(helper.getWeb3().utils.toHex('testValue'));74 });74 });7576 // Soft-deprecated77 itEth('Collection property can be set', async({helper}) => {78 const caller = await helper.eth.createAccountWithBalance(donor);79 const collection = await helper.nft.mintCollection(alice, {name: 'name', description: 'test', tokenPrefix: 'test', properties: []});80 await collection.addAdmin(alice, {Ethereum: caller});8182 const address = helper.ethAddress.fromCollectionId(collection.collectionId);83 const contract = helper.ethNativeContract.collection(address, 'nft', caller, true);8485 await contract.methods.setCollectionProperty('testKey', Buffer.from('testValue')).send();8687 const raw = (await collection.getData())?.raw;8889 expect(raw.properties[0].value).to.equal('testValue');90 });9192 // Soft-deprecated93 itEth('Collection property can be deleted', async({helper}) => {94 const caller = await helper.eth.createAccountWithBalance(donor);95 const collection = await helper.nft.mintCollection(alice, {name: 'name', description: 'test', tokenPrefix: 'test', properties: [{key: 'testKey', value: 'testValue'}]});9697 await collection.addAdmin(alice, {Ethereum: caller});9899 const address = helper.ethAddress.fromCollectionId(collection.collectionId);100 const contract = helper.ethNativeContract.collection(address, 'nft', caller, true);101102 await contract.methods.deleteCollectionProperty('testKey').send({from: caller});103104 const raw = (await collection.getData())?.raw;105106 expect(raw.properties.length).to.equal(0);107 });75});108});7610977describe('Supports ERC721Metadata', () => {110describe('Supports ERC721Metadata', () => {95 const creatorMethod = mode === 'rft' ? 'createRFTCollection' : 'createNFTCollection';128 const creatorMethod = mode === 'rft' ? 'createRFTCollection' : 'createNFTCollection';9612997 const {collectionId, collectionAddress} = await helper.eth[creatorMethod](caller, 'n', 'd', 'p');130 const {collectionId, collectionAddress} = await helper.eth[creatorMethod](caller, 'n', 'd', 'p');131 const bruhCross = helper.ethCrossAccount.fromAddress(bruh);9813299 const contract = helper.ethNativeContract.collectionById(collectionId, mode, caller);133 const contract = helper.ethNativeContract.collectionById(collectionId, mode, caller);100 await contract.methods.addCollectionAdmin(bruh).send(); // to check that admin will work too134 await contract.methods.addCollectionAdminCross(bruhCross).send(); // to check that admin will work too101135102 const collection1 = helper.nft.getCollectionObject(collectionId);136 const collection1 = helper.nft.getCollectionObject(collectionId);103 const data1 = await collection1.getData();137 const data1 = await collection1.getData();133167134 expect(await contract.methods.tokenURI(tokenId1).call()).to.equal(BASE_URI);168 expect(await contract.methods.tokenURI(tokenId1).call()).to.equal(BASE_URI);135169136 await contract.methods.setProperty(tokenId1, 'URISuffix', Buffer.from(SUFFIX)).send();170 await contract.methods.setProperties(tokenId1, [{key: 'URISuffix', value: Buffer.from(SUFFIX)}]).send();137 expect(await contract.methods.tokenURI(tokenId1).call()).to.equal(BASE_URI + SUFFIX);171 expect(await contract.methods.tokenURI(tokenId1).call()).to.equal(BASE_URI + SUFFIX);138172139 await contract.methods.setProperty(tokenId1, 'URI', Buffer.from(URI)).send();173 await contract.methods.setProperties(tokenId1, [{key: 'URI', value: Buffer.from(URI)}]).send();140 expect(await contract.methods.tokenURI(tokenId1).call()).to.equal(URI);174 expect(await contract.methods.tokenURI(tokenId1).call()).to.equal(URI);141175142 await contract.methods.deleteProperties(tokenId1, ['URI']).send();176 await contract.methods.deleteProperties(tokenId1, ['URI']).send();150 await contract.methods.deleteProperties(tokenId2, ['URI']).send();184 await contract.methods.deleteProperties(tokenId2, ['URI']).send();151 expect(await contract.methods.tokenURI(tokenId2).call()).to.equal(BASE_URI);185 expect(await contract.methods.tokenURI(tokenId2).call()).to.equal(BASE_URI);152186153 await contract.methods.setProperty(tokenId2, 'URISuffix', Buffer.from(SUFFIX)).send();187 await contract.methods.setProperties(tokenId2, [{key: 'URISuffix', value: Buffer.from(SUFFIX)}]).send();154 expect(await contract.methods.tokenURI(tokenId2).call()).to.equal(BASE_URI + SUFFIX);188 expect(await contract.methods.tokenURI(tokenId2).call()).to.equal(BASE_URI + SUFFIX);155 };189 };156190tests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth81 // expect(bigIntToSub(api, BigInt(sponsorTuple[1]))).to.be.eq(sponsor.address);81 // expect(bigIntToSub(api, BigInt(sponsorTuple[1]))).to.be.eq(sponsor.address);82 // });82 // });838384 itEth('Remove sponsor', async ({helper}) => {84 // Soft-deprecated85 itEth('[eth] Remove sponsor', async ({helper}) => {85 const owner = await helper.eth.createAccountWithBalance(donor);86 const owner = await helper.eth.createAccountWithBalance(donor);86 const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);87 const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);878888 let result = await collectionHelpers.methods.createNFTCollection('Sponsor collection', '1', '1').send({value: Number(2n * nominal)});89 let result = await collectionHelpers.methods.createNFTCollection('Sponsor collection', '1', '1').send({value: Number(2n * nominal)});89 const collectionIdAddress = helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);90 const collectionIdAddress = helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);90 const sponsor = await helper.eth.createAccountWithBalance(donor);91 const sponsor = await helper.eth.createAccountWithBalance(donor);91 const collectionEvm = helper.ethNativeContract.collection(collectionIdAddress, 'nft', owner);92 const collectionEvm = helper.ethNativeContract.collection(collectionIdAddress, 'nft', owner, true);929393 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;94 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;94 result = await collectionEvm.methods.setCollectionSponsor(sponsor).send({from: owner});95 result = await collectionEvm.methods.setCollectionSponsor(sponsor).send({from: owner});103 expect(sponsorTuple.field_0).to.be.eq('0x0000000000000000000000000000000000000000');104 expect(sponsorTuple.field_0).to.be.eq('0x0000000000000000000000000000000000000000');104 });105 });105106106 itEth('Sponsoring collection from evm address via access list', async ({helper}) => {107 itEth('[cross] Remove sponsor', async ({helper}) => {107 const owner = await helper.eth.createAccountWithBalance(donor);108 const owner = await helper.eth.createAccountWithBalance(donor);109 const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);108110111 let result = await collectionHelpers.methods.createNFTCollection('Sponsor collection', '1', '1').send({value: Number(2n * nominal)});112 const collectionIdAddress = helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);113 const sponsor = await helper.eth.createAccountWithBalance(donor);114 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);115 const collectionEvm = helper.ethNativeContract.collection(collectionIdAddress, 'nft', owner);116117 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;118 result = await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send({from: owner});119 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.true;120121 await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});122 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;123124 await collectionEvm.methods.removeCollectionSponsor().send({from: owner});125126 const sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});127 expect(sponsorTuple.field_0).to.be.eq('0x0000000000000000000000000000000000000000');128 });129130 // Soft-deprecated131 itEth('[eth] Sponsoring collection from evm address via access list', async ({helper}) => {132 const owner = await helper.eth.createAccountWithBalance(donor);133109 const {collectionId, collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'Sponsor collection', '1', '1', '');134 const {collectionId, collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'Sponsor collection', '1', '1', '');110135111 const collection = helper.nft.getCollectionObject(collectionId);136 const collection = helper.nft.getCollectionObject(collectionId);112 const sponsor = await helper.eth.createAccountWithBalance(donor);137 const sponsor = await helper.eth.createAccountWithBalance(donor);113 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);138 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);114139115 await collectionEvm.methods.setCollectionSponsor(sponsor).send({from: owner});140 await collectionEvm.methods.setCollectionSponsor(sponsor).send({from: owner});116 let collectionData = (await collection.getData())!;141 let collectionData = (await collection.getData())!;165 }190 }166 });191 });167192193 itEth('[cross] Sponsoring collection from evm address via access list', async ({helper}) => {194 const owner = await helper.eth.createAccountWithBalance(donor);195196 const {collectionId, collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'Sponsor collection', '1', '1', '');197198 const collection = helper.nft.getCollectionObject(collectionId);199 const sponsor = await helper.eth.createAccountWithBalance(donor);200 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);201 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);202203 await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send({from: owner});204 let collectionData = (await collection.getData())!;205 expect(collectionData.raw.sponsorship.Unconfirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));206 await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');207208 await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});209 collectionData = (await collection.getData())!;210 expect(collectionData.raw.sponsorship.Confirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));211212 const user = helper.eth.createAccount();213 const userCross = helper.ethCrossAccount.fromAddress(user);214 const nextTokenId = await collectionEvm.methods.nextTokenId().call();215 expect(nextTokenId).to.be.equal('1');216217 const oldPermissions = (await collection.getData())!.raw.permissions; // (await getDetailedCollectionInfo(api, collectionId))!.permissions.toHuman();218 expect(oldPermissions.mintMode).to.be.false;219 expect(oldPermissions.access).to.be.equal('Normal');220221 await collectionEvm.methods.setCollectionAccess(1 /*'AllowList'*/).send({from: owner});222 await collectionEvm.methods.addToCollectionAllowListCross(userCross).send({from: owner});223 await collectionEvm.methods.setCollectionMintMode(true).send({from: owner});224225 const newPermissions = (await collection.getData())!.raw.permissions; // (await getDetailedCollectionInfo(api, collectionId))!.permissions.toHuman();226 expect(newPermissions.mintMode).to.be.true;227 expect(newPermissions.access).to.be.equal('AllowList');228229 const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));230 const sponsorBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsor));231232 {233 const result = await collectionEvm.methods.mintWithTokenURI(user, 'Test URI').send({from: user});234 const events = helper.eth.normalizeEvents(result.events);235236 expect(events).to.be.deep.equal([237 {238 address: collectionAddress,239 event: 'Transfer',240 args: {241 from: '0x0000000000000000000000000000000000000000',242 to: user,243 tokenId: '1',244 },245 },246 ]);247248 const ownerBalanceAfter = await helper.balance.getSubstrate(await helper.address.ethToSubstrate(owner));249 const sponsorBalanceAfter = await helper.balance.getSubstrate(await helper.address.ethToSubstrate(sponsor));250251 expect(await collectionEvm.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');252 expect(ownerBalanceBefore).to.be.eq(ownerBalanceAfter);253 expect(sponsorBalanceBefore > sponsorBalanceAfter).to.be.true;254 }255 });256168 // TODO: Temprorary off. Need refactor257 // TODO: Temprorary off. Need refactor169 // itWeb3('Sponsoring collection from substrate address via access list', async ({api, web3, privateKeyWrapper}) => {258 // itWeb3('Sponsoring collection from substrate address via access list', async ({api, web3, privateKeyWrapper}) => {221 // }310 // }222 // });311 // });223312224 itEth('Check that transaction via EVM spend money from sponsor address', async ({helper}) => {313 // Soft-deprecated314 itEth('[eth] Check that transaction via EVM spend money from sponsor address', async ({helper}) => {225 const owner = await helper.eth.createAccountWithBalance(donor);315 const owner = await helper.eth.createAccountWithBalance(donor);226316227 const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner,'Sponsor collection', '1', '1', '');317 const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner,'Sponsor collection', '1', '1', '');228 const collection = helper.nft.getCollectionObject(collectionId);318 const collection = helper.nft.getCollectionObject(collectionId);229 const sponsor = await helper.eth.createAccountWithBalance(donor);319 const sponsor = await helper.eth.createAccountWithBalance(donor);230 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);320 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);231321232 await collectionEvm.methods.setCollectionSponsor(sponsor).send();322 await collectionEvm.methods.setCollectionSponsor(sponsor).send();233 let collectionData = (await collection.getData())!;323 let collectionData = (await collection.getData())!;234 expect(collectionData.raw.sponsorship.Unconfirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));324 expect(collectionData.raw.sponsorship.Unconfirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));235 await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');325 await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');236326327 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor, true);328 await sponsorCollection.methods.confirmCollectionSponsorship().send();329 collectionData = (await collection.getData())!;330 expect(collectionData.raw.sponsorship.Confirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));331332 const user = helper.eth.createAccount();333 await collectionEvm.methods.addCollectionAdmin(user).send();334335 const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));336 const sponsorBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsor));337338 const userCollectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', user, true);339340 const result = await userCollectionEvm.methods.mintWithTokenURI(user, 'Test URI').send();341 const tokenId = result.events.Transfer.returnValues.tokenId;342343 const events = helper.eth.normalizeEvents(result.events);344 const address = helper.ethAddress.fromCollectionId(collectionId);345346 expect(events).to.be.deep.equal([347 {348 address,349 event: 'Transfer',350 args: {351 from: '0x0000000000000000000000000000000000000000',352 to: user,353 tokenId: '1',354 },355 },356 ]);357 expect(await userCollectionEvm.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');358359 const ownerBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));360 expect(ownerBalanceAfter).to.be.eq(ownerBalanceBefore);361 const sponsorBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsor));362 expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;363 });364365 itEth('[cross] Check that transaction via EVM spend money from sponsor address', async ({helper}) => {366 const owner = await helper.eth.createAccountWithBalance(donor);367368 const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner,'Sponsor collection', '1', '1', '');369 const collection = helper.nft.getCollectionObject(collectionId);370 const sponsor = await helper.eth.createAccountWithBalance(donor);371 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);372 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);373374 await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send();375 let collectionData = (await collection.getData())!;376 expect(collectionData.raw.sponsorship.Unconfirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));377 await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');378237 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);379 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);238 await sponsorCollection.methods.confirmCollectionSponsorship().send();380 await sponsorCollection.methods.confirmCollectionSponsorship().send();239 collectionData = (await collection.getData())!;381 collectionData = (await collection.getData())!;240 expect(collectionData.raw.sponsorship.Confirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));382 expect(collectionData.raw.sponsorship.Confirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));241383242 const user = helper.eth.createAccount();384 const user = helper.eth.createAccount();243 await collectionEvm.methods.addCollectionAdmin(user).send();385 const userCross = helper.ethCrossAccount.fromAddress(user);386 await collectionEvm.methods.addCollectionAdminCross(userCross).send();244387245 const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));388 const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));246 const sponsorBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsor));389 const sponsorBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsor));tests/src/eth/createFTCollection.test.tsdiffbeforeafterboth31 });31 });32 });32 });33 33 34 // Soft-deprecated34 itEth('Set sponsorship', async ({helper}) => {35 itEth('[eth] Set sponsorship', async ({helper}) => {35 const owner = await helper.eth.createAccountWithBalance(donor);36 const owner = await helper.eth.createAccountWithBalance(donor);36 const sponsor = await helper.eth.createAccountWithBalance(donor);37 const sponsor = await helper.eth.createAccountWithBalance(donor);37 const ss58Format = helper.chain.getChainProperties().ss58Format;38 const ss58Format = helper.chain.getChainProperties().ss58Format;38 const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, 'absolutely anything', 'ENVY');39 const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, 'absolutely anything', 'ENVY');394040 const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);41 const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner, true);41 await collection.methods.setCollectionSponsor(sponsor).send();42 await collection.methods.setCollectionSponsor(sponsor).send();424343 let data = (await helper.rft.getData(collectionId))!;44 let data = (await helper.rft.getData(collectionId))!;44 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));45 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));454646 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');47 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');474848 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);49 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);49 await sponsorCollection.methods.confirmCollectionSponsorship().send();50 await sponsorCollection.methods.confirmCollectionSponsorship().send();505151 data = (await helper.rft.getData(collectionId))!;52 data = (await helper.rft.getData(collectionId))!;52 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));53 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));53 });54 });5556 itEth('[cross] Set sponsorship', async ({helper}) => {57 const owner = await helper.eth.createAccountWithBalance(donor);58 const sponsor = await helper.eth.createAccountWithBalance(donor);59 const ss58Format = helper.chain.getChainProperties().ss58Format;60 const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, 'absolutely anything', 'ENVY');6162 const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);63 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);64 await collection.methods.setCollectionSponsorCross(sponsorCross).send();6566 let data = (await helper.rft.getData(collectionId))!;67 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));6869 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');7071 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);72 await sponsorCollection.methods.confirmCollectionSponsorship().send();7374 data = (await helper.rft.getData(collectionId))!;75 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));76 });547755 itEth('Set limits', async ({helper}) => {78 itEth('Set limits', async ({helper}) => {56 const owner = await helper.eth.createAccountWithBalance(donor);79 const owner = await helper.eth.createAccountWithBalance(donor);183 .call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');206 .call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');184 });207 });185208209 // Soft-deprecated186 itEth('(!negative test!) Check owner', async ({helper}) => {210 itEth('(!negative test!) [eth] Check owner', async ({helper}) => {187 const owner = await helper.eth.createAccountWithBalance(donor);211 const owner = await helper.eth.createAccountWithBalance(donor);188 const peasant = helper.eth.createAccount();212 const peasant = helper.eth.createAccount();189 const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Transgressed', DECIMALS, 'absolutely anything', 'YVNE');213 const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Transgressed', DECIMALS, 'absolutely anything', 'YVNE');190 const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', peasant);214 const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', peasant, true);191 const EXPECTED_ERROR = 'NoPermission';215 const EXPECTED_ERROR = 'NoPermission';192 {216 {193 const sponsor = await helper.eth.createAccountWithBalance(donor);217 const sponsor = await helper.eth.createAccountWithBalance(donor);194 await expect(peasantCollection.methods218 await expect(peasantCollection.methods195 .setCollectionSponsor(sponsor)219 .setCollectionSponsor(sponsor)196 .call()).to.be.rejectedWith(EXPECTED_ERROR);220 .call()).to.be.rejectedWith(EXPECTED_ERROR);197 221 198 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', sponsor);222 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', sponsor, true);199 await expect(sponsorCollection.methods223 await expect(sponsorCollection.methods200 .confirmCollectionSponsorship()224 .confirmCollectionSponsorship()201 .call()).to.be.rejectedWith('caller is not set as sponsor');225 .call()).to.be.rejectedWith('caller is not set as sponsor');207 }231 }208 });232 });233234 itEth('(!negative test!) [cross] Check owner', async ({helper}) => {235 const owner = await helper.eth.createAccountWithBalance(donor);236 const peasant = helper.eth.createAccount();237 const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Transgressed', DECIMALS, 'absolutely anything', 'YVNE');238 const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', peasant);239 const EXPECTED_ERROR = 'NoPermission';240 {241 const sponsor = await helper.eth.createAccountWithBalance(donor);242 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);243 await expect(peasantCollection.methods244 .setCollectionSponsorCross(sponsorCross)245 .call()).to.be.rejectedWith(EXPECTED_ERROR);246 247 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', sponsor);248 await expect(sponsorCollection.methods249 .confirmCollectionSponsorship()250 .call()).to.be.rejectedWith('caller is not set as sponsor');251 }252 {253 await expect(peasantCollection.methods254 .setCollectionLimit('account_token_ownership_limit', '1000')255 .call()).to.be.rejectedWith(EXPECTED_ERROR);256 }257 });209258210 itEth('(!negative test!) Set limits', async ({helper}) => {259 itEth('(!negative test!) Set limits', async ({helper}) => {211 const owner = await helper.eth.createAccountWithBalance(donor);260 const owner = await helper.eth.createAccountWithBalance(donor);tests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth70 ]);70 ]);71 });71 });727273 // Soft-deprecated73 itEth('Set sponsorship', async ({helper}) => {74 itEth('[eth] Set sponsorship', async ({helper}) => {74 const owner = await helper.eth.createAccountWithBalance(donor);75 const owner = await helper.eth.createAccountWithBalance(donor);75 const sponsor = await helper.eth.createAccountWithBalance(donor);76 const sponsor = await helper.eth.createAccountWithBalance(donor);76 const ss58Format = helper.chain.getChainProperties().ss58Format;77 const ss58Format = helper.chain.getChainProperties().ss58Format;77 const {collectionId, collectionAddress} = await helper.eth.createNFTCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');78 const {collectionId, collectionAddress} = await helper.eth.createNFTCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');787979 const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);80 const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);80 await collection.methods.setCollectionSponsor(sponsor).send();81 await collection.methods.setCollectionSponsor(sponsor).send();818282 let data = (await helper.nft.getData(collectionId))!;83 let data = (await helper.nft.getData(collectionId))!;83 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));84 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));848585 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');86 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');868787 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);88 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor, true);88 await sponsorCollection.methods.confirmCollectionSponsorship().send();89 await sponsorCollection.methods.confirmCollectionSponsorship().send();899090 data = (await helper.nft.getData(collectionId))!;91 data = (await helper.nft.getData(collectionId))!;91 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));92 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));92 });93 });9495 itEth('[cross] Set sponsorship', async ({helper}) => {96 const owner = await helper.eth.createAccountWithBalance(donor);97 const sponsor = await helper.eth.createAccountWithBalance(donor);98 const ss58Format = helper.chain.getChainProperties().ss58Format;99 const {collectionId, collectionAddress} = await helper.eth.createNFTCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');100101 const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);102 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);103 await collection.methods.setCollectionSponsorCross(sponsorCross).send();104105 let data = (await helper.nft.getData(collectionId))!;106 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));107108 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');109110 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);111 await sponsorCollection.methods.confirmCollectionSponsorship().send();112113 data = (await helper.nft.getData(collectionId))!;114 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));115 });9311694 itEth('Set limits', async ({helper}) => {117 itEth('Set limits', async ({helper}) => {95 const owner = await helper.eth.createAccountWithBalance(donor);118 const owner = await helper.eth.createAccountWithBalance(donor);196 .call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');219 .call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');197 });220 });198221222 // Soft-deprecated199 itEth('(!negative test!) Check owner', async ({helper}) => {223 itEth('(!negative test!) [eth] Check owner', async ({helper}) => {200 const owner = await helper.eth.createAccountWithBalance(donor);224 const owner = await helper.eth.createAccountWithBalance(donor);201 const malfeasant = helper.eth.createAccount();225 const malfeasant = helper.eth.createAccount();202 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Transgressed', 'absolutely anything', 'COR');226 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Transgressed', 'absolutely anything', 'COR');203 const malfeasantCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', malfeasant);227 const malfeasantCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', malfeasant, true);204 const EXPECTED_ERROR = 'NoPermission';228 const EXPECTED_ERROR = 'NoPermission';205 {229 {206 const sponsor = await helper.eth.createAccountWithBalance(donor);230 const sponsor = await helper.eth.createAccountWithBalance(donor);207 await expect(malfeasantCollection.methods231 await expect(malfeasantCollection.methods208 .setCollectionSponsor(sponsor)232 .setCollectionSponsor(sponsor)209 .call()).to.be.rejectedWith(EXPECTED_ERROR);233 .call()).to.be.rejectedWith(EXPECTED_ERROR);210234211 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);235 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor, true);212 await expect(sponsorCollection.methods236 await expect(sponsorCollection.methods213 .confirmCollectionSponsorship()237 .confirmCollectionSponsorship()214 .call()).to.be.rejectedWith('caller is not set as sponsor');238 .call()).to.be.rejectedWith('caller is not set as sponsor');220 }244 }221 });245 });246247 itEth('(!negative test!) [cross] Check owner', async ({helper}) => {248 const owner = await helper.eth.createAccountWithBalance(donor);249 const malfeasant = helper.eth.createAccount();250 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Transgressed', 'absolutely anything', 'COR');251 const malfeasantCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', malfeasant);252 const EXPECTED_ERROR = 'NoPermission';253 {254 const sponsor = await helper.eth.createAccountWithBalance(donor);255 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);256 await expect(malfeasantCollection.methods257 .setCollectionSponsorCross(sponsorCross)258 .call()).to.be.rejectedWith(EXPECTED_ERROR);259260 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);261 await expect(sponsorCollection.methods262 .confirmCollectionSponsorship()263 .call()).to.be.rejectedWith('caller is not set as sponsor');264 }265 {266 await expect(malfeasantCollection.methods267 .setCollectionLimit('account_token_ownership_limit', '1000')268 .call()).to.be.rejectedWith(EXPECTED_ERROR);269 }270 });222271223 itEth('(!negative test!) Set limits', async ({helper}) => {272 itEth('(!negative test!) Set limits', async ({helper}) => {224 const owner = await helper.eth.createAccountWithBalance(donor);273 const owner = await helper.eth.createAccountWithBalance(donor);tests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth105 .call()).to.be.true;105 .call()).to.be.true;106 });106 });107 107 108 // Soft-deprecated108 itEth('Set sponsorship', async ({helper}) => {109 itEth('[eth] Set sponsorship', async ({helper}) => {109 const owner = await helper.eth.createAccountWithBalance(donor);110 const owner = await helper.eth.createAccountWithBalance(donor);110 const sponsor = await helper.eth.createAccountWithBalance(donor);111 const sponsor = await helper.eth.createAccountWithBalance(donor);111 const ss58Format = helper.chain.getChainProperties().ss58Format;112 const ss58Format = helper.chain.getChainProperties().ss58Format;112 const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(owner, 'Sponsor', 'absolutely anything', 'ENVY');113 const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(owner, 'Sponsor', 'absolutely anything', 'ENVY');113114114 const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);115 const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner, true);115 await collection.methods.setCollectionSponsor(sponsor).send();116 await collection.methods.setCollectionSponsor(sponsor).send();116117117 let data = (await helper.rft.getData(collectionId))!;118 let data = (await helper.rft.getData(collectionId))!;118 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));119 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));119120120 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');121 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');121122122 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);123 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);123 await sponsorCollection.methods.confirmCollectionSponsorship().send();124 await sponsorCollection.methods.confirmCollectionSponsorship().send();124125125 data = (await helper.rft.getData(collectionId))!;126 data = (await helper.rft.getData(collectionId))!;126 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));127 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));127 });128 });129130 itEth('[cross] Set sponsorship', async ({helper}) => {131 const owner = await helper.eth.createAccountWithBalance(donor);132 const sponsor = await helper.eth.createAccountWithBalance(donor);133 const ss58Format = helper.chain.getChainProperties().ss58Format;134 const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(owner, 'Sponsor', 'absolutely anything', 'ENVY');135136 const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);137 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);138 await collection.methods.setCollectionSponsorCross(sponsorCross).send();139140 let data = (await helper.rft.getData(collectionId))!;141 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));142143 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');144145 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);146 await sponsorCollection.methods.confirmCollectionSponsorship().send();147148 data = (await helper.rft.getData(collectionId))!;149 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));150 });128151129 itEth('Set limits', async ({helper}) => {152 itEth('Set limits', async ({helper}) => {130 const owner = await helper.eth.createAccountWithBalance(donor);153 const owner = await helper.eth.createAccountWithBalance(donor);231 .call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');254 .call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');232 });255 });233256257 // Soft-deprecated234 itEth('(!negative test!) Check owner', async ({helper}) => {258 itEth('(!negative test!) [eth] Check owner', async ({helper}) => {235 const owner = await helper.eth.createAccountWithBalance(donor);259 const owner = await helper.eth.createAccountWithBalance(donor);236 const peasant = helper.eth.createAccount();260 const peasant = helper.eth.createAccount();237 const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Transgressed', 'absolutely anything', 'YVNE');261 const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Transgressed', 'absolutely anything', 'YVNE');238 const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', peasant);262 const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', peasant, true);239 const EXPECTED_ERROR = 'NoPermission';263 const EXPECTED_ERROR = 'NoPermission';240 {264 {241 const sponsor = await helper.eth.createAccountWithBalance(donor);265 const sponsor = await helper.eth.createAccountWithBalance(donor);242 await expect(peasantCollection.methods266 await expect(peasantCollection.methods243 .setCollectionSponsor(sponsor)267 .setCollectionSponsor(sponsor)244 .call()).to.be.rejectedWith(EXPECTED_ERROR);268 .call()).to.be.rejectedWith(EXPECTED_ERROR);245 269 246 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);270 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);247 await expect(sponsorCollection.methods271 await expect(sponsorCollection.methods248 .confirmCollectionSponsorship()272 .confirmCollectionSponsorship()249 .call()).to.be.rejectedWith('caller is not set as sponsor');273 .call()).to.be.rejectedWith('caller is not set as sponsor');255 }279 }256 });280 });281282 itEth('(!negative test!) [cross] Check owner', async ({helper}) => {283 const owner = await helper.eth.createAccountWithBalance(donor);284 const peasant = helper.eth.createAccount();285 const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Transgressed', 'absolutely anything', 'YVNE');286 const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', peasant);287 const EXPECTED_ERROR = 'NoPermission';288 {289 const sponsor = await helper.eth.createAccountWithBalance(donor);290 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);291 await expect(peasantCollection.methods292 .setCollectionSponsorCross(sponsorCross)293 .call()).to.be.rejectedWith(EXPECTED_ERROR);294 295 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);296 await expect(sponsorCollection.methods297 .confirmCollectionSponsorship()298 .call()).to.be.rejectedWith('caller is not set as sponsor');299 }300 {301 await expect(peasantCollection.methods302 .setCollectionLimit('account_token_ownership_limit', '1000')303 .call()).to.be.rejectedWith(EXPECTED_ERROR);304 }305 });257306258 itEth('(!negative test!) Set limits', async ({helper}) => {307 itEth('(!negative test!) Set limits', async ({helper}) => {259 const owner = await helper.eth.createAccountWithBalance(donor);308 const owner = await helper.eth.createAccountWithBalance(donor);tests/src/eth/fractionalizer/Fractionalizer.soldiffbeforeafterboth3import {CollectionHelpers} from "../api/CollectionHelpers.sol";3import {CollectionHelpers} from "../api/CollectionHelpers.sol";4import {ContractHelpers} from "../api/ContractHelpers.sol";4import {ContractHelpers} from "../api/ContractHelpers.sol";5import {UniqueRefungibleToken} from "../api/UniqueRefungibleToken.sol";5import {UniqueRefungibleToken} from "../api/UniqueRefungibleToken.sol";6import {UniqueRefungible} from "../api/UniqueRefungible.sol";6import {UniqueRefungible, EthCrossAccount} from "../api/UniqueRefungible.sol";7import {UniqueNFT} from "../api/UniqueNFT.sol";7import {UniqueNFT} from "../api/UniqueNFT.sol";889/// @dev Fractionalization contract. It stores mappings between NFT and RFT tokens,9/// @dev Fractionalization contract. It stores mappings between NFT and RFT tokens,63 "Wrong collection type. Collection is not refungible."63 "Wrong collection type. Collection is not refungible."64 );64 );65 require(65 require(66 refungibleContract.isOwnerOrAdmin(address(this)),66 refungibleContract.isOwnerOrAdminCross(EthCrossAccount({eth: address(this), sub: uint256(0)})),67 "Fractionalizer contract should be an admin of the collection"67 "Fractionalizer contract should be an admin of the collection"68 );68 );69 rftCollection = _collection;69 rftCollection = _collection;tests/src/eth/fractionalizer/fractionalizer.test.tsdiffbeforeafterboth95 const rftCollection = await helper.eth.createRFTCollection(owner, 'rft', 'RFT collection', 'RFT');95 const rftCollection = await helper.eth.createRFTCollection(owner, 'rft', 'RFT collection', 'RFT');96 const rftContract = helper.ethNativeContract.collection(rftCollection.collectionAddress, 'rft', owner);96 const rftContract = helper.ethNativeContract.collection(rftCollection.collectionAddress, 'rft', owner);979798 const fractionalizerAddressCross = helper.ethCrossAccount.fromAddress(fractionalizer.options.address);98 await rftContract.methods.addCollectionAdmin(fractionalizer.options.address).send({from: owner});99 await rftContract.methods.addCollectionAdminCross(fractionalizerAddressCross).send({from: owner});99 const result = await fractionalizer.methods.setRFTCollection(rftCollection.collectionAddress).send({from: owner});100 const result = await fractionalizer.methods.setRFTCollection(rftCollection.collectionAddress).send({from: owner});100 expect(result.events).to.be.like({101 expect(result.events).to.be.like({101 RFTCollectionSet: {102 RFTCollectionSet: {235 const refungibleContract = helper.ethNativeContract.collection(rftCollection.collectionAddress, 'rft', owner);236 const refungibleContract = helper.ethNativeContract.collection(rftCollection.collectionAddress, 'rft', owner);236237237 const fractionalizer = await deployContract(helper, owner);238 const fractionalizer = await deployContract(helper, owner);239 const fractionalizerAddressCross = helper.ethCrossAccount.fromAddress(fractionalizer.options.address);238 await refungibleContract.methods.addCollectionAdmin(fractionalizer.options.address).send({from: owner});240 await refungibleContract.methods.addCollectionAdminCross(fractionalizerAddressCross).send({from: owner});239 await fractionalizer.methods.setRFTCollection(rftCollection.collectionAddress).send({from: owner});241 await fractionalizer.methods.setRFTCollection(rftCollection.collectionAddress).send({from: owner});240242241 await expect(fractionalizer.methods.setRFTCollection(rftCollection.collectionAddress).call())243 await expect(fractionalizer.methods.setRFTCollection(rftCollection.collectionAddress).call())248 const nftContract = helper.ethNativeContract.collection(nftCollection.collectionAddress, 'nft', owner);250 const nftContract = helper.ethNativeContract.collection(nftCollection.collectionAddress, 'nft', owner);249251250 const fractionalizer = await deployContract(helper, owner);252 const fractionalizer = await deployContract(helper, owner);253 const fractionalizerAddressCross = helper.ethCrossAccount.fromAddress(fractionalizer.options.address);251 await nftContract.methods.addCollectionAdmin(fractionalizer.options.address).send({from: owner});254 await nftContract.methods.addCollectionAdminCross(fractionalizerAddressCross).send({from: owner});252255253 await expect(fractionalizer.methods.setRFTCollection(nftCollection.collectionAddress).call())256 await expect(fractionalizer.methods.setRFTCollection(nftCollection.collectionAddress).call())254 .to.be.rejectedWith(/Wrong collection type. Collection is not refungible.$/g);257 .to.be.rejectedWith(/Wrong collection type. Collection is not refungible.$/g);370373371 const fractionalizer = await deployContract(helper, owner);374 const fractionalizer = await deployContract(helper, owner);372375376 const fractionalizerAddressCross = helper.ethCrossAccount.fromAddress(fractionalizer.options.address);373 await refungibleContract.methods.addCollectionAdmin(fractionalizer.options.address).send({from: owner});377 await refungibleContract.methods.addCollectionAdminCross(fractionalizerAddressCross).send({from: owner});374 await fractionalizer.methods.setRFTCollection(rftCollection.collectionAddress).send({from: owner});378 await fractionalizer.methods.setRFTCollection(rftCollection.collectionAddress).send({from: owner});375379376 const mintResult = await refungibleContract.methods.mint(owner).send({from: owner});380 const mintResult = await refungibleContract.methods.mint(owner).send({from: owner});tests/src/eth/fungible.test.tsdiffbeforeafterboth102 }102 }103 });103 });104104105 // Soft-deprecated105 itEth('Can perform burn()', async ({helper}) => {106 itEth('Can perform burn()', async ({helper}) => {106 const owner = await helper.eth.createAccountWithBalance(donor);107 const owner = await helper.eth.createAccountWithBalance(donor);107 const receiver = await helper.eth.createAccountWithBalance(donor);108 const receiver = await helper.eth.createAccountWithBalance(donor);108 const collection = await helper.ft.mintCollection(alice);109 const collection = await helper.ft.mintCollection(alice);109 await collection.addAdmin(alice, {Ethereum: owner});110 await collection.addAdmin(alice, {Ethereum: owner});110111111 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);112 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);112 const contract = helper.ethNativeContract.collection(collectionAddress, 'ft', owner);113 const contract = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);113 await contract.methods.mint(receiver, 100).send();114 await contract.methods.mint(receiver, 100).send();114115115 const result = await contract.methods.burnFrom(receiver, 49).send({from: receiver});116 const result = await contract.methods.burnFrom(receiver, 49).send({from: receiver});tests/src/eth/fungibleAbi.jsondiffbeforeafterbothno changes
tests/src/eth/nonFungible.test.tsdiffbeforeafterboth102102103 if (propertyKey && propertyValue) {103 if (propertyKey && propertyValue) {104 // Set URL or suffix104 // Set URL or suffix105 await contract.methods.setProperty(tokenId, propertyKey, Buffer.from(propertyValue)).send();105 await contract.methods.setProperties(tokenId, [{key: propertyKey, value: Buffer.from(propertyValue)}]).send();106 }106 }107107108 const event = result.events.Transfer;108 const event = result.events.Transfer;tests/src/eth/nonFungibleAbi.jsondiffbeforeafterbothno changes
tests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth99 });99 });100 });100 });101101102 // Soft-deprecated102 itEth('Can perform mint()', async ({helper}) => {103 itEth('[eth] Can perform mint()', async ({helper}) => {103 const owner = await helper.eth.createAccountWithBalance(donor);104 const owner = await helper.eth.createAccountWithBalance(donor);104 const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'A', 'A', 'A', '');105 const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'A', 'A', 'A', '');105 const caller = await helper.eth.createAccountWithBalance(donor);106 const caller = await helper.eth.createAccountWithBalance(donor);106 const receiver = helper.eth.createAccount();107 const receiver = helper.eth.createAccount();107108108 const collectionEvmOwned = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);109 const collectionEvmOwned = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);109 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', caller);110 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', caller, true);110 const contract = await proxyWrap(helper, collectionEvm, donor);111 const contract = await proxyWrap(helper, collectionEvm, donor);111 await collectionEvmOwned.methods.addCollectionAdmin(contract.options.address).send();112 await collectionEvmOwned.methods.addCollectionAdmin(contract.options.address).send();112113135 }136 }136 });137 });138139 itEth('[cross] Can perform mint()', async ({helper}) => {140 const owner = await helper.eth.createAccountWithBalance(donor);141 const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'A', 'A', 'A', '');142 const caller = await helper.eth.createAccountWithBalance(donor);143 const receiver = helper.eth.createAccount();144145 const collectionEvmOwned = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);146 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', caller);147 const contract = await proxyWrap(helper, collectionEvm, donor);148 const contractAddressCross = helper.ethCrossAccount.fromAddress(contract.options.address);149 await collectionEvmOwned.methods.addCollectionAdminCross(contractAddressCross).send();150151 {152 const nextTokenId = await contract.methods.nextTokenId().call();153 const result = await contract.methods.mintWithTokenURI(receiver, nextTokenId, 'Test URI').send({from: caller});154 const tokenId = result.events.Transfer.returnValues.tokenId;155 expect(tokenId).to.be.equal('1');156157 const events = helper.eth.normalizeEvents(result.events);158 events[0].address = events[0].address.toLocaleLowerCase();159160 expect(events).to.be.deep.equal([161 {162 address: collectionAddress.toLocaleLowerCase(),163 event: 'Transfer',164 args: {165 from: '0x0000000000000000000000000000000000000000',166 to: receiver,167 tokenId,168 },169 },170 ]);171172 expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');173 }174 });137175138 //TODO: CORE-302 add eth methods176 //TODO: CORE-302 add eth methods139 itEth.skip('Can perform mintBulk()', async ({helper}) => {177 itEth.skip('Can perform mintBulk()', async ({helper}) => {tests/src/eth/reFungible.test.tsdiffbeforeafterboth231 }231 }232 });232 });233233234 // Soft-deprecated234 itEth('Can perform burnFrom()', async ({helper}) => {235 itEth('Can perform burnFrom()', async ({helper}) => {235 const collection = await helper.rft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});236 const collection = await helper.rft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});236237240 const token = await collection.mintToken(minter, 100n, {Ethereum: owner});241 const token = await collection.mintToken(minter, 100n, {Ethereum: owner});241242242 const address = helper.ethAddress.fromCollectionId(collection.collectionId);243 const address = helper.ethAddress.fromCollectionId(collection.collectionId);243 const contract = helper.ethNativeContract.collection(address, 'rft');244 const contract = helper.ethNativeContract.collection(address, 'rft', spender, true);244245245 const tokenAddress = helper.ethAddress.fromTokenId(collection.collectionId, token.tokenId);246 const tokenAddress = helper.ethAddress.fromTokenId(collection.collectionId, token.tokenId);246 const tokenContract = helper.ethNativeContract.rftToken(tokenAddress, owner);247 const tokenContract = helper.ethNativeContract.rftToken(tokenAddress, owner);247 await tokenContract.methods.repartition(15).send();248 await tokenContract.methods.repartition(15).send();248 await tokenContract.methods.approve(spender, 15).send();249 await tokenContract.methods.approve(spender, 15).send();249250250 {251 {251 const result = await contract.methods.burnFrom(owner, token.tokenId).send({from: spender});252 const result = await contract.methods.burnFrom(owner, token.tokenId).send();252 const event = result.events.Transfer;253 const event = result.events.Transfer;253 expect(event).to.be.like({254 expect(event).to.be.like({254 address: helper.ethAddress.fromCollectionId(collection.collectionId),255 address: helper.ethAddress.fromCollectionId(collection.collectionId),tests/src/eth/reFungibleAbi.jsondiffbeforeafterbothno changes
tests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth95 if (propertyKey && propertyValue) {95 if (propertyKey && propertyValue) {96 // Set URL or suffix96 // Set URL or suffix9797 await contract.methods.setProperty(tokenId, propertyKey, Buffer.from(propertyValue)).send();98 await contract.methods.setProperties(tokenId, [{key: propertyKey, value: Buffer.from(propertyValue)}]).send();98 }99 }99100100 return {contract, nextTokenId: tokenId};101 return {contract, nextTokenId: tokenId};tests/src/eth/reFungibleTokenAbi.jsondiffbeforeafterbothno changes
tests/src/eth/tokenProperties.test.tsdiffbeforeafterboth48 }48 }49 });49 });505051 itEth('Can be set', async({helper}) => {52 const caller = await helper.eth.createAccountWithBalance(donor);53 const collection = await helper.nft.mintCollection(alice, {54 tokenPropertyPermissions: [{55 key: 'testKey',56 permission: {57 collectionAdmin: true,58 },59 }],60 });61 const token = await collection.mintToken(alice);6263 await collection.addAdmin(alice, {Ethereum: caller});6465 const address = helper.ethAddress.fromCollectionId(collection.collectionId);66 const contract = helper.ethNativeContract.collection(address, 'nft', caller);6768 await contract.methods.setProperties(token.tokenId, [{key: 'testKey', value: Buffer.from('testValue')}]).send({from: caller});6970 const [{value}] = await token.getProperties(['testKey']);71 expect(value).to.equal('testValue');72 });7374 // Soft-deprecated51 itEth('Can be set', async({helper}) => {75 itEth('Property can be set', async({helper}) => {52 const caller = await helper.eth.createAccountWithBalance(donor);76 const caller = await helper.eth.createAccountWithBalance(donor);53 const collection = await helper.nft.mintCollection(alice, {77 const collection = await helper.nft.mintCollection(alice, {54 tokenPropertyPermissions: [{78 tokenPropertyPermissions: [{63 await collection.addAdmin(alice, {Ethereum: caller});87 await collection.addAdmin(alice, {Ethereum: caller});648865 const address = helper.ethAddress.fromCollectionId(collection.collectionId);89 const address = helper.ethAddress.fromCollectionId(collection.collectionId);66 const contract = helper.ethNativeContract.collection(address, 'nft', caller);90 const contract = helper.ethNativeContract.collection(address, 'nft', caller, true);679168 await contract.methods.setProperty(token.tokenId, 'testKey', Buffer.from('testValue')).send({from: caller});92 await contract.methods.setProperty(token.tokenId, 'testKey', Buffer.from('testValue')).send({from: caller});699374 itEth('Can be multiple set for NFT ', async({helper}) => {98 itEth('Can be multiple set for NFT ', async({helper}) => {75 const caller = await helper.eth.createAccountWithBalance(donor);99 const caller = await helper.eth.createAccountWithBalance(donor);76 100 77 const properties = Array(5).fill(0).map((_, i) => { return {field_0: `key_${i}`, field_1: Buffer.from(`value_${i}`)}; });101 const properties = Array(5).fill(0).map((_, i) => { return {key: `key_${i}`, value: Buffer.from(`value_${i}`)}; });78 const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.field_0, permission: {tokenOwner: true,102 const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.key, permission: {tokenOwner: true,79 collectionAdmin: true,103 collectionAdmin: true,80 mutable: true}}; });104 mutable: true}}; });81 105 86 110 87 const token = await collection.mintToken(alice);111 const token = await collection.mintToken(alice);88 112 89 const valuesBefore = await token.getProperties(properties.map(p => p.field_0));113 const valuesBefore = await token.getProperties(properties.map(p => p.key));90 expect(valuesBefore).to.be.deep.equal([]);114 expect(valuesBefore).to.be.deep.equal([]);91 115 92 await collection.addAdmin(alice, {Ethereum: caller});116 await collection.addAdmin(alice, {Ethereum: caller});9612097 await contract.methods.setProperties(token.tokenId, properties).send({from: caller});121 await contract.methods.setProperties(token.tokenId, properties).send({from: caller});9812299 const values = await token.getProperties(properties.map(p => p.field_0));123 const values = await token.getProperties(properties.map(p => p.key));100 expect(values).to.be.deep.equal(properties.map(p => { return {key: p.field_0, value: p.field_1.toString()}; }));124 expect(values).to.be.deep.equal(properties.map(p => { return {key: p.key, value: p.value.toString()}; }));101 });125 });102 126 103 itEth.ifWithPallets('Can be multiple set for RFT ', [Pallets.ReFungible], async({helper}) => {127 itEth.ifWithPallets('Can be multiple set for RFT ', [Pallets.ReFungible], async({helper}) => {104 const caller = await helper.eth.createAccountWithBalance(donor);128 const caller = await helper.eth.createAccountWithBalance(donor);105 129 106 const properties = Array(5).fill(0).map((_, i) => { return {field_0: `key_${i}`, field_1: Buffer.from(`value_${i}`)}; });130 const properties = Array(5).fill(0).map((_, i) => { return {key: `key_${i}`, value: Buffer.from(`value_${i}`)}; });107 const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.field_0, permission: {tokenOwner: true,131 const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.key, permission: {tokenOwner: true,108 collectionAdmin: true,132 collectionAdmin: true,109 mutable: true}}; });133 mutable: true}}; });110 134 115 139 116 const token = await collection.mintToken(alice);140 const token = await collection.mintToken(alice);117 141 118 const valuesBefore = await token.getProperties(properties.map(p => p.field_0));142 const valuesBefore = await token.getProperties(properties.map(p => p.key));119 expect(valuesBefore).to.be.deep.equal([]);143 expect(valuesBefore).to.be.deep.equal([]);120 144 121 await collection.addAdmin(alice, {Ethereum: caller});145 await collection.addAdmin(alice, {Ethereum: caller});125149126 await contract.methods.setProperties(token.tokenId, properties).send({from: caller});150 await contract.methods.setProperties(token.tokenId, properties).send({from: caller});127151128 const values = await token.getProperties(properties.map(p => p.field_0));152 const values = await token.getProperties(properties.map(p => p.key));129 expect(values).to.be.deep.equal(properties.map(p => { return {key: p.field_0, value: p.field_1.toString()}; }));153 expect(values).to.be.deep.equal(properties.map(p => { return {key: p.key, value: p.value.toString()}; }));130 });154 });131155132 itEth('Can be deleted', async({helper}) => {156 itEth('Can be deleted', async({helper}) => {tests/src/eth/util/contractHelpersAbi.jsondiffbeforeafterbothno changes
tests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth21import {ContractImports, CompiledContract, TEthCrossAccount, NormalizedEvent, EthProperty} from './types';21import {ContractImports, CompiledContract, TEthCrossAccount, NormalizedEvent, EthProperty} from './types';222223// Native contracts ABI23// Native contracts ABI24import collectionHelpersAbi from '../../collectionHelpersAbi.json';24import collectionHelpersAbi from '../../abi/collectionHelpers.json';25import fungibleAbi from '../../fungibleAbi.json';25import fungibleAbi from '../../abi/fungible.json';26import fungibleDeprecatedAbi from '../../abi/fungibleDeprecated.json';26import nonFungibleAbi from '../../nonFungibleAbi.json';27import nonFungibleAbi from '../../abi/nonFungible.json';28import nonFungibleDeprecatedAbi from '../../abi/nonFungibleDeprecated.json';27import refungibleAbi from '../../reFungibleAbi.json';29import refungibleAbi from '../../abi/reFungible.json';30import refungibleDeprecatedAbi from '../../abi/reFungibleDeprecated.json';28import refungibleTokenAbi from '../../reFungibleTokenAbi.json';31import refungibleTokenAbi from '../../abi/reFungibleToken.json';29import contractHelpersAbi from './../contractHelpersAbi.json';32import contractHelpersAbi from '../../abi/contractHelpers.json';30import {ICrossAccountId, TEthereumAccount} from '../../../util/playgrounds/types';33import {ICrossAccountId, TEthereumAccount} from '../../../util/playgrounds/types';31import {TCollectionMode} from '../../../util/playgrounds/types';34import {TCollectionMode} from '../../../util/playgrounds/types';3235108 return new web3.eth.Contract(collectionHelpersAbi as any, '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f', {from: caller, gas: this.helper.eth.DEFAULT_GAS});111 return new web3.eth.Contract(collectionHelpersAbi as any, '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f', {from: caller, gas: this.helper.eth.DEFAULT_GAS});109 }112 }110113111 collection(address: string, mode: TCollectionMode, caller?: string): Contract {114 collection(address: string, mode: TCollectionMode, caller?: string, mergeDeprecated = false): Contract {112 const abi = {115 let abi = {113 'nft': nonFungibleAbi,116 'nft': nonFungibleAbi,114 'rft': refungibleAbi,117 'rft': refungibleAbi,115 'ft': fungibleAbi,118 'ft': fungibleAbi,116 }[mode];119 }[mode];120 if (mergeDeprecated) {121 const deprecated = {122 'nft': nonFungibleDeprecatedAbi,123 'rft': refungibleDeprecatedAbi,124 'ft': fungibleDeprecatedAbi,125 }[mode];126 abi = [...abi,...deprecated];127 }117 const web3 = this.helper.getWeb3();128 const web3 = this.helper.getWeb3();118 return new web3.eth.Contract(abi as any, address, {gas: this.helper.eth.DEFAULT_GAS, ...(caller ? {from: caller} : {})});129 return new web3.eth.Contract(abi as any, address, {gas: this.helper.eth.DEFAULT_GAS, ...(caller ? {from: caller} : {})});119 }130 }