difftreelog
Merge branch 'develop' into tests/eth-helpers
in: master
21 files changed
pallets/common/src/erc.rsdiffbeforeafterboth--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -37,6 +37,7 @@
Pallet, CollectionHandle, Config, CollectionProperties, SelfWeightOf,
eth::{
EthCrossAccount, convert_cross_account_to_uint256, CollectionPermissions as EvmPermissions,
+ CollectionLimits as EvmCollectionLimits,
},
weights::WeightInfo,
};
@@ -304,6 +305,99 @@
Ok(result)
}
+ /// Get current collection limits.
+ ///
+ /// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:
+ /// "accountTokenOwnershipLimit",
+ /// "sponsoredDataSize",
+ /// "sponsoredDataRateLimit",
+ /// "tokenLimit",
+ /// "sponsorTransferTimeout",
+ /// "sponsorApproveTimeout"
+ /// "ownerCanTransfer",
+ /// "ownerCanDestroy",
+ /// "transfersEnabled"
+ /// Return `false` if a limit not set.
+ fn collection_limits(&self) -> Result<Vec<(EvmCollectionLimits, bool, uint256)>> {
+ let convert_value_limit = |limit: EvmCollectionLimits,
+ value: Option<u32>|
+ -> (EvmCollectionLimits, bool, uint256) {
+ value
+ .map(|v| (limit, true, v.into()))
+ .unwrap_or((limit, false, Default::default()))
+ };
+
+ let convert_bool_limit = |limit: EvmCollectionLimits,
+ value: Option<bool>|
+ -> (EvmCollectionLimits, bool, uint256) {
+ value
+ .map(|v| {
+ (
+ limit,
+ true,
+ if v {
+ uint256::from(1)
+ } else {
+ Default::default()
+ },
+ )
+ })
+ .unwrap_or((limit, false, Default::default()))
+ };
+
+ let limits = &self.collection.limits;
+
+ Ok(vec![
+ convert_value_limit(
+ EvmCollectionLimits::AccountTokenOwnership,
+ limits.account_token_ownership_limit,
+ ),
+ convert_value_limit(
+ EvmCollectionLimits::SponsoredDataSize,
+ limits.sponsored_data_size,
+ ),
+ limits
+ .sponsored_data_rate_limit
+ .and_then(|limit| {
+ if let SponsoringRateLimit::Blocks(blocks) = limit {
+ Some((
+ EvmCollectionLimits::SponsoredDataRateLimit,
+ true,
+ blocks.into(),
+ ))
+ } else {
+ None
+ }
+ })
+ .unwrap_or((
+ EvmCollectionLimits::SponsoredDataRateLimit,
+ false,
+ Default::default(),
+ )),
+ convert_value_limit(EvmCollectionLimits::TokenLimit, limits.token_limit),
+ convert_value_limit(
+ EvmCollectionLimits::SponsorTransferTimeout,
+ limits.sponsor_transfer_timeout,
+ ),
+ convert_value_limit(
+ EvmCollectionLimits::SponsorApproveTimeout,
+ limits.sponsor_approve_timeout,
+ ),
+ convert_bool_limit(
+ EvmCollectionLimits::OwnerCanTransfer,
+ limits.owner_can_transfer,
+ ),
+ convert_bool_limit(
+ EvmCollectionLimits::OwnerCanDestroy,
+ limits.owner_can_destroy,
+ ),
+ convert_bool_limit(
+ EvmCollectionLimits::TransferEnabled,
+ limits.transfers_enabled,
+ ),
+ ])
+ }
+
/// Set limits for the collection.
/// @dev Throws error if limit not found.
/// @param limit Name of the limit. Valid names:
@@ -316,11 +410,22 @@
/// "ownerCanTransfer",
/// "ownerCanDestroy",
/// "transfersEnabled"
+ /// @param status enable\disable limit. Works only with `true`.
/// @param value Value of the limit.
#[solidity(rename_selector = "setCollectionLimit")]
- fn set_int_limit(&mut self, caller: caller, limit: string, value: uint256) -> Result<void> {
+ fn set_collection_limit(
+ &mut self,
+ caller: caller,
+ limit: EvmCollectionLimits,
+ status: bool,
+ value: uint256,
+ ) -> Result<void> {
self.consume_store_reads_and_writes(1, 1)?;
+ if !status {
+ return Err(Error::Revert("user can't disable limits".into()));
+ }
+
let value = value
.try_into()
.map_err(|_| Error::Revert(format!("can't convert value to u32 \"{}\"", value)))?;
@@ -338,35 +443,35 @@
let mut limits = self.limits.clone();
- match limit.as_str() {
- "accountTokenOwnershipLimit" => {
+ match limit {
+ EvmCollectionLimits::AccountTokenOwnership => {
limits.account_token_ownership_limit = Some(value);
}
- "sponsoredDataSize" => {
+ EvmCollectionLimits::SponsoredDataSize => {
limits.sponsored_data_size = Some(value);
}
- "sponsoredDataRateLimit" => {
+ EvmCollectionLimits::SponsoredDataRateLimit => {
limits.sponsored_data_rate_limit = Some(SponsoringRateLimit::Blocks(value));
}
- "tokenLimit" => {
+ EvmCollectionLimits::TokenLimit => {
limits.token_limit = Some(value);
}
- "sponsorTransferTimeout" => {
+ EvmCollectionLimits::SponsorTransferTimeout => {
limits.sponsor_transfer_timeout = Some(value);
}
- "sponsorApproveTimeout" => {
+ EvmCollectionLimits::SponsorApproveTimeout => {
limits.sponsor_approve_timeout = Some(value);
}
- "ownerCanTransfer" => {
+ EvmCollectionLimits::OwnerCanTransfer => {
limits.owner_can_transfer = Some(convert_value_to_bool()?);
}
- "ownerCanDestroy" => {
+ EvmCollectionLimits::OwnerCanDestroy => {
limits.owner_can_destroy = Some(convert_value_to_bool()?);
}
- "transfersEnabled" => {
+ EvmCollectionLimits::TransferEnabled => {
limits.transfers_enabled = Some(convert_value_to_bool()?);
}
- _ => return Err(Error::Revert(format!("unknown limit \"{}\"", limit))),
+ _ => return Err(Error::Revert(format!("unknown limit \"{:?}\"", limit))),
}
let caller = T::CrossAccountId::from_eth(caller);
pallets/common/src/eth.rsdiffbeforeafterboth--- a/pallets/common/src/eth.rs
+++ b/pallets/common/src/eth.rs
@@ -155,6 +155,31 @@
}
}
}
+
+/// [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.
+#[derive(Debug, Default, Clone, Copy, AbiCoder)]
+#[repr(u8)]
+pub enum CollectionLimits {
+ /// How many tokens can a user have on one account.
+ #[default]
+ AccountTokenOwnership,
+ /// How many bytes of data are available for sponsorship.
+ SponsoredDataSize,
+ /// In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]
+ SponsoredDataRateLimit,
+ /// How many tokens can be mined into this collection.
+ TokenLimit,
+ /// Timeouts for transfer sponsoring.
+ SponsorTransferTimeout,
+ /// Timeout for sponsoring an approval in passed blocks.
+ SponsorApproveTimeout,
+ /// Whether the collection owner of the collection can send tokens (which belong to other users).
+ OwnerCanTransfer,
+ /// Can the collection owner burn other people's tokens.
+ OwnerCanDestroy,
+ /// Is it possible to send tokens from this collection between users.
+ TransferEnabled,
+}
#[derive(Default, Debug, Clone, Copy, AbiCoder)]
#[repr(u8)]
pub enum CollectionPermissions {
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,7 +18,7 @@
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0xb5e1747f
+/// @dev the ERC-165 identifier for this interface is 0x81172a75
contract Collection is Dummy, ERC165 {
// /// Set collection property.
// ///
@@ -158,6 +158,27 @@
return Tuple8(0x0000000000000000000000000000000000000000, 0);
}
+ /// Get current collection limits.
+ ///
+ /// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:
+ /// "accountTokenOwnershipLimit",
+ /// "sponsoredDataSize",
+ /// "sponsoredDataRateLimit",
+ /// "tokenLimit",
+ /// "sponsorTransferTimeout",
+ /// "sponsorApproveTimeout"
+ /// "ownerCanTransfer",
+ /// "ownerCanDestroy",
+ /// "transfersEnabled"
+ /// Return `false` if a limit not set.
+ /// @dev EVM selector for this function is: 0xf63bc572,
+ /// or in textual repr: collectionLimits()
+ function collectionLimits() public view returns (Tuple20[] memory) {
+ require(false, stub_error);
+ dummy;
+ return new Tuple20[](0);
+ }
+
/// Set limits for the collection.
/// @dev Throws error if limit not found.
/// @param limit Name of the limit. Valid names:
@@ -170,12 +191,18 @@
/// "ownerCanTransfer",
/// "ownerCanDestroy",
/// "transfersEnabled"
+ /// @param status enable\disable limit. Works only with `true`.
/// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x4ad890a8,
- /// or in textual repr: setCollectionLimit(string,uint256)
- function setCollectionLimit(string memory limit, uint256 value) public {
+ /// @dev EVM selector for this function is: 0x88150bd0,
+ /// or in textual repr: setCollectionLimit(uint8,bool,uint256)
+ function setCollectionLimit(
+ CollectionLimits limit,
+ bool status,
+ uint256 value
+ ) public {
require(false, stub_error);
limit;
+ status;
value;
dummy = 0;
}
@@ -257,19 +284,19 @@
/// Returns nesting for a collection
/// @dev EVM selector for this function is: 0x22d25bfe,
/// or in textual repr: collectionNestingRestrictedCollectionIds()
- function collectionNestingRestrictedCollectionIds() public view returns (Tuple21 memory) {
+ function collectionNestingRestrictedCollectionIds() public view returns (Tuple26 memory) {
require(false, stub_error);
dummy;
- return Tuple21(false, new uint256[](0));
+ return Tuple26(false, new uint256[](0));
}
/// Returns permissions for a collection
/// @dev EVM selector for this function is: 0x5b2eaf4b,
/// or in textual repr: collectionNestingPermissions()
- function collectionNestingPermissions() public view returns (Tuple24[] memory) {
+ function collectionNestingPermissions() public view returns (Tuple29[] memory) {
require(false, stub_error);
dummy;
- return new Tuple24[](0);
+ return new Tuple29[](0);
}
/// Set the collection access method.
@@ -449,17 +476,46 @@
}
/// @dev anonymous struct
-struct Tuple24 {
+struct Tuple29 {
CollectionPermissions field_0;
bool field_1;
}
/// @dev anonymous struct
-struct Tuple21 {
+struct Tuple26 {
bool field_0;
uint256[] field_1;
}
+/// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.
+enum CollectionLimits {
+ /// @dev How many tokens can a user have on one account.
+ AccountTokenOwnership,
+ /// @dev How many bytes of data are available for sponsorship.
+ SponsoredDataSize,
+ /// @dev In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]
+ SponsoredDataRateLimit,
+ /// @dev How many tokens can be mined into this collection.
+ TokenLimit,
+ /// @dev Timeouts for transfer sponsoring.
+ SponsorTransferTimeout,
+ /// @dev Timeout for sponsoring an approval in passed blocks.
+ SponsorApproveTimeout,
+ /// @dev Whether the collection owner of the collection can send tokens (which belong to other users).
+ OwnerCanTransfer,
+ /// @dev Can the collection owner burn other people's tokens.
+ OwnerCanDestroy,
+ /// @dev Is it possible to send tokens from this collection between users.
+ TransferEnabled
+}
+
+/// @dev anonymous struct
+struct Tuple20 {
+ CollectionLimits field_0;
+ bool field_1;
+ uint256 field_2;
+}
+
/// @dev Property struct
struct Property {
string key;
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,18 +42,19 @@
/// @param permissions Permissions for keys.
/// @dev EVM selector for this function is: 0xbd92983a,
/// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])
- function setTokenPropertyPermissions(Tuple48[] memory permissions) public {
+ function setTokenPropertyPermissions(Tuple59[] memory permissions) public {
require(false, stub_error);
permissions;
dummy = 0;
}
+ /// @notice Get permissions for token properties.
/// @dev EVM selector for this function is: 0xf23d7790,
/// or in textual repr: tokenPropertyPermissions()
- function tokenPropertyPermissions() public view returns (Tuple48[] memory) {
+ function tokenPropertyPermissions() public view returns (Tuple59[] memory) {
require(false, stub_error);
dummy;
- return new Tuple48[](0);
+ return new Tuple59[](0);
}
// /// @notice Set token property value.
@@ -132,26 +133,30 @@
bytes value;
}
+/// @dev Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.
enum EthTokenPermissions {
+ /// @dev Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]
Mutable,
+ /// @dev Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]
TokenOwner,
+ /// @dev Permission to change the property for the owner of the token. See [`up_data_structs::PropertyPermission::collection_admin`]
CollectionAdmin
}
/// @dev anonymous struct
-struct Tuple48 {
+struct Tuple59 {
string field_0;
- Tuple46[] field_1;
+ Tuple57[] field_1;
}
/// @dev anonymous struct
-struct Tuple46 {
+struct Tuple57 {
EthTokenPermissions field_0;
bool field_1;
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0xb5e1747f
+/// @dev the ERC-165 identifier for this interface is 0x81172a75
contract Collection is Dummy, ERC165 {
// /// Set collection property.
// ///
@@ -291,6 +296,27 @@
return Tuple30(0x0000000000000000000000000000000000000000, 0);
}
+ /// Get current collection limits.
+ ///
+ /// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:
+ /// "accountTokenOwnershipLimit",
+ /// "sponsoredDataSize",
+ /// "sponsoredDataRateLimit",
+ /// "tokenLimit",
+ /// "sponsorTransferTimeout",
+ /// "sponsorApproveTimeout"
+ /// "ownerCanTransfer",
+ /// "ownerCanDestroy",
+ /// "transfersEnabled"
+ /// Return `false` if a limit not set.
+ /// @dev EVM selector for this function is: 0xf63bc572,
+ /// or in textual repr: collectionLimits()
+ function collectionLimits() public view returns (Tuple33[] memory) {
+ require(false, stub_error);
+ dummy;
+ return new Tuple33[](0);
+ }
+
/// Set limits for the collection.
/// @dev Throws error if limit not found.
/// @param limit Name of the limit. Valid names:
@@ -303,12 +329,18 @@
/// "ownerCanTransfer",
/// "ownerCanDestroy",
/// "transfersEnabled"
+ /// @param status enable\disable limit. Works only with `true`.
/// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x4ad890a8,
- /// or in textual repr: setCollectionLimit(string,uint256)
- function setCollectionLimit(string memory limit, uint256 value) public {
+ /// @dev EVM selector for this function is: 0x88150bd0,
+ /// or in textual repr: setCollectionLimit(uint8,bool,uint256)
+ function setCollectionLimit(
+ CollectionLimits limit,
+ bool status,
+ uint256 value
+ ) public {
require(false, stub_error);
limit;
+ status;
value;
dummy = 0;
}
@@ -390,19 +422,19 @@
/// Returns nesting for a collection
/// @dev EVM selector for this function is: 0x22d25bfe,
/// or in textual repr: collectionNestingRestrictedCollectionIds()
- function collectionNestingRestrictedCollectionIds() public view returns (Tuple34 memory) {
+ function collectionNestingRestrictedCollectionIds() public view returns (Tuple39 memory) {
require(false, stub_error);
dummy;
- return Tuple34(false, new uint256[](0));
+ return Tuple39(false, new uint256[](0));
}
/// Returns permissions for a collection
/// @dev EVM selector for this function is: 0x5b2eaf4b,
/// or in textual repr: collectionNestingPermissions()
- function collectionNestingPermissions() public view returns (Tuple37[] memory) {
+ function collectionNestingPermissions() public view returns (Tuple42[] memory) {
require(false, stub_error);
dummy;
- return new Tuple37[](0);
+ return new Tuple42[](0);
}
/// Set the collection access method.
@@ -582,17 +614,46 @@
}
/// @dev anonymous struct
-struct Tuple37 {
+struct Tuple42 {
CollectionPermissions field_0;
bool field_1;
}
/// @dev anonymous struct
-struct Tuple34 {
+struct Tuple39 {
bool field_0;
uint256[] field_1;
}
+/// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.
+enum CollectionLimits {
+ /// @dev How many tokens can a user have on one account.
+ AccountTokenOwnership,
+ /// @dev How many bytes of data are available for sponsorship.
+ SponsoredDataSize,
+ /// @dev In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]
+ SponsoredDataRateLimit,
+ /// @dev How many tokens can be mined into this collection.
+ TokenLimit,
+ /// @dev Timeouts for transfer sponsoring.
+ SponsorTransferTimeout,
+ /// @dev Timeout for sponsoring an approval in passed blocks.
+ SponsorApproveTimeout,
+ /// @dev Whether the collection owner of the collection can send tokens (which belong to other users).
+ OwnerCanTransfer,
+ /// @dev Can the collection owner burn other people's tokens.
+ OwnerCanDestroy,
+ /// @dev Is it possible to send tokens from this collection between users.
+ TransferEnabled
+}
+
+/// @dev anonymous struct
+struct Tuple33 {
+ CollectionLimits field_0;
+ bool field_1;
+ uint256 field_2;
+}
+
/// @dev anonymous struct
struct Tuple30 {
address field_0;
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,7 +42,7 @@
/// @param permissions Permissions for keys.
/// @dev EVM selector for this function is: 0xbd92983a,
/// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])
- function setTokenPropertyPermissions(Tuple53[] memory permissions) public {
+ function setTokenPropertyPermissions(Tuple58[] memory permissions) public {
require(false, stub_error);
permissions;
dummy = 0;
@@ -51,10 +51,10 @@
/// @notice Get permissions for token properties.
/// @dev EVM selector for this function is: 0xf23d7790,
/// or in textual repr: tokenPropertyPermissions()
- function tokenPropertyPermissions() public view returns (Tuple53[] memory) {
+ function tokenPropertyPermissions() public view returns (Tuple58[] memory) {
require(false, stub_error);
dummy;
- return new Tuple53[](0);
+ return new Tuple58[](0);
}
// /// @notice Set token property value.
@@ -133,26 +133,30 @@
bytes value;
}
+/// @dev Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.
enum EthTokenPermissions {
+ /// @dev Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]
Mutable,
+ /// @dev Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]
TokenOwner,
+ /// @dev Permission to change the property for the owner of the token. See [`up_data_structs::PropertyPermission::collection_admin`]
CollectionAdmin
}
/// @dev anonymous struct
-struct Tuple53 {
+struct Tuple58 {
string field_0;
- Tuple51[] field_1;
+ Tuple56[] field_1;
}
/// @dev anonymous struct
-struct Tuple51 {
+struct Tuple56 {
EthTokenPermissions field_0;
bool field_1;
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0xb5e1747f
+/// @dev the ERC-165 identifier for this interface is 0x81172a75
contract Collection is Dummy, ERC165 {
// /// Set collection property.
// ///
@@ -292,6 +296,27 @@
return Tuple29(0x0000000000000000000000000000000000000000, 0);
}
+ /// Get current collection limits.
+ ///
+ /// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:
+ /// "accountTokenOwnershipLimit",
+ /// "sponsoredDataSize",
+ /// "sponsoredDataRateLimit",
+ /// "tokenLimit",
+ /// "sponsorTransferTimeout",
+ /// "sponsorApproveTimeout"
+ /// "ownerCanTransfer",
+ /// "ownerCanDestroy",
+ /// "transfersEnabled"
+ /// Return `false` if a limit not set.
+ /// @dev EVM selector for this function is: 0xf63bc572,
+ /// or in textual repr: collectionLimits()
+ function collectionLimits() public view returns (Tuple32[] memory) {
+ require(false, stub_error);
+ dummy;
+ return new Tuple32[](0);
+ }
+
/// Set limits for the collection.
/// @dev Throws error if limit not found.
/// @param limit Name of the limit. Valid names:
@@ -304,12 +329,18 @@
/// "ownerCanTransfer",
/// "ownerCanDestroy",
/// "transfersEnabled"
+ /// @param status enable\disable limit. Works only with `true`.
/// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x4ad890a8,
- /// or in textual repr: setCollectionLimit(string,uint256)
- function setCollectionLimit(string memory limit, uint256 value) public {
+ /// @dev EVM selector for this function is: 0x88150bd0,
+ /// or in textual repr: setCollectionLimit(uint8,bool,uint256)
+ function setCollectionLimit(
+ CollectionLimits limit,
+ bool status,
+ uint256 value
+ ) public {
require(false, stub_error);
limit;
+ status;
value;
dummy = 0;
}
@@ -391,19 +422,19 @@
/// Returns nesting for a collection
/// @dev EVM selector for this function is: 0x22d25bfe,
/// or in textual repr: collectionNestingRestrictedCollectionIds()
- function collectionNestingRestrictedCollectionIds() public view returns (Tuple33 memory) {
+ function collectionNestingRestrictedCollectionIds() public view returns (Tuple38 memory) {
require(false, stub_error);
dummy;
- return Tuple33(false, new uint256[](0));
+ return Tuple38(false, new uint256[](0));
}
/// Returns permissions for a collection
/// @dev EVM selector for this function is: 0x5b2eaf4b,
/// or in textual repr: collectionNestingPermissions()
- function collectionNestingPermissions() public view returns (Tuple36[] memory) {
+ function collectionNestingPermissions() public view returns (Tuple41[] memory) {
require(false, stub_error);
dummy;
- return new Tuple36[](0);
+ return new Tuple41[](0);
}
/// Set the collection access method.
@@ -583,17 +614,46 @@
}
/// @dev anonymous struct
-struct Tuple36 {
+struct Tuple41 {
CollectionPermissions field_0;
bool field_1;
}
/// @dev anonymous struct
-struct Tuple33 {
+struct Tuple38 {
bool field_0;
uint256[] field_1;
}
+/// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.
+enum CollectionLimits {
+ /// @dev How many tokens can a user have on one account.
+ AccountTokenOwnership,
+ /// @dev How many bytes of data are available for sponsorship.
+ SponsoredDataSize,
+ /// @dev In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]
+ SponsoredDataRateLimit,
+ /// @dev How many tokens can be mined into this collection.
+ TokenLimit,
+ /// @dev Timeouts for transfer sponsoring.
+ SponsorTransferTimeout,
+ /// @dev Timeout for sponsoring an approval in passed blocks.
+ SponsorApproveTimeout,
+ /// @dev Whether the collection owner of the collection can send tokens (which belong to other users).
+ OwnerCanTransfer,
+ /// @dev Can the collection owner burn other people's tokens.
+ OwnerCanDestroy,
+ /// @dev Is it possible to send tokens from this collection between users.
+ TransferEnabled
+}
+
+/// @dev anonymous struct
+struct Tuple32 {
+ CollectionLimits field_0;
+ bool field_1;
+ uint256 field_2;
+}
+
/// @dev anonymous struct
struct Tuple29 {
address field_0;
tests/src/eth/abi/fungible.jsondiffbeforeafterboth--- a/tests/src/eth/abi/fungible.json
+++ b/tests/src/eth/abi/fungible.json
@@ -208,6 +208,28 @@
},
{
"inputs": [],
+ "name": "collectionLimits",
+ "outputs": [
+ {
+ "components": [
+ {
+ "internalType": "enum CollectionLimits",
+ "name": "field_0",
+ "type": "uint8"
+ },
+ { "internalType": "bool", "name": "field_1", "type": "bool" },
+ { "internalType": "uint256", "name": "field_2", "type": "uint256" }
+ ],
+ "internalType": "struct Tuple20[]",
+ "name": "",
+ "type": "tuple[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
"name": "collectionNestingPermissions",
"outputs": [
{
@@ -219,7 +241,7 @@
},
{ "internalType": "bool", "name": "field_1", "type": "bool" }
],
- "internalType": "struct Tuple24[]",
+ "internalType": "struct Tuple29[]",
"name": "",
"type": "tuple[]"
}
@@ -240,7 +262,7 @@
"type": "uint256[]"
}
],
- "internalType": "struct Tuple21",
+ "internalType": "struct Tuple26",
"name": "",
"type": "tuple"
}
@@ -453,7 +475,12 @@
},
{
"inputs": [
- { "internalType": "string", "name": "limit", "type": "string" },
+ {
+ "internalType": "enum CollectionLimits",
+ "name": "limit",
+ "type": "uint8"
+ },
+ { "internalType": "bool", "name": "status", "type": "bool" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
],
"name": "setCollectionLimit",
tests/src/eth/abi/nonFungible.jsondiffbeforeafterboth--- a/tests/src/eth/abi/nonFungible.json
+++ b/tests/src/eth/abi/nonFungible.json
@@ -238,6 +238,28 @@
},
{
"inputs": [],
+ "name": "collectionLimits",
+ "outputs": [
+ {
+ "components": [
+ {
+ "internalType": "enum CollectionLimits",
+ "name": "field_0",
+ "type": "uint8"
+ },
+ { "internalType": "bool", "name": "field_1", "type": "bool" },
+ { "internalType": "uint256", "name": "field_2", "type": "uint256" }
+ ],
+ "internalType": "struct Tuple33[]",
+ "name": "",
+ "type": "tuple[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
"name": "collectionNestingPermissions",
"outputs": [
{
@@ -249,7 +271,7 @@
},
{ "internalType": "bool", "name": "field_1", "type": "bool" }
],
- "internalType": "struct Tuple37[]",
+ "internalType": "struct Tuple42[]",
"name": "",
"type": "tuple[]"
}
@@ -270,7 +292,7 @@
"type": "uint256[]"
}
],
- "internalType": "struct Tuple34",
+ "internalType": "struct Tuple39",
"name": "",
"type": "tuple"
}
@@ -607,7 +629,12 @@
},
{
"inputs": [
- { "internalType": "string", "name": "limit", "type": "string" },
+ {
+ "internalType": "enum CollectionLimits",
+ "name": "limit",
+ "type": "uint8"
+ },
+ { "internalType": "bool", "name": "status", "type": "bool" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
],
"name": "setCollectionLimit",
@@ -709,12 +736,12 @@
},
{ "internalType": "bool", "name": "field_1", "type": "bool" }
],
- "internalType": "struct Tuple46[]",
+ "internalType": "struct Tuple57[]",
"name": "field_1",
"type": "tuple[]"
}
],
- "internalType": "struct Tuple48[]",
+ "internalType": "struct Tuple59[]",
"name": "permissions",
"type": "tuple[]"
}
@@ -775,12 +802,12 @@
},
{ "internalType": "bool", "name": "field_1", "type": "bool" }
],
- "internalType": "struct Tuple46[]",
+ "internalType": "struct Tuple57[]",
"name": "field_1",
"type": "tuple[]"
}
],
- "internalType": "struct Tuple48[]",
+ "internalType": "struct Tuple59[]",
"name": "",
"type": "tuple[]"
}
tests/src/eth/abi/reFungible.jsondiffbeforeafterboth1[2 {3 "anonymous": false,4 "inputs": [5 {6 "indexed": true,7 "internalType": "address",8 "name": "owner",9 "type": "address"10 },11 {12 "indexed": true,13 "internalType": "address",14 "name": "approved",15 "type": "address"16 },17 {18 "indexed": true,19 "internalType": "uint256",20 "name": "tokenId",21 "type": "uint256"22 }23 ],24 "name": "Approval",25 "type": "event"26 },27 {28 "anonymous": false,29 "inputs": [30 {31 "indexed": true,32 "internalType": "address",33 "name": "owner",34 "type": "address"35 },36 {37 "indexed": true,38 "internalType": "address",39 "name": "operator",40 "type": "address"41 },42 {43 "indexed": false,44 "internalType": "bool",45 "name": "approved",46 "type": "bool"47 }48 ],49 "name": "ApprovalForAll",50 "type": "event"51 },52 {53 "anonymous": false,54 "inputs": [],55 "name": "MintingFinished",56 "type": "event"57 },58 {59 "anonymous": false,60 "inputs": [61 {62 "indexed": true,63 "internalType": "address",64 "name": "from",65 "type": "address"66 },67 {68 "indexed": true,69 "internalType": "address",70 "name": "to",71 "type": "address"72 },73 {74 "indexed": true,75 "internalType": "uint256",76 "name": "tokenId",77 "type": "uint256"78 }79 ],80 "name": "Transfer",81 "type": "event"82 },83 {84 "inputs": [85 {86 "components": [87 { "internalType": "address", "name": "eth", "type": "address" },88 { "internalType": "uint256", "name": "sub", "type": "uint256" }89 ],90 "internalType": "struct EthCrossAccount",91 "name": "newAdmin",92 "type": "tuple"93 }94 ],95 "name": "addCollectionAdminCross",96 "outputs": [],97 "stateMutability": "nonpayable",98 "type": "function"99 },100 {101 "inputs": [102 {103 "components": [104 { "internalType": "address", "name": "eth", "type": "address" },105 { "internalType": "uint256", "name": "sub", "type": "uint256" }106 ],107 "internalType": "struct EthCrossAccount",108 "name": "user",109 "type": "tuple"110 }111 ],112 "name": "addToCollectionAllowListCross",113 "outputs": [],114 "stateMutability": "nonpayable",115 "type": "function"116 },117 {118 "inputs": [119 {120 "components": [121 { "internalType": "address", "name": "eth", "type": "address" },122 { "internalType": "uint256", "name": "sub", "type": "uint256" }123 ],124 "internalType": "struct EthCrossAccount",125 "name": "user",126 "type": "tuple"127 }128 ],129 "name": "allowlistedCross",130 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],131 "stateMutability": "view",132 "type": "function"133 },134 {135 "inputs": [136 { "internalType": "address", "name": "approved", "type": "address" },137 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }138 ],139 "name": "approve",140 "outputs": [],141 "stateMutability": "nonpayable",142 "type": "function"143 },144 {145 "inputs": [146 { "internalType": "address", "name": "owner", "type": "address" }147 ],148 "name": "balanceOf",149 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],150 "stateMutability": "view",151 "type": "function"152 },153 {154 "inputs": [155 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }156 ],157 "name": "burn",158 "outputs": [],159 "stateMutability": "nonpayable",160 "type": "function"161 },162 {163 "inputs": [164 {165 "components": [166 { "internalType": "address", "name": "eth", "type": "address" },167 { "internalType": "uint256", "name": "sub", "type": "uint256" }168 ],169 "internalType": "struct EthCrossAccount",170 "name": "from",171 "type": "tuple"172 },173 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }174 ],175 "name": "burnFromCross",176 "outputs": [],177 "stateMutability": "nonpayable",178 "type": "function"179 },180 {181 "inputs": [182 {183 "components": [184 { "internalType": "address", "name": "eth", "type": "address" },185 { "internalType": "uint256", "name": "sub", "type": "uint256" }186 ],187 "internalType": "struct EthCrossAccount",188 "name": "newOwner",189 "type": "tuple"190 }191 ],192 "name": "changeCollectionOwnerCross",193 "outputs": [],194 "stateMutability": "nonpayable",195 "type": "function"196 },197 {198 "inputs": [],199 "name": "collectionAdmins",200 "outputs": [201 {202 "components": [203 { "internalType": "address", "name": "eth", "type": "address" },204 { "internalType": "uint256", "name": "sub", "type": "uint256" }205 ],206 "internalType": "struct EthCrossAccount[]",207 "name": "",208 "type": "tuple[]"209 }210 ],211 "stateMutability": "view",212 "type": "function"213 },214 {215 "inputs": [],216 "name": "collectionHelperAddress",217 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],218 "stateMutability": "view",219 "type": "function"220 },221 {222 "inputs": [],223 "name": "collectionNestingPermissions",224 "outputs": [225 {226 "components": [227 {228 "internalType": "enum CollectionPermissions",229 "name": "field_0",230 "type": "uint8"231 },232 { "internalType": "bool", "name": "field_1", "type": "bool" }233 ],234 "internalType": "struct Tuple36[]",235 "name": "",236 "type": "tuple[]"237 }238 ],239 "stateMutability": "view",240 "type": "function"241 },242 {243 "inputs": [],244 "name": "collectionNestingRestrictedCollectionIds",245 "outputs": [246 {247 "components": [248 { "internalType": "bool", "name": "field_0", "type": "bool" },249 {250 "internalType": "uint256[]",251 "name": "field_1",252 "type": "uint256[]"253 }254 ],255 "internalType": "struct Tuple33",256 "name": "",257 "type": "tuple"258 }259 ],260 "stateMutability": "view",261 "type": "function"262 },263 {264 "inputs": [],265 "name": "collectionOwner",266 "outputs": [267 {268 "components": [269 { "internalType": "address", "name": "eth", "type": "address" },270 { "internalType": "uint256", "name": "sub", "type": "uint256" }271 ],272 "internalType": "struct EthCrossAccount",273 "name": "",274 "type": "tuple"275 }276 ],277 "stateMutability": "view",278 "type": "function"279 },280 {281 "inputs": [282 { "internalType": "string[]", "name": "keys", "type": "string[]" }283 ],284 "name": "collectionProperties",285 "outputs": [286 {287 "components": [288 { "internalType": "string", "name": "key", "type": "string" },289 { "internalType": "bytes", "name": "value", "type": "bytes" }290 ],291 "internalType": "struct Property[]",292 "name": "",293 "type": "tuple[]"294 }295 ],296 "stateMutability": "view",297 "type": "function"298 },299 {300 "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],301 "name": "collectionProperty",302 "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],303 "stateMutability": "view",304 "type": "function"305 },306 {307 "inputs": [],308 "name": "collectionSponsor",309 "outputs": [310 {311 "components": [312 { "internalType": "address", "name": "field_0", "type": "address" },313 { "internalType": "uint256", "name": "field_1", "type": "uint256" }314 ],315 "internalType": "struct Tuple29",316 "name": "",317 "type": "tuple"318 }319 ],320 "stateMutability": "view",321 "type": "function"322 },323 {324 "inputs": [],325 "name": "confirmCollectionSponsorship",326 "outputs": [],327 "stateMutability": "nonpayable",328 "type": "function"329 },330 {331 "inputs": [],332 "name": "contractAddress",333 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],334 "stateMutability": "view",335 "type": "function"336 },337 {338 "inputs": [339 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }340 ],341 "name": "crossOwnerOf",342 "outputs": [343 {344 "components": [345 { "internalType": "address", "name": "eth", "type": "address" },346 { "internalType": "uint256", "name": "sub", "type": "uint256" }347 ],348 "internalType": "struct EthCrossAccount",349 "name": "",350 "type": "tuple"351 }352 ],353 "stateMutability": "view",354 "type": "function"355 },356 {357 "inputs": [358 { "internalType": "string[]", "name": "keys", "type": "string[]" }359 ],360 "name": "deleteCollectionProperties",361 "outputs": [],362 "stateMutability": "nonpayable",363 "type": "function"364 },365 {366 "inputs": [367 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },368 { "internalType": "string[]", "name": "keys", "type": "string[]" }369 ],370 "name": "deleteProperties",371 "outputs": [],372 "stateMutability": "nonpayable",373 "type": "function"374 },375 {376 "inputs": [],377 "name": "description",378 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],379 "stateMutability": "view",380 "type": "function"381 },382 {383 "inputs": [],384 "name": "finishMinting",385 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],386 "stateMutability": "nonpayable",387 "type": "function"388 },389 {390 "inputs": [391 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }392 ],393 "name": "getApproved",394 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],395 "stateMutability": "view",396 "type": "function"397 },398 {399 "inputs": [],400 "name": "hasCollectionPendingSponsor",401 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],402 "stateMutability": "view",403 "type": "function"404 },405 {406 "inputs": [407 { "internalType": "address", "name": "owner", "type": "address" },408 { "internalType": "address", "name": "operator", "type": "address" }409 ],410 "name": "isApprovedForAll",411 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],412 "stateMutability": "view",413 "type": "function"414 },415 {416 "inputs": [417 {418 "components": [419 { "internalType": "address", "name": "eth", "type": "address" },420 { "internalType": "uint256", "name": "sub", "type": "uint256" }421 ],422 "internalType": "struct EthCrossAccount",423 "name": "user",424 "type": "tuple"425 }426 ],427 "name": "isOwnerOrAdminCross",428 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],429 "stateMutability": "view",430 "type": "function"431 },432 {433 "inputs": [{ "internalType": "address", "name": "to", "type": "address" }],434 "name": "mint",435 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],436 "stateMutability": "nonpayable",437 "type": "function"438 },439 {440 "inputs": [441 { "internalType": "address", "name": "to", "type": "address" },442 { "internalType": "string", "name": "tokenUri", "type": "string" }443 ],444 "name": "mintWithTokenURI",445 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],446 "stateMutability": "nonpayable",447 "type": "function"448 },449 {450 "inputs": [],451 "name": "mintingFinished",452 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],453 "stateMutability": "view",454 "type": "function"455 },456 {457 "inputs": [],458 "name": "name",459 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],460 "stateMutability": "view",461 "type": "function"462 },463 {464 "inputs": [],465 "name": "nextTokenId",466 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],467 "stateMutability": "view",468 "type": "function"469 },470 {471 "inputs": [472 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }473 ],474 "name": "ownerOf",475 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],476 "stateMutability": "view",477 "type": "function"478 },479 {480 "inputs": [481 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },482 { "internalType": "string[]", "name": "keys", "type": "string[]" }483 ],484 "name": "properties",485 "outputs": [486 {487 "components": [488 { "internalType": "string", "name": "key", "type": "string" },489 { "internalType": "bytes", "name": "value", "type": "bytes" }490 ],491 "internalType": "struct Property[]",492 "name": "",493 "type": "tuple[]"494 }495 ],496 "stateMutability": "view",497 "type": "function"498 },499 {500 "inputs": [501 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },502 { "internalType": "string", "name": "key", "type": "string" }503 ],504 "name": "property",505 "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],506 "stateMutability": "view",507 "type": "function"508 },509 {510 "inputs": [511 {512 "components": [513 { "internalType": "address", "name": "eth", "type": "address" },514 { "internalType": "uint256", "name": "sub", "type": "uint256" }515 ],516 "internalType": "struct EthCrossAccount",517 "name": "admin",518 "type": "tuple"519 }520 ],521 "name": "removeCollectionAdminCross",522 "outputs": [],523 "stateMutability": "nonpayable",524 "type": "function"525 },526 {527 "inputs": [],528 "name": "removeCollectionSponsor",529 "outputs": [],530 "stateMutability": "nonpayable",531 "type": "function"532 },533 {534 "inputs": [535 {536 "components": [537 { "internalType": "address", "name": "eth", "type": "address" },538 { "internalType": "uint256", "name": "sub", "type": "uint256" }539 ],540 "internalType": "struct EthCrossAccount",541 "name": "user",542 "type": "tuple"543 }544 ],545 "name": "removeFromCollectionAllowListCross",546 "outputs": [],547 "stateMutability": "nonpayable",548 "type": "function"549 },550 {551 "inputs": [552 { "internalType": "address", "name": "from", "type": "address" },553 { "internalType": "address", "name": "to", "type": "address" },554 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }555 ],556 "name": "safeTransferFrom",557 "outputs": [],558 "stateMutability": "nonpayable",559 "type": "function"560 },561 {562 "inputs": [563 { "internalType": "address", "name": "from", "type": "address" },564 { "internalType": "address", "name": "to", "type": "address" },565 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },566 { "internalType": "bytes", "name": "data", "type": "bytes" }567 ],568 "name": "safeTransferFromWithData",569 "outputs": [],570 "stateMutability": "nonpayable",571 "type": "function"572 },573 {574 "inputs": [575 { "internalType": "address", "name": "operator", "type": "address" },576 { "internalType": "bool", "name": "approved", "type": "bool" }577 ],578 "name": "setApprovalForAll",579 "outputs": [],580 "stateMutability": "nonpayable",581 "type": "function"582 },583 {584 "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],585 "name": "setCollectionAccess",586 "outputs": [],587 "stateMutability": "nonpayable",588 "type": "function"589 },590 {591 "inputs": [592 { "internalType": "string", "name": "limit", "type": "string" },593 { "internalType": "uint256", "name": "value", "type": "uint256" }594 ],595 "name": "setCollectionLimit",596 "outputs": [],597 "stateMutability": "nonpayable",598 "type": "function"599 },600 {601 "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],602 "name": "setCollectionMintMode",603 "outputs": [],604 "stateMutability": "nonpayable",605 "type": "function"606 },607 {608 "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],609 "name": "setCollectionNesting",610 "outputs": [],611 "stateMutability": "nonpayable",612 "type": "function"613 },614 {615 "inputs": [616 { "internalType": "bool", "name": "enable", "type": "bool" },617 {618 "internalType": "address[]",619 "name": "collections",620 "type": "address[]"621 }622 ],623 "name": "setCollectionNesting",624 "outputs": [],625 "stateMutability": "nonpayable",626 "type": "function"627 },628 {629 "inputs": [630 {631 "components": [632 { "internalType": "string", "name": "key", "type": "string" },633 { "internalType": "bytes", "name": "value", "type": "bytes" }634 ],635 "internalType": "struct Property[]",636 "name": "properties",637 "type": "tuple[]"638 }639 ],640 "name": "setCollectionProperties",641 "outputs": [],642 "stateMutability": "nonpayable",643 "type": "function"644 },645 {646 "inputs": [647 {648 "components": [649 { "internalType": "address", "name": "eth", "type": "address" },650 { "internalType": "uint256", "name": "sub", "type": "uint256" }651 ],652 "internalType": "struct EthCrossAccount",653 "name": "sponsor",654 "type": "tuple"655 }656 ],657 "name": "setCollectionSponsorCross",658 "outputs": [],659 "stateMutability": "nonpayable",660 "type": "function"661 },662 {663 "inputs": [664 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },665 {666 "components": [667 { "internalType": "string", "name": "key", "type": "string" },668 { "internalType": "bytes", "name": "value", "type": "bytes" }669 ],670 "internalType": "struct Property[]",671 "name": "properties",672 "type": "tuple[]"673 }674 ],675 "name": "setProperties",676 "outputs": [],677 "stateMutability": "nonpayable",678 "type": "function"679 },680 {681 "inputs": [682 {683 "components": [684 { "internalType": "string", "name": "field_0", "type": "string" },685 {686 "components": [687 {688 "internalType": "enum EthTokenPermissions",689 "name": "field_0",690 "type": "uint8"691 },692 { "internalType": "bool", "name": "field_1", "type": "bool" }693 ],694 "internalType": "struct Tuple51[]",695 "name": "field_1",696 "type": "tuple[]"697 }698 ],699 "internalType": "struct Tuple53[]",700 "name": "permissions",701 "type": "tuple[]"702 }703 ],704 "name": "setTokenPropertyPermissions",705 "outputs": [],706 "stateMutability": "nonpayable",707 "type": "function"708 },709 {710 "inputs": [711 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }712 ],713 "name": "supportsInterface",714 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],715 "stateMutability": "view",716 "type": "function"717 },718 {719 "inputs": [],720 "name": "symbol",721 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],722 "stateMutability": "view",723 "type": "function"724 },725 {726 "inputs": [727 { "internalType": "uint256", "name": "index", "type": "uint256" }728 ],729 "name": "tokenByIndex",730 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],731 "stateMutability": "view",732 "type": "function"733 },734 {735 "inputs": [736 { "internalType": "uint256", "name": "token", "type": "uint256" }737 ],738 "name": "tokenContractAddress",739 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],740 "stateMutability": "view",741 "type": "function"742 },743 {744 "inputs": [745 { "internalType": "address", "name": "owner", "type": "address" },746 { "internalType": "uint256", "name": "index", "type": "uint256" }747 ],748 "name": "tokenOfOwnerByIndex",749 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],750 "stateMutability": "view",751 "type": "function"752 },753 {754 "inputs": [],755 "name": "tokenPropertyPermissions",756 "outputs": [757 {758 "components": [759 { "internalType": "string", "name": "field_0", "type": "string" },760 {761 "components": [762 {763 "internalType": "enum EthTokenPermissions",764 "name": "field_0",765 "type": "uint8"766 },767 { "internalType": "bool", "name": "field_1", "type": "bool" }768 ],769 "internalType": "struct Tuple51[]",770 "name": "field_1",771 "type": "tuple[]"772 }773 ],774 "internalType": "struct Tuple53[]",775 "name": "",776 "type": "tuple[]"777 }778 ],779 "stateMutability": "view",780 "type": "function"781 },782 {783 "inputs": [784 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }785 ],786 "name": "tokenURI",787 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],788 "stateMutability": "view",789 "type": "function"790 },791 {792 "inputs": [],793 "name": "totalSupply",794 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],795 "stateMutability": "view",796 "type": "function"797 },798 {799 "inputs": [800 { "internalType": "address", "name": "to", "type": "address" },801 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }802 ],803 "name": "transfer",804 "outputs": [],805 "stateMutability": "nonpayable",806 "type": "function"807 },808 {809 "inputs": [810 {811 "components": [812 { "internalType": "address", "name": "eth", "type": "address" },813 { "internalType": "uint256", "name": "sub", "type": "uint256" }814 ],815 "internalType": "struct EthCrossAccount",816 "name": "to",817 "type": "tuple"818 },819 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }820 ],821 "name": "transferCross",822 "outputs": [],823 "stateMutability": "nonpayable",824 "type": "function"825 },826 {827 "inputs": [828 { "internalType": "address", "name": "from", "type": "address" },829 { "internalType": "address", "name": "to", "type": "address" },830 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }831 ],832 "name": "transferFrom",833 "outputs": [],834 "stateMutability": "nonpayable",835 "type": "function"836 },837 {838 "inputs": [839 {840 "components": [841 { "internalType": "address", "name": "eth", "type": "address" },842 { "internalType": "uint256", "name": "sub", "type": "uint256" }843 ],844 "internalType": "struct EthCrossAccount",845 "name": "from",846 "type": "tuple"847 },848 {849 "components": [850 { "internalType": "address", "name": "eth", "type": "address" },851 { "internalType": "uint256", "name": "sub", "type": "uint256" }852 ],853 "internalType": "struct EthCrossAccount",854 "name": "to",855 "type": "tuple"856 },857 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }858 ],859 "name": "transferFromCross",860 "outputs": [],861 "stateMutability": "nonpayable",862 "type": "function"863 },864 {865 "inputs": [],866 "name": "uniqueCollectionType",867 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],868 "stateMutability": "view",869 "type": "function"870 }871]1[2 {3 "anonymous": false,4 "inputs": [5 {6 "indexed": true,7 "internalType": "address",8 "name": "owner",9 "type": "address"10 },11 {12 "indexed": true,13 "internalType": "address",14 "name": "approved",15 "type": "address"16 },17 {18 "indexed": true,19 "internalType": "uint256",20 "name": "tokenId",21 "type": "uint256"22 }23 ],24 "name": "Approval",25 "type": "event"26 },27 {28 "anonymous": false,29 "inputs": [30 {31 "indexed": true,32 "internalType": "address",33 "name": "owner",34 "type": "address"35 },36 {37 "indexed": true,38 "internalType": "address",39 "name": "operator",40 "type": "address"41 },42 {43 "indexed": false,44 "internalType": "bool",45 "name": "approved",46 "type": "bool"47 }48 ],49 "name": "ApprovalForAll",50 "type": "event"51 },52 {53 "anonymous": false,54 "inputs": [],55 "name": "MintingFinished",56 "type": "event"57 },58 {59 "anonymous": false,60 "inputs": [61 {62 "indexed": true,63 "internalType": "address",64 "name": "from",65 "type": "address"66 },67 {68 "indexed": true,69 "internalType": "address",70 "name": "to",71 "type": "address"72 },73 {74 "indexed": true,75 "internalType": "uint256",76 "name": "tokenId",77 "type": "uint256"78 }79 ],80 "name": "Transfer",81 "type": "event"82 },83 {84 "inputs": [85 {86 "components": [87 { "internalType": "address", "name": "eth", "type": "address" },88 { "internalType": "uint256", "name": "sub", "type": "uint256" }89 ],90 "internalType": "struct EthCrossAccount",91 "name": "newAdmin",92 "type": "tuple"93 }94 ],95 "name": "addCollectionAdminCross",96 "outputs": [],97 "stateMutability": "nonpayable",98 "type": "function"99 },100 {101 "inputs": [102 {103 "components": [104 { "internalType": "address", "name": "eth", "type": "address" },105 { "internalType": "uint256", "name": "sub", "type": "uint256" }106 ],107 "internalType": "struct EthCrossAccount",108 "name": "user",109 "type": "tuple"110 }111 ],112 "name": "addToCollectionAllowListCross",113 "outputs": [],114 "stateMutability": "nonpayable",115 "type": "function"116 },117 {118 "inputs": [119 {120 "components": [121 { "internalType": "address", "name": "eth", "type": "address" },122 { "internalType": "uint256", "name": "sub", "type": "uint256" }123 ],124 "internalType": "struct EthCrossAccount",125 "name": "user",126 "type": "tuple"127 }128 ],129 "name": "allowlistedCross",130 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],131 "stateMutability": "view",132 "type": "function"133 },134 {135 "inputs": [136 { "internalType": "address", "name": "approved", "type": "address" },137 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }138 ],139 "name": "approve",140 "outputs": [],141 "stateMutability": "nonpayable",142 "type": "function"143 },144 {145 "inputs": [146 { "internalType": "address", "name": "owner", "type": "address" }147 ],148 "name": "balanceOf",149 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],150 "stateMutability": "view",151 "type": "function"152 },153 {154 "inputs": [155 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }156 ],157 "name": "burn",158 "outputs": [],159 "stateMutability": "nonpayable",160 "type": "function"161 },162 {163 "inputs": [164 {165 "components": [166 { "internalType": "address", "name": "eth", "type": "address" },167 { "internalType": "uint256", "name": "sub", "type": "uint256" }168 ],169 "internalType": "struct EthCrossAccount",170 "name": "from",171 "type": "tuple"172 },173 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }174 ],175 "name": "burnFromCross",176 "outputs": [],177 "stateMutability": "nonpayable",178 "type": "function"179 },180 {181 "inputs": [182 {183 "components": [184 { "internalType": "address", "name": "eth", "type": "address" },185 { "internalType": "uint256", "name": "sub", "type": "uint256" }186 ],187 "internalType": "struct EthCrossAccount",188 "name": "newOwner",189 "type": "tuple"190 }191 ],192 "name": "changeCollectionOwnerCross",193 "outputs": [],194 "stateMutability": "nonpayable",195 "type": "function"196 },197 {198 "inputs": [],199 "name": "collectionAdmins",200 "outputs": [201 {202 "components": [203 { "internalType": "address", "name": "eth", "type": "address" },204 { "internalType": "uint256", "name": "sub", "type": "uint256" }205 ],206 "internalType": "struct EthCrossAccount[]",207 "name": "",208 "type": "tuple[]"209 }210 ],211 "stateMutability": "view",212 "type": "function"213 },214 {215 "inputs": [],216 "name": "collectionHelperAddress",217 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],218 "stateMutability": "view",219 "type": "function"220 },221 {222 "inputs": [],223 "name": "collectionLimits",224 "outputs": [225 {226 "components": [227 {228 "internalType": "enum CollectionLimits",229 "name": "field_0",230 "type": "uint8"231 },232 { "internalType": "bool", "name": "field_1", "type": "bool" },233 { "internalType": "uint256", "name": "field_2", "type": "uint256" }234 ],235 "internalType": "struct Tuple32[]",236 "name": "",237 "type": "tuple[]"238 }239 ],240 "stateMutability": "view",241 "type": "function"242 },243 {244 "inputs": [],245 "name": "collectionNestingPermissions",246 "outputs": [247 {248 "components": [249 {250 "internalType": "enum CollectionPermissions",251 "name": "field_0",252 "type": "uint8"253 },254 { "internalType": "bool", "name": "field_1", "type": "bool" }255 ],256 "internalType": "struct Tuple41[]",257 "name": "",258 "type": "tuple[]"259 }260 ],261 "stateMutability": "view",262 "type": "function"263 },264 {265 "inputs": [],266 "name": "collectionNestingRestrictedCollectionIds",267 "outputs": [268 {269 "components": [270 { "internalType": "bool", "name": "field_0", "type": "bool" },271 {272 "internalType": "uint256[]",273 "name": "field_1",274 "type": "uint256[]"275 }276 ],277 "internalType": "struct Tuple38",278 "name": "",279 "type": "tuple"280 }281 ],282 "stateMutability": "view",283 "type": "function"284 },285 {286 "inputs": [],287 "name": "collectionOwner",288 "outputs": [289 {290 "components": [291 { "internalType": "address", "name": "eth", "type": "address" },292 { "internalType": "uint256", "name": "sub", "type": "uint256" }293 ],294 "internalType": "struct EthCrossAccount",295 "name": "",296 "type": "tuple"297 }298 ],299 "stateMutability": "view",300 "type": "function"301 },302 {303 "inputs": [304 { "internalType": "string[]", "name": "keys", "type": "string[]" }305 ],306 "name": "collectionProperties",307 "outputs": [308 {309 "components": [310 { "internalType": "string", "name": "key", "type": "string" },311 { "internalType": "bytes", "name": "value", "type": "bytes" }312 ],313 "internalType": "struct Property[]",314 "name": "",315 "type": "tuple[]"316 }317 ],318 "stateMutability": "view",319 "type": "function"320 },321 {322 "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],323 "name": "collectionProperty",324 "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],325 "stateMutability": "view",326 "type": "function"327 },328 {329 "inputs": [],330 "name": "collectionSponsor",331 "outputs": [332 {333 "components": [334 { "internalType": "address", "name": "field_0", "type": "address" },335 { "internalType": "uint256", "name": "field_1", "type": "uint256" }336 ],337 "internalType": "struct Tuple29",338 "name": "",339 "type": "tuple"340 }341 ],342 "stateMutability": "view",343 "type": "function"344 },345 {346 "inputs": [],347 "name": "confirmCollectionSponsorship",348 "outputs": [],349 "stateMutability": "nonpayable",350 "type": "function"351 },352 {353 "inputs": [],354 "name": "contractAddress",355 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],356 "stateMutability": "view",357 "type": "function"358 },359 {360 "inputs": [361 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }362 ],363 "name": "crossOwnerOf",364 "outputs": [365 {366 "components": [367 { "internalType": "address", "name": "eth", "type": "address" },368 { "internalType": "uint256", "name": "sub", "type": "uint256" }369 ],370 "internalType": "struct EthCrossAccount",371 "name": "",372 "type": "tuple"373 }374 ],375 "stateMutability": "view",376 "type": "function"377 },378 {379 "inputs": [380 { "internalType": "string[]", "name": "keys", "type": "string[]" }381 ],382 "name": "deleteCollectionProperties",383 "outputs": [],384 "stateMutability": "nonpayable",385 "type": "function"386 },387 {388 "inputs": [389 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },390 { "internalType": "string[]", "name": "keys", "type": "string[]" }391 ],392 "name": "deleteProperties",393 "outputs": [],394 "stateMutability": "nonpayable",395 "type": "function"396 },397 {398 "inputs": [],399 "name": "description",400 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],401 "stateMutability": "view",402 "type": "function"403 },404 {405 "inputs": [],406 "name": "finishMinting",407 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],408 "stateMutability": "nonpayable",409 "type": "function"410 },411 {412 "inputs": [413 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }414 ],415 "name": "getApproved",416 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],417 "stateMutability": "view",418 "type": "function"419 },420 {421 "inputs": [],422 "name": "hasCollectionPendingSponsor",423 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],424 "stateMutability": "view",425 "type": "function"426 },427 {428 "inputs": [429 { "internalType": "address", "name": "owner", "type": "address" },430 { "internalType": "address", "name": "operator", "type": "address" }431 ],432 "name": "isApprovedForAll",433 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],434 "stateMutability": "view",435 "type": "function"436 },437 {438 "inputs": [439 {440 "components": [441 { "internalType": "address", "name": "eth", "type": "address" },442 { "internalType": "uint256", "name": "sub", "type": "uint256" }443 ],444 "internalType": "struct EthCrossAccount",445 "name": "user",446 "type": "tuple"447 }448 ],449 "name": "isOwnerOrAdminCross",450 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],451 "stateMutability": "view",452 "type": "function"453 },454 {455 "inputs": [{ "internalType": "address", "name": "to", "type": "address" }],456 "name": "mint",457 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],458 "stateMutability": "nonpayable",459 "type": "function"460 },461 {462 "inputs": [463 { "internalType": "address", "name": "to", "type": "address" },464 { "internalType": "string", "name": "tokenUri", "type": "string" }465 ],466 "name": "mintWithTokenURI",467 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],468 "stateMutability": "nonpayable",469 "type": "function"470 },471 {472 "inputs": [],473 "name": "mintingFinished",474 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],475 "stateMutability": "view",476 "type": "function"477 },478 {479 "inputs": [],480 "name": "name",481 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],482 "stateMutability": "view",483 "type": "function"484 },485 {486 "inputs": [],487 "name": "nextTokenId",488 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],489 "stateMutability": "view",490 "type": "function"491 },492 {493 "inputs": [494 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }495 ],496 "name": "ownerOf",497 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],498 "stateMutability": "view",499 "type": "function"500 },501 {502 "inputs": [503 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },504 { "internalType": "string[]", "name": "keys", "type": "string[]" }505 ],506 "name": "properties",507 "outputs": [508 {509 "components": [510 { "internalType": "string", "name": "key", "type": "string" },511 { "internalType": "bytes", "name": "value", "type": "bytes" }512 ],513 "internalType": "struct Property[]",514 "name": "",515 "type": "tuple[]"516 }517 ],518 "stateMutability": "view",519 "type": "function"520 },521 {522 "inputs": [523 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },524 { "internalType": "string", "name": "key", "type": "string" }525 ],526 "name": "property",527 "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],528 "stateMutability": "view",529 "type": "function"530 },531 {532 "inputs": [533 {534 "components": [535 { "internalType": "address", "name": "eth", "type": "address" },536 { "internalType": "uint256", "name": "sub", "type": "uint256" }537 ],538 "internalType": "struct EthCrossAccount",539 "name": "admin",540 "type": "tuple"541 }542 ],543 "name": "removeCollectionAdminCross",544 "outputs": [],545 "stateMutability": "nonpayable",546 "type": "function"547 },548 {549 "inputs": [],550 "name": "removeCollectionSponsor",551 "outputs": [],552 "stateMutability": "nonpayable",553 "type": "function"554 },555 {556 "inputs": [557 {558 "components": [559 { "internalType": "address", "name": "eth", "type": "address" },560 { "internalType": "uint256", "name": "sub", "type": "uint256" }561 ],562 "internalType": "struct EthCrossAccount",563 "name": "user",564 "type": "tuple"565 }566 ],567 "name": "removeFromCollectionAllowListCross",568 "outputs": [],569 "stateMutability": "nonpayable",570 "type": "function"571 },572 {573 "inputs": [574 { "internalType": "address", "name": "from", "type": "address" },575 { "internalType": "address", "name": "to", "type": "address" },576 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }577 ],578 "name": "safeTransferFrom",579 "outputs": [],580 "stateMutability": "nonpayable",581 "type": "function"582 },583 {584 "inputs": [585 { "internalType": "address", "name": "from", "type": "address" },586 { "internalType": "address", "name": "to", "type": "address" },587 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },588 { "internalType": "bytes", "name": "data", "type": "bytes" }589 ],590 "name": "safeTransferFromWithData",591 "outputs": [],592 "stateMutability": "nonpayable",593 "type": "function"594 },595 {596 "inputs": [597 { "internalType": "address", "name": "operator", "type": "address" },598 { "internalType": "bool", "name": "approved", "type": "bool" }599 ],600 "name": "setApprovalForAll",601 "outputs": [],602 "stateMutability": "nonpayable",603 "type": "function"604 },605 {606 "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],607 "name": "setCollectionAccess",608 "outputs": [],609 "stateMutability": "nonpayable",610 "type": "function"611 },612 {613 "inputs": [614 {615 "internalType": "enum CollectionLimits",616 "name": "limit",617 "type": "uint8"618 },619 { "internalType": "bool", "name": "status", "type": "bool" },620 { "internalType": "uint256", "name": "value", "type": "uint256" }621 ],622 "name": "setCollectionLimit",623 "outputs": [],624 "stateMutability": "nonpayable",625 "type": "function"626 },627 {628 "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],629 "name": "setCollectionMintMode",630 "outputs": [],631 "stateMutability": "nonpayable",632 "type": "function"633 },634 {635 "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],636 "name": "setCollectionNesting",637 "outputs": [],638 "stateMutability": "nonpayable",639 "type": "function"640 },641 {642 "inputs": [643 { "internalType": "bool", "name": "enable", "type": "bool" },644 {645 "internalType": "address[]",646 "name": "collections",647 "type": "address[]"648 }649 ],650 "name": "setCollectionNesting",651 "outputs": [],652 "stateMutability": "nonpayable",653 "type": "function"654 },655 {656 "inputs": [657 {658 "components": [659 { "internalType": "string", "name": "key", "type": "string" },660 { "internalType": "bytes", "name": "value", "type": "bytes" }661 ],662 "internalType": "struct Property[]",663 "name": "properties",664 "type": "tuple[]"665 }666 ],667 "name": "setCollectionProperties",668 "outputs": [],669 "stateMutability": "nonpayable",670 "type": "function"671 },672 {673 "inputs": [674 {675 "components": [676 { "internalType": "address", "name": "eth", "type": "address" },677 { "internalType": "uint256", "name": "sub", "type": "uint256" }678 ],679 "internalType": "struct EthCrossAccount",680 "name": "sponsor",681 "type": "tuple"682 }683 ],684 "name": "setCollectionSponsorCross",685 "outputs": [],686 "stateMutability": "nonpayable",687 "type": "function"688 },689 {690 "inputs": [691 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },692 {693 "components": [694 { "internalType": "string", "name": "key", "type": "string" },695 { "internalType": "bytes", "name": "value", "type": "bytes" }696 ],697 "internalType": "struct Property[]",698 "name": "properties",699 "type": "tuple[]"700 }701 ],702 "name": "setProperties",703 "outputs": [],704 "stateMutability": "nonpayable",705 "type": "function"706 },707 {708 "inputs": [709 {710 "components": [711 { "internalType": "string", "name": "field_0", "type": "string" },712 {713 "components": [714 {715 "internalType": "enum EthTokenPermissions",716 "name": "field_0",717 "type": "uint8"718 },719 { "internalType": "bool", "name": "field_1", "type": "bool" }720 ],721 "internalType": "struct Tuple56[]",722 "name": "field_1",723 "type": "tuple[]"724 }725 ],726 "internalType": "struct Tuple58[]",727 "name": "permissions",728 "type": "tuple[]"729 }730 ],731 "name": "setTokenPropertyPermissions",732 "outputs": [],733 "stateMutability": "nonpayable",734 "type": "function"735 },736 {737 "inputs": [738 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }739 ],740 "name": "supportsInterface",741 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],742 "stateMutability": "view",743 "type": "function"744 },745 {746 "inputs": [],747 "name": "symbol",748 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],749 "stateMutability": "view",750 "type": "function"751 },752 {753 "inputs": [754 { "internalType": "uint256", "name": "index", "type": "uint256" }755 ],756 "name": "tokenByIndex",757 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],758 "stateMutability": "view",759 "type": "function"760 },761 {762 "inputs": [763 { "internalType": "uint256", "name": "token", "type": "uint256" }764 ],765 "name": "tokenContractAddress",766 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],767 "stateMutability": "view",768 "type": "function"769 },770 {771 "inputs": [772 { "internalType": "address", "name": "owner", "type": "address" },773 { "internalType": "uint256", "name": "index", "type": "uint256" }774 ],775 "name": "tokenOfOwnerByIndex",776 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],777 "stateMutability": "view",778 "type": "function"779 },780 {781 "inputs": [],782 "name": "tokenPropertyPermissions",783 "outputs": [784 {785 "components": [786 { "internalType": "string", "name": "field_0", "type": "string" },787 {788 "components": [789 {790 "internalType": "enum EthTokenPermissions",791 "name": "field_0",792 "type": "uint8"793 },794 { "internalType": "bool", "name": "field_1", "type": "bool" }795 ],796 "internalType": "struct Tuple56[]",797 "name": "field_1",798 "type": "tuple[]"799 }800 ],801 "internalType": "struct Tuple58[]",802 "name": "",803 "type": "tuple[]"804 }805 ],806 "stateMutability": "view",807 "type": "function"808 },809 {810 "inputs": [811 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }812 ],813 "name": "tokenURI",814 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],815 "stateMutability": "view",816 "type": "function"817 },818 {819 "inputs": [],820 "name": "totalSupply",821 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],822 "stateMutability": "view",823 "type": "function"824 },825 {826 "inputs": [827 { "internalType": "address", "name": "to", "type": "address" },828 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }829 ],830 "name": "transfer",831 "outputs": [],832 "stateMutability": "nonpayable",833 "type": "function"834 },835 {836 "inputs": [837 {838 "components": [839 { "internalType": "address", "name": "eth", "type": "address" },840 { "internalType": "uint256", "name": "sub", "type": "uint256" }841 ],842 "internalType": "struct EthCrossAccount",843 "name": "to",844 "type": "tuple"845 },846 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }847 ],848 "name": "transferCross",849 "outputs": [],850 "stateMutability": "nonpayable",851 "type": "function"852 },853 {854 "inputs": [855 { "internalType": "address", "name": "from", "type": "address" },856 { "internalType": "address", "name": "to", "type": "address" },857 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }858 ],859 "name": "transferFrom",860 "outputs": [],861 "stateMutability": "nonpayable",862 "type": "function"863 },864 {865 "inputs": [866 {867 "components": [868 { "internalType": "address", "name": "eth", "type": "address" },869 { "internalType": "uint256", "name": "sub", "type": "uint256" }870 ],871 "internalType": "struct EthCrossAccount",872 "name": "from",873 "type": "tuple"874 },875 {876 "components": [877 { "internalType": "address", "name": "eth", "type": "address" },878 { "internalType": "uint256", "name": "sub", "type": "uint256" }879 ],880 "internalType": "struct EthCrossAccount",881 "name": "to",882 "type": "tuple"883 },884 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }885 ],886 "name": "transferFromCross",887 "outputs": [],888 "stateMutability": "nonpayable",889 "type": "function"890 },891 {892 "inputs": [],893 "name": "uniqueCollectionType",894 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],895 "stateMutability": "view",896 "type": "function"897 }898]tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -13,7 +13,7 @@
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0xb5e1747f
+/// @dev the ERC-165 identifier for this interface is 0x81172a75
interface Collection is Dummy, ERC165 {
// /// Set collection property.
// ///
@@ -104,6 +104,23 @@
/// or in textual repr: collectionSponsor()
function collectionSponsor() external view returns (Tuple8 memory);
+ /// Get current collection limits.
+ ///
+ /// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:
+ /// "accountTokenOwnershipLimit",
+ /// "sponsoredDataSize",
+ /// "sponsoredDataRateLimit",
+ /// "tokenLimit",
+ /// "sponsorTransferTimeout",
+ /// "sponsorApproveTimeout"
+ /// "ownerCanTransfer",
+ /// "ownerCanDestroy",
+ /// "transfersEnabled"
+ /// Return `false` if a limit not set.
+ /// @dev EVM selector for this function is: 0xf63bc572,
+ /// or in textual repr: collectionLimits()
+ function collectionLimits() external view returns (Tuple19[] memory);
+
/// Set limits for the collection.
/// @dev Throws error if limit not found.
/// @param limit Name of the limit. Valid names:
@@ -116,10 +133,15 @@
/// "ownerCanTransfer",
/// "ownerCanDestroy",
/// "transfersEnabled"
+ /// @param status enable\disable limit. Works only with `true`.
/// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x4ad890a8,
- /// or in textual repr: setCollectionLimit(string,uint256)
- function setCollectionLimit(string memory limit, uint256 value) external;
+ /// @dev EVM selector for this function is: 0x88150bd0,
+ /// or in textual repr: setCollectionLimit(uint8,bool,uint256)
+ function setCollectionLimit(
+ CollectionLimits limit,
+ bool status,
+ uint256 value
+ ) external;
/// Get contract address.
/// @dev EVM selector for this function is: 0xf6b4dfb4,
@@ -169,12 +191,12 @@
/// Returns nesting for a collection
/// @dev EVM selector for this function is: 0x22d25bfe,
/// or in textual repr: collectionNestingRestrictedCollectionIds()
- function collectionNestingRestrictedCollectionIds() external view returns (Tuple20 memory);
+ function collectionNestingRestrictedCollectionIds() external view returns (Tuple24 memory);
/// Returns permissions for a collection
/// @dev EVM selector for this function is: 0x5b2eaf4b,
/// or in textual repr: collectionNestingPermissions()
- function collectionNestingPermissions() external view returns (Tuple23[] memory);
+ function collectionNestingPermissions() external view returns (Tuple27[] memory);
/// Set the collection access method.
/// @param mode Access mode
@@ -289,7 +311,7 @@
}
/// @dev anonymous struct
-struct Tuple23 {
+struct Tuple27 {
CollectionPermissions field_0;
bool field_1;
}
@@ -300,11 +322,40 @@
}
/// @dev anonymous struct
-struct Tuple20 {
+struct Tuple24 {
bool field_0;
uint256[] field_1;
}
+/// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.
+enum CollectionLimits {
+ /// @dev How many tokens can a user have on one account.
+ AccountTokenOwnership,
+ /// @dev How many bytes of data are available for sponsorship.
+ SponsoredDataSize,
+ /// @dev In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]
+ SponsoredDataRateLimit,
+ /// @dev How many tokens can be mined into this collection.
+ TokenLimit,
+ /// @dev Timeouts for transfer sponsoring.
+ SponsorTransferTimeout,
+ /// @dev Timeout for sponsoring an approval in passed blocks.
+ SponsorApproveTimeout,
+ /// @dev Whether the collection owner of the collection can send tokens (which belong to other users).
+ OwnerCanTransfer,
+ /// @dev Can the collection owner burn other people's tokens.
+ OwnerCanDestroy,
+ /// @dev Is it possible to send tokens from this collection between users.
+ TransferEnabled
+}
+
+/// @dev anonymous struct
+struct Tuple19 {
+ CollectionLimits field_0;
+ bool field_1;
+ uint256 field_2;
+}
+
/// @dev Property struct
struct Property {
string key;
tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -30,11 +30,12 @@
/// @param permissions Permissions for keys.
/// @dev EVM selector for this function is: 0xbd92983a,
/// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])
- function setTokenPropertyPermissions(Tuple43[] memory permissions) external;
+ function setTokenPropertyPermissions(Tuple52[] memory permissions) external;
+ /// @notice Get permissions for token properties.
/// @dev EVM selector for this function is: 0xf23d7790,
/// or in textual repr: tokenPropertyPermissions()
- function tokenPropertyPermissions() external view returns (Tuple43[] memory);
+ function tokenPropertyPermissions() external view returns (Tuple52[] memory);
// /// @notice Set token property value.
// /// @dev Throws error if `msg.sender` has no permission to edit the property.
@@ -85,26 +86,30 @@
bytes value;
}
+/// @dev Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.
enum EthTokenPermissions {
+ /// @dev Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]
Mutable,
+ /// @dev Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]
TokenOwner,
+ /// @dev Permission to change the property for the owner of the token. See [`up_data_structs::PropertyPermission::collection_admin`]
CollectionAdmin
}
/// @dev anonymous struct
-struct Tuple43 {
+struct Tuple52 {
string field_0;
- Tuple41[] field_1;
+ Tuple50[] field_1;
}
/// @dev anonymous struct
-struct Tuple41 {
+struct Tuple50 {
EthTokenPermissions field_0;
bool field_1;
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0xb5e1747f
+/// @dev the ERC-165 identifier for this interface is 0x81172a75
interface Collection is Dummy, ERC165 {
// /// Set collection property.
// ///
@@ -195,6 +200,23 @@
/// or in textual repr: collectionSponsor()
function collectionSponsor() external view returns (Tuple27 memory);
+ /// Get current collection limits.
+ ///
+ /// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:
+ /// "accountTokenOwnershipLimit",
+ /// "sponsoredDataSize",
+ /// "sponsoredDataRateLimit",
+ /// "tokenLimit",
+ /// "sponsorTransferTimeout",
+ /// "sponsorApproveTimeout"
+ /// "ownerCanTransfer",
+ /// "ownerCanDestroy",
+ /// "transfersEnabled"
+ /// Return `false` if a limit not set.
+ /// @dev EVM selector for this function is: 0xf63bc572,
+ /// or in textual repr: collectionLimits()
+ function collectionLimits() external view returns (Tuple30[] memory);
+
/// Set limits for the collection.
/// @dev Throws error if limit not found.
/// @param limit Name of the limit. Valid names:
@@ -207,10 +229,15 @@
/// "ownerCanTransfer",
/// "ownerCanDestroy",
/// "transfersEnabled"
+ /// @param status enable\disable limit. Works only with `true`.
/// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x4ad890a8,
- /// or in textual repr: setCollectionLimit(string,uint256)
- function setCollectionLimit(string memory limit, uint256 value) external;
+ /// @dev EVM selector for this function is: 0x88150bd0,
+ /// or in textual repr: setCollectionLimit(uint8,bool,uint256)
+ function setCollectionLimit(
+ CollectionLimits limit,
+ bool status,
+ uint256 value
+ ) external;
/// Get contract address.
/// @dev EVM selector for this function is: 0xf6b4dfb4,
@@ -260,12 +287,12 @@
/// Returns nesting for a collection
/// @dev EVM selector for this function is: 0x22d25bfe,
/// or in textual repr: collectionNestingRestrictedCollectionIds()
- function collectionNestingRestrictedCollectionIds() external view returns (Tuple31 memory);
+ function collectionNestingRestrictedCollectionIds() external view returns (Tuple35 memory);
/// Returns permissions for a collection
/// @dev EVM selector for this function is: 0x5b2eaf4b,
/// or in textual repr: collectionNestingPermissions()
- function collectionNestingPermissions() external view returns (Tuple34[] memory);
+ function collectionNestingPermissions() external view returns (Tuple38[] memory);
/// Set the collection access method.
/// @param mode Access mode
@@ -380,7 +407,7 @@
}
/// @dev anonymous struct
-struct Tuple34 {
+struct Tuple38 {
CollectionPermissions field_0;
bool field_1;
}
@@ -391,11 +418,40 @@
}
/// @dev anonymous struct
-struct Tuple31 {
+struct Tuple35 {
bool field_0;
uint256[] field_1;
}
+/// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.
+enum CollectionLimits {
+ /// @dev How many tokens can a user have on one account.
+ AccountTokenOwnership,
+ /// @dev How many bytes of data are available for sponsorship.
+ SponsoredDataSize,
+ /// @dev In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]
+ SponsoredDataRateLimit,
+ /// @dev How many tokens can be mined into this collection.
+ TokenLimit,
+ /// @dev Timeouts for transfer sponsoring.
+ SponsorTransferTimeout,
+ /// @dev Timeout for sponsoring an approval in passed blocks.
+ SponsorApproveTimeout,
+ /// @dev Whether the collection owner of the collection can send tokens (which belong to other users).
+ OwnerCanTransfer,
+ /// @dev Can the collection owner burn other people's tokens.
+ OwnerCanDestroy,
+ /// @dev Is it possible to send tokens from this collection between users.
+ TransferEnabled
+}
+
+/// @dev anonymous struct
+struct Tuple30 {
+ CollectionLimits field_0;
+ bool field_1;
+ uint256 field_2;
+}
+
/// @dev anonymous struct
struct Tuple27 {
address field_0;
tests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -30,12 +30,12 @@
/// @param permissions Permissions for keys.
/// @dev EVM selector for this function is: 0xbd92983a,
/// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])
- function setTokenPropertyPermissions(Tuple47[] memory permissions) external;
+ function setTokenPropertyPermissions(Tuple51[] memory permissions) external;
/// @notice Get permissions for token properties.
/// @dev EVM selector for this function is: 0xf23d7790,
/// or in textual repr: tokenPropertyPermissions()
- function tokenPropertyPermissions() external view returns (Tuple47[] memory);
+ function tokenPropertyPermissions() external view returns (Tuple51[] memory);
// /// @notice Set token property value.
// /// @dev Throws error if `msg.sender` has no permission to edit the property.
@@ -86,26 +86,30 @@
bytes value;
}
+/// @dev Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.
enum EthTokenPermissions {
+ /// @dev Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]
Mutable,
+ /// @dev Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]
TokenOwner,
+ /// @dev Permission to change the property for the owner of the token. See [`up_data_structs::PropertyPermission::collection_admin`]
CollectionAdmin
}
/// @dev anonymous struct
-struct Tuple47 {
+struct Tuple51 {
string field_0;
- Tuple45[] field_1;
+ Tuple49[] field_1;
}
/// @dev anonymous struct
-struct Tuple45 {
+struct Tuple49 {
EthTokenPermissions field_0;
bool field_1;
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0xb5e1747f
+/// @dev the ERC-165 identifier for this interface is 0x81172a75
interface Collection is Dummy, ERC165 {
// /// Set collection property.
// ///
@@ -196,6 +200,23 @@
/// or in textual repr: collectionSponsor()
function collectionSponsor() external view returns (Tuple26 memory);
+ /// Get current collection limits.
+ ///
+ /// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:
+ /// "accountTokenOwnershipLimit",
+ /// "sponsoredDataSize",
+ /// "sponsoredDataRateLimit",
+ /// "tokenLimit",
+ /// "sponsorTransferTimeout",
+ /// "sponsorApproveTimeout"
+ /// "ownerCanTransfer",
+ /// "ownerCanDestroy",
+ /// "transfersEnabled"
+ /// Return `false` if a limit not set.
+ /// @dev EVM selector for this function is: 0xf63bc572,
+ /// or in textual repr: collectionLimits()
+ function collectionLimits() external view returns (Tuple29[] memory);
+
/// Set limits for the collection.
/// @dev Throws error if limit not found.
/// @param limit Name of the limit. Valid names:
@@ -208,10 +229,15 @@
/// "ownerCanTransfer",
/// "ownerCanDestroy",
/// "transfersEnabled"
+ /// @param status enable\disable limit. Works only with `true`.
/// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x4ad890a8,
- /// or in textual repr: setCollectionLimit(string,uint256)
- function setCollectionLimit(string memory limit, uint256 value) external;
+ /// @dev EVM selector for this function is: 0x88150bd0,
+ /// or in textual repr: setCollectionLimit(uint8,bool,uint256)
+ function setCollectionLimit(
+ CollectionLimits limit,
+ bool status,
+ uint256 value
+ ) external;
/// Get contract address.
/// @dev EVM selector for this function is: 0xf6b4dfb4,
@@ -261,12 +287,12 @@
/// Returns nesting for a collection
/// @dev EVM selector for this function is: 0x22d25bfe,
/// or in textual repr: collectionNestingRestrictedCollectionIds()
- function collectionNestingRestrictedCollectionIds() external view returns (Tuple30 memory);
+ function collectionNestingRestrictedCollectionIds() external view returns (Tuple34 memory);
/// Returns permissions for a collection
/// @dev EVM selector for this function is: 0x5b2eaf4b,
/// or in textual repr: collectionNestingPermissions()
- function collectionNestingPermissions() external view returns (Tuple33[] memory);
+ function collectionNestingPermissions() external view returns (Tuple37[] memory);
/// Set the collection access method.
/// @param mode Access mode
@@ -381,7 +407,7 @@
}
/// @dev anonymous struct
-struct Tuple33 {
+struct Tuple37 {
CollectionPermissions field_0;
bool field_1;
}
@@ -392,11 +418,40 @@
}
/// @dev anonymous struct
-struct Tuple30 {
+struct Tuple34 {
bool field_0;
uint256[] field_1;
}
+/// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.
+enum CollectionLimits {
+ /// @dev How many tokens can a user have on one account.
+ AccountTokenOwnership,
+ /// @dev How many bytes of data are available for sponsorship.
+ SponsoredDataSize,
+ /// @dev In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]
+ SponsoredDataRateLimit,
+ /// @dev How many tokens can be mined into this collection.
+ TokenLimit,
+ /// @dev Timeouts for transfer sponsoring.
+ SponsorTransferTimeout,
+ /// @dev Timeout for sponsoring an approval in passed blocks.
+ SponsorApproveTimeout,
+ /// @dev Whether the collection owner of the collection can send tokens (which belong to other users).
+ OwnerCanTransfer,
+ /// @dev Can the collection owner burn other people's tokens.
+ OwnerCanDestroy,
+ /// @dev Is it possible to send tokens from this collection between users.
+ TransferEnabled
+}
+
+/// @dev anonymous struct
+struct Tuple29 {
+ CollectionLimits field_0;
+ bool field_1;
+ uint256 field_2;
+}
+
/// @dev anonymous struct
struct Tuple26 {
address field_0;
tests/src/eth/collectionLimits.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionLimits.test.ts
+++ b/tests/src/eth/collectionLimits.test.ts
@@ -1,6 +1,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {Pallets} from '../util';
import {expect, itEth, usingEthPlaygrounds} from './util';
+import {CollectionLimits} from './util/playgrounds/types';
describe('Can set collection limits', () => {
@@ -44,20 +45,33 @@
transfersEnabled: false,
};
- const collection = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);
- await collection.methods.setCollectionLimit('accountTokenOwnershipLimit', limits.accountTokenOwnershipLimit).send();
- await collection.methods.setCollectionLimit('sponsoredDataSize', limits.sponsoredDataSize).send();
- await collection.methods.setCollectionLimit('sponsoredDataRateLimit', limits.sponsoredDataRateLimit).send();
- await collection.methods.setCollectionLimit('tokenLimit', limits.tokenLimit).send();
- await collection.methods.setCollectionLimit('sponsorTransferTimeout', limits.sponsorTransferTimeout).send();
- await collection.methods.setCollectionLimit('sponsorApproveTimeout', limits.sponsorApproveTimeout).send();
- await collection.methods.setCollectionLimit('ownerCanTransfer', limits.ownerCanTransfer).send();
- await collection.methods.setCollectionLimit('ownerCanDestroy', limits.ownerCanDestroy).send();
- await collection.methods.setCollectionLimit('transfersEnabled', limits.transfersEnabled).send();
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);
+ await collectionEvm.methods.setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, limits.accountTokenOwnershipLimit).send();
+ await collectionEvm.methods.setCollectionLimit(CollectionLimits.SponsoredDataSize, true, limits.sponsoredDataSize).send();
+ await collectionEvm.methods.setCollectionLimit(CollectionLimits.SponsoredDataRateLimit, true, limits.sponsoredDataRateLimit).send();
+ await collectionEvm.methods.setCollectionLimit(CollectionLimits.TokenLimit, true, limits.tokenLimit).send();
+ await collectionEvm.methods.setCollectionLimit(CollectionLimits.SponsorTransferTimeout, true, limits.sponsorTransferTimeout).send();
+ await collectionEvm.methods.setCollectionLimit(CollectionLimits.SponsorApproveTimeout, true, limits.sponsorApproveTimeout).send();
+ await collectionEvm.methods.setCollectionLimit(CollectionLimits.OwnerCanTransfer, true, limits.ownerCanTransfer).send();
+ await collectionEvm.methods.setCollectionLimit(CollectionLimits.OwnerCanDestroy, true, limits.ownerCanDestroy).send();
+ await collectionEvm.methods.setCollectionLimit(CollectionLimits.TransferEnabled, true, limits.transfersEnabled).send();
+ // Check limits from sub:
const data = (await helper.rft.getData(collectionId))!;
expect(data.raw.limits).to.deep.eq(expectedLimits);
expect(await helper.collection.getEffectiveLimits(collectionId)).to.deep.eq(expectedLimits);
+ // Check limits from eth:
+ const limitsEvm = await collectionEvm.methods.collectionLimits().call({from: owner});
+ expect(limitsEvm).to.have.length(9);
+ expect(limitsEvm[0]).to.deep.eq([CollectionLimits.AccountTokenOwnership.toString(), true, limits.accountTokenOwnershipLimit.toString()]);
+ expect(limitsEvm[1]).to.deep.eq([CollectionLimits.SponsoredDataSize.toString(), true, limits.sponsoredDataSize.toString()]);
+ expect(limitsEvm[2]).to.deep.eq([CollectionLimits.SponsoredDataRateLimit.toString(), true, limits.sponsoredDataRateLimit.toString()]);
+ expect(limitsEvm[3]).to.deep.eq([CollectionLimits.TokenLimit.toString(), true, limits.tokenLimit.toString()]);
+ expect(limitsEvm[4]).to.deep.eq([CollectionLimits.SponsorTransferTimeout.toString(), true, limits.sponsorTransferTimeout.toString()]);
+ expect(limitsEvm[5]).to.deep.eq([CollectionLimits.SponsorApproveTimeout.toString(), true, limits.sponsorApproveTimeout.toString()]);
+ expect(limitsEvm[6]).to.deep.eq([CollectionLimits.OwnerCanTransfer.toString(), true, limits.ownerCanTransfer.toString()]);
+ expect(limitsEvm[7]).to.deep.eq([CollectionLimits.OwnerCanDestroy.toString(), true, limits.ownerCanDestroy.toString()]);
+ expect(limitsEvm[8]).to.deep.eq([CollectionLimits.TransferEnabled.toString(), true, limits.transfersEnabled.toString()]);
}));
});
@@ -84,17 +98,48 @@
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress} = await helper.eth.createCollection(testCase.case, owner, 'Limits', 'absolutely anything', 'ISNI', 18);
const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);
+
+ // Cannot set non-existing limit
await expect(collectionEvm.methods
- .setCollectionLimit('badLimit', '1')
- .call()).to.be.rejectedWith('unknown limit "badLimit"');
-
+ .setCollectionLimit(9, true, 1)
+ .call()).to.be.rejectedWith('Returned error: VM Exception while processing transaction: revert Value not convertible into enum "CollectionLimits"');
+
+ // Cannot disable limits
+ await expect(collectionEvm.methods
+ .setCollectionLimit(CollectionLimits.AccountTokenOwnership, false, 200)
+ .call()).to.be.rejectedWith('Returned error: VM Exception while processing transaction: revert user can\'t disable limits');
+
await expect(collectionEvm.methods
- .setCollectionLimit(Object.keys(invalidLimits)[0], invalidLimits.accountTokenOwnershipLimit)
+ .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, invalidLimits.accountTokenOwnershipLimit)
.call()).to.be.rejectedWith(`can't convert value to u32 "${invalidLimits.accountTokenOwnershipLimit}"`);
-
+
await expect(collectionEvm.methods
- .setCollectionLimit(Object.keys(invalidLimits)[1], invalidLimits.transfersEnabled)
+ .setCollectionLimit(CollectionLimits.TransferEnabled, true, 3)
.call()).to.be.rejectedWith(`can't convert value to boolean "${invalidLimits.transfersEnabled}"`);
+
+ expect(() => collectionEvm.methods
+ .setCollectionLimit(CollectionLimits.SponsoredDataSize, true, -1).send()).to.throw('value out-of-bounds');
}));
+
+ [
+ {case: 'nft' as const, requiredPallets: []},
+ {case: 'rft' as const, requiredPallets: [Pallets.ReFungible]},
+ {case: 'ft' as const, requiredPallets: []},
+ ].map(testCase =>
+ itEth.ifWithPallets(`Non-owner and non-admin cannot set collection limits for ${testCase.case}`, testCase.requiredPallets || [], async ({helper}) => {
+ const owner = await helper.eth.createAccountWithBalance(donor);
+ const nonOwner = await helper.eth.createAccountWithBalance(donor);
+ const {collectionAddress} = await helper.eth.createCollection(testCase.case, owner, 'Limits', 'absolutely anything', 'FLO', 18);
+
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);
+ await expect(collectionEvm.methods
+ .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)
+ .call({from: nonOwner}))
+ .to.be.rejectedWith('NoPermission');
+
+ await expect(collectionEvm.methods
+ .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)
+ .send({from: nonOwner}))
+ .to.be.rejected;
+ }));
});
-
\ No newline at end of file
tests/src/eth/createFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createFTCollection.test.ts
+++ b/tests/src/eth/createFTCollection.test.ts
@@ -18,6 +18,7 @@
import {evmToAddress} from '@polkadot/util-crypto';
import {Pallets, requirePalletsOrSkip} from '../util';
import {expect, itEth, usingEthPlaygrounds} from './util';
+import { CollectionLimits } from './util/playgrounds/types';
const DECIMALS = 18;
@@ -196,7 +197,7 @@
}
{
await expect(peasantCollection.methods
- .setCollectionLimit('accountTokenOwnershipLimit', '1000')
+ .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
}
});
@@ -221,7 +222,7 @@
}
{
await expect(peasantCollection.methods
- .setCollectionLimit('accountTokenOwnershipLimit', '1000')
+ .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
}
});
tests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createNFTCollection.test.ts
+++ b/tests/src/eth/createNFTCollection.test.ts
@@ -17,6 +17,7 @@
import {evmToAddress} from '@polkadot/util-crypto';
import {IKeyringPair} from '@polkadot/types/types';
import {expect, itEth, usingEthPlaygrounds} from './util';
+import { CollectionLimits } from './util/playgrounds/types';
describe('Create NFT collection from EVM', () => {
@@ -207,7 +208,7 @@
}
{
await expect(malfeasantCollection.methods
- .setCollectionLimit('accountTokenOwnershipLimit', '1000')
+ .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
}
});
@@ -232,7 +233,7 @@
}
{
await expect(malfeasantCollection.methods
- .setCollectionLimit('accountTokenOwnershipLimit', '1000')
+ .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
}
});
tests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createRFTCollection.test.ts
+++ b/tests/src/eth/createRFTCollection.test.ts
@@ -18,6 +18,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {Pallets, requirePalletsOrSkip} from '../util';
import {expect, itEth, usingEthPlaygrounds} from './util';
+import {CollectionLimits} from './util/playgrounds/types';
describe('Create RFT collection from EVM', () => {
@@ -239,7 +240,7 @@
}
{
await expect(peasantCollection.methods
- .setCollectionLimit('accountTokenOwnershipLimit', '1000')
+ .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
}
});
@@ -264,7 +265,7 @@
}
{
await expect(peasantCollection.methods
- .setCollectionLimit('accountTokenOwnershipLimit', '1000')
+ .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
}
});
tests/src/eth/events.test.tsdiffbeforeafterboth--- a/tests/src/eth/events.test.ts
+++ b/tests/src/eth/events.test.ts
@@ -19,7 +19,7 @@
import {EthUniqueHelper, itEth, usingEthPlaygrounds} from './util';
import {IEvent, TCollectionMode} from '../util/playgrounds/types';
import {Pallets, requirePalletsOrSkip} from '../util';
-import {EthTokenPermissions, NormalizedEvent} from './util/playgrounds/types';
+import {CollectionLimits, EthTokenPermissions, NormalizedEvent} from './util/playgrounds/types';
let donor: IKeyringPair;
@@ -234,7 +234,7 @@
});
const {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['CollectionLimitSet']}]);
{
- await collection.methods.setCollectionLimit('ownerCanTransfer', 0n).send({from: owner});
+ await collection.methods.setCollectionLimit(CollectionLimits.OwnerCanTransfer, true, 0).send({from: owner});
await helper.wait.newBlocks(1);
expect(ethEvents).to.be.like([
{
tests/src/eth/util/playgrounds/types.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/types.ts
+++ b/tests/src/eth/util/playgrounds/types.ts
@@ -24,4 +24,15 @@
Mutable,
TokenOwner,
CollectionAdmin
-}
\ No newline at end of file
+}
+export enum CollectionLimits {
+ AccountTokenOwnership,
+ SponsoredDataSize,
+ SponsoredDataRateLimit,
+ TokenLimit,
+ SponsorTransferTimeout,
+ SponsorApproveTimeout,
+ OwnerCanTransfer,
+ OwnerCanDestroy,
+ TransferEnabled
+}
tests/src/pallet-presence.test.tsdiffbeforeafterboth--- a/tests/src/pallet-presence.test.ts
+++ b/tests/src/pallet-presence.test.ts
@@ -84,6 +84,7 @@
);
} else if (chain.eq('UNIQUE')) {
// Insert Unique additional pallets here
+ requiredPallets.push(foreignAssets);
}
});
});