difftreelog
Merge pull request #723 from UniqueNetwork/feature/deprecate-non-cross-methods
in: master
51 files changed
Makefilediffbeforeafterboth--- a/Makefile
+++ b/Makefile
@@ -7,23 +7,20 @@
@echo " bench-unique"
FUNGIBLE_EVM_STUBS=./pallets/fungible/src/stubs
-FUNGIBLE_EVM_ABI=./tests/src/eth/fungibleAbi.json
-
-REFUNGIBLE_EVM_STUBS=./pallets/refungible/src/stubs
-REFUNGIBLE_EVM_ABI=./tests/src/eth/refungibleAbi.json
+FUNGIBLE_EVM_ABI=./tests/src/eth/abi/fungible.json
NONFUNGIBLE_EVM_STUBS=./pallets/nonfungible/src/stubs
-NONFUNGIBLE_EVM_ABI=./tests/src/eth/nonFungibleAbi.json
+NONFUNGIBLE_EVM_ABI=./tests/src/eth/abi/nonFungible.json
REFUNGIBLE_EVM_STUBS=./pallets/refungible/src/stubs
-REFUNGIBLE_EVM_ABI=./tests/src/eth/reFungibleAbi.json
-REFUNGIBLE_TOKEN_EVM_ABI=./tests/src/eth/reFungibleTokenAbi.json
+REFUNGIBLE_EVM_ABI=./tests/src/eth/abi/reFungible.json
+REFUNGIBLE_TOKEN_EVM_ABI=./tests/src/eth/abi/reFungibleToken.json
CONTRACT_HELPERS_STUBS=./pallets/evm-contract-helpers/src/stubs/
-CONTRACT_HELPERS_ABI=./tests/src/eth/util/contractHelpersAbi.json
+CONTRACT_HELPERS_ABI=./tests/src/eth/abi/contractHelpers.json
COLLECTION_HELPER_STUBS=./pallets/unique/src/eth/stubs/
-COLLECTION_HELPER_ABI=./tests/src/eth/collectionHelpersAbi.json
+COLLECTION_HELPER_ABI=./tests/src/eth/abi/collectionHelpers.json
TESTS_API=./tests/src/eth/api/
crates/evm-coder/src/abi/impls.rsdiffbeforeafterboth--- a/crates/evm-coder/src/abi/impls.rs
+++ b/crates/evm-coder/src/abi/impls.rs
@@ -153,6 +153,42 @@
}
}
+impl sealed::CanBePlacedInVec for Property {}
+
+impl AbiType for Property {
+ const SIGNATURE: SignatureUnit = make_signature!(new fixed("(string,bytes)"));
+
+ fn is_dynamic() -> bool {
+ string::is_dynamic() || bytes::is_dynamic()
+ }
+
+ fn size() -> usize {
+ <string as AbiType>::size() + <bytes as AbiType>::size()
+ }
+}
+
+impl AbiRead for Property {
+ fn abi_read(reader: &mut AbiReader) -> Result<Property> {
+ let size = if !Property::is_dynamic() {
+ Some(<Property as AbiType>::size())
+ } else {
+ None
+ };
+ let mut subresult = reader.subresult(size)?;
+ let key = <string>::abi_read(&mut subresult)?;
+ let value = <bytes>::abi_read(&mut subresult)?;
+
+ Ok(Property { key, value })
+ }
+}
+
+impl AbiWrite for Property {
+ fn abi_write(&self, writer: &mut AbiWriter) {
+ self.key.abi_write(writer);
+ self.value.abi_write(writer);
+ }
+}
+
macro_rules! impl_abi_writeable {
($ty:ty, $method:ident) => {
impl AbiWrite for $ty {
crates/evm-coder/src/lib.rsdiffbeforeafterboth--- a/crates/evm-coder/src/lib.rs
+++ b/crates/evm-coder/src/lib.rs
@@ -253,6 +253,12 @@
let account_id = T::AccountId::from(new_admin_arr);
T::CrossAccountId::from_sub(account_id)
}
+
+ #[derive(Debug, Default)]
+ pub struct Property {
+ pub key: string,
+ pub value: bytes,
+ }
}
/// Parseable EVM call, this trait should be implemented with [`solidity_interface`] macro
crates/evm-coder/src/solidity.rsdiffbeforeafterboth--- a/crates/evm-coder/src/solidity.rs
+++ b/crates/evm-coder/src/solidity.rs
@@ -157,6 +157,7 @@
impl sealed::CanBePlacedInVec for string {}
impl sealed::CanBePlacedInVec for address {}
impl sealed::CanBePlacedInVec for EthCrossAccount {}
+impl sealed::CanBePlacedInVec for Property {}
impl<T: SolidityTypeName + sealed::CanBePlacedInVec> SolidityTypeName for Vec<T> {
fn solidity_name(writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {
@@ -193,6 +194,7 @@
2
}
}
+
impl SolidityTypeName for EthCrossAccount {
fn solidity_name(writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {
write!(writer, "{}", tc.collect_struct::<Self>())
@@ -227,6 +229,61 @@
}
}
+impl StructCollect for Property {
+ fn name() -> String {
+ "Property".into()
+ }
+
+ fn declaration() -> String {
+ let mut str = String::new();
+ writeln!(str, "/// @dev Property struct").unwrap();
+ writeln!(str, "struct {} {{", Self::name()).unwrap();
+ writeln!(str, "\tstring key;").unwrap();
+ writeln!(str, "\tbytes value;").unwrap();
+ writeln!(str, "}}").unwrap();
+ str
+ }
+}
+
+impl SolidityTypeName for Property {
+ fn solidity_name(writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {
+ write!(writer, "{}", tc.collect_struct::<Self>())
+ }
+
+ fn is_simple() -> bool {
+ false
+ }
+
+ fn solidity_default(writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {
+ write!(writer, "{}(", tc.collect_struct::<Self>())?;
+ address::solidity_default(writer, tc)?;
+ write!(writer, ",")?;
+ uint256::solidity_default(writer, tc)?;
+ write!(writer, ")")
+ }
+}
+
+impl SolidityTupleType for Property {
+ fn names(tc: &TypeCollector) -> Vec<string> {
+ let mut collected = Vec::with_capacity(Self::len());
+ {
+ let mut out = string::new();
+ string::solidity_name(&mut out, tc).expect("no fmt error");
+ collected.push(out);
+ }
+ {
+ let mut out = string::new();
+ bytes::solidity_name(&mut out, tc).expect("no fmt error");
+ collected.push(out);
+ }
+ collected
+ }
+
+ fn len() -> usize {
+ 2
+ }
+}
+
pub trait SolidityTupleType {
fn names(tc: &TypeCollector) -> Vec<String>;
fn len() -> usize;
pallets/common/src/erc.rsdiffbeforeafterboth--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -20,6 +20,7 @@
abi::AbiType,
solidity_interface, solidity, ToLog,
types::*,
+ types::Property as PropertyStruct,
execution::{Result, Error},
weight,
};
@@ -78,6 +79,7 @@
///
/// @param key Property key.
/// @param value Propery value.
+ #[solidity(hide)]
#[weight(<SelfWeightOf<T>>::set_collection_properties(1))]
fn set_collection_property(
&mut self,
@@ -102,13 +104,13 @@
fn set_collection_properties(
&mut self,
caller: caller,
- properties: Vec<(string, bytes)>,
+ properties: Vec<PropertyStruct>,
) -> Result<void> {
let caller = T::CrossAccountId::from_eth(caller);
let properties = properties
.into_iter()
- .map(|(key, value)| {
+ .map(|PropertyStruct { key, value }| {
let key = <Vec<u8>>::from(key)
.try_into()
.map_err(|_| "key too large")?;
@@ -126,6 +128,7 @@
/// Delete collection property.
///
/// @param key Property key.
+ #[solidity(hide)]
#[weight(<SelfWeightOf<T>>::delete_collection_properties(1))]
fn delete_collection_property(&mut self, caller: caller, key: string) -> Result<()> {
let caller = T::CrossAccountId::from_eth(caller);
@@ -208,6 +211,7 @@
/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
///
/// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
+ #[solidity(hide)]
fn set_collection_sponsor(&mut self, caller: caller, sponsor: address) -> Result<void> {
self.consume_store_reads_and_writes(1, 1)?;
@@ -411,6 +415,7 @@
/// Add collection admin.
/// @param newAdmin Address of the added administrator.
+ #[solidity(hide)]
fn add_collection_admin(&mut self, caller: caller, new_admin: address) -> Result<void> {
self.consume_store_writes(2)?;
@@ -423,6 +428,7 @@
/// Remove collection admin.
///
/// @param admin Address of the removed administrator.
+ #[solidity(hide)]
fn remove_collection_admin(&mut self, caller: caller, admin: address) -> Result<void> {
self.consume_store_writes(2)?;
@@ -547,6 +553,7 @@
/// Add the user to the allowed list.
///
/// @param user Address of a trusted user.
+ #[solidity(hide)]
fn add_to_collection_allow_list(&mut self, caller: caller, user: address) -> Result<void> {
self.consume_store_writes(1)?;
@@ -575,6 +582,7 @@
/// Remove the user from the allowed list.
///
/// @param user Address of a removed user.
+ #[solidity(hide)]
fn remove_from_collection_allow_list(&mut self, caller: caller, user: address) -> Result<void> {
self.consume_store_writes(1)?;
@@ -625,7 +633,7 @@
///
/// @param user account to verify
/// @return "true" if account is the owner or admin
- #[solidity(rename_selector = "isOwnerOrAdmin")]
+ #[solidity(hide, rename_selector = "isOwnerOrAdmin")]
fn is_owner_or_admin_eth(&self, user: address) -> Result<bool> {
let user = T::CrossAccountId::from_eth(user);
Ok(self.is_owner_or_admin(&user))
@@ -666,7 +674,7 @@
///
/// @dev Owner can be changed only by current owner
/// @param newOwner new owner account
- #[solidity(rename_selector = "changeCollectionOwner")]
+ #[solidity(hide, rename_selector = "changeCollectionOwner")]
fn set_owner(&mut self, caller: caller, new_owner: address) -> Result<void> {
self.consume_store_writes(1)?;
@@ -691,7 +699,11 @@
///
/// @dev Owner can be changed only by current owner
/// @param newOwner new owner cross account
- fn set_owner_cross(&mut self, caller: caller, new_owner: EthCrossAccount) -> Result<void> {
+ fn change_collection_owner_cross(
+ &mut self,
+ caller: caller,
+ new_owner: EthCrossAccount,
+ ) -> Result<void> {
self.consume_store_writes(1)?;
let caller = T::CrossAccountId::from_eth(caller);
pallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/erc.rsdiffbeforeafterboth--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -20,7 +20,8 @@
use core::char::{REPLACEMENT_CHARACTER, decode_utf16};
use core::convert::TryInto;
use evm_coder::{
- abi::AbiType, ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight,
+ abi::AbiType, ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*,
+ weight,
};
use up_data_structs::CollectionMode;
use pallet_common::erc::{CommonEvmHandler, PrecompileResult};
@@ -178,6 +179,7 @@
/// deducting from the sender's allowance for said account.
/// @param from The account whose tokens will be burnt.
/// @param amount The amount that will be burnt.
+ #[solidity(hide)]
#[weight(<SelfWeightOf<T>>::burn_from())]
fn burn_from(&mut self, caller: caller, from: address, amount: uint256) -> Result<bool> {
let caller = T::CrossAccountId::from_eth(caller);
pallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth--- a/pallets/fungible/src/stubs/UniqueFungible.sol
+++ b/pallets/fungible/src/stubs/UniqueFungible.sol
@@ -18,42 +18,42 @@
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0xb3152af3
+/// @dev the ERC-165 identifier for this interface is 0x324a7f5b
contract Collection is Dummy, ERC165 {
- /// Set collection property.
- ///
- /// @param key Property key.
- /// @param value Propery value.
- /// @dev EVM selector for this function is: 0x2f073f66,
- /// or in textual repr: setCollectionProperty(string,bytes)
- function setCollectionProperty(string memory key, bytes memory value) public {
- require(false, stub_error);
- key;
- value;
- dummy = 0;
- }
+ // /// Set collection property.
+ // ///
+ // /// @param key Property key.
+ // /// @param value Propery value.
+ // /// @dev EVM selector for this function is: 0x2f073f66,
+ // /// or in textual repr: setCollectionProperty(string,bytes)
+ // function setCollectionProperty(string memory key, bytes memory value) public {
+ // require(false, stub_error);
+ // key;
+ // value;
+ // dummy = 0;
+ // }
/// Set collection properties.
///
/// @param properties Vector of properties key/value pair.
/// @dev EVM selector for this function is: 0x50b26b2a,
/// or in textual repr: setCollectionProperties((string,bytes)[])
- function setCollectionProperties(Tuple15[] memory properties) public {
+ function setCollectionProperties(Property[] memory properties) public {
require(false, stub_error);
properties;
dummy = 0;
}
- /// Delete collection property.
- ///
- /// @param key Property key.
- /// @dev EVM selector for this function is: 0x7b7debce,
- /// or in textual repr: deleteCollectionProperty(string)
- function deleteCollectionProperty(string memory key) public {
- require(false, stub_error);
- key;
- dummy = 0;
- }
+ // /// Delete collection property.
+ // ///
+ // /// @param key Property key.
+ // /// @dev EVM selector for this function is: 0x7b7debce,
+ // /// or in textual repr: deleteCollectionProperty(string)
+ // function deleteCollectionProperty(string memory key) public {
+ // require(false, stub_error);
+ // key;
+ // dummy = 0;
+ // }
/// Delete collection properties.
///
@@ -87,25 +87,25 @@
/// @return Vector of properties key/value pairs.
/// @dev EVM selector for this function is: 0x285fb8e6,
/// or in textual repr: collectionProperties(string[])
- function collectionProperties(string[] memory keys) public view returns (Tuple15[] memory) {
+ function collectionProperties(string[] memory keys) public view returns (Tuple16[] memory) {
require(false, stub_error);
keys;
dummy;
- return new Tuple15[](0);
+ return new Tuple16[](0);
}
- /// Set the sponsor of the collection.
- ///
- /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
- ///
- /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
- /// @dev EVM selector for this function is: 0x7623402e,
- /// or in textual repr: setCollectionSponsor(address)
- function setCollectionSponsor(address sponsor) public {
- require(false, stub_error);
- sponsor;
- dummy = 0;
- }
+ // /// Set the sponsor of the collection.
+ // ///
+ // /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
+ // ///
+ // /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
+ // /// @dev EVM selector for this function is: 0x7623402e,
+ // /// or in textual repr: setCollectionSponsor(address)
+ // function setCollectionSponsor(address sponsor) public {
+ // require(false, stub_error);
+ // sponsor;
+ // dummy = 0;
+ // }
/// Set the sponsor of the collection.
///
@@ -222,26 +222,26 @@
dummy = 0;
}
- /// Add collection admin.
- /// @param newAdmin Address of the added administrator.
- /// @dev EVM selector for this function is: 0x92e462c7,
- /// or in textual repr: addCollectionAdmin(address)
- function addCollectionAdmin(address newAdmin) public {
- require(false, stub_error);
- newAdmin;
- dummy = 0;
- }
+ // /// Add collection admin.
+ // /// @param newAdmin Address of the added administrator.
+ // /// @dev EVM selector for this function is: 0x92e462c7,
+ // /// or in textual repr: addCollectionAdmin(address)
+ // function addCollectionAdmin(address newAdmin) public {
+ // require(false, stub_error);
+ // newAdmin;
+ // dummy = 0;
+ // }
- /// Remove collection admin.
- ///
- /// @param admin Address of the removed administrator.
- /// @dev EVM selector for this function is: 0xfafd7b42,
- /// or in textual repr: removeCollectionAdmin(address)
- function removeCollectionAdmin(address admin) public {
- require(false, stub_error);
- admin;
- dummy = 0;
- }
+ // /// Remove collection admin.
+ // ///
+ // /// @param admin Address of the removed administrator.
+ // /// @dev EVM selector for this function is: 0xfafd7b42,
+ // /// or in textual repr: removeCollectionAdmin(address)
+ // function removeCollectionAdmin(address admin) public {
+ // require(false, stub_error);
+ // admin;
+ // dummy = 0;
+ // }
/// Toggle accessibility of collection nesting.
///
@@ -291,16 +291,16 @@
return false;
}
- /// Add the user to the allowed list.
- ///
- /// @param user Address of a trusted user.
- /// @dev EVM selector for this function is: 0x67844fe6,
- /// or in textual repr: addToCollectionAllowList(address)
- function addToCollectionAllowList(address user) public {
- require(false, stub_error);
- user;
- dummy = 0;
- }
+ // /// Add the user to the allowed list.
+ // ///
+ // /// @param user Address of a trusted user.
+ // /// @dev EVM selector for this function is: 0x67844fe6,
+ // /// or in textual repr: addToCollectionAllowList(address)
+ // function addToCollectionAllowList(address user) public {
+ // require(false, stub_error);
+ // user;
+ // dummy = 0;
+ // }
/// Add user to allowed list.
///
@@ -313,16 +313,16 @@
dummy = 0;
}
- /// Remove the user from the allowed list.
- ///
- /// @param user Address of a removed user.
- /// @dev EVM selector for this function is: 0x85c51acb,
- /// or in textual repr: removeFromCollectionAllowList(address)
- function removeFromCollectionAllowList(address user) public {
- require(false, stub_error);
- user;
- dummy = 0;
- }
+ // /// Remove the user from the allowed list.
+ // ///
+ // /// @param user Address of a removed user.
+ // /// @dev EVM selector for this function is: 0x85c51acb,
+ // /// or in textual repr: removeFromCollectionAllowList(address)
+ // function removeFromCollectionAllowList(address user) public {
+ // require(false, stub_error);
+ // user;
+ // dummy = 0;
+ // }
/// Remove user from allowed list.
///
@@ -346,18 +346,18 @@
dummy = 0;
}
- /// Check that account is the owner or admin of the collection
- ///
- /// @param user account to verify
- /// @return "true" if account is the owner or admin
- /// @dev EVM selector for this function is: 0x9811b0c7,
- /// or in textual repr: isOwnerOrAdmin(address)
- function isOwnerOrAdmin(address user) public view returns (bool) {
- require(false, stub_error);
- user;
- dummy;
- return false;
- }
+ // /// Check that account is the owner or admin of the collection
+ // ///
+ // /// @param user account to verify
+ // /// @return "true" if account is the owner or admin
+ // /// @dev EVM selector for this function is: 0x9811b0c7,
+ // /// or in textual repr: isOwnerOrAdmin(address)
+ // function isOwnerOrAdmin(address user) public view returns (bool) {
+ // require(false, stub_error);
+ // user;
+ // dummy;
+ // return false;
+ // }
/// Check that account is the owner or admin of the collection
///
@@ -395,17 +395,17 @@
return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);
}
- /// Changes collection owner to another account
- ///
- /// @dev Owner can be changed only by current owner
- /// @param newOwner new owner account
- /// @dev EVM selector for this function is: 0x4f53e226,
- /// or in textual repr: changeCollectionOwner(address)
- function changeCollectionOwner(address newOwner) public {
- require(false, stub_error);
- newOwner;
- dummy = 0;
- }
+ // /// Changes collection owner to another account
+ // ///
+ // /// @dev Owner can be changed only by current owner
+ // /// @param newOwner new owner account
+ // /// @dev EVM selector for this function is: 0x4f53e226,
+ // /// or in textual repr: changeCollectionOwner(address)
+ // function changeCollectionOwner(address newOwner) public {
+ // require(false, stub_error);
+ // newOwner;
+ // dummy = 0;
+ // }
/// Get collection administrators
///
@@ -423,9 +423,9 @@
///
/// @dev Owner can be changed only by current owner
/// @param newOwner new owner cross account
- /// @dev EVM selector for this function is: 0xe5c9913f,
- /// or in textual repr: setOwnerCross((address,uint256))
- function setOwnerCross(EthCrossAccount memory newOwner) public {
+ /// @dev EVM selector for this function is: 0x6496c497,
+ /// or in textual repr: changeCollectionOwnerCross((address,uint256))
+ function changeCollectionOwnerCross(EthCrossAccount memory newOwner) public {
require(false, stub_error);
newOwner;
dummy = 0;
@@ -439,11 +439,17 @@
}
/// @dev anonymous struct
-struct Tuple15 {
+struct Tuple16 {
string field_0;
bytes field_1;
}
+/// @dev Property struct
+struct Property {
+ string key;
+ bytes value;
+}
+
/// @dev the ERC-165 identifier for this interface is 0x29f4dcd9
contract ERC20UniqueExtensions is Dummy, ERC165 {
/// @dev EVM selector for this function is: 0x0ecd0ab0,
@@ -456,20 +462,20 @@
return false;
}
- /// Burn tokens from account
- /// @dev Function that burns an `amount` of the tokens of a given account,
- /// deducting from the sender's allowance for said account.
- /// @param from The account whose tokens will be burnt.
- /// @param amount The amount that will be burnt.
- /// @dev EVM selector for this function is: 0x79cc6790,
- /// or in textual repr: burnFrom(address,uint256)
- function burnFrom(address from, uint256 amount) public returns (bool) {
- require(false, stub_error);
- from;
- amount;
- dummy = 0;
- return false;
- }
+ // /// Burn tokens from account
+ // /// @dev Function that burns an `amount` of the tokens of a given account,
+ // /// deducting from the sender's allowance for said account.
+ // /// @param from The account whose tokens will be burnt.
+ // /// @param amount The amount that will be burnt.
+ // /// @dev EVM selector for this function is: 0x79cc6790,
+ // /// or in textual repr: burnFrom(address,uint256)
+ // function burnFrom(address from, uint256 amount) public returns (bool) {
+ // require(false, stub_error);
+ // from;
+ // amount;
+ // dummy = 0;
+ // return false;
+ // }
/// Burn tokens from account
/// @dev Function that burns an `amount` of the tokens of a given account,
pallets/nonfungible/src/erc.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -26,7 +26,7 @@
};
use evm_coder::{
abi::AbiType, ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*,
- weight,
+ types::Property as PropertyStruct, weight,
};
use frame_support::BoundedVec;
use up_data_structs::{
@@ -88,6 +88,7 @@
/// @param tokenId ID of the token.
/// @param key Property key.
/// @param value Property value.
+ #[solidity(hide)]
fn set_property(
&mut self,
caller: caller,
@@ -125,7 +126,7 @@
&mut self,
caller: caller,
token_id: uint256,
- properties: Vec<(string, bytes)>,
+ properties: Vec<PropertyStruct>,
) -> Result<()> {
let caller = T::CrossAccountId::from_eth(caller);
let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
@@ -136,7 +137,7 @@
let properties = properties
.into_iter()
- .map(|(key, value)| {
+ .map(|PropertyStruct { key, value }| {
let key = <Vec<u8>>::from(key)
.try_into()
.map_err(|_| "key too large")?;
@@ -794,6 +795,7 @@
/// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.
/// @param from The current owner of the NFT
/// @param tokenId The NFT to transfer
+ #[solidity(hide)]
#[weight(<SelfWeightOf<T>>::burn_from())]
fn burn_from(&mut self, caller: caller, from: address, token_id: uint256) -> Result<void> {
let caller = T::CrossAccountId::from_eth(caller);
pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -42,24 +42,20 @@
dummy = 0;
}
- /// @notice Set token property value.
- /// @dev Throws error if `msg.sender` has no permission to edit the property.
- /// @param tokenId ID of the token.
- /// @param key Property key.
- /// @param value Property value.
- /// @dev EVM selector for this function is: 0x1752d67b,
- /// or in textual repr: setProperty(uint256,string,bytes)
- function setProperty(
- uint256 tokenId,
- string memory key,
- bytes memory value
- ) public {
- require(false, stub_error);
- tokenId;
- key;
- value;
- dummy = 0;
- }
+ // /// @notice Set token property value.
+ // /// @dev Throws error if `msg.sender` has no permission to edit the property.
+ // /// @param tokenId ID of the token.
+ // /// @param key Property key.
+ // /// @param value Property value.
+ // /// @dev EVM selector for this function is: 0x1752d67b,
+ // /// or in textual repr: setProperty(uint256,string,bytes)
+ // function setProperty(uint256 tokenId, string memory key, bytes memory value) public {
+ // require(false, stub_error);
+ // tokenId;
+ // key;
+ // value;
+ // dummy = 0;
+ // }
/// @notice Set token properties value.
/// @dev Throws error if `msg.sender` has no permission to edit the property.
@@ -67,7 +63,7 @@
/// @param properties settable properties
/// @dev EVM selector for this function is: 0x14ed3a6e,
/// or in textual repr: setProperties(uint256,(string,bytes)[])
- function setProperties(uint256 tokenId, Tuple22[] memory properties) public {
+ function setProperties(uint256 tokenId, Property[] memory properties) public {
require(false, stub_error);
tokenId;
properties;
@@ -116,43 +112,49 @@
}
}
+/// @dev Property struct
+struct Property {
+ string key;
+ bytes value;
+}
+
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0xb3152af3
+/// @dev the ERC-165 identifier for this interface is 0x324a7f5b
contract Collection is Dummy, ERC165 {
- /// Set collection property.
- ///
- /// @param key Property key.
- /// @param value Propery value.
- /// @dev EVM selector for this function is: 0x2f073f66,
- /// or in textual repr: setCollectionProperty(string,bytes)
- function setCollectionProperty(string memory key, bytes memory value) public {
- require(false, stub_error);
- key;
- value;
- dummy = 0;
- }
+ // /// Set collection property.
+ // ///
+ // /// @param key Property key.
+ // /// @param value Propery value.
+ // /// @dev EVM selector for this function is: 0x2f073f66,
+ // /// or in textual repr: setCollectionProperty(string,bytes)
+ // function setCollectionProperty(string memory key, bytes memory value) public {
+ // require(false, stub_error);
+ // key;
+ // value;
+ // dummy = 0;
+ // }
/// Set collection properties.
///
/// @param properties Vector of properties key/value pair.
/// @dev EVM selector for this function is: 0x50b26b2a,
/// or in textual repr: setCollectionProperties((string,bytes)[])
- function setCollectionProperties(Tuple22[] memory properties) public {
+ function setCollectionProperties(Property[] memory properties) public {
require(false, stub_error);
properties;
dummy = 0;
}
- /// Delete collection property.
- ///
- /// @param key Property key.
- /// @dev EVM selector for this function is: 0x7b7debce,
- /// or in textual repr: deleteCollectionProperty(string)
- function deleteCollectionProperty(string memory key) public {
- require(false, stub_error);
- key;
- dummy = 0;
- }
+ // /// Delete collection property.
+ // ///
+ // /// @param key Property key.
+ // /// @dev EVM selector for this function is: 0x7b7debce,
+ // /// or in textual repr: deleteCollectionProperty(string)
+ // function deleteCollectionProperty(string memory key) public {
+ // require(false, stub_error);
+ // key;
+ // dummy = 0;
+ // }
/// Delete collection properties.
///
@@ -186,25 +188,25 @@
/// @return Vector of properties key/value pairs.
/// @dev EVM selector for this function is: 0x285fb8e6,
/// or in textual repr: collectionProperties(string[])
- function collectionProperties(string[] memory keys) public view returns (Tuple22[] memory) {
+ function collectionProperties(string[] memory keys) public view returns (Tuple23[] memory) {
require(false, stub_error);
keys;
dummy;
- return new Tuple22[](0);
+ return new Tuple23[](0);
}
- /// Set the sponsor of the collection.
- ///
- /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
- ///
- /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
- /// @dev EVM selector for this function is: 0x7623402e,
- /// or in textual repr: setCollectionSponsor(address)
- function setCollectionSponsor(address sponsor) public {
- require(false, stub_error);
- sponsor;
- dummy = 0;
- }
+ // /// Set the sponsor of the collection.
+ // ///
+ // /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
+ // ///
+ // /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
+ // /// @dev EVM selector for this function is: 0x7623402e,
+ // /// or in textual repr: setCollectionSponsor(address)
+ // function setCollectionSponsor(address sponsor) public {
+ // require(false, stub_error);
+ // sponsor;
+ // dummy = 0;
+ // }
/// Set the sponsor of the collection.
///
@@ -251,10 +253,10 @@
/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
/// @dev EVM selector for this function is: 0x6ec0a9f1,
/// or in textual repr: collectionSponsor()
- function collectionSponsor() public view returns (Tuple25 memory) {
+ function collectionSponsor() public view returns (Tuple26 memory) {
require(false, stub_error);
dummy;
- return Tuple25(0x0000000000000000000000000000000000000000, 0);
+ return Tuple26(0x0000000000000000000000000000000000000000, 0);
}
/// Set limits for the collection.
@@ -321,26 +323,26 @@
dummy = 0;
}
- /// Add collection admin.
- /// @param newAdmin Address of the added administrator.
- /// @dev EVM selector for this function is: 0x92e462c7,
- /// or in textual repr: addCollectionAdmin(address)
- function addCollectionAdmin(address newAdmin) public {
- require(false, stub_error);
- newAdmin;
- dummy = 0;
- }
+ // /// Add collection admin.
+ // /// @param newAdmin Address of the added administrator.
+ // /// @dev EVM selector for this function is: 0x92e462c7,
+ // /// or in textual repr: addCollectionAdmin(address)
+ // function addCollectionAdmin(address newAdmin) public {
+ // require(false, stub_error);
+ // newAdmin;
+ // dummy = 0;
+ // }
- /// Remove collection admin.
- ///
- /// @param admin Address of the removed administrator.
- /// @dev EVM selector for this function is: 0xfafd7b42,
- /// or in textual repr: removeCollectionAdmin(address)
- function removeCollectionAdmin(address admin) public {
- require(false, stub_error);
- admin;
- dummy = 0;
- }
+ // /// Remove collection admin.
+ // ///
+ // /// @param admin Address of the removed administrator.
+ // /// @dev EVM selector for this function is: 0xfafd7b42,
+ // /// or in textual repr: removeCollectionAdmin(address)
+ // function removeCollectionAdmin(address admin) public {
+ // require(false, stub_error);
+ // admin;
+ // dummy = 0;
+ // }
/// Toggle accessibility of collection nesting.
///
@@ -390,16 +392,16 @@
return false;
}
- /// Add the user to the allowed list.
- ///
- /// @param user Address of a trusted user.
- /// @dev EVM selector for this function is: 0x67844fe6,
- /// or in textual repr: addToCollectionAllowList(address)
- function addToCollectionAllowList(address user) public {
- require(false, stub_error);
- user;
- dummy = 0;
- }
+ // /// Add the user to the allowed list.
+ // ///
+ // /// @param user Address of a trusted user.
+ // /// @dev EVM selector for this function is: 0x67844fe6,
+ // /// or in textual repr: addToCollectionAllowList(address)
+ // function addToCollectionAllowList(address user) public {
+ // require(false, stub_error);
+ // user;
+ // dummy = 0;
+ // }
/// Add user to allowed list.
///
@@ -412,16 +414,16 @@
dummy = 0;
}
- /// Remove the user from the allowed list.
- ///
- /// @param user Address of a removed user.
- /// @dev EVM selector for this function is: 0x85c51acb,
- /// or in textual repr: removeFromCollectionAllowList(address)
- function removeFromCollectionAllowList(address user) public {
- require(false, stub_error);
- user;
- dummy = 0;
- }
+ // /// Remove the user from the allowed list.
+ // ///
+ // /// @param user Address of a removed user.
+ // /// @dev EVM selector for this function is: 0x85c51acb,
+ // /// or in textual repr: removeFromCollectionAllowList(address)
+ // function removeFromCollectionAllowList(address user) public {
+ // require(false, stub_error);
+ // user;
+ // dummy = 0;
+ // }
/// Remove user from allowed list.
///
@@ -445,18 +447,18 @@
dummy = 0;
}
- /// Check that account is the owner or admin of the collection
- ///
- /// @param user account to verify
- /// @return "true" if account is the owner or admin
- /// @dev EVM selector for this function is: 0x9811b0c7,
- /// or in textual repr: isOwnerOrAdmin(address)
- function isOwnerOrAdmin(address user) public view returns (bool) {
- require(false, stub_error);
- user;
- dummy;
- return false;
- }
+ // /// Check that account is the owner or admin of the collection
+ // ///
+ // /// @param user account to verify
+ // /// @return "true" if account is the owner or admin
+ // /// @dev EVM selector for this function is: 0x9811b0c7,
+ // /// or in textual repr: isOwnerOrAdmin(address)
+ // function isOwnerOrAdmin(address user) public view returns (bool) {
+ // require(false, stub_error);
+ // user;
+ // dummy;
+ // return false;
+ // }
/// Check that account is the owner or admin of the collection
///
@@ -494,17 +496,17 @@
return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);
}
- /// Changes collection owner to another account
- ///
- /// @dev Owner can be changed only by current owner
- /// @param newOwner new owner account
- /// @dev EVM selector for this function is: 0x4f53e226,
- /// or in textual repr: changeCollectionOwner(address)
- function changeCollectionOwner(address newOwner) public {
- require(false, stub_error);
- newOwner;
- dummy = 0;
- }
+ // /// Changes collection owner to another account
+ // ///
+ // /// @dev Owner can be changed only by current owner
+ // /// @param newOwner new owner account
+ // /// @dev EVM selector for this function is: 0x4f53e226,
+ // /// or in textual repr: changeCollectionOwner(address)
+ // function changeCollectionOwner(address newOwner) public {
+ // require(false, stub_error);
+ // newOwner;
+ // dummy = 0;
+ // }
/// Get collection administrators
///
@@ -522,9 +524,9 @@
///
/// @dev Owner can be changed only by current owner
/// @param newOwner new owner cross account
- /// @dev EVM selector for this function is: 0xe5c9913f,
- /// or in textual repr: setOwnerCross((address,uint256))
- function setOwnerCross(EthCrossAccount memory newOwner) public {
+ /// @dev EVM selector for this function is: 0x6496c497,
+ /// or in textual repr: changeCollectionOwnerCross((address,uint256))
+ function changeCollectionOwnerCross(EthCrossAccount memory newOwner) public {
require(false, stub_error);
newOwner;
dummy = 0;
@@ -538,13 +540,13 @@
}
/// @dev anonymous struct
-struct Tuple25 {
+struct Tuple26 {
address field_0;
uint256 field_1;
}
/// @dev anonymous struct
-struct Tuple22 {
+struct Tuple23 {
string field_0;
bytes field_1;
}
@@ -776,20 +778,20 @@
dummy = 0;
}
- /// @notice Burns a specific ERC721 token.
- /// @dev Throws unless `msg.sender` is the current owner or an authorized
- /// operator for this NFT. Throws if `from` is not the current owner. Throws
- /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.
- /// @param from The current owner of the NFT
- /// @param tokenId The NFT to transfer
- /// @dev EVM selector for this function is: 0x79cc6790,
- /// or in textual repr: burnFrom(address,uint256)
- function burnFrom(address from, uint256 tokenId) public {
- require(false, stub_error);
- from;
- tokenId;
- dummy = 0;
- }
+ // /// @notice Burns a specific ERC721 token.
+ // /// @dev Throws unless `msg.sender` is the current owner or an authorized
+ // /// operator for this NFT. Throws if `from` is not the current owner. Throws
+ // /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.
+ // /// @param from The current owner of the NFT
+ // /// @param tokenId The NFT to transfer
+ // /// @dev EVM selector for this function is: 0x79cc6790,
+ // /// or in textual repr: burnFrom(address,uint256)
+ // function burnFrom(address from, uint256 tokenId) public {
+ // require(false, stub_error);
+ // from;
+ // tokenId;
+ // dummy = 0;
+ // }
/// @notice Burns a specific ERC721 token.
/// @dev Throws unless `msg.sender` is the current owner or an authorized
pallets/refungible/src/erc.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -27,7 +27,7 @@
};
use evm_coder::{
abi::AbiType, ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*,
- weight,
+ types::Property as PropertyStruct, weight,
};
use frame_support::{BoundedBTreeMap, BoundedVec};
use pallet_common::{
@@ -91,6 +91,7 @@
/// @param tokenId ID of the token.
/// @param key Property key.
/// @param value Property value.
+ #[solidity(hide)]
fn set_property(
&mut self,
caller: caller,
@@ -127,7 +128,7 @@
&mut self,
caller: caller,
token_id: uint256,
- properties: Vec<(string, bytes)>,
+ properties: Vec<PropertyStruct>,
) -> Result<()> {
let caller = T::CrossAccountId::from_eth(caller);
let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
@@ -138,7 +139,7 @@
let properties = properties
.into_iter()
- .map(|(key, value)| {
+ .map(|PropertyStruct { key, value }| {
let key = <Vec<u8>>::from(key)
.try_into()
.map_err(|_| "key too large")?;
@@ -814,6 +815,7 @@
/// Throws if RFT pieces have multiple owners.
/// @param from The current owner of the RFT
/// @param tokenId The RFT to transfer
+ #[solidity(hide)]
#[weight(<SelfWeightOf<T>>::burn_from())]
fn burn_from(&mut self, caller: caller, from: address, token_id: uint256) -> Result<void> {
let caller = T::CrossAccountId::from_eth(caller);
pallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth--- a/pallets/refungible/src/stubs/UniqueRefungible.sol
+++ b/pallets/refungible/src/stubs/UniqueRefungible.sol
@@ -42,24 +42,20 @@
dummy = 0;
}
- /// @notice Set token property value.
- /// @dev Throws error if `msg.sender` has no permission to edit the property.
- /// @param tokenId ID of the token.
- /// @param key Property key.
- /// @param value Property value.
- /// @dev EVM selector for this function is: 0x1752d67b,
- /// or in textual repr: setProperty(uint256,string,bytes)
- function setProperty(
- uint256 tokenId,
- string memory key,
- bytes memory value
- ) public {
- require(false, stub_error);
- tokenId;
- key;
- value;
- dummy = 0;
- }
+ // /// @notice Set token property value.
+ // /// @dev Throws error if `msg.sender` has no permission to edit the property.
+ // /// @param tokenId ID of the token.
+ // /// @param key Property key.
+ // /// @param value Property value.
+ // /// @dev EVM selector for this function is: 0x1752d67b,
+ // /// or in textual repr: setProperty(uint256,string,bytes)
+ // function setProperty(uint256 tokenId, string memory key, bytes memory value) public {
+ // require(false, stub_error);
+ // tokenId;
+ // key;
+ // value;
+ // dummy = 0;
+ // }
/// @notice Set token properties value.
/// @dev Throws error if `msg.sender` has no permission to edit the property.
@@ -67,7 +63,7 @@
/// @param properties settable properties
/// @dev EVM selector for this function is: 0x14ed3a6e,
/// or in textual repr: setProperties(uint256,(string,bytes)[])
- function setProperties(uint256 tokenId, Tuple21[] memory properties) public {
+ function setProperties(uint256 tokenId, Property[] memory properties) public {
require(false, stub_error);
tokenId;
properties;
@@ -116,43 +112,49 @@
}
}
+/// @dev Property struct
+struct Property {
+ string key;
+ bytes value;
+}
+
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0xb3152af3
+/// @dev the ERC-165 identifier for this interface is 0x324a7f5b
contract Collection is Dummy, ERC165 {
- /// Set collection property.
- ///
- /// @param key Property key.
- /// @param value Propery value.
- /// @dev EVM selector for this function is: 0x2f073f66,
- /// or in textual repr: setCollectionProperty(string,bytes)
- function setCollectionProperty(string memory key, bytes memory value) public {
- require(false, stub_error);
- key;
- value;
- dummy = 0;
- }
+ // /// Set collection property.
+ // ///
+ // /// @param key Property key.
+ // /// @param value Propery value.
+ // /// @dev EVM selector for this function is: 0x2f073f66,
+ // /// or in textual repr: setCollectionProperty(string,bytes)
+ // function setCollectionProperty(string memory key, bytes memory value) public {
+ // require(false, stub_error);
+ // key;
+ // value;
+ // dummy = 0;
+ // }
/// Set collection properties.
///
/// @param properties Vector of properties key/value pair.
/// @dev EVM selector for this function is: 0x50b26b2a,
/// or in textual repr: setCollectionProperties((string,bytes)[])
- function setCollectionProperties(Tuple21[] memory properties) public {
+ function setCollectionProperties(Property[] memory properties) public {
require(false, stub_error);
properties;
dummy = 0;
}
- /// Delete collection property.
- ///
- /// @param key Property key.
- /// @dev EVM selector for this function is: 0x7b7debce,
- /// or in textual repr: deleteCollectionProperty(string)
- function deleteCollectionProperty(string memory key) public {
- require(false, stub_error);
- key;
- dummy = 0;
- }
+ // /// Delete collection property.
+ // ///
+ // /// @param key Property key.
+ // /// @dev EVM selector for this function is: 0x7b7debce,
+ // /// or in textual repr: deleteCollectionProperty(string)
+ // function deleteCollectionProperty(string memory key) public {
+ // require(false, stub_error);
+ // key;
+ // dummy = 0;
+ // }
/// Delete collection properties.
///
@@ -186,25 +188,25 @@
/// @return Vector of properties key/value pairs.
/// @dev EVM selector for this function is: 0x285fb8e6,
/// or in textual repr: collectionProperties(string[])
- function collectionProperties(string[] memory keys) public view returns (Tuple21[] memory) {
+ function collectionProperties(string[] memory keys) public view returns (Tuple22[] memory) {
require(false, stub_error);
keys;
dummy;
- return new Tuple21[](0);
+ return new Tuple22[](0);
}
- /// Set the sponsor of the collection.
- ///
- /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
- ///
- /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
- /// @dev EVM selector for this function is: 0x7623402e,
- /// or in textual repr: setCollectionSponsor(address)
- function setCollectionSponsor(address sponsor) public {
- require(false, stub_error);
- sponsor;
- dummy = 0;
- }
+ // /// Set the sponsor of the collection.
+ // ///
+ // /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
+ // ///
+ // /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
+ // /// @dev EVM selector for this function is: 0x7623402e,
+ // /// or in textual repr: setCollectionSponsor(address)
+ // function setCollectionSponsor(address sponsor) public {
+ // require(false, stub_error);
+ // sponsor;
+ // dummy = 0;
+ // }
/// Set the sponsor of the collection.
///
@@ -251,10 +253,10 @@
/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
/// @dev EVM selector for this function is: 0x6ec0a9f1,
/// or in textual repr: collectionSponsor()
- function collectionSponsor() public view returns (Tuple24 memory) {
+ function collectionSponsor() public view returns (Tuple25 memory) {
require(false, stub_error);
dummy;
- return Tuple24(0x0000000000000000000000000000000000000000, 0);
+ return Tuple25(0x0000000000000000000000000000000000000000, 0);
}
/// Set limits for the collection.
@@ -321,26 +323,26 @@
dummy = 0;
}
- /// Add collection admin.
- /// @param newAdmin Address of the added administrator.
- /// @dev EVM selector for this function is: 0x92e462c7,
- /// or in textual repr: addCollectionAdmin(address)
- function addCollectionAdmin(address newAdmin) public {
- require(false, stub_error);
- newAdmin;
- dummy = 0;
- }
+ // /// Add collection admin.
+ // /// @param newAdmin Address of the added administrator.
+ // /// @dev EVM selector for this function is: 0x92e462c7,
+ // /// or in textual repr: addCollectionAdmin(address)
+ // function addCollectionAdmin(address newAdmin) public {
+ // require(false, stub_error);
+ // newAdmin;
+ // dummy = 0;
+ // }
- /// Remove collection admin.
- ///
- /// @param admin Address of the removed administrator.
- /// @dev EVM selector for this function is: 0xfafd7b42,
- /// or in textual repr: removeCollectionAdmin(address)
- function removeCollectionAdmin(address admin) public {
- require(false, stub_error);
- admin;
- dummy = 0;
- }
+ // /// Remove collection admin.
+ // ///
+ // /// @param admin Address of the removed administrator.
+ // /// @dev EVM selector for this function is: 0xfafd7b42,
+ // /// or in textual repr: removeCollectionAdmin(address)
+ // function removeCollectionAdmin(address admin) public {
+ // require(false, stub_error);
+ // admin;
+ // dummy = 0;
+ // }
/// Toggle accessibility of collection nesting.
///
@@ -390,16 +392,16 @@
return false;
}
- /// Add the user to the allowed list.
- ///
- /// @param user Address of a trusted user.
- /// @dev EVM selector for this function is: 0x67844fe6,
- /// or in textual repr: addToCollectionAllowList(address)
- function addToCollectionAllowList(address user) public {
- require(false, stub_error);
- user;
- dummy = 0;
- }
+ // /// Add the user to the allowed list.
+ // ///
+ // /// @param user Address of a trusted user.
+ // /// @dev EVM selector for this function is: 0x67844fe6,
+ // /// or in textual repr: addToCollectionAllowList(address)
+ // function addToCollectionAllowList(address user) public {
+ // require(false, stub_error);
+ // user;
+ // dummy = 0;
+ // }
/// Add user to allowed list.
///
@@ -412,16 +414,16 @@
dummy = 0;
}
- /// Remove the user from the allowed list.
- ///
- /// @param user Address of a removed user.
- /// @dev EVM selector for this function is: 0x85c51acb,
- /// or in textual repr: removeFromCollectionAllowList(address)
- function removeFromCollectionAllowList(address user) public {
- require(false, stub_error);
- user;
- dummy = 0;
- }
+ // /// Remove the user from the allowed list.
+ // ///
+ // /// @param user Address of a removed user.
+ // /// @dev EVM selector for this function is: 0x85c51acb,
+ // /// or in textual repr: removeFromCollectionAllowList(address)
+ // function removeFromCollectionAllowList(address user) public {
+ // require(false, stub_error);
+ // user;
+ // dummy = 0;
+ // }
/// Remove user from allowed list.
///
@@ -445,18 +447,18 @@
dummy = 0;
}
- /// Check that account is the owner or admin of the collection
- ///
- /// @param user account to verify
- /// @return "true" if account is the owner or admin
- /// @dev EVM selector for this function is: 0x9811b0c7,
- /// or in textual repr: isOwnerOrAdmin(address)
- function isOwnerOrAdmin(address user) public view returns (bool) {
- require(false, stub_error);
- user;
- dummy;
- return false;
- }
+ // /// Check that account is the owner or admin of the collection
+ // ///
+ // /// @param user account to verify
+ // /// @return "true" if account is the owner or admin
+ // /// @dev EVM selector for this function is: 0x9811b0c7,
+ // /// or in textual repr: isOwnerOrAdmin(address)
+ // function isOwnerOrAdmin(address user) public view returns (bool) {
+ // require(false, stub_error);
+ // user;
+ // dummy;
+ // return false;
+ // }
/// Check that account is the owner or admin of the collection
///
@@ -494,17 +496,17 @@
return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);
}
- /// Changes collection owner to another account
- ///
- /// @dev Owner can be changed only by current owner
- /// @param newOwner new owner account
- /// @dev EVM selector for this function is: 0x4f53e226,
- /// or in textual repr: changeCollectionOwner(address)
- function changeCollectionOwner(address newOwner) public {
- require(false, stub_error);
- newOwner;
- dummy = 0;
- }
+ // /// Changes collection owner to another account
+ // ///
+ // /// @dev Owner can be changed only by current owner
+ // /// @param newOwner new owner account
+ // /// @dev EVM selector for this function is: 0x4f53e226,
+ // /// or in textual repr: changeCollectionOwner(address)
+ // function changeCollectionOwner(address newOwner) public {
+ // require(false, stub_error);
+ // newOwner;
+ // dummy = 0;
+ // }
/// Get collection administrators
///
@@ -522,9 +524,9 @@
///
/// @dev Owner can be changed only by current owner
/// @param newOwner new owner cross account
- /// @dev EVM selector for this function is: 0xe5c9913f,
- /// or in textual repr: setOwnerCross((address,uint256))
- function setOwnerCross(EthCrossAccount memory newOwner) public {
+ /// @dev EVM selector for this function is: 0x6496c497,
+ /// or in textual repr: changeCollectionOwnerCross((address,uint256))
+ function changeCollectionOwnerCross(EthCrossAccount memory newOwner) public {
require(false, stub_error);
newOwner;
dummy = 0;
@@ -538,13 +540,13 @@
}
/// @dev anonymous struct
-struct Tuple24 {
+struct Tuple25 {
address field_0;
uint256 field_1;
}
/// @dev anonymous struct
-struct Tuple21 {
+struct Tuple22 {
string field_0;
bytes field_1;
}
@@ -761,21 +763,21 @@
dummy = 0;
}
- /// @notice Burns a specific ERC721 token.
- /// @dev Throws unless `msg.sender` is the current owner or an authorized
- /// operator for this RFT. Throws if `from` is not the current owner. Throws
- /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.
- /// Throws if RFT pieces have multiple owners.
- /// @param from The current owner of the RFT
- /// @param tokenId The RFT to transfer
- /// @dev EVM selector for this function is: 0x79cc6790,
- /// or in textual repr: burnFrom(address,uint256)
- function burnFrom(address from, uint256 tokenId) public {
- require(false, stub_error);
- from;
- tokenId;
- dummy = 0;
- }
+ // /// @notice Burns a specific ERC721 token.
+ // /// @dev Throws unless `msg.sender` is the current owner or an authorized
+ // /// operator for this RFT. Throws if `from` is not the current owner. Throws
+ // /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.
+ // /// Throws if RFT pieces have multiple owners.
+ // /// @param from The current owner of the RFT
+ // /// @param tokenId The RFT to transfer
+ // /// @dev EVM selector for this function is: 0x79cc6790,
+ // /// or in textual repr: burnFrom(address,uint256)
+ // function burnFrom(address from, uint256 tokenId) public {
+ // require(false, stub_error);
+ // from;
+ // tokenId;
+ // dummy = 0;
+ // }
/// @notice Burns a specific ERC721 token.
/// @dev Throws unless `msg.sender` is the current owner or an authorized
pallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterbothbinary blob — no preview
pallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterbothbinary blob — no preview
tests/src/eth/abi/collectionHelpers.jsondiffbeforeafterboth--- /dev/null
+++ b/tests/src/eth/abi/collectionHelpers.json
@@ -0,0 +1,120 @@
+[
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "collectionId",
+ "type": "address"
+ }
+ ],
+ "name": "CollectionCreated",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "collectionId",
+ "type": "address"
+ }
+ ],
+ "name": "CollectionDestroyed",
+ "type": "event"
+ },
+ {
+ "inputs": [],
+ "name": "collectionCreationFee",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string", "name": "name", "type": "string" },
+ { "internalType": "uint8", "name": "decimals", "type": "uint8" },
+ { "internalType": "string", "name": "description", "type": "string" },
+ { "internalType": "string", "name": "tokenPrefix", "type": "string" }
+ ],
+ "name": "createFTCollection",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "payable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string", "name": "name", "type": "string" },
+ { "internalType": "string", "name": "description", "type": "string" },
+ { "internalType": "string", "name": "tokenPrefix", "type": "string" }
+ ],
+ "name": "createNFTCollection",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "payable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string", "name": "name", "type": "string" },
+ { "internalType": "string", "name": "description", "type": "string" },
+ { "internalType": "string", "name": "tokenPrefix", "type": "string" }
+ ],
+ "name": "createRFTCollection",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "payable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "collectionAddress",
+ "type": "address"
+ }
+ ],
+ "name": "destroyCollection",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "collectionAddress",
+ "type": "address"
+ }
+ ],
+ "name": "isCollectionExist",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "collection", "type": "address" },
+ { "internalType": "string", "name": "baseUri", "type": "string" }
+ ],
+ "name": "makeCollectionERC721MetadataCompatible",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
+ ],
+ "name": "supportsInterface",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ }
+]
tests/src/eth/abi/contractHelpers.jsondiffbeforeafterboth--- /dev/null
+++ b/tests/src/eth/abi/contractHelpers.json
@@ -0,0 +1,314 @@
+[
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ }
+ ],
+ "name": "ContractSponsorRemoved",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "address",
+ "name": "sponsor",
+ "type": "address"
+ }
+ ],
+ "name": "ContractSponsorSet",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "address",
+ "name": "sponsor",
+ "type": "address"
+ }
+ ],
+ "name": "ContractSponsorshipConfirmed",
+ "type": "event"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ },
+ { "internalType": "address", "name": "user", "type": "address" }
+ ],
+ "name": "allowed",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ }
+ ],
+ "name": "allowlistEnabled",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ }
+ ],
+ "name": "confirmSponsorship",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ }
+ ],
+ "name": "contractOwner",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ }
+ ],
+ "name": "hasPendingSponsor",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ }
+ ],
+ "name": "hasSponsor",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ }
+ ],
+ "name": "removeSponsor",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ }
+ ],
+ "name": "selfSponsoredEnable",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ },
+ { "internalType": "address", "name": "sponsor", "type": "address" }
+ ],
+ "name": "setSponsor",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ },
+ { "internalType": "uint256", "name": "feeLimit", "type": "uint256" }
+ ],
+ "name": "setSponsoringFeeLimit",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ },
+ { "internalType": "uint8", "name": "mode", "type": "uint8" }
+ ],
+ "name": "setSponsoringMode",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ },
+ { "internalType": "uint32", "name": "rateLimit", "type": "uint32" }
+ ],
+ "name": "setSponsoringRateLimit",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ }
+ ],
+ "name": "sponsor",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "field_0", "type": "address" },
+ { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+ ],
+ "internalType": "struct Tuple0",
+ "name": "",
+ "type": "tuple"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ }
+ ],
+ "name": "sponsoringEnabled",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ }
+ ],
+ "name": "sponsoringFeeLimit",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ }
+ ],
+ "name": "sponsoringRateLimit",
+ "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
+ ],
+ "name": "supportsInterface",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ },
+ { "internalType": "address", "name": "user", "type": "address" },
+ { "internalType": "bool", "name": "isAllowed", "type": "bool" }
+ ],
+ "name": "toggleAllowed",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "contractAddress",
+ "type": "address"
+ },
+ { "internalType": "bool", "name": "enabled", "type": "bool" }
+ ],
+ "name": "toggleAllowlist",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ }
+]
tests/src/eth/abi/fungible.jsondiffbeforeafterboth--- /dev/null
+++ b/tests/src/eth/abi/fungible.json
@@ -0,0 +1,568 @@
+[
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "newAdmin",
+ "type": "tuple"
+ }
+ ],
+ "name": "addCollectionAdminCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "user",
+ "type": "tuple"
+ }
+ ],
+ "name": "addToCollectionAllowListCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "owner", "type": "address" },
+ { "internalType": "address", "name": "spender", "type": "address" }
+ ],
+ "name": "allowance",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "user", "type": "address" }
+ ],
+ "name": "allowed",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "spender", "type": "address" },
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "approve",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "spender",
+ "type": "tuple"
+ },
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "approveCross",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "owner", "type": "address" }
+ ],
+ "name": "balanceOf",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "from",
+ "type": "tuple"
+ },
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "burnFromCross",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "newOwner",
+ "type": "tuple"
+ }
+ ],
+ "name": "changeCollectionOwnerCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "collectionAdmins",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount[]",
+ "name": "",
+ "type": "tuple[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "collectionOwner",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "",
+ "type": "tuple"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string[]", "name": "keys", "type": "string[]" }
+ ],
+ "name": "collectionProperties",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "string", "name": "field_0", "type": "string" },
+ { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+ ],
+ "internalType": "struct Tuple16[]",
+ "name": "",
+ "type": "tuple[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
+ "name": "collectionProperty",
+ "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "collectionSponsor",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "field_0", "type": "address" },
+ { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+ ],
+ "internalType": "struct Tuple8",
+ "name": "",
+ "type": "tuple"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "confirmCollectionSponsorship",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "contractAddress",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "decimals",
+ "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string[]", "name": "keys", "type": "string[]" }
+ ],
+ "name": "deleteCollectionProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "hasCollectionPendingSponsor",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "user",
+ "type": "tuple"
+ }
+ ],
+ "name": "isOwnerOrAdminCross",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "mint",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "field_0", "type": "address" },
+ { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+ ],
+ "internalType": "struct Tuple8[]",
+ "name": "amounts",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "mintBulk",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "name",
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "admin",
+ "type": "tuple"
+ }
+ ],
+ "name": "removeCollectionAdminCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "removeCollectionSponsor",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "user",
+ "type": "tuple"
+ }
+ ],
+ "name": "removeFromCollectionAllowListCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],
+ "name": "setCollectionAccess",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string", "name": "limit", "type": "string" },
+ { "internalType": "uint32", "name": "value", "type": "uint32" }
+ ],
+ "name": "setCollectionLimit",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string", "name": "limit", "type": "string" },
+ { "internalType": "bool", "name": "value", "type": "bool" }
+ ],
+ "name": "setCollectionLimit",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],
+ "name": "setCollectionMintMode",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],
+ "name": "setCollectionNesting",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "bool", "name": "enable", "type": "bool" },
+ {
+ "internalType": "address[]",
+ "name": "collections",
+ "type": "address[]"
+ }
+ ],
+ "name": "setCollectionNesting",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "string", "name": "key", "type": "string" },
+ { "internalType": "bytes", "name": "value", "type": "bytes" }
+ ],
+ "internalType": "struct Property[]",
+ "name": "properties",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "setCollectionProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "sponsor",
+ "type": "tuple"
+ }
+ ],
+ "name": "setCollectionSponsorCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
+ ],
+ "name": "supportsInterface",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "symbol",
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "transfer",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "to",
+ "type": "tuple"
+ },
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "transferCross",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "from", "type": "address" },
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "transferFrom",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "from",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "to",
+ "type": "tuple"
+ },
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "transferFromCross",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "uniqueCollectionType",
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+ "stateMutability": "view",
+ "type": "function"
+ }
+]
tests/src/eth/abi/fungibleDeprecated.jsondiffbeforeafterboth--- /dev/null
+++ b/tests/src/eth/abi/fungibleDeprecated.json
@@ -0,0 +1,101 @@
+[
+ {
+ "inputs": [
+ { "internalType": "address", "name": "newAdmin", "type": "address" }
+ ],
+ "name": "addCollectionAdmin",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "user", "type": "address" }
+ ],
+ "name": "addToCollectionAllowList",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "from", "type": "address" },
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "burnFrom",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "newOwner", "type": "address" }
+ ],
+ "name": "changeCollectionOwner",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
+ "name": "deleteCollectionProperty",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "user", "type": "address" }
+ ],
+ "name": "isOwnerOrAdmin",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "admin", "type": "address" }
+ ],
+ "name": "removeCollectionAdmin",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "user", "type": "address" }
+ ],
+ "name": "removeFromCollectionAllowList",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string", "name": "key", "type": "string" },
+ { "internalType": "bytes", "name": "value", "type": "bytes" }
+ ],
+ "name": "setCollectionProperty",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "sponsor", "type": "address" }
+ ],
+ "name": "setCollectionSponsor",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "newOwner", "type": "address" }
+ ],
+ "name": "changeCollectionOwner",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ }
+]
tests/src/eth/abi/nonFungible.jsondiffbeforeafterboth--- /dev/null
+++ b/tests/src/eth/abi/nonFungible.json
@@ -0,0 +1,741 @@
+[
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "approved",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "uint256",
+ "name": "tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "operator",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "bool",
+ "name": "approved",
+ "type": "bool"
+ }
+ ],
+ "name": "ApprovalForAll",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [],
+ "name": "MintingFinished",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "uint256",
+ "name": "tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "newAdmin",
+ "type": "tuple"
+ }
+ ],
+ "name": "addCollectionAdminCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "user",
+ "type": "tuple"
+ }
+ ],
+ "name": "addToCollectionAllowListCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "user", "type": "address" }
+ ],
+ "name": "allowed",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "approved", "type": "address" },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "approve",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "approved",
+ "type": "tuple"
+ },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "approveCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "owner", "type": "address" }
+ ],
+ "name": "balanceOf",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "burn",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "from",
+ "type": "tuple"
+ },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "burnFromCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "newOwner",
+ "type": "tuple"
+ }
+ ],
+ "name": "changeCollectionOwnerCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "collectionAdmins",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount[]",
+ "name": "",
+ "type": "tuple[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "collectionOwner",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "",
+ "type": "tuple"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string[]", "name": "keys", "type": "string[]" }
+ ],
+ "name": "collectionProperties",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "string", "name": "field_0", "type": "string" },
+ { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+ ],
+ "internalType": "struct Tuple23[]",
+ "name": "",
+ "type": "tuple[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
+ "name": "collectionProperty",
+ "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "collectionSponsor",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "field_0", "type": "address" },
+ { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+ ],
+ "internalType": "struct Tuple26",
+ "name": "",
+ "type": "tuple"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "confirmCollectionSponsorship",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "contractAddress",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string[]", "name": "keys", "type": "string[]" }
+ ],
+ "name": "deleteCollectionProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+ { "internalType": "string[]", "name": "keys", "type": "string[]" }
+ ],
+ "name": "deleteProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "finishMinting",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "getApproved",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "hasCollectionPendingSponsor",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "owner", "type": "address" },
+ { "internalType": "address", "name": "operator", "type": "address" }
+ ],
+ "name": "isApprovedForAll",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "user",
+ "type": "tuple"
+ }
+ ],
+ "name": "isOwnerOrAdminCross",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "address", "name": "to", "type": "address" }],
+ "name": "mint",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "string", "name": "tokenUri", "type": "string" }
+ ],
+ "name": "mintWithTokenURI",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "mintingFinished",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "name",
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "nextTokenId",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "ownerOf",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+ { "internalType": "string", "name": "key", "type": "string" }
+ ],
+ "name": "property",
+ "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "admin",
+ "type": "tuple"
+ }
+ ],
+ "name": "removeCollectionAdminCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "removeCollectionSponsor",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "user",
+ "type": "tuple"
+ }
+ ],
+ "name": "removeFromCollectionAllowListCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "from", "type": "address" },
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "safeTransferFrom",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "from", "type": "address" },
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+ { "internalType": "bytes", "name": "data", "type": "bytes" }
+ ],
+ "name": "safeTransferFrom",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "operator", "type": "address" },
+ { "internalType": "bool", "name": "approved", "type": "bool" }
+ ],
+ "name": "setApprovalForAll",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],
+ "name": "setCollectionAccess",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string", "name": "limit", "type": "string" },
+ { "internalType": "uint32", "name": "value", "type": "uint32" }
+ ],
+ "name": "setCollectionLimit",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string", "name": "limit", "type": "string" },
+ { "internalType": "bool", "name": "value", "type": "bool" }
+ ],
+ "name": "setCollectionLimit",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],
+ "name": "setCollectionMintMode",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],
+ "name": "setCollectionNesting",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "bool", "name": "enable", "type": "bool" },
+ {
+ "internalType": "address[]",
+ "name": "collections",
+ "type": "address[]"
+ }
+ ],
+ "name": "setCollectionNesting",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "string", "name": "key", "type": "string" },
+ { "internalType": "bytes", "name": "value", "type": "bytes" }
+ ],
+ "internalType": "struct Property[]",
+ "name": "properties",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "setCollectionProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "sponsor",
+ "type": "tuple"
+ }
+ ],
+ "name": "setCollectionSponsorCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+ {
+ "components": [
+ { "internalType": "string", "name": "key", "type": "string" },
+ { "internalType": "bytes", "name": "value", "type": "bytes" }
+ ],
+ "internalType": "struct Property[]",
+ "name": "properties",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "setProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string", "name": "key", "type": "string" },
+ { "internalType": "bool", "name": "isMutable", "type": "bool" },
+ { "internalType": "bool", "name": "collectionAdmin", "type": "bool" },
+ { "internalType": "bool", "name": "tokenOwner", "type": "bool" }
+ ],
+ "name": "setTokenPropertyPermission",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
+ ],
+ "name": "supportsInterface",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "symbol",
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "index", "type": "uint256" }
+ ],
+ "name": "tokenByIndex",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "owner", "type": "address" },
+ { "internalType": "uint256", "name": "index", "type": "uint256" }
+ ],
+ "name": "tokenOfOwnerByIndex",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "tokenURI",
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "transfer",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "to",
+ "type": "tuple"
+ },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "transferCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "from", "type": "address" },
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "transferFrom",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "from",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "to",
+ "type": "tuple"
+ },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "transferFromCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "uniqueCollectionType",
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+ "stateMutability": "view",
+ "type": "function"
+ }
+]
tests/src/eth/abi/nonFungibleDeprecated.jsondiffbeforeafterboth--- /dev/null
+++ b/tests/src/eth/abi/nonFungibleDeprecated.json
@@ -0,0 +1,103 @@
+[
+ {
+ "inputs": [
+ { "internalType": "address", "name": "newAdmin", "type": "address" }
+ ],
+ "name": "addCollectionAdmin",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "user", "type": "address" }
+ ],
+ "name": "addToCollectionAllowList",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "from", "type": "address" },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "burnFrom",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
+ "name": "deleteCollectionProperty",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "user", "type": "address" }
+ ],
+ "name": "isOwnerOrAdmin",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "admin", "type": "address" }
+ ],
+ "name": "removeCollectionAdmin",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "user", "type": "address" }
+ ],
+ "name": "removeFromCollectionAllowList",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string", "name": "key", "type": "string" },
+ { "internalType": "bytes", "name": "value", "type": "bytes" }
+ ],
+ "name": "setCollectionProperty",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "sponsor", "type": "address" }
+ ],
+ "name": "setCollectionSponsor",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+ { "internalType": "string", "name": "key", "type": "string" },
+ { "internalType": "bytes", "name": "value", "type": "bytes" }
+ ],
+ "name": "setProperty",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "newOwner", "type": "address" }
+ ],
+ "name": "changeCollectionOwner",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ }
+]
tests/src/eth/abi/reFungible.jsondiffbeforeafterboth--- /dev/null
+++ b/tests/src/eth/abi/reFungible.json
@@ -0,0 +1,732 @@
+[
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "approved",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "uint256",
+ "name": "tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "operator",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "bool",
+ "name": "approved",
+ "type": "bool"
+ }
+ ],
+ "name": "ApprovalForAll",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [],
+ "name": "MintingFinished",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "uint256",
+ "name": "tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "newAdmin",
+ "type": "tuple"
+ }
+ ],
+ "name": "addCollectionAdminCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "user",
+ "type": "tuple"
+ }
+ ],
+ "name": "addToCollectionAllowListCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "user", "type": "address" }
+ ],
+ "name": "allowed",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "approved", "type": "address" },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "approve",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "owner", "type": "address" }
+ ],
+ "name": "balanceOf",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "burn",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "from",
+ "type": "tuple"
+ },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "burnFromCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "newOwner",
+ "type": "tuple"
+ }
+ ],
+ "name": "changeCollectionOwnerCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "collectionAdmins",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount[]",
+ "name": "",
+ "type": "tuple[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "collectionOwner",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "",
+ "type": "tuple"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string[]", "name": "keys", "type": "string[]" }
+ ],
+ "name": "collectionProperties",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "string", "name": "field_0", "type": "string" },
+ { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+ ],
+ "internalType": "struct Tuple22[]",
+ "name": "",
+ "type": "tuple[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
+ "name": "collectionProperty",
+ "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "collectionSponsor",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "field_0", "type": "address" },
+ { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+ ],
+ "internalType": "struct Tuple25",
+ "name": "",
+ "type": "tuple"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "confirmCollectionSponsorship",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "contractAddress",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string[]", "name": "keys", "type": "string[]" }
+ ],
+ "name": "deleteCollectionProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+ { "internalType": "string[]", "name": "keys", "type": "string[]" }
+ ],
+ "name": "deleteProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "finishMinting",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "getApproved",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "hasCollectionPendingSponsor",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "owner", "type": "address" },
+ { "internalType": "address", "name": "operator", "type": "address" }
+ ],
+ "name": "isApprovedForAll",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "user",
+ "type": "tuple"
+ }
+ ],
+ "name": "isOwnerOrAdminCross",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "address", "name": "to", "type": "address" }],
+ "name": "mint",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "string", "name": "tokenUri", "type": "string" }
+ ],
+ "name": "mintWithTokenURI",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "mintingFinished",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "name",
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "nextTokenId",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "ownerOf",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+ { "internalType": "string", "name": "key", "type": "string" }
+ ],
+ "name": "property",
+ "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "admin",
+ "type": "tuple"
+ }
+ ],
+ "name": "removeCollectionAdminCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "removeCollectionSponsor",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "user",
+ "type": "tuple"
+ }
+ ],
+ "name": "removeFromCollectionAllowListCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "from", "type": "address" },
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "safeTransferFrom",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "from", "type": "address" },
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+ { "internalType": "bytes", "name": "data", "type": "bytes" }
+ ],
+ "name": "safeTransferFromWithData",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "operator", "type": "address" },
+ { "internalType": "bool", "name": "approved", "type": "bool" }
+ ],
+ "name": "setApprovalForAll",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],
+ "name": "setCollectionAccess",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string", "name": "limit", "type": "string" },
+ { "internalType": "uint32", "name": "value", "type": "uint32" }
+ ],
+ "name": "setCollectionLimit",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string", "name": "limit", "type": "string" },
+ { "internalType": "bool", "name": "value", "type": "bool" }
+ ],
+ "name": "setCollectionLimit",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],
+ "name": "setCollectionMintMode",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],
+ "name": "setCollectionNesting",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "bool", "name": "enable", "type": "bool" },
+ {
+ "internalType": "address[]",
+ "name": "collections",
+ "type": "address[]"
+ }
+ ],
+ "name": "setCollectionNesting",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "string", "name": "key", "type": "string" },
+ { "internalType": "bytes", "name": "value", "type": "bytes" }
+ ],
+ "internalType": "struct Property[]",
+ "name": "properties",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "setCollectionProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "sponsor",
+ "type": "tuple"
+ }
+ ],
+ "name": "setCollectionSponsorCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+ {
+ "components": [
+ { "internalType": "string", "name": "key", "type": "string" },
+ { "internalType": "bytes", "name": "value", "type": "bytes" }
+ ],
+ "internalType": "struct Property[]",
+ "name": "properties",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "setProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string", "name": "key", "type": "string" },
+ { "internalType": "bool", "name": "isMutable", "type": "bool" },
+ { "internalType": "bool", "name": "collectionAdmin", "type": "bool" },
+ { "internalType": "bool", "name": "tokenOwner", "type": "bool" }
+ ],
+ "name": "setTokenPropertyPermission",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
+ ],
+ "name": "supportsInterface",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "symbol",
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "index", "type": "uint256" }
+ ],
+ "name": "tokenByIndex",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "token", "type": "uint256" }
+ ],
+ "name": "tokenContractAddress",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "owner", "type": "address" },
+ { "internalType": "uint256", "name": "index", "type": "uint256" }
+ ],
+ "name": "tokenOfOwnerByIndex",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "tokenURI",
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "transfer",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "to",
+ "type": "tuple"
+ },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "transferCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "from", "type": "address" },
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "transferFrom",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "from",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct EthCrossAccount",
+ "name": "to",
+ "type": "tuple"
+ },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "transferFromCross",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "uniqueCollectionType",
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+ "stateMutability": "view",
+ "type": "function"
+ }
+]
tests/src/eth/abi/reFungibleDeprecated.jsondiffbeforeafterboth--- /dev/null
+++ b/tests/src/eth/abi/reFungibleDeprecated.json
@@ -0,0 +1,92 @@
+[
+ {
+ "inputs": [
+ { "internalType": "address", "name": "newAdmin", "type": "address" }
+ ],
+ "name": "addCollectionAdmin",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "user", "type": "address" }
+ ],
+ "name": "addToCollectionAllowList",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "from", "type": "address" },
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "burnFrom",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
+ "name": "deleteCollectionProperty",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "user", "type": "address" }
+ ],
+ "name": "isOwnerOrAdmin",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "admin", "type": "address" }
+ ],
+ "name": "removeCollectionAdmin",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "user", "type": "address" }
+ ],
+ "name": "removeFromCollectionAllowList",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "string", "name": "key", "type": "string" },
+ { "internalType": "bytes", "name": "value", "type": "bytes" }
+ ],
+ "name": "setCollectionProperty",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "sponsor", "type": "address" }
+ ],
+ "name": "setCollectionSponsor",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "newOwner", "type": "address" }
+ ],
+ "name": "changeCollectionOwner",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ }
+]
tests/src/eth/abi/reFungibleToken.jsondiffbeforeafterboth--- /dev/null
+++ b/tests/src/eth/abi/reFungibleToken.json
@@ -0,0 +1,172 @@
+[
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "owner", "type": "address" },
+ { "internalType": "address", "name": "spender", "type": "address" }
+ ],
+ "name": "allowance",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "spender", "type": "address" },
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "approve",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "owner", "type": "address" }
+ ],
+ "name": "balanceOf",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "from", "type": "address" },
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "burnFrom",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "decimals",
+ "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "name",
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "parentToken",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "parentTokenId",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "repartition",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
+ ],
+ "name": "supportsInterface",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "symbol",
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "transfer",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "from", "type": "address" },
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "transferFrom",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ }
+]
tests/src/eth/allowlist.test.tsdiffbeforeafterboth--- a/tests/src/eth/allowlist.test.ts
+++ b/tests/src/eth/allowlist.test.ts
@@ -74,12 +74,13 @@
});
});
+ // Soft-deprecated
itEth('Collection allowlist can be added and removed by [eth] address', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const user = helper.eth.createAccount();
const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
- const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.false;
await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});
@@ -105,13 +106,14 @@
expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
});
+ // Soft-deprecated
itEth('Collection allowlist can not be add and remove [eth] address by not owner', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const notOwner = await helper.eth.createAccountWithBalance(donor);
const user = helper.eth.createAccount();
const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
- const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.false;
await expect(collectionEvm.methods.addToCollectionAllowList(user).call({from: notOwner})).to.be.rejectedWith('NoPermission');
tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -13,29 +13,29 @@
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0xb3152af3
+/// @dev the ERC-165 identifier for this interface is 0x324a7f5b
interface Collection is Dummy, ERC165 {
- /// Set collection property.
- ///
- /// @param key Property key.
- /// @param value Propery value.
- /// @dev EVM selector for this function is: 0x2f073f66,
- /// or in textual repr: setCollectionProperty(string,bytes)
- function setCollectionProperty(string memory key, bytes memory value) external;
+ // /// Set collection property.
+ // ///
+ // /// @param key Property key.
+ // /// @param value Propery value.
+ // /// @dev EVM selector for this function is: 0x2f073f66,
+ // /// or in textual repr: setCollectionProperty(string,bytes)
+ // function setCollectionProperty(string memory key, bytes memory value) external;
/// Set collection properties.
///
/// @param properties Vector of properties key/value pair.
/// @dev EVM selector for this function is: 0x50b26b2a,
/// or in textual repr: setCollectionProperties((string,bytes)[])
- function setCollectionProperties(Tuple15[] memory properties) external;
+ function setCollectionProperties(Property[] memory properties) external;
- /// Delete collection property.
- ///
- /// @param key Property key.
- /// @dev EVM selector for this function is: 0x7b7debce,
- /// or in textual repr: deleteCollectionProperty(string)
- function deleteCollectionProperty(string memory key) external;
+ // /// Delete collection property.
+ // ///
+ // /// @param key Property key.
+ // /// @dev EVM selector for this function is: 0x7b7debce,
+ // /// or in textual repr: deleteCollectionProperty(string)
+ // function deleteCollectionProperty(string memory key) external;
/// Delete collection properties.
///
@@ -60,16 +60,16 @@
/// @return Vector of properties key/value pairs.
/// @dev EVM selector for this function is: 0x285fb8e6,
/// or in textual repr: collectionProperties(string[])
- function collectionProperties(string[] memory keys) external view returns (Tuple15[] memory);
+ function collectionProperties(string[] memory keys) external view returns (Tuple16[] memory);
- /// Set the sponsor of the collection.
- ///
- /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
- ///
- /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
- /// @dev EVM selector for this function is: 0x7623402e,
- /// or in textual repr: setCollectionSponsor(address)
- function setCollectionSponsor(address sponsor) external;
+ // /// Set the sponsor of the collection.
+ // ///
+ // /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
+ // ///
+ // /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
+ // /// @dev EVM selector for this function is: 0x7623402e,
+ // /// or in textual repr: setCollectionSponsor(address)
+ // function setCollectionSponsor(address sponsor) external;
/// Set the sponsor of the collection.
///
@@ -146,18 +146,18 @@
/// or in textual repr: removeCollectionAdminCross((address,uint256))
function removeCollectionAdminCross(EthCrossAccount memory admin) external;
- /// Add collection admin.
- /// @param newAdmin Address of the added administrator.
- /// @dev EVM selector for this function is: 0x92e462c7,
- /// or in textual repr: addCollectionAdmin(address)
- function addCollectionAdmin(address newAdmin) external;
+ // /// Add collection admin.
+ // /// @param newAdmin Address of the added administrator.
+ // /// @dev EVM selector for this function is: 0x92e462c7,
+ // /// or in textual repr: addCollectionAdmin(address)
+ // function addCollectionAdmin(address newAdmin) external;
- /// Remove collection admin.
- ///
- /// @param admin Address of the removed administrator.
- /// @dev EVM selector for this function is: 0xfafd7b42,
- /// or in textual repr: removeCollectionAdmin(address)
- function removeCollectionAdmin(address admin) external;
+ // /// Remove collection admin.
+ // ///
+ // /// @param admin Address of the removed administrator.
+ // /// @dev EVM selector for this function is: 0xfafd7b42,
+ // /// or in textual repr: removeCollectionAdmin(address)
+ // function removeCollectionAdmin(address admin) external;
/// Toggle accessibility of collection nesting.
///
@@ -189,12 +189,12 @@
/// or in textual repr: allowed(address)
function allowed(address user) external view returns (bool);
- /// Add the user to the allowed list.
- ///
- /// @param user Address of a trusted user.
- /// @dev EVM selector for this function is: 0x67844fe6,
- /// or in textual repr: addToCollectionAllowList(address)
- function addToCollectionAllowList(address user) external;
+ // /// Add the user to the allowed list.
+ // ///
+ // /// @param user Address of a trusted user.
+ // /// @dev EVM selector for this function is: 0x67844fe6,
+ // /// or in textual repr: addToCollectionAllowList(address)
+ // function addToCollectionAllowList(address user) external;
/// Add user to allowed list.
///
@@ -203,12 +203,12 @@
/// or in textual repr: addToCollectionAllowListCross((address,uint256))
function addToCollectionAllowListCross(EthCrossAccount memory user) external;
- /// Remove the user from the allowed list.
- ///
- /// @param user Address of a removed user.
- /// @dev EVM selector for this function is: 0x85c51acb,
- /// or in textual repr: removeFromCollectionAllowList(address)
- function removeFromCollectionAllowList(address user) external;
+ // /// Remove the user from the allowed list.
+ // ///
+ // /// @param user Address of a removed user.
+ // /// @dev EVM selector for this function is: 0x85c51acb,
+ // /// or in textual repr: removeFromCollectionAllowList(address)
+ // function removeFromCollectionAllowList(address user) external;
/// Remove user from allowed list.
///
@@ -224,13 +224,13 @@
/// or in textual repr: setCollectionMintMode(bool)
function setCollectionMintMode(bool mode) external;
- /// Check that account is the owner or admin of the collection
- ///
- /// @param user account to verify
- /// @return "true" if account is the owner or admin
- /// @dev EVM selector for this function is: 0x9811b0c7,
- /// or in textual repr: isOwnerOrAdmin(address)
- function isOwnerOrAdmin(address user) external view returns (bool);
+ // /// Check that account is the owner or admin of the collection
+ // ///
+ // /// @param user account to verify
+ // /// @return "true" if account is the owner or admin
+ // /// @dev EVM selector for this function is: 0x9811b0c7,
+ // /// or in textual repr: isOwnerOrAdmin(address)
+ // function isOwnerOrAdmin(address user) external view returns (bool);
/// Check that account is the owner or admin of the collection
///
@@ -255,13 +255,13 @@
/// or in textual repr: collectionOwner()
function collectionOwner() external view returns (EthCrossAccount memory);
- /// Changes collection owner to another account
- ///
- /// @dev Owner can be changed only by current owner
- /// @param newOwner new owner account
- /// @dev EVM selector for this function is: 0x4f53e226,
- /// or in textual repr: changeCollectionOwner(address)
- function changeCollectionOwner(address newOwner) external;
+ // /// Changes collection owner to another account
+ // ///
+ // /// @dev Owner can be changed only by current owner
+ // /// @param newOwner new owner account
+ // /// @dev EVM selector for this function is: 0x4f53e226,
+ // /// or in textual repr: changeCollectionOwner(address)
+ // function changeCollectionOwner(address newOwner) external;
/// Get collection administrators
///
@@ -275,9 +275,9 @@
///
/// @dev Owner can be changed only by current owner
/// @param newOwner new owner cross account
- /// @dev EVM selector for this function is: 0xe5c9913f,
- /// or in textual repr: setOwnerCross((address,uint256))
- function setOwnerCross(EthCrossAccount memory newOwner) external;
+ /// @dev EVM selector for this function is: 0x6496c497,
+ /// or in textual repr: changeCollectionOwnerCross((address,uint256))
+ function changeCollectionOwnerCross(EthCrossAccount memory newOwner) external;
}
/// @dev Cross account struct
@@ -287,25 +287,31 @@
}
/// @dev anonymous struct
-struct Tuple15 {
+struct Tuple16 {
string field_0;
bytes field_1;
}
+/// @dev Property struct
+struct Property {
+ string key;
+ bytes value;
+}
+
/// @dev the ERC-165 identifier for this interface is 0x29f4dcd9
interface ERC20UniqueExtensions is Dummy, ERC165 {
/// @dev EVM selector for this function is: 0x0ecd0ab0,
/// or in textual repr: approveCross((address,uint256),uint256)
function approveCross(EthCrossAccount memory spender, uint256 amount) external returns (bool);
- /// Burn tokens from account
- /// @dev Function that burns an `amount` of the tokens of a given account,
- /// deducting from the sender's allowance for said account.
- /// @param from The account whose tokens will be burnt.
- /// @param amount The amount that will be burnt.
- /// @dev EVM selector for this function is: 0x79cc6790,
- /// or in textual repr: burnFrom(address,uint256)
- function burnFrom(address from, uint256 amount) external returns (bool);
+ // /// Burn tokens from account
+ // /// @dev Function that burns an `amount` of the tokens of a given account,
+ // /// deducting from the sender's allowance for said account.
+ // /// @param from The account whose tokens will be burnt.
+ // /// @param amount The amount that will be burnt.
+ // /// @dev EVM selector for this function is: 0x79cc6790,
+ // /// or in textual repr: burnFrom(address,uint256)
+ // function burnFrom(address from, uint256 amount) external returns (bool);
/// Burn tokens from account
/// @dev Function that burns an `amount` of the tokens of a given account,
tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56/// @dev common stubs holder7interface Dummy {89}1011interface ERC165 is Dummy {12 function supportsInterface(bytes4 interfaceID) external view returns (bool);13}1415/// @title A contract that allows to set and delete token properties and change token property permissions.16/// @dev the ERC-165 identifier for this interface is 0x91a97a6817interface TokenProperties is Dummy, ERC165 {18 /// @notice Set permissions for token property.19 /// @dev Throws error if `msg.sender` is not admin or owner of the collection.20 /// @param key Property key.21 /// @param isMutable Permission to mutate property.22 /// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.23 /// @param tokenOwner Permission to mutate property by token owner if property is mutable.24 /// @dev EVM selector for this function is: 0x222d97fa,25 /// or in textual repr: setTokenPropertyPermission(string,bool,bool,bool)26 function setTokenPropertyPermission(27 string memory key,28 bool isMutable,29 bool collectionAdmin,30 bool tokenOwner31 ) external;3233 /// @notice Set token property value.34 /// @dev Throws error if `msg.sender` has no permission to edit the property.35 /// @param tokenId ID of the token.36 /// @param key Property key.37 /// @param value Property value.38 /// @dev EVM selector for this function is: 0x1752d67b,39 /// or in textual repr: setProperty(uint256,string,bytes)40 function setProperty(41 uint256 tokenId,42 string memory key,43 bytes memory value44 ) external;4546 /// @notice Set token properties value.47 /// @dev Throws error if `msg.sender` has no permission to edit the property.48 /// @param tokenId ID of the token.49 /// @param properties settable properties50 /// @dev EVM selector for this function is: 0x14ed3a6e,51 /// or in textual repr: setProperties(uint256,(string,bytes)[])52 function setProperties(uint256 tokenId, Tuple22[] memory properties) external;5354 // /// @notice Delete token property value.55 // /// @dev Throws error if `msg.sender` has no permission to edit the property.56 // /// @param tokenId ID of the token.57 // /// @param key Property key.58 // /// @dev EVM selector for this function is: 0x066111d1,59 // /// or in textual repr: deleteProperty(uint256,string)60 // function deleteProperty(uint256 tokenId, string memory key) external;6162 /// @notice Delete token properties value.63 /// @dev Throws error if `msg.sender` has no permission to edit the property.64 /// @param tokenId ID of the token.65 /// @param keys Properties key.66 /// @dev EVM selector for this function is: 0xc472d371,67 /// or in textual repr: deleteProperties(uint256,string[])68 function deleteProperties(uint256 tokenId, string[] memory keys) external;6970 /// @notice Get token property value.71 /// @dev Throws error if key not found72 /// @param tokenId ID of the token.73 /// @param key Property key.74 /// @return Property value bytes75 /// @dev EVM selector for this function is: 0x7228c327,76 /// or in textual repr: property(uint256,string)77 function property(uint256 tokenId, string memory key) external view returns (bytes memory);78}7980/// @title A contract that allows you to work with collections.81/// @dev the ERC-165 identifier for this interface is 0xb3152af382interface Collection is Dummy, ERC165 {83 /// Set collection property.84 ///85 /// @param key Property key.86 /// @param value Propery value.87 /// @dev EVM selector for this function is: 0x2f073f66,88 /// or in textual repr: setCollectionProperty(string,bytes)89 function setCollectionProperty(string memory key, bytes memory value) external;9091 /// Set collection properties.92 ///93 /// @param properties Vector of properties key/value pair.94 /// @dev EVM selector for this function is: 0x50b26b2a,95 /// or in textual repr: setCollectionProperties((string,bytes)[])96 function setCollectionProperties(Tuple22[] memory properties) external;9798 /// Delete collection property.99 ///100 /// @param key Property key.101 /// @dev EVM selector for this function is: 0x7b7debce,102 /// or in textual repr: deleteCollectionProperty(string)103 function deleteCollectionProperty(string memory key) external;104105 /// Delete collection properties.106 ///107 /// @param keys Properties keys.108 /// @dev EVM selector for this function is: 0xee206ee3,109 /// or in textual repr: deleteCollectionProperties(string[])110 function deleteCollectionProperties(string[] memory keys) external;111112 /// Get collection property.113 ///114 /// @dev Throws error if key not found.115 ///116 /// @param key Property key.117 /// @return bytes The property corresponding to the key.118 /// @dev EVM selector for this function is: 0xcf24fd6d,119 /// or in textual repr: collectionProperty(string)120 function collectionProperty(string memory key) external view returns (bytes memory);121122 /// Get collection properties.123 ///124 /// @param keys Properties keys. Empty keys for all propertyes.125 /// @return Vector of properties key/value pairs.126 /// @dev EVM selector for this function is: 0x285fb8e6,127 /// or in textual repr: collectionProperties(string[])128 function collectionProperties(string[] memory keys) external view returns (Tuple22[] memory);129130 /// Set the sponsor of the collection.131 ///132 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.133 ///134 /// @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,136 /// or in textual repr: setCollectionSponsor(address)137 function setCollectionSponsor(address sponsor) external;138139 /// Set the sponsor of the collection.140 ///141 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.142 ///143 /// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.144 /// @dev EVM selector for this function is: 0x84a1d5a8,145 /// or in textual repr: setCollectionSponsorCross((address,uint256))146 function setCollectionSponsorCross(EthCrossAccount memory sponsor) external;147148 /// Whether there is a pending sponsor.149 /// @dev EVM selector for this function is: 0x058ac185,150 /// or in textual repr: hasCollectionPendingSponsor()151 function hasCollectionPendingSponsor() external view returns (bool);152153 /// Collection sponsorship confirmation.154 ///155 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.156 /// @dev EVM selector for this function is: 0x3c50e97a,157 /// or in textual repr: confirmCollectionSponsorship()158 function confirmCollectionSponsorship() external;159160 /// Remove collection sponsor.161 /// @dev EVM selector for this function is: 0x6e0326a3,162 /// or in textual repr: removeCollectionSponsor()163 function removeCollectionSponsor() external;164165 /// Get current sponsor.166 ///167 /// @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,169 /// or in textual repr: collectionSponsor()170 function collectionSponsor() external view returns (Tuple25 memory);171172 /// Set limits for the collection.173 /// @dev Throws error if limit not found.174 /// @param limit Name of the limit. Valid names:175 /// "accountTokenOwnershipLimit",176 /// "sponsoredDataSize",177 /// "sponsoredDataRateLimit",178 /// "tokenLimit",179 /// "sponsorTransferTimeout",180 /// "sponsorApproveTimeout"181 /// @param value Value of the limit.182 /// @dev EVM selector for this function is: 0x6a3841db,183 /// or in textual repr: setCollectionLimit(string,uint32)184 function setCollectionLimit(string memory limit, uint32 value) external;185186 /// Set limits for the collection.187 /// @dev Throws error if limit not found.188 /// @param limit Name of the limit. Valid names:189 /// "ownerCanTransfer",190 /// "ownerCanDestroy",191 /// "transfersEnabled"192 /// @param value Value of the limit.193 /// @dev EVM selector for this function is: 0x993b7fba,194 /// or in textual repr: setCollectionLimit(string,bool)195 function setCollectionLimit(string memory limit, bool value) external;196197 /// Get contract address.198 /// @dev EVM selector for this function is: 0xf6b4dfb4,199 /// or in textual repr: contractAddress()200 function contractAddress() external view returns (address);201202 /// Add collection admin.203 /// @param newAdmin Cross account administrator address.204 /// @dev EVM selector for this function is: 0x859aa7d6,205 /// or in textual repr: addCollectionAdminCross((address,uint256))206 function addCollectionAdminCross(EthCrossAccount memory newAdmin) external;207208 /// Remove collection admin.209 /// @param admin Cross account administrator address.210 /// @dev EVM selector for this function is: 0x6c0cd173,211 /// or in textual repr: removeCollectionAdminCross((address,uint256))212 function removeCollectionAdminCross(EthCrossAccount memory admin) external;213214 /// Add collection admin.215 /// @param newAdmin Address of the added administrator.216 /// @dev EVM selector for this function is: 0x92e462c7,217 /// or in textual repr: addCollectionAdmin(address)218 function addCollectionAdmin(address newAdmin) external;219220 /// Remove collection admin.221 ///222 /// @param admin Address of the removed administrator.223 /// @dev EVM selector for this function is: 0xfafd7b42,224 /// or in textual repr: removeCollectionAdmin(address)225 function removeCollectionAdmin(address admin) external;226227 /// Toggle accessibility of collection nesting.228 ///229 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'230 /// @dev EVM selector for this function is: 0x112d4586,231 /// or in textual repr: setCollectionNesting(bool)232 function setCollectionNesting(bool enable) external;233234 /// Toggle accessibility of collection nesting.235 ///236 /// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'237 /// @param collections Addresses of collections that will be available for nesting.238 /// @dev EVM selector for this function is: 0x64872396,239 /// or in textual repr: setCollectionNesting(bool,address[])240 function setCollectionNesting(bool enable, address[] memory collections) external;241242 /// Set the collection access method.243 /// @param mode Access mode244 /// 0 for Normal245 /// 1 for AllowList246 /// @dev EVM selector for this function is: 0x41835d4c,247 /// or in textual repr: setCollectionAccess(uint8)248 function setCollectionAccess(uint8 mode) external;249250 /// Checks that user allowed to operate with collection.251 ///252 /// @param user User address to check.253 /// @dev EVM selector for this function is: 0xd63a8e11,254 /// or in textual repr: allowed(address)255 function allowed(address user) external view returns (bool);256257 /// Add the user to the allowed list.258 ///259 /// @param user Address of a trusted user.260 /// @dev EVM selector for this function is: 0x67844fe6,261 /// or in textual repr: addToCollectionAllowList(address)262 function addToCollectionAllowList(address user) external;263264 /// Add user to allowed list.265 ///266 /// @param user User cross account address.267 /// @dev EVM selector for this function is: 0xa0184a3a,268 /// or in textual repr: addToCollectionAllowListCross((address,uint256))269 function addToCollectionAllowListCross(EthCrossAccount memory user) external;270271 /// Remove the user from the allowed list.272 ///273 /// @param user Address of a removed user.274 /// @dev EVM selector for this function is: 0x85c51acb,275 /// or in textual repr: removeFromCollectionAllowList(address)276 function removeFromCollectionAllowList(address user) external;277278 /// Remove user from allowed list.279 ///280 /// @param user User cross account address.281 /// @dev EVM selector for this function is: 0x09ba452a,282 /// or in textual repr: removeFromCollectionAllowListCross((address,uint256))283 function removeFromCollectionAllowListCross(EthCrossAccount memory user) external;284285 /// Switch permission for minting.286 ///287 /// @param mode Enable if "true".288 /// @dev EVM selector for this function is: 0x00018e84,289 /// or in textual repr: setCollectionMintMode(bool)290 function setCollectionMintMode(bool mode) external;291292 /// Check that account is the owner or admin of the collection293 ///294 /// @param user account to verify295 /// @return "true" if account is the owner or admin296 /// @dev EVM selector for this function is: 0x9811b0c7,297 /// or in textual repr: isOwnerOrAdmin(address)298 function isOwnerOrAdmin(address user) external view returns (bool);299300 /// Check that account is the owner or admin of the collection301 ///302 /// @param user User cross account to verify303 /// @return "true" if account is the owner or admin304 /// @dev EVM selector for this function is: 0x3e75a905,305 /// or in textual repr: isOwnerOrAdminCross((address,uint256))306 function isOwnerOrAdminCross(EthCrossAccount memory user) external view returns (bool);307308 /// Returns collection type309 ///310 /// @return `Fungible` or `NFT` or `ReFungible`311 /// @dev EVM selector for this function is: 0xd34b55b8,312 /// or in textual repr: uniqueCollectionType()313 function uniqueCollectionType() external view returns (string memory);314315 /// Get collection owner.316 ///317 /// @return Tuble with sponsor address and his substrate mirror.318 /// If address is canonical then substrate mirror is zero and vice versa.319 /// @dev EVM selector for this function is: 0xdf727d3b,320 /// or in textual repr: collectionOwner()321 function collectionOwner() external view returns (EthCrossAccount memory);322323 /// Changes collection owner to another account324 ///325 /// @dev Owner can be changed only by current owner326 /// @param newOwner new owner account327 /// @dev EVM selector for this function is: 0x4f53e226,328 /// or in textual repr: changeCollectionOwner(address)329 function changeCollectionOwner(address newOwner) external;330331 /// Get collection administrators332 ///333 /// @return Vector of tuples with admins address and his substrate mirror.334 /// If address is canonical then substrate mirror is zero and vice versa.335 /// @dev EVM selector for this function is: 0x5813216b,336 /// or in textual repr: collectionAdmins()337 function collectionAdmins() external view returns (EthCrossAccount[] memory);338339 /// Changes collection owner to another account340 ///341 /// @dev Owner can be changed only by current owner342 /// @param newOwner new owner cross account343 /// @dev EVM selector for this function is: 0xe5c9913f,344 /// or in textual repr: setOwnerCross((address,uint256))345 function setOwnerCross(EthCrossAccount memory newOwner) external;346}347348/// @dev Cross account struct349struct EthCrossAccount {350 address eth;351 uint256 sub;352}353354/// @dev anonymous struct355struct Tuple25 {356 address field_0;357 uint256 field_1;358}359360/// @dev anonymous struct361struct Tuple22 {362 string field_0;363 bytes field_1;364}365366/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension367/// @dev See https://eips.ethereum.org/EIPS/eip-721368/// @dev the ERC-165 identifier for this interface is 0x5b5e139f369interface ERC721Metadata is Dummy, ERC165 {370 // /// @notice A descriptive name for a collection of NFTs in this contract371 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`372 // /// @dev EVM selector for this function is: 0x06fdde03,373 // /// or in textual repr: name()374 // function name() external view returns (string memory);375376 // /// @notice An abbreviated name for NFTs in this contract377 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`378 // /// @dev EVM selector for this function is: 0x95d89b41,379 // /// or in textual repr: symbol()380 // function symbol() external view returns (string memory);381382 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.383 ///384 /// @dev If the token has a `url` property and it is not empty, it is returned.385 /// Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.386 /// If the collection property `baseURI` is empty or absent, return "" (empty string)387 /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix388 /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).389 ///390 /// @return token's const_metadata391 /// @dev EVM selector for this function is: 0xc87b56dd,392 /// or in textual repr: tokenURI(uint256)393 function tokenURI(uint256 tokenId) external view returns (string memory);394}395396/// @title ERC721 Token that can be irreversibly burned (destroyed).397/// @dev the ERC-165 identifier for this interface is 0x42966c68398interface ERC721Burnable is Dummy, ERC165 {399 /// @notice Burns a specific ERC721 token.400 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized401 /// operator of the current owner.402 /// @param tokenId The NFT to approve403 /// @dev EVM selector for this function is: 0x42966c68,404 /// or in textual repr: burn(uint256)405 function burn(uint256 tokenId) external;406}407408/// @dev inlined interface409interface ERC721UniqueMintableEvents {410 event MintingFinished();411}412413/// @title ERC721 minting logic.414/// @dev the ERC-165 identifier for this interface is 0x476ff149415interface ERC721UniqueMintable is Dummy, ERC165, ERC721UniqueMintableEvents {416 /// @dev EVM selector for this function is: 0x05d2035b,417 /// or in textual repr: mintingFinished()418 function mintingFinished() external view returns (bool);419420 /// @notice Function to mint token.421 /// @param to The new owner422 /// @return uint256 The id of the newly minted token423 /// @dev EVM selector for this function is: 0x6a627842,424 /// or in textual repr: mint(address)425 function mint(address to) external returns (uint256);426427 // /// @notice Function to mint token.428 // /// @dev `tokenId` should be obtained with `nextTokenId` method,429 // /// unlike standard, you can't specify it manually430 // /// @param to The new owner431 // /// @param tokenId ID of the minted NFT432 // /// @dev EVM selector for this function is: 0x40c10f19,433 // /// or in textual repr: mint(address,uint256)434 // function mint(address to, uint256 tokenId) external returns (bool);435436 /// @notice Function to mint token with the given tokenUri.437 /// @param to The new owner438 /// @param tokenUri Token URI that would be stored in the NFT properties439 /// @return uint256 The id of the newly minted token440 /// @dev EVM selector for this function is: 0x45c17782,441 /// or in textual repr: mintWithTokenURI(address,string)442 function mintWithTokenURI(address to, string memory tokenUri) external returns (uint256);443444 // /// @notice Function to mint token with the given tokenUri.445 // /// @dev `tokenId` should be obtained with `nextTokenId` method,446 // /// unlike standard, you can't specify it manually447 // /// @param to The new owner448 // /// @param tokenId ID of the minted NFT449 // /// @param tokenUri Token URI that would be stored in the NFT properties450 // /// @dev EVM selector for this function is: 0x50bb4e7f,451 // /// or in textual repr: mintWithTokenURI(address,uint256,string)452 // function mintWithTokenURI(address to, uint256 tokenId, string memory tokenUri) external returns (bool);453454 /// @dev Not implemented455 /// @dev EVM selector for this function is: 0x7d64bcb4,456 /// or in textual repr: finishMinting()457 function finishMinting() external returns (bool);458}459460/// @title Unique extensions for ERC721.461/// @dev the ERC-165 identifier for this interface is 0x0e9fc611462interface ERC721UniqueExtensions is Dummy, ERC165 {463 /// @notice A descriptive name for a collection of NFTs in this contract464 /// @dev EVM selector for this function is: 0x06fdde03,465 /// or in textual repr: name()466 function name() external view returns (string memory);467468 /// @notice An abbreviated name for NFTs in this contract469 /// @dev EVM selector for this function is: 0x95d89b41,470 /// or in textual repr: symbol()471 function symbol() external view returns (string memory);472473 /// @notice Set or reaffirm the approved address for an NFT474 /// @dev The zero address indicates there is no approved address.475 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized476 /// operator of the current owner.477 /// @param approved The new substrate address approved NFT controller478 /// @param tokenId The NFT to approve479 /// @dev EVM selector for this function is: 0x0ecd0ab0,480 /// or in textual repr: approveCross((address,uint256),uint256)481 function approveCross(EthCrossAccount memory approved, uint256 tokenId) external;482483 /// @notice Transfer ownership of an NFT484 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`485 /// is the zero address. Throws if `tokenId` is not a valid NFT.486 /// @param to The new owner487 /// @param tokenId The NFT to transfer488 /// @dev EVM selector for this function is: 0xa9059cbb,489 /// or in textual repr: transfer(address,uint256)490 function transfer(address to, uint256 tokenId) external;491492 /// @notice Transfer ownership of an NFT493 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`494 /// is the zero address. Throws if `tokenId` is not a valid NFT.495 /// @param to The new owner496 /// @param tokenId The NFT to transfer497 /// @dev EVM selector for this function is: 0x2ada85ff,498 /// or in textual repr: transferCross((address,uint256),uint256)499 function transferCross(EthCrossAccount memory to, uint256 tokenId) external;500501 /// @notice Transfer ownership of an NFT from cross account address to cross account address502 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`503 /// is the zero address. Throws if `tokenId` is not a valid NFT.504 /// @param from Cross acccount address of current owner505 /// @param to Cross acccount address of new owner506 /// @param tokenId The NFT to transfer507 /// @dev EVM selector for this function is: 0xd5cf430b,508 /// or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)509 function transferFromCross(510 EthCrossAccount memory from,511 EthCrossAccount memory to,512 uint256 tokenId513 ) external;514515 /// @notice Burns a specific ERC721 token.516 /// @dev Throws unless `msg.sender` is the current owner or an authorized517 /// 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.519 /// @param from The current owner of the NFT520 /// @param tokenId The NFT to transfer521 /// @dev EVM selector for this function is: 0x79cc6790,522 /// or in textual repr: burnFrom(address,uint256)523 function burnFrom(address from, uint256 tokenId) external;524525 /// @notice Burns a specific ERC721 token.526 /// @dev Throws unless `msg.sender` is the current owner or an authorized527 /// operator for this NFT. Throws if `from` is not the current owner. Throws528 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.529 /// @param from The current owner of the NFT530 /// @param tokenId The NFT to transfer531 /// @dev EVM selector for this function is: 0xbb2f5a58,532 /// or in textual repr: burnFromCross((address,uint256),uint256)533 function burnFromCross(EthCrossAccount memory from, uint256 tokenId) external;534535 /// @notice Returns next free NFT ID.536 /// @dev EVM selector for this function is: 0x75794a3c,537 /// or in textual repr: nextTokenId()538 function nextTokenId() external view returns (uint256);539 // /// @notice Function to mint multiple tokens.540 // /// @dev `tokenIds` should be an array of consecutive numbers and first number541 // /// should be obtained with `nextTokenId` method542 // /// @param to The new owner543 // /// @param tokenIds IDs of the minted NFTs544 // /// @dev EVM selector for this function is: 0x44a9945e,545 // /// or in textual repr: mintBulk(address,uint256[])546 // function mintBulk(address to, uint256[] memory tokenIds) external returns (bool);547548 // /// @notice Function to mint multiple tokens with the given tokenUris.549 // /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive550 // /// numbers and first number should be obtained with `nextTokenId` method551 // /// @param to The new owner552 // /// @param tokens array of pairs of token ID and token URI for minted tokens553 // /// @dev EVM selector for this function is: 0x36543006,554 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])555 // function mintBulkWithTokenURI(address to, Tuple11[] memory tokens) external returns (bool);556557}558559/// @dev anonymous struct560struct Tuple11 {561 uint256 field_0;562 string field_1;563}564565/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension566/// @dev See https://eips.ethereum.org/EIPS/eip-721567/// @dev the ERC-165 identifier for this interface is 0x780e9d63568interface ERC721Enumerable is Dummy, ERC165 {569 /// @notice Enumerate valid NFTs570 /// @param index A counter less than `totalSupply()`571 /// @return The token identifier for the `index`th NFT,572 /// (sort order not specified)573 /// @dev EVM selector for this function is: 0x4f6ccce7,574 /// or in textual repr: tokenByIndex(uint256)575 function tokenByIndex(uint256 index) external view returns (uint256);576577 /// @dev Not implemented578 /// @dev EVM selector for this function is: 0x2f745c59,579 /// or in textual repr: tokenOfOwnerByIndex(address,uint256)580 function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);581582 /// @notice Count NFTs tracked by this contract583 /// @return A count of valid NFTs tracked by this contract, where each one of584 /// them has an assigned and queryable owner not equal to the zero address585 /// @dev EVM selector for this function is: 0x18160ddd,586 /// or in textual repr: totalSupply()587 function totalSupply() external view returns (uint256);588}589590/// @dev inlined interface591interface ERC721Events {592 event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);593 event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);594 event ApprovalForAll(address indexed owner, address indexed operator, bool approved);595}596597/// @title ERC-721 Non-Fungible Token Standard598/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md599/// @dev the ERC-165 identifier for this interface is 0x80ac58cd600interface ERC721 is Dummy, ERC165, ERC721Events {601 /// @notice Count all NFTs assigned to an owner602 /// @dev NFTs assigned to the zero address are considered invalid, and this603 /// function throws for queries about the zero address.604 /// @param owner An address for whom to query the balance605 /// @return The number of NFTs owned by `owner`, possibly zero606 /// @dev EVM selector for this function is: 0x70a08231,607 /// or in textual repr: balanceOf(address)608 function balanceOf(address owner) external view returns (uint256);609610 /// @notice Find the owner of an NFT611 /// @dev NFTs assigned to zero address are considered invalid, and queries612 /// about them do throw.613 /// @param tokenId The identifier for an NFT614 /// @return The address of the owner of the NFT615 /// @dev EVM selector for this function is: 0x6352211e,616 /// or in textual repr: ownerOf(uint256)617 function ownerOf(uint256 tokenId) external view returns (address);618619 /// @dev Not implemented620 /// @dev EVM selector for this function is: 0xb88d4fde,621 /// or in textual repr: safeTransferFrom(address,address,uint256,bytes)622 function safeTransferFrom(623 address from,624 address to,625 uint256 tokenId,626 bytes memory data627 ) external;628629 /// @dev Not implemented630 /// @dev EVM selector for this function is: 0x42842e0e,631 /// or in textual repr: safeTransferFrom(address,address,uint256)632 function safeTransferFrom(633 address from,634 address to,635 uint256 tokenId636 ) external;637638 /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE639 /// TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE640 /// THEY MAY BE PERMANENTLY LOST641 /// @dev Throws unless `msg.sender` is the current owner or an authorized642 /// operator for this NFT. Throws if `from` is not the current owner. Throws643 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.644 /// @param from The current owner of the NFT645 /// @param to The new owner646 /// @param tokenId The NFT to transfer647 /// @dev EVM selector for this function is: 0x23b872dd,648 /// or in textual repr: transferFrom(address,address,uint256)649 function transferFrom(650 address from,651 address to,652 uint256 tokenId653 ) external;654655 /// @notice Set or reaffirm the approved address for an NFT656 /// @dev The zero address indicates there is no approved address.657 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized658 /// operator of the current owner.659 /// @param approved The new approved NFT controller660 /// @param tokenId The NFT to approve661 /// @dev EVM selector for this function is: 0x095ea7b3,662 /// or in textual repr: approve(address,uint256)663 function approve(address approved, uint256 tokenId) external;664665 /// @dev Not implemented666 /// @dev EVM selector for this function is: 0xa22cb465,667 /// or in textual repr: setApprovalForAll(address,bool)668 function setApprovalForAll(address operator, bool approved) external;669670 /// @dev Not implemented671 /// @dev EVM selector for this function is: 0x081812fc,672 /// or in textual repr: getApproved(uint256)673 function getApproved(uint256 tokenId) external view returns (address);674675 /// @dev Not implemented676 /// @dev EVM selector for this function is: 0xe985e9c5,677 /// or in textual repr: isApprovedForAll(address,address)678 function isApprovedForAll(address owner, address operator) external view returns (address);679}680681interface UniqueNFT is682 Dummy,683 ERC165,684 ERC721,685 ERC721Enumerable,686 ERC721UniqueExtensions,687 ERC721UniqueMintable,688 ERC721Burnable,689 ERC721Metadata,690 Collection,691 TokenProperties692{}1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56/// @dev common stubs holder7interface Dummy {89}1011interface ERC165 is Dummy {12 function supportsInterface(bytes4 interfaceID) external view returns (bool);13}1415/// @title A contract that allows to set and delete token properties and change token property permissions.16/// @dev the ERC-165 identifier for this interface is 0x91a97a6817interface TokenProperties is Dummy, ERC165 {18 /// @notice Set permissions for token property.19 /// @dev Throws error if `msg.sender` is not admin or owner of the collection.20 /// @param key Property key.21 /// @param isMutable Permission to mutate property.22 /// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.23 /// @param tokenOwner Permission to mutate property by token owner if property is mutable.24 /// @dev EVM selector for this function is: 0x222d97fa,25 /// or in textual repr: setTokenPropertyPermission(string,bool,bool,bool)26 function setTokenPropertyPermission(27 string memory key,28 bool isMutable,29 bool collectionAdmin,30 bool tokenOwner31 ) external;3233 // /// @notice Set token property value.34 // /// @dev Throws error if `msg.sender` has no permission to edit the property.35 // /// @param tokenId ID of the token.36 // /// @param key Property key.37 // /// @param value Property value.38 // /// @dev EVM selector for this function is: 0x1752d67b,39 // /// or in textual repr: setProperty(uint256,string,bytes)40 // function setProperty(uint256 tokenId, string memory key, bytes memory value) external;4142 /// @notice Set token properties value.43 /// @dev Throws error if `msg.sender` has no permission to edit the property.44 /// @param tokenId ID of the token.45 /// @param properties settable properties46 /// @dev EVM selector for this function is: 0x14ed3a6e,47 /// or in textual repr: setProperties(uint256,(string,bytes)[])48 function setProperties(uint256 tokenId, Property[] memory properties) external;4950 // /// @notice Delete token property value.51 // /// @dev Throws error if `msg.sender` has no permission to edit the property.52 // /// @param tokenId ID of the token.53 // /// @param key Property key.54 // /// @dev EVM selector for this function is: 0x066111d1,55 // /// or in textual repr: deleteProperty(uint256,string)56 // function deleteProperty(uint256 tokenId, string memory key) external;5758 /// @notice Delete token properties value.59 /// @dev Throws error if `msg.sender` has no permission to edit the property.60 /// @param tokenId ID of the token.61 /// @param keys Properties key.62 /// @dev EVM selector for this function is: 0xc472d371,63 /// or in textual repr: deleteProperties(uint256,string[])64 function deleteProperties(uint256 tokenId, string[] memory keys) external;6566 /// @notice Get token property value.67 /// @dev Throws error if key not found68 /// @param tokenId ID of the token.69 /// @param key Property key.70 /// @return Property value bytes71 /// @dev EVM selector for this function is: 0x7228c327,72 /// or in textual repr: property(uint256,string)73 function property(uint256 tokenId, string memory key) external view returns (bytes memory);74}7576/// @dev Property struct77struct Property {78 string key;79 bytes value;80}8182/// @title A contract that allows you to work with collections.83/// @dev the ERC-165 identifier for this interface is 0x324a7f5b84interface Collection is Dummy, ERC165 {85 // /// Set collection property.86 // ///87 // /// @param key Property key.88 // /// @param value Propery value.89 // /// @dev EVM selector for this function is: 0x2f073f66,90 // /// or in textual repr: setCollectionProperty(string,bytes)91 // function setCollectionProperty(string memory key, bytes memory value) external;9293 /// Set collection properties.94 ///95 /// @param properties Vector of properties key/value pair.96 /// @dev EVM selector for this function is: 0x50b26b2a,97 /// or in textual repr: setCollectionProperties((string,bytes)[])98 function setCollectionProperties(Property[] memory properties) external;99100 // /// Delete collection property.101 // ///102 // /// @param key Property key.103 // /// @dev EVM selector for this function is: 0x7b7debce,104 // /// or in textual repr: deleteCollectionProperty(string)105 // function deleteCollectionProperty(string memory key) external;106107 /// Delete collection properties.108 ///109 /// @param keys Properties keys.110 /// @dev EVM selector for this function is: 0xee206ee3,111 /// or in textual repr: deleteCollectionProperties(string[])112 function deleteCollectionProperties(string[] memory keys) external;113114 /// Get collection property.115 ///116 /// @dev Throws error if key not found.117 ///118 /// @param key Property key.119 /// @return bytes The property corresponding to the key.120 /// @dev EVM selector for this function is: 0xcf24fd6d,121 /// or in textual repr: collectionProperty(string)122 function collectionProperty(string memory key) external view returns (bytes memory);123124 /// Get collection properties.125 ///126 /// @param keys Properties keys. Empty keys for all propertyes.127 /// @return Vector of properties key/value pairs.128 /// @dev EVM selector for this function is: 0x285fb8e6,129 /// or in textual repr: collectionProperties(string[])130 function collectionProperties(string[] memory keys) external view returns (Tuple23[] memory);131132 // /// Set the sponsor of the collection.133 // ///134 // /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.135 // ///136 // /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.137 // /// @dev EVM selector for this function is: 0x7623402e,138 // /// or in textual repr: setCollectionSponsor(address)139 // function setCollectionSponsor(address sponsor) external;140141 /// Set the sponsor of the collection.142 ///143 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.144 ///145 /// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.146 /// @dev EVM selector for this function is: 0x84a1d5a8,147 /// or in textual repr: setCollectionSponsorCross((address,uint256))148 function setCollectionSponsorCross(EthCrossAccount memory sponsor) external;149150 /// Whether there is a pending sponsor.151 /// @dev EVM selector for this function is: 0x058ac185,152 /// or in textual repr: hasCollectionPendingSponsor()153 function hasCollectionPendingSponsor() external view returns (bool);154155 /// Collection sponsorship confirmation.156 ///157 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.158 /// @dev EVM selector for this function is: 0x3c50e97a,159 /// or in textual repr: confirmCollectionSponsorship()160 function confirmCollectionSponsorship() external;161162 /// Remove collection sponsor.163 /// @dev EVM selector for this function is: 0x6e0326a3,164 /// or in textual repr: removeCollectionSponsor()165 function removeCollectionSponsor() external;166167 /// Get current sponsor.168 ///169 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.170 /// @dev EVM selector for this function is: 0x6ec0a9f1,171 /// or in textual repr: collectionSponsor()172 function collectionSponsor() external view returns (Tuple26 memory);173174 /// Set limits for the collection.175 /// @dev Throws error if limit not found.176 /// @param limit Name of the limit. Valid names:177 /// "accountTokenOwnershipLimit",178 /// "sponsoredDataSize",179 /// "sponsoredDataRateLimit",180 /// "tokenLimit",181 /// "sponsorTransferTimeout",182 /// "sponsorApproveTimeout"183 /// @param value Value of the limit.184 /// @dev EVM selector for this function is: 0x6a3841db,185 /// or in textual repr: setCollectionLimit(string,uint32)186 function setCollectionLimit(string memory limit, uint32 value) external;187188 /// Set limits for the collection.189 /// @dev Throws error if limit not found.190 /// @param limit Name of the limit. Valid names:191 /// "ownerCanTransfer",192 /// "ownerCanDestroy",193 /// "transfersEnabled"194 /// @param value Value of the limit.195 /// @dev EVM selector for this function is: 0x993b7fba,196 /// or in textual repr: setCollectionLimit(string,bool)197 function setCollectionLimit(string memory limit, bool value) external;198199 /// Get contract address.200 /// @dev EVM selector for this function is: 0xf6b4dfb4,201 /// or in textual repr: contractAddress()202 function contractAddress() external view returns (address);203204 /// Add collection admin.205 /// @param newAdmin Cross account administrator address.206 /// @dev EVM selector for this function is: 0x859aa7d6,207 /// or in textual repr: addCollectionAdminCross((address,uint256))208 function addCollectionAdminCross(EthCrossAccount memory newAdmin) external;209210 /// Remove collection admin.211 /// @param admin Cross account administrator address.212 /// @dev EVM selector for this function is: 0x6c0cd173,213 /// or in textual repr: removeCollectionAdminCross((address,uint256))214 function removeCollectionAdminCross(EthCrossAccount memory admin) external;215216 // /// Add collection admin.217 // /// @param newAdmin Address of the added administrator.218 // /// @dev EVM selector for this function is: 0x92e462c7,219 // /// or in textual repr: addCollectionAdmin(address)220 // function addCollectionAdmin(address newAdmin) external;221222 // /// Remove collection admin.223 // ///224 // /// @param admin Address of the removed administrator.225 // /// @dev EVM selector for this function is: 0xfafd7b42,226 // /// or in textual repr: removeCollectionAdmin(address)227 // function removeCollectionAdmin(address admin) external;228229 /// Toggle accessibility of collection nesting.230 ///231 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'232 /// @dev EVM selector for this function is: 0x112d4586,233 /// or in textual repr: setCollectionNesting(bool)234 function setCollectionNesting(bool enable) external;235236 /// Toggle accessibility of collection nesting.237 ///238 /// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'239 /// @param collections Addresses of collections that will be available for nesting.240 /// @dev EVM selector for this function is: 0x64872396,241 /// or in textual repr: setCollectionNesting(bool,address[])242 function setCollectionNesting(bool enable, address[] memory collections) external;243244 /// Set the collection access method.245 /// @param mode Access mode246 /// 0 for Normal247 /// 1 for AllowList248 /// @dev EVM selector for this function is: 0x41835d4c,249 /// or in textual repr: setCollectionAccess(uint8)250 function setCollectionAccess(uint8 mode) external;251252 /// Checks that user allowed to operate with collection.253 ///254 /// @param user User address to check.255 /// @dev EVM selector for this function is: 0xd63a8e11,256 /// or in textual repr: allowed(address)257 function allowed(address user) external view returns (bool);258259 // /// Add the user to the allowed list.260 // ///261 // /// @param user Address of a trusted user.262 // /// @dev EVM selector for this function is: 0x67844fe6,263 // /// or in textual repr: addToCollectionAllowList(address)264 // function addToCollectionAllowList(address user) external;265266 /// Add user to allowed list.267 ///268 /// @param user User cross account address.269 /// @dev EVM selector for this function is: 0xa0184a3a,270 /// or in textual repr: addToCollectionAllowListCross((address,uint256))271 function addToCollectionAllowListCross(EthCrossAccount memory user) external;272273 // /// Remove the user from the allowed list.274 // ///275 // /// @param user Address of a removed user.276 // /// @dev EVM selector for this function is: 0x85c51acb,277 // /// or in textual repr: removeFromCollectionAllowList(address)278 // function removeFromCollectionAllowList(address user) external;279280 /// Remove user from allowed list.281 ///282 /// @param user User cross account address.283 /// @dev EVM selector for this function is: 0x09ba452a,284 /// or in textual repr: removeFromCollectionAllowListCross((address,uint256))285 function removeFromCollectionAllowListCross(EthCrossAccount memory user) external;286287 /// Switch permission for minting.288 ///289 /// @param mode Enable if "true".290 /// @dev EVM selector for this function is: 0x00018e84,291 /// or in textual repr: setCollectionMintMode(bool)292 function setCollectionMintMode(bool mode) external;293294 // /// Check that account is the owner or admin of the collection295 // ///296 // /// @param user account to verify297 // /// @return "true" if account is the owner or admin298 // /// @dev EVM selector for this function is: 0x9811b0c7,299 // /// or in textual repr: isOwnerOrAdmin(address)300 // function isOwnerOrAdmin(address user) external view returns (bool);301302 /// Check that account is the owner or admin of the collection303 ///304 /// @param user User cross account to verify305 /// @return "true" if account is the owner or admin306 /// @dev EVM selector for this function is: 0x3e75a905,307 /// or in textual repr: isOwnerOrAdminCross((address,uint256))308 function isOwnerOrAdminCross(EthCrossAccount memory user) external view returns (bool);309310 /// Returns collection type311 ///312 /// @return `Fungible` or `NFT` or `ReFungible`313 /// @dev EVM selector for this function is: 0xd34b55b8,314 /// or in textual repr: uniqueCollectionType()315 function uniqueCollectionType() external view returns (string memory);316317 /// Get collection owner.318 ///319 /// @return Tuble with sponsor address and his substrate mirror.320 /// If address is canonical then substrate mirror is zero and vice versa.321 /// @dev EVM selector for this function is: 0xdf727d3b,322 /// or in textual repr: collectionOwner()323 function collectionOwner() external view returns (EthCrossAccount memory);324325 // /// Changes collection owner to another account326 // ///327 // /// @dev Owner can be changed only by current owner328 // /// @param newOwner new owner account329 // /// @dev EVM selector for this function is: 0x4f53e226,330 // /// or in textual repr: changeCollectionOwner(address)331 // function changeCollectionOwner(address newOwner) external;332333 /// Get collection administrators334 ///335 /// @return Vector of tuples with admins address and his substrate mirror.336 /// If address is canonical then substrate mirror is zero and vice versa.337 /// @dev EVM selector for this function is: 0x5813216b,338 /// or in textual repr: collectionAdmins()339 function collectionAdmins() external view returns (EthCrossAccount[] memory);340341 /// Changes collection owner to another account342 ///343 /// @dev Owner can be changed only by current owner344 /// @param newOwner new owner cross account345 /// @dev EVM selector for this function is: 0x6496c497,346 /// or in textual repr: changeCollectionOwnerCross((address,uint256))347 function changeCollectionOwnerCross(EthCrossAccount memory newOwner) external;348}349350/// @dev Cross account struct351struct EthCrossAccount {352 address eth;353 uint256 sub;354}355356/// @dev anonymous struct357struct Tuple26 {358 address field_0;359 uint256 field_1;360}361362/// @dev anonymous struct363struct Tuple23 {364 string field_0;365 bytes field_1;366}367368/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension369/// @dev See https://eips.ethereum.org/EIPS/eip-721370/// @dev the ERC-165 identifier for this interface is 0x5b5e139f371interface ERC721Metadata is Dummy, ERC165 {372 // /// @notice A descriptive name for a collection of NFTs in this contract373 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`374 // /// @dev EVM selector for this function is: 0x06fdde03,375 // /// or in textual repr: name()376 // function name() external view returns (string memory);377378 // /// @notice An abbreviated name for NFTs in this contract379 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`380 // /// @dev EVM selector for this function is: 0x95d89b41,381 // /// or in textual repr: symbol()382 // function symbol() external view returns (string memory);383384 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.385 ///386 /// @dev If the token has a `url` property and it is not empty, it is returned.387 /// Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.388 /// If the collection property `baseURI` is empty or absent, return "" (empty string)389 /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix390 /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).391 ///392 /// @return token's const_metadata393 /// @dev EVM selector for this function is: 0xc87b56dd,394 /// or in textual repr: tokenURI(uint256)395 function tokenURI(uint256 tokenId) external view returns (string memory);396}397398/// @title ERC721 Token that can be irreversibly burned (destroyed).399/// @dev the ERC-165 identifier for this interface is 0x42966c68400interface ERC721Burnable is Dummy, ERC165 {401 /// @notice Burns a specific ERC721 token.402 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized403 /// operator of the current owner.404 /// @param tokenId The NFT to approve405 /// @dev EVM selector for this function is: 0x42966c68,406 /// or in textual repr: burn(uint256)407 function burn(uint256 tokenId) external;408}409410/// @dev inlined interface411interface ERC721UniqueMintableEvents {412 event MintingFinished();413}414415/// @title ERC721 minting logic.416/// @dev the ERC-165 identifier for this interface is 0x476ff149417interface ERC721UniqueMintable is Dummy, ERC165, ERC721UniqueMintableEvents {418 /// @dev EVM selector for this function is: 0x05d2035b,419 /// or in textual repr: mintingFinished()420 function mintingFinished() external view returns (bool);421422 /// @notice Function to mint token.423 /// @param to The new owner424 /// @return uint256 The id of the newly minted token425 /// @dev EVM selector for this function is: 0x6a627842,426 /// or in textual repr: mint(address)427 function mint(address to) external returns (uint256);428429 // /// @notice Function to mint token.430 // /// @dev `tokenId` should be obtained with `nextTokenId` method,431 // /// unlike standard, you can't specify it manually432 // /// @param to The new owner433 // /// @param tokenId ID of the minted NFT434 // /// @dev EVM selector for this function is: 0x40c10f19,435 // /// or in textual repr: mint(address,uint256)436 // function mint(address to, uint256 tokenId) external returns (bool);437438 /// @notice Function to mint token with the given tokenUri.439 /// @param to The new owner440 /// @param tokenUri Token URI that would be stored in the NFT properties441 /// @return uint256 The id of the newly minted token442 /// @dev EVM selector for this function is: 0x45c17782,443 /// or in textual repr: mintWithTokenURI(address,string)444 function mintWithTokenURI(address to, string memory tokenUri) external returns (uint256);445446 // /// @notice Function to mint token with the given tokenUri.447 // /// @dev `tokenId` should be obtained with `nextTokenId` method,448 // /// unlike standard, you can't specify it manually449 // /// @param to The new owner450 // /// @param tokenId ID of the minted NFT451 // /// @param tokenUri Token URI that would be stored in the NFT properties452 // /// @dev EVM selector for this function is: 0x50bb4e7f,453 // /// or in textual repr: mintWithTokenURI(address,uint256,string)454 // function mintWithTokenURI(address to, uint256 tokenId, string memory tokenUri) external returns (bool);455456 /// @dev Not implemented457 /// @dev EVM selector for this function is: 0x7d64bcb4,458 /// or in textual repr: finishMinting()459 function finishMinting() external returns (bool);460}461462/// @title Unique extensions for ERC721.463/// @dev the ERC-165 identifier for this interface is 0x0e9fc611464interface ERC721UniqueExtensions is Dummy, ERC165 {465 /// @notice A descriptive name for a collection of NFTs in this contract466 /// @dev EVM selector for this function is: 0x06fdde03,467 /// or in textual repr: name()468 function name() external view returns (string memory);469470 /// @notice An abbreviated name for NFTs in this contract471 /// @dev EVM selector for this function is: 0x95d89b41,472 /// or in textual repr: symbol()473 function symbol() external view returns (string memory);474475 /// @notice Set or reaffirm the approved address for an NFT476 /// @dev The zero address indicates there is no approved address.477 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized478 /// operator of the current owner.479 /// @param approved The new substrate address approved NFT controller480 /// @param tokenId The NFT to approve481 /// @dev EVM selector for this function is: 0x0ecd0ab0,482 /// or in textual repr: approveCross((address,uint256),uint256)483 function approveCross(EthCrossAccount memory approved, uint256 tokenId) external;484485 /// @notice Transfer ownership of an NFT486 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`487 /// is the zero address. Throws if `tokenId` is not a valid NFT.488 /// @param to The new owner489 /// @param tokenId The NFT to transfer490 /// @dev EVM selector for this function is: 0xa9059cbb,491 /// or in textual repr: transfer(address,uint256)492 function transfer(address to, uint256 tokenId) external;493494 /// @notice Transfer ownership of an NFT495 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`496 /// is the zero address. Throws if `tokenId` is not a valid NFT.497 /// @param to The new owner498 /// @param tokenId The NFT to transfer499 /// @dev EVM selector for this function is: 0x2ada85ff,500 /// or in textual repr: transferCross((address,uint256),uint256)501 function transferCross(EthCrossAccount memory to, uint256 tokenId) external;502503 /// @notice Transfer ownership of an NFT from cross account address to cross account address504 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`505 /// is the zero address. Throws if `tokenId` is not a valid NFT.506 /// @param from Cross acccount address of current owner507 /// @param to Cross acccount address of new owner508 /// @param tokenId The NFT to transfer509 /// @dev EVM selector for this function is: 0xd5cf430b,510 /// or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)511 function transferFromCross(512 EthCrossAccount memory from,513 EthCrossAccount memory to,514 uint256 tokenId515 ) external;516517 // /// @notice Burns a specific ERC721 token.518 // /// @dev Throws unless `msg.sender` is the current owner or an authorized519 // /// operator for this NFT. Throws if `from` is not the current owner. Throws520 // /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.521 // /// @param from The current owner of the NFT522 // /// @param tokenId The NFT to transfer523 // /// @dev EVM selector for this function is: 0x79cc6790,524 // /// or in textual repr: burnFrom(address,uint256)525 // function burnFrom(address from, uint256 tokenId) external;526527 /// @notice Burns a specific ERC721 token.528 /// @dev Throws unless `msg.sender` is the current owner or an authorized529 /// operator for this NFT. Throws if `from` is not the current owner. Throws530 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.531 /// @param from The current owner of the NFT532 /// @param tokenId The NFT to transfer533 /// @dev EVM selector for this function is: 0xbb2f5a58,534 /// or in textual repr: burnFromCross((address,uint256),uint256)535 function burnFromCross(EthCrossAccount memory from, uint256 tokenId) external;536537 /// @notice Returns next free NFT ID.538 /// @dev EVM selector for this function is: 0x75794a3c,539 /// or in textual repr: nextTokenId()540 function nextTokenId() external view returns (uint256);541 // /// @notice Function to mint multiple tokens.542 // /// @dev `tokenIds` should be an array of consecutive numbers and first number543 // /// should be obtained with `nextTokenId` method544 // /// @param to The new owner545 // /// @param tokenIds IDs of the minted NFTs546 // /// @dev EVM selector for this function is: 0x44a9945e,547 // /// or in textual repr: mintBulk(address,uint256[])548 // function mintBulk(address to, uint256[] memory tokenIds) external returns (bool);549550 // /// @notice Function to mint multiple tokens with the given tokenUris.551 // /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive552 // /// numbers and first number should be obtained with `nextTokenId` method553 // /// @param to The new owner554 // /// @param tokens array of pairs of token ID and token URI for minted tokens555 // /// @dev EVM selector for this function is: 0x36543006,556 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])557 // function mintBulkWithTokenURI(address to, Tuple11[] memory tokens) external returns (bool);558559}560561/// @dev anonymous struct562struct Tuple11 {563 uint256 field_0;564 string field_1;565}566567/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension568/// @dev See https://eips.ethereum.org/EIPS/eip-721569/// @dev the ERC-165 identifier for this interface is 0x780e9d63570interface ERC721Enumerable is Dummy, ERC165 {571 /// @notice Enumerate valid NFTs572 /// @param index A counter less than `totalSupply()`573 /// @return The token identifier for the `index`th NFT,574 /// (sort order not specified)575 /// @dev EVM selector for this function is: 0x4f6ccce7,576 /// or in textual repr: tokenByIndex(uint256)577 function tokenByIndex(uint256 index) external view returns (uint256);578579 /// @dev Not implemented580 /// @dev EVM selector for this function is: 0x2f745c59,581 /// or in textual repr: tokenOfOwnerByIndex(address,uint256)582 function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);583584 /// @notice Count NFTs tracked by this contract585 /// @return A count of valid NFTs tracked by this contract, where each one of586 /// them has an assigned and queryable owner not equal to the zero address587 /// @dev EVM selector for this function is: 0x18160ddd,588 /// or in textual repr: totalSupply()589 function totalSupply() external view returns (uint256);590}591592/// @dev inlined interface593interface ERC721Events {594 event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);595 event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);596 event ApprovalForAll(address indexed owner, address indexed operator, bool approved);597}598599/// @title ERC-721 Non-Fungible Token Standard600/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md601/// @dev the ERC-165 identifier for this interface is 0x80ac58cd602interface ERC721 is Dummy, ERC165, ERC721Events {603 /// @notice Count all NFTs assigned to an owner604 /// @dev NFTs assigned to the zero address are considered invalid, and this605 /// function throws for queries about the zero address.606 /// @param owner An address for whom to query the balance607 /// @return The number of NFTs owned by `owner`, possibly zero608 /// @dev EVM selector for this function is: 0x70a08231,609 /// or in textual repr: balanceOf(address)610 function balanceOf(address owner) external view returns (uint256);611612 /// @notice Find the owner of an NFT613 /// @dev NFTs assigned to zero address are considered invalid, and queries614 /// about them do throw.615 /// @param tokenId The identifier for an NFT616 /// @return The address of the owner of the NFT617 /// @dev EVM selector for this function is: 0x6352211e,618 /// or in textual repr: ownerOf(uint256)619 function ownerOf(uint256 tokenId) external view returns (address);620621 /// @dev Not implemented622 /// @dev EVM selector for this function is: 0xb88d4fde,623 /// or in textual repr: safeTransferFrom(address,address,uint256,bytes)624 function safeTransferFrom(625 address from,626 address to,627 uint256 tokenId,628 bytes memory data629 ) external;630631 /// @dev Not implemented632 /// @dev EVM selector for this function is: 0x42842e0e,633 /// or in textual repr: safeTransferFrom(address,address,uint256)634 function safeTransferFrom(635 address from,636 address to,637 uint256 tokenId638 ) external;639640 /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE641 /// TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE642 /// THEY MAY BE PERMANENTLY LOST643 /// @dev Throws unless `msg.sender` is the current owner or an authorized644 /// operator for this NFT. Throws if `from` is not the current owner. Throws645 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.646 /// @param from The current owner of the NFT647 /// @param to The new owner648 /// @param tokenId The NFT to transfer649 /// @dev EVM selector for this function is: 0x23b872dd,650 /// or in textual repr: transferFrom(address,address,uint256)651 function transferFrom(652 address from,653 address to,654 uint256 tokenId655 ) external;656657 /// @notice Set or reaffirm the approved address for an NFT658 /// @dev The zero address indicates there is no approved address.659 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized660 /// operator of the current owner.661 /// @param approved The new approved NFT controller662 /// @param tokenId The NFT to approve663 /// @dev EVM selector for this function is: 0x095ea7b3,664 /// or in textual repr: approve(address,uint256)665 function approve(address approved, uint256 tokenId) external;666667 /// @dev Not implemented668 /// @dev EVM selector for this function is: 0xa22cb465,669 /// or in textual repr: setApprovalForAll(address,bool)670 function setApprovalForAll(address operator, bool approved) external;671672 /// @dev Not implemented673 /// @dev EVM selector for this function is: 0x081812fc,674 /// or in textual repr: getApproved(uint256)675 function getApproved(uint256 tokenId) external view returns (address);676677 /// @dev Not implemented678 /// @dev EVM selector for this function is: 0xe985e9c5,679 /// or in textual repr: isApprovedForAll(address,address)680 function isApprovedForAll(address owner, address operator) external view returns (address);681}682683interface UniqueNFT is684 Dummy,685 ERC165,686 ERC721,687 ERC721Enumerable,688 ERC721UniqueExtensions,689 ERC721UniqueMintable,690 ERC721Burnable,691 ERC721Metadata,692 Collection,693 TokenProperties694{}tests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -30,18 +30,14 @@
bool tokenOwner
) external;
- /// @notice Set token property value.
- /// @dev Throws error if `msg.sender` has no permission to edit the property.
- /// @param tokenId ID of the token.
- /// @param key Property key.
- /// @param value Property value.
- /// @dev EVM selector for this function is: 0x1752d67b,
- /// or in textual repr: setProperty(uint256,string,bytes)
- function setProperty(
- uint256 tokenId,
- string memory key,
- bytes memory value
- ) external;
+ // /// @notice Set token property value.
+ // /// @dev Throws error if `msg.sender` has no permission to edit the property.
+ // /// @param tokenId ID of the token.
+ // /// @param key Property key.
+ // /// @param value Property value.
+ // /// @dev EVM selector for this function is: 0x1752d67b,
+ // /// or in textual repr: setProperty(uint256,string,bytes)
+ // function setProperty(uint256 tokenId, string memory key, bytes memory value) external;
/// @notice Set token properties value.
/// @dev Throws error if `msg.sender` has no permission to edit the property.
@@ -49,7 +45,7 @@
/// @param properties settable properties
/// @dev EVM selector for this function is: 0x14ed3a6e,
/// or in textual repr: setProperties(uint256,(string,bytes)[])
- function setProperties(uint256 tokenId, Tuple21[] memory properties) external;
+ function setProperties(uint256 tokenId, Property[] memory properties) external;
// /// @notice Delete token property value.
// /// @dev Throws error if `msg.sender` has no permission to edit the property.
@@ -77,30 +73,36 @@
function property(uint256 tokenId, string memory key) external view returns (bytes memory);
}
+/// @dev Property struct
+struct Property {
+ string key;
+ bytes value;
+}
+
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0xb3152af3
+/// @dev the ERC-165 identifier for this interface is 0x324a7f5b
interface Collection is Dummy, ERC165 {
- /// Set collection property.
- ///
- /// @param key Property key.
- /// @param value Propery value.
- /// @dev EVM selector for this function is: 0x2f073f66,
- /// or in textual repr: setCollectionProperty(string,bytes)
- function setCollectionProperty(string memory key, bytes memory value) external;
+ // /// Set collection property.
+ // ///
+ // /// @param key Property key.
+ // /// @param value Propery value.
+ // /// @dev EVM selector for this function is: 0x2f073f66,
+ // /// or in textual repr: setCollectionProperty(string,bytes)
+ // function setCollectionProperty(string memory key, bytes memory value) external;
/// Set collection properties.
///
/// @param properties Vector of properties key/value pair.
/// @dev EVM selector for this function is: 0x50b26b2a,
/// or in textual repr: setCollectionProperties((string,bytes)[])
- function setCollectionProperties(Tuple21[] memory properties) external;
+ function setCollectionProperties(Property[] memory properties) external;
- /// Delete collection property.
- ///
- /// @param key Property key.
- /// @dev EVM selector for this function is: 0x7b7debce,
- /// or in textual repr: deleteCollectionProperty(string)
- function deleteCollectionProperty(string memory key) external;
+ // /// Delete collection property.
+ // ///
+ // /// @param key Property key.
+ // /// @dev EVM selector for this function is: 0x7b7debce,
+ // /// or in textual repr: deleteCollectionProperty(string)
+ // function deleteCollectionProperty(string memory key) external;
/// Delete collection properties.
///
@@ -125,16 +127,16 @@
/// @return Vector of properties key/value pairs.
/// @dev EVM selector for this function is: 0x285fb8e6,
/// or in textual repr: collectionProperties(string[])
- function collectionProperties(string[] memory keys) external view returns (Tuple21[] memory);
+ function collectionProperties(string[] memory keys) external view returns (Tuple22[] memory);
- /// Set the sponsor of the collection.
- ///
- /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
- ///
- /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
- /// @dev EVM selector for this function is: 0x7623402e,
- /// or in textual repr: setCollectionSponsor(address)
- function setCollectionSponsor(address sponsor) external;
+ // /// Set the sponsor of the collection.
+ // ///
+ // /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
+ // ///
+ // /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
+ // /// @dev EVM selector for this function is: 0x7623402e,
+ // /// or in textual repr: setCollectionSponsor(address)
+ // function setCollectionSponsor(address sponsor) external;
/// Set the sponsor of the collection.
///
@@ -167,7 +169,7 @@
/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
/// @dev EVM selector for this function is: 0x6ec0a9f1,
/// or in textual repr: collectionSponsor()
- function collectionSponsor() external view returns (Tuple24 memory);
+ function collectionSponsor() external view returns (Tuple25 memory);
/// Set limits for the collection.
/// @dev Throws error if limit not found.
@@ -211,18 +213,18 @@
/// or in textual repr: removeCollectionAdminCross((address,uint256))
function removeCollectionAdminCross(EthCrossAccount memory admin) external;
- /// Add collection admin.
- /// @param newAdmin Address of the added administrator.
- /// @dev EVM selector for this function is: 0x92e462c7,
- /// or in textual repr: addCollectionAdmin(address)
- function addCollectionAdmin(address newAdmin) external;
+ // /// Add collection admin.
+ // /// @param newAdmin Address of the added administrator.
+ // /// @dev EVM selector for this function is: 0x92e462c7,
+ // /// or in textual repr: addCollectionAdmin(address)
+ // function addCollectionAdmin(address newAdmin) external;
- /// Remove collection admin.
- ///
- /// @param admin Address of the removed administrator.
- /// @dev EVM selector for this function is: 0xfafd7b42,
- /// or in textual repr: removeCollectionAdmin(address)
- function removeCollectionAdmin(address admin) external;
+ // /// Remove collection admin.
+ // ///
+ // /// @param admin Address of the removed administrator.
+ // /// @dev EVM selector for this function is: 0xfafd7b42,
+ // /// or in textual repr: removeCollectionAdmin(address)
+ // function removeCollectionAdmin(address admin) external;
/// Toggle accessibility of collection nesting.
///
@@ -254,12 +256,12 @@
/// or in textual repr: allowed(address)
function allowed(address user) external view returns (bool);
- /// Add the user to the allowed list.
- ///
- /// @param user Address of a trusted user.
- /// @dev EVM selector for this function is: 0x67844fe6,
- /// or in textual repr: addToCollectionAllowList(address)
- function addToCollectionAllowList(address user) external;
+ // /// Add the user to the allowed list.
+ // ///
+ // /// @param user Address of a trusted user.
+ // /// @dev EVM selector for this function is: 0x67844fe6,
+ // /// or in textual repr: addToCollectionAllowList(address)
+ // function addToCollectionAllowList(address user) external;
/// Add user to allowed list.
///
@@ -268,12 +270,12 @@
/// or in textual repr: addToCollectionAllowListCross((address,uint256))
function addToCollectionAllowListCross(EthCrossAccount memory user) external;
- /// Remove the user from the allowed list.
- ///
- /// @param user Address of a removed user.
- /// @dev EVM selector for this function is: 0x85c51acb,
- /// or in textual repr: removeFromCollectionAllowList(address)
- function removeFromCollectionAllowList(address user) external;
+ // /// Remove the user from the allowed list.
+ // ///
+ // /// @param user Address of a removed user.
+ // /// @dev EVM selector for this function is: 0x85c51acb,
+ // /// or in textual repr: removeFromCollectionAllowList(address)
+ // function removeFromCollectionAllowList(address user) external;
/// Remove user from allowed list.
///
@@ -289,13 +291,13 @@
/// or in textual repr: setCollectionMintMode(bool)
function setCollectionMintMode(bool mode) external;
- /// Check that account is the owner or admin of the collection
- ///
- /// @param user account to verify
- /// @return "true" if account is the owner or admin
- /// @dev EVM selector for this function is: 0x9811b0c7,
- /// or in textual repr: isOwnerOrAdmin(address)
- function isOwnerOrAdmin(address user) external view returns (bool);
+ // /// Check that account is the owner or admin of the collection
+ // ///
+ // /// @param user account to verify
+ // /// @return "true" if account is the owner or admin
+ // /// @dev EVM selector for this function is: 0x9811b0c7,
+ // /// or in textual repr: isOwnerOrAdmin(address)
+ // function isOwnerOrAdmin(address user) external view returns (bool);
/// Check that account is the owner or admin of the collection
///
@@ -320,13 +322,13 @@
/// or in textual repr: collectionOwner()
function collectionOwner() external view returns (EthCrossAccount memory);
- /// Changes collection owner to another account
- ///
- /// @dev Owner can be changed only by current owner
- /// @param newOwner new owner account
- /// @dev EVM selector for this function is: 0x4f53e226,
- /// or in textual repr: changeCollectionOwner(address)
- function changeCollectionOwner(address newOwner) external;
+ // /// Changes collection owner to another account
+ // ///
+ // /// @dev Owner can be changed only by current owner
+ // /// @param newOwner new owner account
+ // /// @dev EVM selector for this function is: 0x4f53e226,
+ // /// or in textual repr: changeCollectionOwner(address)
+ // function changeCollectionOwner(address newOwner) external;
/// Get collection administrators
///
@@ -340,9 +342,9 @@
///
/// @dev Owner can be changed only by current owner
/// @param newOwner new owner cross account
- /// @dev EVM selector for this function is: 0xe5c9913f,
- /// or in textual repr: setOwnerCross((address,uint256))
- function setOwnerCross(EthCrossAccount memory newOwner) external;
+ /// @dev EVM selector for this function is: 0x6496c497,
+ /// or in textual repr: changeCollectionOwnerCross((address,uint256))
+ function changeCollectionOwnerCross(EthCrossAccount memory newOwner) external;
}
/// @dev Cross account struct
@@ -352,13 +354,13 @@
}
/// @dev anonymous struct
-struct Tuple24 {
+struct Tuple25 {
address field_0;
uint256 field_1;
}
/// @dev anonymous struct
-struct Tuple21 {
+struct Tuple22 {
string field_0;
bytes field_1;
}
@@ -502,16 +504,16 @@
uint256 tokenId
) external;
- /// @notice Burns a specific ERC721 token.
- /// @dev Throws unless `msg.sender` is the current owner or an authorized
- /// operator for this RFT. Throws if `from` is not the current owner. Throws
- /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.
- /// Throws if RFT pieces have multiple owners.
- /// @param from The current owner of the RFT
- /// @param tokenId The RFT to transfer
- /// @dev EVM selector for this function is: 0x79cc6790,
- /// or in textual repr: burnFrom(address,uint256)
- function burnFrom(address from, uint256 tokenId) external;
+ // /// @notice Burns a specific ERC721 token.
+ // /// @dev Throws unless `msg.sender` is the current owner or an authorized
+ // /// operator for this RFT. Throws if `from` is not the current owner. Throws
+ // /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.
+ // /// Throws if RFT pieces have multiple owners.
+ // /// @param from The current owner of the RFT
+ // /// @param tokenId The RFT to transfer
+ // /// @dev EVM selector for this function is: 0x79cc6790,
+ // /// or in textual repr: burnFrom(address,uint256)
+ // function burnFrom(address from, uint256 tokenId) external;
/// @notice Burns a specific ERC721 token.
/// @dev Throws unless `msg.sender` is the current owner or an authorized
tests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionAdmin.test.ts
+++ b/tests/src/eth/collectionAdmin.test.ts
@@ -39,10 +39,11 @@
});
});
+ // Soft-deprecated
itEth('Add admin by owner', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
- const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
const newAdmin = helper.eth.createAccount();
@@ -70,11 +71,13 @@
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
- const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
const admin1 = helper.eth.createAccount();
const admin2 = await privateKey('admin');
const admin2Cross = helper.ethCrossAccount.fromKeyringPair(admin2);
+
+ // Soft-deprecated
await collectionEvm.methods.addCollectionAdmin(admin1).send();
await collectionEvm.methods.addCollectionAdminCross(admin2Cross).send();
@@ -86,24 +89,39 @@
expect(adminListRpc).to.be.like(adminListEth);
});
+ // Soft-deprecated
itEth('Verify owner or admin', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
const newAdmin = helper.eth.createAccount();
- const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
expect(await collectionEvm.methods.isOwnerOrAdmin(newAdmin).call()).to.be.false;
await collectionEvm.methods.addCollectionAdmin(newAdmin).send();
expect(await collectionEvm.methods.isOwnerOrAdmin(newAdmin).call()).to.be.true;
});
-
+
+ itEth('Verify owner or admin cross', async ({helper, privateKey}) => {
+ const owner = await helper.eth.createAccountWithBalance(donor);
+ const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
+
+ const newAdmin = await privateKey('admin');
+ const newAdminCross = helper.ethCrossAccount.fromKeyringPair(newAdmin);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+
+ expect(await collectionEvm.methods.isOwnerOrAdminCross(newAdminCross).call()).to.be.false;
+ await collectionEvm.methods.addCollectionAdminCross(newAdminCross).send();
+ expect(await collectionEvm.methods.isOwnerOrAdminCross(newAdminCross).call()).to.be.true;
+ });
+
+ // Soft-deprecated
itEth('(!negative tests!) Add admin by ADMIN is not allowed', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
const admin = await helper.eth.createAccountWithBalance(donor);
- const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
await collectionEvm.methods.addCollectionAdmin(admin).send();
const user = helper.eth.createAccount();
@@ -116,12 +134,13 @@
.to.be.eq(admin.toLocaleLowerCase());
});
+ // Soft-deprecated
itEth('(!negative tests!) Add admin by USER is not allowed', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
const notAdmin = await helper.eth.createAccountWithBalance(donor);
- const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
const user = helper.eth.createAccount();
await expect(collectionEvm.methods.addCollectionAdmin(user).call({from: notAdmin}))
@@ -135,19 +154,22 @@
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
- const admin = await helper.eth.createAccountWithBalance(donor);
+ const [admin] = await helper.arrange.createAccounts([10n], donor);
+ const adminCross = helper.ethCrossAccount.fromKeyringPair(admin);
const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
- await collectionEvm.methods.addCollectionAdmin(admin).send();
+ await collectionEvm.methods.addCollectionAdminCross(adminCross).send();
const [notAdmin] = await helper.arrange.createAccounts([10n], donor);
const notAdminCross = helper.ethCrossAccount.fromKeyringPair(notAdmin);
- await expect(collectionEvm.methods.addCollectionAdminCross(notAdminCross).call({from: admin}))
+ await expect(collectionEvm.methods.addCollectionAdminCross(notAdminCross).call({from: adminCross.eth}))
.to.be.rejectedWith('NoPermission');
const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);
expect(adminList.length).to.be.eq(1);
- expect(adminList[0].asEthereum.toString().toLocaleLowerCase())
- .to.be.eq(admin.toLocaleLowerCase());
+
+ const admin0Cross = helper.ethCrossAccount.fromKeyringPair(adminList[0]);
+ expect(admin0Cross.eth.toLocaleLowerCase())
+ .to.be.eq(adminCross.eth.toLocaleLowerCase());
});
itEth('(!negative tests!) Add [cross] admin by USER is not allowed', async ({helper}) => {
@@ -175,12 +197,13 @@
});
});
+ // Soft-deprecated
itEth('Remove admin by owner', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
const newAdmin = helper.eth.createAccount();
- const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
await collectionEvm.methods.addCollectionAdmin(newAdmin).send();
{
@@ -214,11 +237,12 @@
expect(adminList.length).to.be.eq(0);
});
+ // Soft-deprecated
itEth('(!negative tests!) Remove admin by ADMIN is not allowed', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
- const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
const admin0 = await helper.eth.createAccountWithBalance(donor);
await collectionEvm.methods.addCollectionAdmin(admin0).send();
@@ -236,11 +260,12 @@
}
});
+ // Soft-deprecated
itEth('(!negative tests!) Remove admin by USER is not allowed', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
- const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
const admin = await helper.eth.createAccountWithBalance(donor);
await collectionEvm.methods.addCollectionAdmin(admin).send();
@@ -260,21 +285,23 @@
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
- const [adminSub] = await helper.arrange.createAccounts([10n], donor);
- const adminSubCross = helper.ethCrossAccount.fromKeyringPair(adminSub);
+ const [admin1] = await helper.arrange.createAccounts([10n], donor);
+ const admin1Cross = helper.ethCrossAccount.fromKeyringPair(admin1);
const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
- await collectionEvm.methods.addCollectionAdminCross(adminSubCross).send();
- const adminEth = await helper.eth.createAccountWithBalance(donor);
- await collectionEvm.methods.addCollectionAdmin(adminEth).send();
+ await collectionEvm.methods.addCollectionAdminCross(admin1Cross).send();
+
+ const [admin2] = await helper.arrange.createAccounts([10n], donor);
+ const admin2Cross = helper.ethCrossAccount.fromKeyringPair(admin2);
+ await collectionEvm.methods.addCollectionAdminCross(admin2Cross).send();
- await expect(collectionEvm.methods.removeCollectionAdminCross(adminSubCross).call({from: adminEth}))
+ await expect(collectionEvm.methods.removeCollectionAdminCross(admin1Cross).call({from: admin2Cross.eth}))
.to.be.rejectedWith('NoPermission');
const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);
expect(adminList.length).to.be.eq(2);
expect(adminList.toString().toLocaleLowerCase())
- .to.be.deep.contains(adminSub.address.toLocaleLowerCase())
- .to.be.deep.contains(adminEth.toLocaleLowerCase());
+ .to.be.deep.contains(admin1.address.toLocaleLowerCase())
+ .to.be.deep.contains(admin2.address.toLocaleLowerCase());
});
itEth('(!negative tests!) Remove [cross] admin by USER is not allowed', async ({helper}) => {
@@ -297,6 +324,7 @@
});
});
+// Soft-deprecated
describe('Change owner tests', () => {
let donor: IKeyringPair;
@@ -310,7 +338,7 @@
const owner = await helper.eth.createAccountWithBalance(donor);
const newOwner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
- const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
await collectionEvm.methods.changeCollectionOwner(newOwner).send();
@@ -322,7 +350,7 @@
const owner = await helper.eth.createAccountWithBalance(donor);
const newOwner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
- const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
const cost = await recordEthFee(helper, owner, () => collectionEvm.methods.changeCollectionOwner(newOwner).send());
expect(cost < BigInt(0.2 * Number(helper.balance.getOneTokenNominal())));
expect(cost > 0);
@@ -332,7 +360,7 @@
const owner = await helper.eth.createAccountWithBalance(donor);
const newOwner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
- const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
await expect(collectionEvm.methods.changeCollectionOwner(newOwner).send({from: newOwner})).to.be.rejected;
expect(await collectionEvm.methods.isOwnerOrAdmin(newOwner).call()).to.be.false;
@@ -355,12 +383,10 @@
const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
- expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.true;
expect(await collectionEvm.methods.isOwnerOrAdminCross(newOwnerCross).call()).to.be.false;
- await collectionEvm.methods.setOwnerCross(newOwnerCross).send();
+ await collectionEvm.methods.changeCollectionOwnerCross(newOwnerCross).send();
- expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.false;
expect(await collectionEvm.methods.isOwnerOrAdminCross(newOwnerCross).call()).to.be.true;
});
@@ -383,7 +409,7 @@
const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
- await expect(collectionEvm.methods.setOwnerCross(newOwnerCross).send({from: otherReceiver})).to.be.rejected;
+ await expect(collectionEvm.methods.changeCollectionOwnerCross(newOwnerCross).send({from: otherReceiver})).to.be.rejected;
expect(await collectionEvm.methods.isOwnerOrAdminCross(newOwnerCross).call()).to.be.false;
});
});
tests/src/eth/collectionHelpersAbi.jsondiffbeforeafterboth--- a/tests/src/eth/collectionHelpersAbi.json
+++ /dev/null
@@ -1,120 +0,0 @@
-[
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "owner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "collectionId",
- "type": "address"
- }
- ],
- "name": "CollectionCreated",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "collectionId",
- "type": "address"
- }
- ],
- "name": "CollectionDestroyed",
- "type": "event"
- },
- {
- "inputs": [],
- "name": "collectionCreationFee",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string", "name": "name", "type": "string" },
- { "internalType": "uint8", "name": "decimals", "type": "uint8" },
- { "internalType": "string", "name": "description", "type": "string" },
- { "internalType": "string", "name": "tokenPrefix", "type": "string" }
- ],
- "name": "createFTCollection",
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
- "stateMutability": "payable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string", "name": "name", "type": "string" },
- { "internalType": "string", "name": "description", "type": "string" },
- { "internalType": "string", "name": "tokenPrefix", "type": "string" }
- ],
- "name": "createNFTCollection",
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
- "stateMutability": "payable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string", "name": "name", "type": "string" },
- { "internalType": "string", "name": "description", "type": "string" },
- { "internalType": "string", "name": "tokenPrefix", "type": "string" }
- ],
- "name": "createRFTCollection",
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
- "stateMutability": "payable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "collectionAddress",
- "type": "address"
- }
- ],
- "name": "destroyCollection",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "collectionAddress",
- "type": "address"
- }
- ],
- "name": "isCollectionExist",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "collection", "type": "address" },
- { "internalType": "string", "name": "baseUri", "type": "string" }
- ],
- "name": "makeCollectionERC721MetadataCompatible",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
- ],
- "name": "supportsInterface",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- }
-]
tests/src/eth/collectionProperties.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionProperties.test.ts
+++ b/tests/src/eth/collectionProperties.test.ts
@@ -27,7 +27,7 @@
before(async function() {
await usingEthPlaygrounds(async (_helper, privateKey) => {
donor = await privateKey({filename: __filename});
- [alice] = await _helper.arrange.createAccounts([10n], donor);
+ [alice] = await _helper.arrange.createAccounts([20n], donor);
});
});
@@ -39,7 +39,7 @@
const address = helper.ethAddress.fromCollectionId(collection.collectionId);
const contract = helper.ethNativeContract.collection(address, 'nft', caller);
- await contract.methods.setCollectionProperty('testKey', Buffer.from('testValue')).send({from: caller});
+ await contract.methods.setCollectionProperties([{key: 'testKey', value: Buffer.from('testValue')}]).send({from: caller});
const raw = (await collection.getData())?.raw;
@@ -55,7 +55,7 @@
const address = helper.ethAddress.fromCollectionId(collection.collectionId);
const contract = helper.ethNativeContract.collection(address, 'nft', caller);
- await contract.methods.deleteCollectionProperty('testKey').send({from: caller});
+ await contract.methods.deleteCollectionProperties(['testKey']).send({from: caller});
const raw = (await collection.getData())?.raw;
@@ -72,6 +72,39 @@
const value = await contract.methods.collectionProperty('testKey').call();
expect(value).to.equal(helper.getWeb3().utils.toHex('testValue'));
});
+
+ // Soft-deprecated
+ itEth('Collection property can be set', async({helper}) => {
+ const caller = await helper.eth.createAccountWithBalance(donor);
+ const collection = await helper.nft.mintCollection(alice, {name: 'name', description: 'test', tokenPrefix: 'test', properties: []});
+ await collection.addAdmin(alice, {Ethereum: caller});
+
+ const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+ const contract = helper.ethNativeContract.collection(address, 'nft', caller, true);
+
+ await contract.methods.setCollectionProperty('testKey', Buffer.from('testValue')).send();
+
+ const raw = (await collection.getData())?.raw;
+
+ expect(raw.properties[0].value).to.equal('testValue');
+ });
+
+ // Soft-deprecated
+ itEth('Collection property can be deleted', async({helper}) => {
+ const caller = await helper.eth.createAccountWithBalance(donor);
+ const collection = await helper.nft.mintCollection(alice, {name: 'name', description: 'test', tokenPrefix: 'test', properties: [{key: 'testKey', value: 'testValue'}]});
+
+ await collection.addAdmin(alice, {Ethereum: caller});
+
+ const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+ const contract = helper.ethNativeContract.collection(address, 'nft', caller, true);
+
+ await contract.methods.deleteCollectionProperty('testKey').send({from: caller});
+
+ const raw = (await collection.getData())?.raw;
+
+ expect(raw.properties.length).to.equal(0);
+ });
});
describe('Supports ERC721Metadata', () => {
@@ -95,9 +128,10 @@
const creatorMethod = mode === 'rft' ? 'createRFTCollection' : 'createNFTCollection';
const {collectionId, collectionAddress} = await helper.eth[creatorMethod](caller, 'n', 'd', 'p');
+ const bruhCross = helper.ethCrossAccount.fromAddress(bruh);
const contract = helper.ethNativeContract.collectionById(collectionId, mode, caller);
- await contract.methods.addCollectionAdmin(bruh).send(); // to check that admin will work too
+ await contract.methods.addCollectionAdminCross(bruhCross).send(); // to check that admin will work too
const collection1 = helper.nft.getCollectionObject(collectionId);
const data1 = await collection1.getData();
@@ -133,10 +167,10 @@
expect(await contract.methods.tokenURI(tokenId1).call()).to.equal(BASE_URI);
- await contract.methods.setProperty(tokenId1, 'URISuffix', Buffer.from(SUFFIX)).send();
+ await contract.methods.setProperties(tokenId1, [{key: 'URISuffix', value: Buffer.from(SUFFIX)}]).send();
expect(await contract.methods.tokenURI(tokenId1).call()).to.equal(BASE_URI + SUFFIX);
- await contract.methods.setProperty(tokenId1, 'URI', Buffer.from(URI)).send();
+ await contract.methods.setProperties(tokenId1, [{key: 'URI', value: Buffer.from(URI)}]).send();
expect(await contract.methods.tokenURI(tokenId1).call()).to.equal(URI);
await contract.methods.deleteProperties(tokenId1, ['URI']).send();
@@ -150,7 +184,7 @@
await contract.methods.deleteProperties(tokenId2, ['URI']).send();
expect(await contract.methods.tokenURI(tokenId2).call()).to.equal(BASE_URI);
- await contract.methods.setProperty(tokenId2, 'URISuffix', Buffer.from(SUFFIX)).send();
+ await contract.methods.setProperties(tokenId2, [{key: 'URISuffix', value: Buffer.from(SUFFIX)}]).send();
expect(await contract.methods.tokenURI(tokenId2).call()).to.equal(BASE_URI + SUFFIX);
};
tests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionSponsoring.test.ts
+++ b/tests/src/eth/collectionSponsoring.test.ts
@@ -81,17 +81,41 @@
// expect(bigIntToSub(api, BigInt(sponsorTuple[1]))).to.be.eq(sponsor.address);
// });
- itEth('Remove sponsor', async ({helper}) => {
+ // Soft-deprecated
+ itEth('[eth] Remove sponsor', async ({helper}) => {
+ const owner = await helper.eth.createAccountWithBalance(donor);
+ const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);
+
+ let result = await collectionHelpers.methods.createNFTCollection('Sponsor collection', '1', '1').send({value: Number(2n * nominal)});
+ const collectionIdAddress = helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);
+ const sponsor = await helper.eth.createAccountWithBalance(donor);
+ const collectionEvm = helper.ethNativeContract.collection(collectionIdAddress, 'nft', owner, true);
+
+ expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;
+ result = await collectionEvm.methods.setCollectionSponsor(sponsor).send({from: owner});
+ expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.true;
+
+ await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});
+ expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;
+
+ await collectionEvm.methods.removeCollectionSponsor().send({from: owner});
+
+ const sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});
+ expect(sponsorTuple.field_0).to.be.eq('0x0000000000000000000000000000000000000000');
+ });
+
+ itEth('[cross] Remove sponsor', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);
let result = await collectionHelpers.methods.createNFTCollection('Sponsor collection', '1', '1').send({value: Number(2n * nominal)});
const collectionIdAddress = helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);
const sponsor = await helper.eth.createAccountWithBalance(donor);
+ const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);
const collectionEvm = helper.ethNativeContract.collection(collectionIdAddress, 'nft', owner);
expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;
- result = await collectionEvm.methods.setCollectionSponsor(sponsor).send({from: owner});
+ result = await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send({from: owner});
expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.true;
await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});
@@ -103,14 +127,15 @@
expect(sponsorTuple.field_0).to.be.eq('0x0000000000000000000000000000000000000000');
});
- itEth('Sponsoring collection from evm address via access list', async ({helper}) => {
+ // Soft-deprecated
+ itEth('[eth] Sponsoring collection from evm address via access list', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionId, collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'Sponsor collection', '1', '1', '');
const collection = helper.nft.getCollectionObject(collectionId);
const sponsor = await helper.eth.createAccountWithBalance(donor);
- const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
await collectionEvm.methods.setCollectionSponsor(sponsor).send({from: owner});
let collectionData = (await collection.getData())!;
@@ -165,6 +190,70 @@
}
});
+ itEth('[cross] Sponsoring collection from evm address via access list', async ({helper}) => {
+ const owner = await helper.eth.createAccountWithBalance(donor);
+
+ const {collectionId, collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'Sponsor collection', '1', '1', '');
+
+ const collection = helper.nft.getCollectionObject(collectionId);
+ const sponsor = await helper.eth.createAccountWithBalance(donor);
+ const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+
+ await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send({from: owner});
+ let collectionData = (await collection.getData())!;
+ expect(collectionData.raw.sponsorship.Unconfirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));
+ await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');
+
+ await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});
+ collectionData = (await collection.getData())!;
+ expect(collectionData.raw.sponsorship.Confirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));
+
+ const user = helper.eth.createAccount();
+ const userCross = helper.ethCrossAccount.fromAddress(user);
+ const nextTokenId = await collectionEvm.methods.nextTokenId().call();
+ expect(nextTokenId).to.be.equal('1');
+
+ const oldPermissions = (await collection.getData())!.raw.permissions; // (await getDetailedCollectionInfo(api, collectionId))!.permissions.toHuman();
+ expect(oldPermissions.mintMode).to.be.false;
+ expect(oldPermissions.access).to.be.equal('Normal');
+
+ await collectionEvm.methods.setCollectionAccess(1 /*'AllowList'*/).send({from: owner});
+ await collectionEvm.methods.addToCollectionAllowListCross(userCross).send({from: owner});
+ await collectionEvm.methods.setCollectionMintMode(true).send({from: owner});
+
+ const newPermissions = (await collection.getData())!.raw.permissions; // (await getDetailedCollectionInfo(api, collectionId))!.permissions.toHuman();
+ expect(newPermissions.mintMode).to.be.true;
+ expect(newPermissions.access).to.be.equal('AllowList');
+
+ const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));
+ const sponsorBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsor));
+
+ {
+ const result = await collectionEvm.methods.mintWithTokenURI(user, 'Test URI').send({from: user});
+ const events = helper.eth.normalizeEvents(result.events);
+
+ expect(events).to.be.deep.equal([
+ {
+ address: collectionAddress,
+ event: 'Transfer',
+ args: {
+ from: '0x0000000000000000000000000000000000000000',
+ to: user,
+ tokenId: '1',
+ },
+ },
+ ]);
+
+ const ownerBalanceAfter = await helper.balance.getSubstrate(await helper.address.ethToSubstrate(owner));
+ const sponsorBalanceAfter = await helper.balance.getSubstrate(await helper.address.ethToSubstrate(sponsor));
+
+ expect(await collectionEvm.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');
+ expect(ownerBalanceBefore).to.be.eq(ownerBalanceAfter);
+ expect(sponsorBalanceBefore > sponsorBalanceAfter).to.be.true;
+ }
+ });
+
// TODO: Temprorary off. Need refactor
// itWeb3('Sponsoring collection from substrate address via access list', async ({api, web3, privateKeyWrapper}) => {
// const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
@@ -221,15 +310,68 @@
// }
// });
- itEth('Check that transaction via EVM spend money from sponsor address', async ({helper}) => {
+ // Soft-deprecated
+ itEth('[eth] Check that transaction via EVM spend money from sponsor address', async ({helper}) => {
+ const owner = await helper.eth.createAccountWithBalance(donor);
+
+ const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner,'Sponsor collection', '1', '1', '');
+ const collection = helper.nft.getCollectionObject(collectionId);
+ const sponsor = await helper.eth.createAccountWithBalance(donor);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
+
+ await collectionEvm.methods.setCollectionSponsor(sponsor).send();
+ let collectionData = (await collection.getData())!;
+ expect(collectionData.raw.sponsorship.Unconfirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));
+ await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');
+
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor, true);
+ await sponsorCollection.methods.confirmCollectionSponsorship().send();
+ collectionData = (await collection.getData())!;
+ expect(collectionData.raw.sponsorship.Confirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));
+
+ const user = helper.eth.createAccount();
+ await collectionEvm.methods.addCollectionAdmin(user).send();
+
+ const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));
+ const sponsorBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsor));
+
+ const userCollectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', user, true);
+
+ const result = await userCollectionEvm.methods.mintWithTokenURI(user, 'Test URI').send();
+ const tokenId = result.events.Transfer.returnValues.tokenId;
+
+ const events = helper.eth.normalizeEvents(result.events);
+ const address = helper.ethAddress.fromCollectionId(collectionId);
+
+ expect(events).to.be.deep.equal([
+ {
+ address,
+ event: 'Transfer',
+ args: {
+ from: '0x0000000000000000000000000000000000000000',
+ to: user,
+ tokenId: '1',
+ },
+ },
+ ]);
+ expect(await userCollectionEvm.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');
+
+ const ownerBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));
+ expect(ownerBalanceAfter).to.be.eq(ownerBalanceBefore);
+ const sponsorBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsor));
+ expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;
+ });
+
+ itEth('[cross] Check that transaction via EVM spend money from sponsor address', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner,'Sponsor collection', '1', '1', '');
const collection = helper.nft.getCollectionObject(collectionId);
const sponsor = await helper.eth.createAccountWithBalance(donor);
+ const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);
const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
- await collectionEvm.methods.setCollectionSponsor(sponsor).send();
+ await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send();
let collectionData = (await collection.getData())!;
expect(collectionData.raw.sponsorship.Unconfirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));
await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');
@@ -240,7 +382,8 @@
expect(collectionData.raw.sponsorship.Confirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));
const user = helper.eth.createAccount();
- await collectionEvm.methods.addCollectionAdmin(user).send();
+ const userCross = helper.ethCrossAccount.fromAddress(user);
+ await collectionEvm.methods.addCollectionAdminCross(userCross).send();
const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));
const sponsorBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsor));
tests/src/eth/createFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createFTCollection.test.ts
+++ b/tests/src/eth/createFTCollection.test.ts
@@ -31,13 +31,14 @@
});
});
- itEth('Set sponsorship', async ({helper}) => {
+ // Soft-deprecated
+ itEth('[eth] Set sponsorship', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const sponsor = await helper.eth.createAccountWithBalance(donor);
const ss58Format = helper.chain.getChainProperties().ss58Format;
const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, 'absolutely anything', 'ENVY');
- const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);
+ const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner, true);
await collection.methods.setCollectionSponsor(sponsor).send();
let data = (await helper.rft.getData(collectionId))!;
@@ -45,6 +46,28 @@
await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);
+ await sponsorCollection.methods.confirmCollectionSponsorship().send();
+
+ data = (await helper.rft.getData(collectionId))!;
+ expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));
+ });
+
+ itEth('[cross] Set sponsorship', async ({helper}) => {
+ const owner = await helper.eth.createAccountWithBalance(donor);
+ const sponsor = await helper.eth.createAccountWithBalance(donor);
+ const ss58Format = helper.chain.getChainProperties().ss58Format;
+ const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, 'absolutely anything', 'ENVY');
+
+ const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);
+ const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);
+ await collection.methods.setCollectionSponsorCross(sponsorCross).send();
+
+ let data = (await helper.rft.getData(collectionId))!;
+ expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));
+
+ await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');
+
const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);
await sponsorCollection.methods.confirmCollectionSponsorship().send();
@@ -183,7 +206,32 @@
.call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');
});
- itEth('(!negative test!) Check owner', async ({helper}) => {
+ // Soft-deprecated
+ itEth('(!negative test!) [eth] Check owner', async ({helper}) => {
+ const owner = await helper.eth.createAccountWithBalance(donor);
+ const peasant = helper.eth.createAccount();
+ const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Transgressed', DECIMALS, 'absolutely anything', 'YVNE');
+ const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', peasant, true);
+ const EXPECTED_ERROR = 'NoPermission';
+ {
+ const sponsor = await helper.eth.createAccountWithBalance(donor);
+ await expect(peasantCollection.methods
+ .setCollectionSponsor(sponsor)
+ .call()).to.be.rejectedWith(EXPECTED_ERROR);
+
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', sponsor, true);
+ await expect(sponsorCollection.methods
+ .confirmCollectionSponsorship()
+ .call()).to.be.rejectedWith('caller is not set as sponsor');
+ }
+ {
+ await expect(peasantCollection.methods
+ .setCollectionLimit('account_token_ownership_limit', '1000')
+ .call()).to.be.rejectedWith(EXPECTED_ERROR);
+ }
+ });
+
+ itEth('(!negative test!) [cross] Check owner', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const peasant = helper.eth.createAccount();
const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Transgressed', DECIMALS, 'absolutely anything', 'YVNE');
@@ -191,8 +239,9 @@
const EXPECTED_ERROR = 'NoPermission';
{
const sponsor = await helper.eth.createAccountWithBalance(donor);
+ const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);
await expect(peasantCollection.methods
- .setCollectionSponsor(sponsor)
+ .setCollectionSponsorCross(sponsorCross)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', sponsor);
tests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createNFTCollection.test.ts
+++ b/tests/src/eth/createNFTCollection.test.ts
@@ -70,13 +70,14 @@
]);
});
- itEth('Set sponsorship', async ({helper}) => {
+ // Soft-deprecated
+ itEth('[eth] Set sponsorship', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const sponsor = await helper.eth.createAccountWithBalance(donor);
const ss58Format = helper.chain.getChainProperties().ss58Format;
const {collectionId, collectionAddress} = await helper.eth.createNFTCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');
- const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
await collection.methods.setCollectionSponsor(sponsor).send();
let data = (await helper.nft.getData(collectionId))!;
@@ -84,6 +85,28 @@
await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor, true);
+ await sponsorCollection.methods.confirmCollectionSponsorship().send();
+
+ data = (await helper.nft.getData(collectionId))!;
+ expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));
+ });
+
+ itEth('[cross] Set sponsorship', async ({helper}) => {
+ const owner = await helper.eth.createAccountWithBalance(donor);
+ const sponsor = await helper.eth.createAccountWithBalance(donor);
+ const ss58Format = helper.chain.getChainProperties().ss58Format;
+ const {collectionId, collectionAddress} = await helper.eth.createNFTCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');
+
+ const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);
+ await collection.methods.setCollectionSponsorCross(sponsorCross).send();
+
+ let data = (await helper.nft.getData(collectionId))!;
+ expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));
+
+ await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');
+
const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);
await sponsorCollection.methods.confirmCollectionSponsorship().send();
@@ -196,7 +219,32 @@
.call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');
});
- itEth('(!negative test!) Check owner', async ({helper}) => {
+ // Soft-deprecated
+ itEth('(!negative test!) [eth] Check owner', async ({helper}) => {
+ const owner = await helper.eth.createAccountWithBalance(donor);
+ const malfeasant = helper.eth.createAccount();
+ const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Transgressed', 'absolutely anything', 'COR');
+ const malfeasantCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', malfeasant, true);
+ const EXPECTED_ERROR = 'NoPermission';
+ {
+ const sponsor = await helper.eth.createAccountWithBalance(donor);
+ await expect(malfeasantCollection.methods
+ .setCollectionSponsor(sponsor)
+ .call()).to.be.rejectedWith(EXPECTED_ERROR);
+
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor, true);
+ await expect(sponsorCollection.methods
+ .confirmCollectionSponsorship()
+ .call()).to.be.rejectedWith('caller is not set as sponsor');
+ }
+ {
+ await expect(malfeasantCollection.methods
+ .setCollectionLimit('account_token_ownership_limit', '1000')
+ .call()).to.be.rejectedWith(EXPECTED_ERROR);
+ }
+ });
+
+ itEth('(!negative test!) [cross] Check owner', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const malfeasant = helper.eth.createAccount();
const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Transgressed', 'absolutely anything', 'COR');
@@ -204,8 +252,9 @@
const EXPECTED_ERROR = 'NoPermission';
{
const sponsor = await helper.eth.createAccountWithBalance(donor);
+ const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);
await expect(malfeasantCollection.methods
- .setCollectionSponsor(sponsor)
+ .setCollectionSponsorCross(sponsorCross)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);
tests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createRFTCollection.test.ts
+++ b/tests/src/eth/createRFTCollection.test.ts
@@ -105,13 +105,14 @@
.call()).to.be.true;
});
- itEth('Set sponsorship', async ({helper}) => {
+ // Soft-deprecated
+ itEth('[eth] Set sponsorship', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const sponsor = await helper.eth.createAccountWithBalance(donor);
const ss58Format = helper.chain.getChainProperties().ss58Format;
const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(owner, 'Sponsor', 'absolutely anything', 'ENVY');
- const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);
+ const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner, true);
await collection.methods.setCollectionSponsor(sponsor).send();
let data = (await helper.rft.getData(collectionId))!;
@@ -119,6 +120,28 @@
await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);
+ await sponsorCollection.methods.confirmCollectionSponsorship().send();
+
+ data = (await helper.rft.getData(collectionId))!;
+ expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));
+ });
+
+ itEth('[cross] Set sponsorship', async ({helper}) => {
+ const owner = await helper.eth.createAccountWithBalance(donor);
+ const sponsor = await helper.eth.createAccountWithBalance(donor);
+ const ss58Format = helper.chain.getChainProperties().ss58Format;
+ const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(owner, 'Sponsor', 'absolutely anything', 'ENVY');
+
+ const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);
+ const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);
+ await collection.methods.setCollectionSponsorCross(sponsorCross).send();
+
+ let data = (await helper.rft.getData(collectionId))!;
+ expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));
+
+ await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');
+
const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);
await sponsorCollection.methods.confirmCollectionSponsorship().send();
@@ -231,7 +254,32 @@
.call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');
});
- itEth('(!negative test!) Check owner', async ({helper}) => {
+ // Soft-deprecated
+ itEth('(!negative test!) [eth] Check owner', async ({helper}) => {
+ const owner = await helper.eth.createAccountWithBalance(donor);
+ const peasant = helper.eth.createAccount();
+ const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Transgressed', 'absolutely anything', 'YVNE');
+ const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', peasant, true);
+ const EXPECTED_ERROR = 'NoPermission';
+ {
+ const sponsor = await helper.eth.createAccountWithBalance(donor);
+ await expect(peasantCollection.methods
+ .setCollectionSponsor(sponsor)
+ .call()).to.be.rejectedWith(EXPECTED_ERROR);
+
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);
+ await expect(sponsorCollection.methods
+ .confirmCollectionSponsorship()
+ .call()).to.be.rejectedWith('caller is not set as sponsor');
+ }
+ {
+ await expect(peasantCollection.methods
+ .setCollectionLimit('account_token_ownership_limit', '1000')
+ .call()).to.be.rejectedWith(EXPECTED_ERROR);
+ }
+ });
+
+ itEth('(!negative test!) [cross] Check owner', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const peasant = helper.eth.createAccount();
const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Transgressed', 'absolutely anything', 'YVNE');
@@ -239,8 +287,9 @@
const EXPECTED_ERROR = 'NoPermission';
{
const sponsor = await helper.eth.createAccountWithBalance(donor);
+ const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);
await expect(peasantCollection.methods
- .setCollectionSponsor(sponsor)
+ .setCollectionSponsorCross(sponsorCross)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);
tests/src/eth/fractionalizer/Fractionalizer.soldiffbeforeafterboth--- a/tests/src/eth/fractionalizer/Fractionalizer.sol
+++ b/tests/src/eth/fractionalizer/Fractionalizer.sol
@@ -3,7 +3,7 @@
import {CollectionHelpers} from "../api/CollectionHelpers.sol";
import {ContractHelpers} from "../api/ContractHelpers.sol";
import {UniqueRefungibleToken} from "../api/UniqueRefungibleToken.sol";
-import {UniqueRefungible} from "../api/UniqueRefungible.sol";
+import {UniqueRefungible, EthCrossAccount} from "../api/UniqueRefungible.sol";
import {UniqueNFT} from "../api/UniqueNFT.sol";
/// @dev Fractionalization contract. It stores mappings between NFT and RFT tokens,
@@ -63,7 +63,7 @@
"Wrong collection type. Collection is not refungible."
);
require(
- refungibleContract.isOwnerOrAdmin(address(this)),
+ refungibleContract.isOwnerOrAdminCross(EthCrossAccount({eth: address(this), sub: uint256(0)})),
"Fractionalizer contract should be an admin of the collection"
);
rftCollection = _collection;
tests/src/eth/fractionalizer/fractionalizer.test.tsdiffbeforeafterboth--- a/tests/src/eth/fractionalizer/fractionalizer.test.ts
+++ b/tests/src/eth/fractionalizer/fractionalizer.test.ts
@@ -95,7 +95,8 @@
const rftCollection = await helper.eth.createRFTCollection(owner, 'rft', 'RFT collection', 'RFT');
const rftContract = helper.ethNativeContract.collection(rftCollection.collectionAddress, 'rft', owner);
- await rftContract.methods.addCollectionAdmin(fractionalizer.options.address).send({from: owner});
+ const fractionalizerAddressCross = helper.ethCrossAccount.fromAddress(fractionalizer.options.address);
+ await rftContract.methods.addCollectionAdminCross(fractionalizerAddressCross).send({from: owner});
const result = await fractionalizer.methods.setRFTCollection(rftCollection.collectionAddress).send({from: owner});
expect(result.events).to.be.like({
RFTCollectionSet: {
@@ -235,7 +236,8 @@
const refungibleContract = helper.ethNativeContract.collection(rftCollection.collectionAddress, 'rft', owner);
const fractionalizer = await deployContract(helper, owner);
- await refungibleContract.methods.addCollectionAdmin(fractionalizer.options.address).send({from: owner});
+ const fractionalizerAddressCross = helper.ethCrossAccount.fromAddress(fractionalizer.options.address);
+ await refungibleContract.methods.addCollectionAdminCross(fractionalizerAddressCross).send({from: owner});
await fractionalizer.methods.setRFTCollection(rftCollection.collectionAddress).send({from: owner});
await expect(fractionalizer.methods.setRFTCollection(rftCollection.collectionAddress).call())
@@ -248,7 +250,8 @@
const nftContract = helper.ethNativeContract.collection(nftCollection.collectionAddress, 'nft', owner);
const fractionalizer = await deployContract(helper, owner);
- await nftContract.methods.addCollectionAdmin(fractionalizer.options.address).send({from: owner});
+ const fractionalizerAddressCross = helper.ethCrossAccount.fromAddress(fractionalizer.options.address);
+ await nftContract.methods.addCollectionAdminCross(fractionalizerAddressCross).send({from: owner});
await expect(fractionalizer.methods.setRFTCollection(nftCollection.collectionAddress).call())
.to.be.rejectedWith(/Wrong collection type. Collection is not refungible.$/g);
@@ -370,7 +373,8 @@
const fractionalizer = await deployContract(helper, owner);
- await refungibleContract.methods.addCollectionAdmin(fractionalizer.options.address).send({from: owner});
+ const fractionalizerAddressCross = helper.ethCrossAccount.fromAddress(fractionalizer.options.address);
+ await refungibleContract.methods.addCollectionAdminCross(fractionalizerAddressCross).send({from: owner});
await fractionalizer.methods.setRFTCollection(rftCollection.collectionAddress).send({from: owner});
const mintResult = await refungibleContract.methods.mint(owner).send({from: owner});
tests/src/eth/fungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/fungible.test.ts
+++ b/tests/src/eth/fungible.test.ts
@@ -102,6 +102,7 @@
}
});
+ // Soft-deprecated
itEth('Can perform burn()', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const receiver = await helper.eth.createAccountWithBalance(donor);
@@ -109,7 +110,7 @@
await collection.addAdmin(alice, {Ethereum: owner});
const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
- const contract = helper.ethNativeContract.collection(collectionAddress, 'ft', owner);
+ const contract = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);
await contract.methods.mint(receiver, 100).send();
const result = await contract.methods.burnFrom(receiver, 49).send({from: receiver});
tests/src/eth/fungibleAbi.jsondiffbeforeafterboth--- a/tests/src/eth/fungibleAbi.json
+++ /dev/null
@@ -1,658 +0,0 @@
-[
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "owner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "spender",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "value",
- "type": "uint256"
- }
- ],
- "name": "Approval",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "value",
- "type": "uint256"
- }
- ],
- "name": "Transfer",
- "type": "event"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "newAdmin", "type": "address" }
- ],
- "name": "addCollectionAdmin",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "newAdmin",
- "type": "tuple"
- }
- ],
- "name": "addCollectionAdminCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "user", "type": "address" }
- ],
- "name": "addToCollectionAllowList",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "user",
- "type": "tuple"
- }
- ],
- "name": "addToCollectionAllowListCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "owner", "type": "address" },
- { "internalType": "address", "name": "spender", "type": "address" }
- ],
- "name": "allowance",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "user", "type": "address" }
- ],
- "name": "allowed",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "spender", "type": "address" },
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
- ],
- "name": "approve",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "spender",
- "type": "tuple"
- },
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
- ],
- "name": "approveCross",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "owner", "type": "address" }
- ],
- "name": "balanceOf",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "from", "type": "address" },
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
- ],
- "name": "burnFrom",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "from",
- "type": "tuple"
- },
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
- ],
- "name": "burnFromCross",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "newOwner", "type": "address" }
- ],
- "name": "changeCollectionOwner",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "collectionAdmins",
- "outputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount[]",
- "name": "",
- "type": "tuple[]"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "collectionOwner",
- "outputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "",
- "type": "tuple"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string[]", "name": "keys", "type": "string[]" }
- ],
- "name": "collectionProperties",
- "outputs": [
- {
- "components": [
- { "internalType": "string", "name": "field_0", "type": "string" },
- { "internalType": "bytes", "name": "field_1", "type": "bytes" }
- ],
- "internalType": "struct Tuple15[]",
- "name": "",
- "type": "tuple[]"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
- "name": "collectionProperty",
- "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "collectionSponsor",
- "outputs": [
- {
- "components": [
- { "internalType": "address", "name": "field_0", "type": "address" },
- { "internalType": "uint256", "name": "field_1", "type": "uint256" }
- ],
- "internalType": "struct Tuple8",
- "name": "",
- "type": "tuple"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "confirmCollectionSponsorship",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "contractAddress",
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "decimals",
- "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string[]", "name": "keys", "type": "string[]" }
- ],
- "name": "deleteCollectionProperties",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
- "name": "deleteCollectionProperty",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "hasCollectionPendingSponsor",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "user", "type": "address" }
- ],
- "name": "isOwnerOrAdmin",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "user",
- "type": "tuple"
- }
- ],
- "name": "isOwnerOrAdminCross",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "to", "type": "address" },
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
- ],
- "name": "mint",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "field_0", "type": "address" },
- { "internalType": "uint256", "name": "field_1", "type": "uint256" }
- ],
- "internalType": "struct Tuple8[]",
- "name": "amounts",
- "type": "tuple[]"
- }
- ],
- "name": "mintBulk",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "name",
- "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "admin", "type": "address" }
- ],
- "name": "removeCollectionAdmin",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "admin",
- "type": "tuple"
- }
- ],
- "name": "removeCollectionAdminCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "removeCollectionSponsor",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "user", "type": "address" }
- ],
- "name": "removeFromCollectionAllowList",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "user",
- "type": "tuple"
- }
- ],
- "name": "removeFromCollectionAllowListCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],
- "name": "setCollectionAccess",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string", "name": "limit", "type": "string" },
- { "internalType": "uint32", "name": "value", "type": "uint32" }
- ],
- "name": "setCollectionLimit",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string", "name": "limit", "type": "string" },
- { "internalType": "bool", "name": "value", "type": "bool" }
- ],
- "name": "setCollectionLimit",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],
- "name": "setCollectionMintMode",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],
- "name": "setCollectionNesting",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "bool", "name": "enable", "type": "bool" },
- {
- "internalType": "address[]",
- "name": "collections",
- "type": "address[]"
- }
- ],
- "name": "setCollectionNesting",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "string", "name": "field_0", "type": "string" },
- { "internalType": "bytes", "name": "field_1", "type": "bytes" }
- ],
- "internalType": "struct Tuple15[]",
- "name": "properties",
- "type": "tuple[]"
- }
- ],
- "name": "setCollectionProperties",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string", "name": "key", "type": "string" },
- { "internalType": "bytes", "name": "value", "type": "bytes" }
- ],
- "name": "setCollectionProperty",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "sponsor", "type": "address" }
- ],
- "name": "setCollectionSponsor",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "sponsor",
- "type": "tuple"
- }
- ],
- "name": "setCollectionSponsorCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "newOwner",
- "type": "tuple"
- }
- ],
- "name": "setOwnerCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
- ],
- "name": "supportsInterface",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "symbol",
- "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "totalSupply",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "to", "type": "address" },
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
- ],
- "name": "transfer",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "to",
- "type": "tuple"
- },
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
- ],
- "name": "transferCross",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "from", "type": "address" },
- { "internalType": "address", "name": "to", "type": "address" },
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
- ],
- "name": "transferFrom",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "from",
- "type": "tuple"
- },
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "to",
- "type": "tuple"
- },
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
- ],
- "name": "transferFromCross",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "uniqueCollectionType",
- "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
- "stateMutability": "view",
- "type": "function"
- }
-]
tests/src/eth/nonFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -102,7 +102,7 @@
if (propertyKey && propertyValue) {
// Set URL or suffix
- await contract.methods.setProperty(tokenId, propertyKey, Buffer.from(propertyValue)).send();
+ await contract.methods.setProperties(tokenId, [{key: propertyKey, value: Buffer.from(propertyValue)}]).send();
}
const event = result.events.Transfer;
tests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth--- a/tests/src/eth/nonFungibleAbi.json
+++ /dev/null
@@ -1,842 +0,0 @@
-[
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "owner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "approved",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "uint256",
- "name": "tokenId",
- "type": "uint256"
- }
- ],
- "name": "Approval",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "owner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "bool",
- "name": "approved",
- "type": "bool"
- }
- ],
- "name": "ApprovalForAll",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [],
- "name": "MintingFinished",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "uint256",
- "name": "tokenId",
- "type": "uint256"
- }
- ],
- "name": "Transfer",
- "type": "event"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "newAdmin", "type": "address" }
- ],
- "name": "addCollectionAdmin",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "newAdmin",
- "type": "tuple"
- }
- ],
- "name": "addCollectionAdminCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "user", "type": "address" }
- ],
- "name": "addToCollectionAllowList",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "user",
- "type": "tuple"
- }
- ],
- "name": "addToCollectionAllowListCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "user", "type": "address" }
- ],
- "name": "allowed",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "approved", "type": "address" },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "approve",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "approved",
- "type": "tuple"
- },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "approveCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "owner", "type": "address" }
- ],
- "name": "balanceOf",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "burn",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "from", "type": "address" },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "burnFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "from",
- "type": "tuple"
- },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "burnFromCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "newOwner", "type": "address" }
- ],
- "name": "changeCollectionOwner",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "collectionAdmins",
- "outputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount[]",
- "name": "",
- "type": "tuple[]"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "collectionOwner",
- "outputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "",
- "type": "tuple"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string[]", "name": "keys", "type": "string[]" }
- ],
- "name": "collectionProperties",
- "outputs": [
- {
- "components": [
- { "internalType": "string", "name": "field_0", "type": "string" },
- { "internalType": "bytes", "name": "field_1", "type": "bytes" }
- ],
- "internalType": "struct Tuple22[]",
- "name": "",
- "type": "tuple[]"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
- "name": "collectionProperty",
- "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "collectionSponsor",
- "outputs": [
- {
- "components": [
- { "internalType": "address", "name": "field_0", "type": "address" },
- { "internalType": "uint256", "name": "field_1", "type": "uint256" }
- ],
- "internalType": "struct Tuple25",
- "name": "",
- "type": "tuple"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "confirmCollectionSponsorship",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "contractAddress",
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string[]", "name": "keys", "type": "string[]" }
- ],
- "name": "deleteCollectionProperties",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
- "name": "deleteCollectionProperty",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
- { "internalType": "string[]", "name": "keys", "type": "string[]" }
- ],
- "name": "deleteProperties",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "finishMinting",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "getApproved",
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "hasCollectionPendingSponsor",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "owner", "type": "address" },
- { "internalType": "address", "name": "operator", "type": "address" }
- ],
- "name": "isApprovedForAll",
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "user", "type": "address" }
- ],
- "name": "isOwnerOrAdmin",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "user",
- "type": "tuple"
- }
- ],
- "name": "isOwnerOrAdminCross",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "address", "name": "to", "type": "address" }],
- "name": "mint",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "to", "type": "address" },
- { "internalType": "string", "name": "tokenUri", "type": "string" }
- ],
- "name": "mintWithTokenURI",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "mintingFinished",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "name",
- "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "nextTokenId",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "ownerOf",
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
- { "internalType": "string", "name": "key", "type": "string" }
- ],
- "name": "property",
- "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "admin", "type": "address" }
- ],
- "name": "removeCollectionAdmin",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "admin",
- "type": "tuple"
- }
- ],
- "name": "removeCollectionAdminCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "removeCollectionSponsor",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "user", "type": "address" }
- ],
- "name": "removeFromCollectionAllowList",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "user",
- "type": "tuple"
- }
- ],
- "name": "removeFromCollectionAllowListCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "from", "type": "address" },
- { "internalType": "address", "name": "to", "type": "address" },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "safeTransferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "from", "type": "address" },
- { "internalType": "address", "name": "to", "type": "address" },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
- { "internalType": "bytes", "name": "data", "type": "bytes" }
- ],
- "name": "safeTransferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "operator", "type": "address" },
- { "internalType": "bool", "name": "approved", "type": "bool" }
- ],
- "name": "setApprovalForAll",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],
- "name": "setCollectionAccess",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string", "name": "limit", "type": "string" },
- { "internalType": "uint32", "name": "value", "type": "uint32" }
- ],
- "name": "setCollectionLimit",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string", "name": "limit", "type": "string" },
- { "internalType": "bool", "name": "value", "type": "bool" }
- ],
- "name": "setCollectionLimit",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],
- "name": "setCollectionMintMode",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],
- "name": "setCollectionNesting",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "bool", "name": "enable", "type": "bool" },
- {
- "internalType": "address[]",
- "name": "collections",
- "type": "address[]"
- }
- ],
- "name": "setCollectionNesting",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "string", "name": "field_0", "type": "string" },
- { "internalType": "bytes", "name": "field_1", "type": "bytes" }
- ],
- "internalType": "struct Tuple22[]",
- "name": "properties",
- "type": "tuple[]"
- }
- ],
- "name": "setCollectionProperties",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string", "name": "key", "type": "string" },
- { "internalType": "bytes", "name": "value", "type": "bytes" }
- ],
- "name": "setCollectionProperty",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "sponsor", "type": "address" }
- ],
- "name": "setCollectionSponsor",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "sponsor",
- "type": "tuple"
- }
- ],
- "name": "setCollectionSponsorCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "newOwner",
- "type": "tuple"
- }
- ],
- "name": "setOwnerCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
- {
- "components": [
- { "internalType": "string", "name": "field_0", "type": "string" },
- { "internalType": "bytes", "name": "field_1", "type": "bytes" }
- ],
- "internalType": "struct Tuple22[]",
- "name": "properties",
- "type": "tuple[]"
- }
- ],
- "name": "setProperties",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
- { "internalType": "string", "name": "key", "type": "string" },
- { "internalType": "bytes", "name": "value", "type": "bytes" }
- ],
- "name": "setProperty",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string", "name": "key", "type": "string" },
- { "internalType": "bool", "name": "isMutable", "type": "bool" },
- { "internalType": "bool", "name": "collectionAdmin", "type": "bool" },
- { "internalType": "bool", "name": "tokenOwner", "type": "bool" }
- ],
- "name": "setTokenPropertyPermission",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
- ],
- "name": "supportsInterface",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "symbol",
- "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "index", "type": "uint256" }
- ],
- "name": "tokenByIndex",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "owner", "type": "address" },
- { "internalType": "uint256", "name": "index", "type": "uint256" }
- ],
- "name": "tokenOfOwnerByIndex",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "tokenURI",
- "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "totalSupply",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "to", "type": "address" },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "transfer",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "to",
- "type": "tuple"
- },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "transferCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "from", "type": "address" },
- { "internalType": "address", "name": "to", "type": "address" },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "transferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "from",
- "type": "tuple"
- },
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "to",
- "type": "tuple"
- },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "transferFromCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "uniqueCollectionType",
- "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
- "stateMutability": "view",
- "type": "function"
- }
-]
tests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth--- a/tests/src/eth/proxy/nonFungibleProxy.test.ts
+++ b/tests/src/eth/proxy/nonFungibleProxy.test.ts
@@ -99,7 +99,44 @@
});
});
- itEth('Can perform mint()', async ({helper}) => {
+ // Soft-deprecated
+ itEth('[eth] Can perform mint()', async ({helper}) => {
+ const owner = await helper.eth.createAccountWithBalance(donor);
+ const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'A', 'A', 'A', '');
+ const caller = await helper.eth.createAccountWithBalance(donor);
+ const receiver = helper.eth.createAccount();
+
+ const collectionEvmOwned = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', caller, true);
+ const contract = await proxyWrap(helper, collectionEvm, donor);
+ await collectionEvmOwned.methods.addCollectionAdmin(contract.options.address).send();
+
+ {
+ const nextTokenId = await contract.methods.nextTokenId().call();
+ const result = await contract.methods.mintWithTokenURI(receiver, nextTokenId, 'Test URI').send({from: caller});
+ const tokenId = result.events.Transfer.returnValues.tokenId;
+ expect(tokenId).to.be.equal('1');
+
+ const events = helper.eth.normalizeEvents(result.events);
+ events[0].address = events[0].address.toLocaleLowerCase();
+
+ expect(events).to.be.deep.equal([
+ {
+ address: collectionAddress.toLocaleLowerCase(),
+ event: 'Transfer',
+ args: {
+ from: '0x0000000000000000000000000000000000000000',
+ to: receiver,
+ tokenId,
+ },
+ },
+ ]);
+
+ expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');
+ }
+ });
+
+ itEth('[cross] Can perform mint()', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'A', 'A', 'A', '');
const caller = await helper.eth.createAccountWithBalance(donor);
@@ -108,7 +145,8 @@
const collectionEvmOwned = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', caller);
const contract = await proxyWrap(helper, collectionEvm, donor);
- await collectionEvmOwned.methods.addCollectionAdmin(contract.options.address).send();
+ const contractAddressCross = helper.ethCrossAccount.fromAddress(contract.options.address);
+ await collectionEvmOwned.methods.addCollectionAdminCross(contractAddressCross).send();
{
const nextTokenId = await contract.methods.nextTokenId().call();
tests/src/eth/reFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -231,6 +231,7 @@
}
});
+ // Soft-deprecated
itEth('Can perform burnFrom()', async ({helper}) => {
const collection = await helper.rft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});
@@ -240,7 +241,7 @@
const token = await collection.mintToken(minter, 100n, {Ethereum: owner});
const address = helper.ethAddress.fromCollectionId(collection.collectionId);
- const contract = helper.ethNativeContract.collection(address, 'rft');
+ const contract = helper.ethNativeContract.collection(address, 'rft', spender, true);
const tokenAddress = helper.ethAddress.fromTokenId(collection.collectionId, token.tokenId);
const tokenContract = helper.ethNativeContract.rftToken(tokenAddress, owner);
@@ -248,7 +249,7 @@
await tokenContract.methods.approve(spender, 15).send();
{
- const result = await contract.methods.burnFrom(owner, token.tokenId).send({from: spender});
+ const result = await contract.methods.burnFrom(owner, token.tokenId).send();
const event = result.events.Transfer;
expect(event).to.be.like({
address: helper.ethAddress.fromCollectionId(collection.collectionId),
tests/src/eth/reFungibleAbi.jsondiffbeforeafterboth--- a/tests/src/eth/reFungibleAbi.json
+++ /dev/null
@@ -1,833 +0,0 @@
-[
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "owner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "approved",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "uint256",
- "name": "tokenId",
- "type": "uint256"
- }
- ],
- "name": "Approval",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "owner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "bool",
- "name": "approved",
- "type": "bool"
- }
- ],
- "name": "ApprovalForAll",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [],
- "name": "MintingFinished",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "uint256",
- "name": "tokenId",
- "type": "uint256"
- }
- ],
- "name": "Transfer",
- "type": "event"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "newAdmin", "type": "address" }
- ],
- "name": "addCollectionAdmin",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "newAdmin",
- "type": "tuple"
- }
- ],
- "name": "addCollectionAdminCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "user", "type": "address" }
- ],
- "name": "addToCollectionAllowList",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "user",
- "type": "tuple"
- }
- ],
- "name": "addToCollectionAllowListCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "user", "type": "address" }
- ],
- "name": "allowed",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "approved", "type": "address" },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "approve",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "owner", "type": "address" }
- ],
- "name": "balanceOf",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "burn",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "from", "type": "address" },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "burnFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "from",
- "type": "tuple"
- },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "burnFromCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "newOwner", "type": "address" }
- ],
- "name": "changeCollectionOwner",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "collectionAdmins",
- "outputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount[]",
- "name": "",
- "type": "tuple[]"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "collectionOwner",
- "outputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "",
- "type": "tuple"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string[]", "name": "keys", "type": "string[]" }
- ],
- "name": "collectionProperties",
- "outputs": [
- {
- "components": [
- { "internalType": "string", "name": "field_0", "type": "string" },
- { "internalType": "bytes", "name": "field_1", "type": "bytes" }
- ],
- "internalType": "struct Tuple21[]",
- "name": "",
- "type": "tuple[]"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
- "name": "collectionProperty",
- "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "collectionSponsor",
- "outputs": [
- {
- "components": [
- { "internalType": "address", "name": "field_0", "type": "address" },
- { "internalType": "uint256", "name": "field_1", "type": "uint256" }
- ],
- "internalType": "struct Tuple24",
- "name": "",
- "type": "tuple"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "confirmCollectionSponsorship",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "contractAddress",
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string[]", "name": "keys", "type": "string[]" }
- ],
- "name": "deleteCollectionProperties",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
- "name": "deleteCollectionProperty",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
- { "internalType": "string[]", "name": "keys", "type": "string[]" }
- ],
- "name": "deleteProperties",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "finishMinting",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "getApproved",
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "hasCollectionPendingSponsor",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "owner", "type": "address" },
- { "internalType": "address", "name": "operator", "type": "address" }
- ],
- "name": "isApprovedForAll",
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "user", "type": "address" }
- ],
- "name": "isOwnerOrAdmin",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "user",
- "type": "tuple"
- }
- ],
- "name": "isOwnerOrAdminCross",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "address", "name": "to", "type": "address" }],
- "name": "mint",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "to", "type": "address" },
- { "internalType": "string", "name": "tokenUri", "type": "string" }
- ],
- "name": "mintWithTokenURI",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "mintingFinished",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "name",
- "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "nextTokenId",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "ownerOf",
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
- { "internalType": "string", "name": "key", "type": "string" }
- ],
- "name": "property",
- "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "admin", "type": "address" }
- ],
- "name": "removeCollectionAdmin",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "admin",
- "type": "tuple"
- }
- ],
- "name": "removeCollectionAdminCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "removeCollectionSponsor",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "user", "type": "address" }
- ],
- "name": "removeFromCollectionAllowList",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "user",
- "type": "tuple"
- }
- ],
- "name": "removeFromCollectionAllowListCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "from", "type": "address" },
- { "internalType": "address", "name": "to", "type": "address" },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "safeTransferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "from", "type": "address" },
- { "internalType": "address", "name": "to", "type": "address" },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
- { "internalType": "bytes", "name": "data", "type": "bytes" }
- ],
- "name": "safeTransferFromWithData",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "operator", "type": "address" },
- { "internalType": "bool", "name": "approved", "type": "bool" }
- ],
- "name": "setApprovalForAll",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],
- "name": "setCollectionAccess",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string", "name": "limit", "type": "string" },
- { "internalType": "uint32", "name": "value", "type": "uint32" }
- ],
- "name": "setCollectionLimit",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string", "name": "limit", "type": "string" },
- { "internalType": "bool", "name": "value", "type": "bool" }
- ],
- "name": "setCollectionLimit",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],
- "name": "setCollectionMintMode",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],
- "name": "setCollectionNesting",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "bool", "name": "enable", "type": "bool" },
- {
- "internalType": "address[]",
- "name": "collections",
- "type": "address[]"
- }
- ],
- "name": "setCollectionNesting",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "string", "name": "field_0", "type": "string" },
- { "internalType": "bytes", "name": "field_1", "type": "bytes" }
- ],
- "internalType": "struct Tuple21[]",
- "name": "properties",
- "type": "tuple[]"
- }
- ],
- "name": "setCollectionProperties",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string", "name": "key", "type": "string" },
- { "internalType": "bytes", "name": "value", "type": "bytes" }
- ],
- "name": "setCollectionProperty",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "sponsor", "type": "address" }
- ],
- "name": "setCollectionSponsor",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "sponsor",
- "type": "tuple"
- }
- ],
- "name": "setCollectionSponsorCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "newOwner",
- "type": "tuple"
- }
- ],
- "name": "setOwnerCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
- {
- "components": [
- { "internalType": "string", "name": "field_0", "type": "string" },
- { "internalType": "bytes", "name": "field_1", "type": "bytes" }
- ],
- "internalType": "struct Tuple21[]",
- "name": "properties",
- "type": "tuple[]"
- }
- ],
- "name": "setProperties",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
- { "internalType": "string", "name": "key", "type": "string" },
- { "internalType": "bytes", "name": "value", "type": "bytes" }
- ],
- "name": "setProperty",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string", "name": "key", "type": "string" },
- { "internalType": "bool", "name": "isMutable", "type": "bool" },
- { "internalType": "bool", "name": "collectionAdmin", "type": "bool" },
- { "internalType": "bool", "name": "tokenOwner", "type": "bool" }
- ],
- "name": "setTokenPropertyPermission",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
- ],
- "name": "supportsInterface",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "symbol",
- "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "index", "type": "uint256" }
- ],
- "name": "tokenByIndex",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "token", "type": "uint256" }
- ],
- "name": "tokenContractAddress",
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "owner", "type": "address" },
- { "internalType": "uint256", "name": "index", "type": "uint256" }
- ],
- "name": "tokenOfOwnerByIndex",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "tokenURI",
- "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "totalSupply",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "to", "type": "address" },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "transfer",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "to",
- "type": "tuple"
- },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "transferCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "from", "type": "address" },
- { "internalType": "address", "name": "to", "type": "address" },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "transferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "from",
- "type": "tuple"
- },
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct EthCrossAccount",
- "name": "to",
- "type": "tuple"
- },
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "transferFromCross",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "uniqueCollectionType",
- "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
- "stateMutability": "view",
- "type": "function"
- }
-]
tests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth--- a/tests/src/eth/reFungibleToken.test.ts
+++ b/tests/src/eth/reFungibleToken.test.ts
@@ -94,7 +94,8 @@
if (propertyKey && propertyValue) {
// Set URL or suffix
- await contract.methods.setProperty(tokenId, propertyKey, Buffer.from(propertyValue)).send();
+
+ await contract.methods.setProperties(tokenId, [{key: propertyKey, value: Buffer.from(propertyValue)}]).send();
}
return {contract, nextTokenId: tokenId};
tests/src/eth/reFungibleTokenAbi.jsondiffbeforeafterboth--- a/tests/src/eth/reFungibleTokenAbi.json
+++ /dev/null
@@ -1,172 +0,0 @@
-[
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "owner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "spender",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "value",
- "type": "uint256"
- }
- ],
- "name": "Approval",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "value",
- "type": "uint256"
- }
- ],
- "name": "Transfer",
- "type": "event"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "owner", "type": "address" },
- { "internalType": "address", "name": "spender", "type": "address" }
- ],
- "name": "allowance",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "spender", "type": "address" },
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
- ],
- "name": "approve",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "owner", "type": "address" }
- ],
- "name": "balanceOf",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "from", "type": "address" },
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
- ],
- "name": "burnFrom",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "decimals",
- "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "name",
- "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "parentToken",
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "parentTokenId",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
- ],
- "name": "repartition",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
- ],
- "name": "supportsInterface",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "symbol",
- "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "totalSupply",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "to", "type": "address" },
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
- ],
- "name": "transfer",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "from", "type": "address" },
- { "internalType": "address", "name": "to", "type": "address" },
- { "internalType": "uint256", "name": "amount", "type": "uint256" }
- ],
- "name": "transferFrom",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- }
-]
tests/src/eth/tokenProperties.test.tsdiffbeforeafterboth--- a/tests/src/eth/tokenProperties.test.ts
+++ b/tests/src/eth/tokenProperties.test.ts
@@ -65,6 +65,30 @@
const address = helper.ethAddress.fromCollectionId(collection.collectionId);
const contract = helper.ethNativeContract.collection(address, 'nft', caller);
+ await contract.methods.setProperties(token.tokenId, [{key: 'testKey', value: Buffer.from('testValue')}]).send({from: caller});
+
+ const [{value}] = await token.getProperties(['testKey']);
+ expect(value).to.equal('testValue');
+ });
+
+ // Soft-deprecated
+ itEth('Property can be set', async({helper}) => {
+ const caller = await helper.eth.createAccountWithBalance(donor);
+ const collection = await helper.nft.mintCollection(alice, {
+ tokenPropertyPermissions: [{
+ key: 'testKey',
+ permission: {
+ collectionAdmin: true,
+ },
+ }],
+ });
+ const token = await collection.mintToken(alice);
+
+ await collection.addAdmin(alice, {Ethereum: caller});
+
+ const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+ const contract = helper.ethNativeContract.collection(address, 'nft', caller, true);
+
await contract.methods.setProperty(token.tokenId, 'testKey', Buffer.from('testValue')).send({from: caller});
const [{value}] = await token.getProperties(['testKey']);
@@ -74,8 +98,8 @@
itEth('Can be multiple set for NFT ', async({helper}) => {
const caller = await helper.eth.createAccountWithBalance(donor);
- const properties = Array(5).fill(0).map((_, i) => { return {field_0: `key_${i}`, field_1: Buffer.from(`value_${i}`)}; });
- const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.field_0, permission: {tokenOwner: true,
+ const properties = Array(5).fill(0).map((_, i) => { return {key: `key_${i}`, value: Buffer.from(`value_${i}`)}; });
+ const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.key, permission: {tokenOwner: true,
collectionAdmin: true,
mutable: true}}; });
@@ -86,7 +110,7 @@
const token = await collection.mintToken(alice);
- const valuesBefore = await token.getProperties(properties.map(p => p.field_0));
+ const valuesBefore = await token.getProperties(properties.map(p => p.key));
expect(valuesBefore).to.be.deep.equal([]);
await collection.addAdmin(alice, {Ethereum: caller});
@@ -96,15 +120,15 @@
await contract.methods.setProperties(token.tokenId, properties).send({from: caller});
- const values = await token.getProperties(properties.map(p => p.field_0));
- expect(values).to.be.deep.equal(properties.map(p => { return {key: p.field_0, value: p.field_1.toString()}; }));
+ const values = await token.getProperties(properties.map(p => p.key));
+ expect(values).to.be.deep.equal(properties.map(p => { return {key: p.key, value: p.value.toString()}; }));
});
itEth.ifWithPallets('Can be multiple set for RFT ', [Pallets.ReFungible], async({helper}) => {
const caller = await helper.eth.createAccountWithBalance(donor);
- const properties = Array(5).fill(0).map((_, i) => { return {field_0: `key_${i}`, field_1: Buffer.from(`value_${i}`)}; });
- const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.field_0, permission: {tokenOwner: true,
+ const properties = Array(5).fill(0).map((_, i) => { return {key: `key_${i}`, value: Buffer.from(`value_${i}`)}; });
+ const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.key, permission: {tokenOwner: true,
collectionAdmin: true,
mutable: true}}; });
@@ -115,7 +139,7 @@
const token = await collection.mintToken(alice);
- const valuesBefore = await token.getProperties(properties.map(p => p.field_0));
+ const valuesBefore = await token.getProperties(properties.map(p => p.key));
expect(valuesBefore).to.be.deep.equal([]);
await collection.addAdmin(alice, {Ethereum: caller});
@@ -125,8 +149,8 @@
await contract.methods.setProperties(token.tokenId, properties).send({from: caller});
- const values = await token.getProperties(properties.map(p => p.field_0));
- expect(values).to.be.deep.equal(properties.map(p => { return {key: p.field_0, value: p.field_1.toString()}; }));
+ const values = await token.getProperties(properties.map(p => p.key));
+ expect(values).to.be.deep.equal(properties.map(p => { return {key: p.key, value: p.value.toString()}; }));
});
itEth('Can be deleted', async({helper}) => {
tests/src/eth/util/contractHelpersAbi.jsondiffbeforeafterboth--- a/tests/src/eth/util/contractHelpersAbi.json
+++ /dev/null
@@ -1,314 +0,0 @@
-[
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- }
- ],
- "name": "ContractSponsorRemoved",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "address",
- "name": "sponsor",
- "type": "address"
- }
- ],
- "name": "ContractSponsorSet",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "address",
- "name": "sponsor",
- "type": "address"
- }
- ],
- "name": "ContractSponsorshipConfirmed",
- "type": "event"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- },
- { "internalType": "address", "name": "user", "type": "address" }
- ],
- "name": "allowed",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- }
- ],
- "name": "allowlistEnabled",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- }
- ],
- "name": "confirmSponsorship",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- }
- ],
- "name": "contractOwner",
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- }
- ],
- "name": "hasPendingSponsor",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- }
- ],
- "name": "hasSponsor",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- }
- ],
- "name": "removeSponsor",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- }
- ],
- "name": "selfSponsoredEnable",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- },
- { "internalType": "address", "name": "sponsor", "type": "address" }
- ],
- "name": "setSponsor",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- },
- { "internalType": "uint256", "name": "feeLimit", "type": "uint256" }
- ],
- "name": "setSponsoringFeeLimit",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- },
- { "internalType": "uint8", "name": "mode", "type": "uint8" }
- ],
- "name": "setSponsoringMode",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- },
- { "internalType": "uint32", "name": "rateLimit", "type": "uint32" }
- ],
- "name": "setSponsoringRateLimit",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- }
- ],
- "name": "sponsor",
- "outputs": [
- {
- "components": [
- { "internalType": "address", "name": "field_0", "type": "address" },
- { "internalType": "uint256", "name": "field_1", "type": "uint256" }
- ],
- "internalType": "struct Tuple0",
- "name": "",
- "type": "tuple"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- }
- ],
- "name": "sponsoringEnabled",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- }
- ],
- "name": "sponsoringFeeLimit",
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- }
- ],
- "name": "sponsoringRateLimit",
- "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
- ],
- "name": "supportsInterface",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- },
- { "internalType": "address", "name": "user", "type": "address" },
- { "internalType": "bool", "name": "isAllowed", "type": "bool" }
- ],
- "name": "toggleAllowed",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "contractAddress",
- "type": "address"
- },
- { "internalType": "bool", "name": "enabled", "type": "bool" }
- ],
- "name": "toggleAllowlist",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- }
-]
tests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -21,12 +21,15 @@
import {ContractImports, CompiledContract, TEthCrossAccount, NormalizedEvent, EthProperty} from './types';
// Native contracts ABI
-import collectionHelpersAbi from '../../collectionHelpersAbi.json';
-import fungibleAbi from '../../fungibleAbi.json';
-import nonFungibleAbi from '../../nonFungibleAbi.json';
-import refungibleAbi from '../../reFungibleAbi.json';
-import refungibleTokenAbi from '../../reFungibleTokenAbi.json';
-import contractHelpersAbi from './../contractHelpersAbi.json';
+import collectionHelpersAbi from '../../abi/collectionHelpers.json';
+import fungibleAbi from '../../abi/fungible.json';
+import fungibleDeprecatedAbi from '../../abi/fungibleDeprecated.json';
+import nonFungibleAbi from '../../abi/nonFungible.json';
+import nonFungibleDeprecatedAbi from '../../abi/nonFungibleDeprecated.json';
+import refungibleAbi from '../../abi/reFungible.json';
+import refungibleDeprecatedAbi from '../../abi/reFungibleDeprecated.json';
+import refungibleTokenAbi from '../../abi/reFungibleToken.json';
+import contractHelpersAbi from '../../abi/contractHelpers.json';
import {ICrossAccountId, TEthereumAccount} from '../../../util/playgrounds/types';
import {TCollectionMode} from '../../../util/playgrounds/types';
@@ -108,12 +111,20 @@
return new web3.eth.Contract(collectionHelpersAbi as any, '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f', {from: caller, gas: this.helper.eth.DEFAULT_GAS});
}
- collection(address: string, mode: TCollectionMode, caller?: string): Contract {
- const abi = {
+ collection(address: string, mode: TCollectionMode, caller?: string, mergeDeprecated = false): Contract {
+ let abi = {
'nft': nonFungibleAbi,
'rft': refungibleAbi,
'ft': fungibleAbi,
}[mode];
+ if (mergeDeprecated) {
+ const deprecated = {
+ 'nft': nonFungibleDeprecatedAbi,
+ 'rft': refungibleDeprecatedAbi,
+ 'ft': fungibleDeprecatedAbi,
+ }[mode];
+ abi = [...abi,...deprecated];
+ }
const web3 = this.helper.getWeb3();
return new web3.eth.Contract(abi as any, address, {gas: this.helper.eth.DEFAULT_GAS, ...(caller ? {from: caller} : {})});
}