difftreelog
Merge branch 'develop' into tests/eth-helpers
in: master
21 files changed
pallets/common/src/erc.rsdiffbeforeafterboth37 Pallet, CollectionHandle, Config, CollectionProperties, SelfWeightOf,37 Pallet, CollectionHandle, Config, CollectionProperties, SelfWeightOf,38 eth::{38 eth::{39 EthCrossAccount, convert_cross_account_to_uint256, CollectionPermissions as EvmPermissions,39 EthCrossAccount, convert_cross_account_to_uint256, CollectionPermissions as EvmPermissions,40 CollectionLimits as EvmCollectionLimits,40 },41 },41 weights::WeightInfo,42 weights::WeightInfo,42};43};304 Ok(result)305 Ok(result)305 }306 }307308 /// Get current collection limits.309 ///310 /// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:311 /// "accountTokenOwnershipLimit",312 /// "sponsoredDataSize",313 /// "sponsoredDataRateLimit",314 /// "tokenLimit",315 /// "sponsorTransferTimeout",316 /// "sponsorApproveTimeout"317 /// "ownerCanTransfer",318 /// "ownerCanDestroy",319 /// "transfersEnabled"320 /// Return `false` if a limit not set.321 fn collection_limits(&self) -> Result<Vec<(EvmCollectionLimits, bool, uint256)>> {322 let convert_value_limit = |limit: EvmCollectionLimits,323 value: Option<u32>|324 -> (EvmCollectionLimits, bool, uint256) {325 value326 .map(|v| (limit, true, v.into()))327 .unwrap_or((limit, false, Default::default()))328 };329330 let convert_bool_limit = |limit: EvmCollectionLimits,331 value: Option<bool>|332 -> (EvmCollectionLimits, bool, uint256) {333 value334 .map(|v| {335 (336 limit,337 true,338 if v {339 uint256::from(1)340 } else {341 Default::default()342 },343 )344 })345 .unwrap_or((limit, false, Default::default()))346 };347348 let limits = &self.collection.limits;349350 Ok(vec![351 convert_value_limit(352 EvmCollectionLimits::AccountTokenOwnership,353 limits.account_token_ownership_limit,354 ),355 convert_value_limit(356 EvmCollectionLimits::SponsoredDataSize,357 limits.sponsored_data_size,358 ),359 limits360 .sponsored_data_rate_limit361 .and_then(|limit| {362 if let SponsoringRateLimit::Blocks(blocks) = limit {363 Some((364 EvmCollectionLimits::SponsoredDataRateLimit,365 true,366 blocks.into(),367 ))368 } else {369 None370 }371 })372 .unwrap_or((373 EvmCollectionLimits::SponsoredDataRateLimit,374 false,375 Default::default(),376 )),377 convert_value_limit(EvmCollectionLimits::TokenLimit, limits.token_limit),378 convert_value_limit(379 EvmCollectionLimits::SponsorTransferTimeout,380 limits.sponsor_transfer_timeout,381 ),382 convert_value_limit(383 EvmCollectionLimits::SponsorApproveTimeout,384 limits.sponsor_approve_timeout,385 ),386 convert_bool_limit(387 EvmCollectionLimits::OwnerCanTransfer,388 limits.owner_can_transfer,389 ),390 convert_bool_limit(391 EvmCollectionLimits::OwnerCanDestroy,392 limits.owner_can_destroy,393 ),394 convert_bool_limit(395 EvmCollectionLimits::TransferEnabled,396 limits.transfers_enabled,397 ),398 ])399 }306400307 /// Set limits for the collection.401 /// Set limits for the collection.308 /// @dev Throws error if limit not found.402 /// @dev Throws error if limit not found.316 /// "ownerCanTransfer",410 /// "ownerCanTransfer",317 /// "ownerCanDestroy",411 /// "ownerCanDestroy",318 /// "transfersEnabled"412 /// "transfersEnabled"413 /// @param status enable\disable limit. Works only with `true`.319 /// @param value Value of the limit.414 /// @param value Value of the limit.320 #[solidity(rename_selector = "setCollectionLimit")]415 #[solidity(rename_selector = "setCollectionLimit")]321 fn set_int_limit(&mut self, caller: caller, limit: string, value: uint256) -> Result<void> {416 fn set_collection_limit(417 &mut self,418 caller: caller,419 limit: EvmCollectionLimits,420 status: bool,421 value: uint256,422 ) -> Result<void> {322 self.consume_store_reads_and_writes(1, 1)?;423 self.consume_store_reads_and_writes(1, 1)?;424425 if !status {426 return Err(Error::Revert("user can't disable limits".into()));427 }323428324 let value = value429 let value = value325 .try_into()430 .try_into()338443339 let mut limits = self.limits.clone();444 let mut limits = self.limits.clone();340445341 match limit.as_str() {446 match limit {342 "accountTokenOwnershipLimit" => {447 EvmCollectionLimits::AccountTokenOwnership => {343 limits.account_token_ownership_limit = Some(value);448 limits.account_token_ownership_limit = Some(value);344 }449 }345 "sponsoredDataSize" => {450 EvmCollectionLimits::SponsoredDataSize => {346 limits.sponsored_data_size = Some(value);451 limits.sponsored_data_size = Some(value);347 }452 }348 "sponsoredDataRateLimit" => {453 EvmCollectionLimits::SponsoredDataRateLimit => {349 limits.sponsored_data_rate_limit = Some(SponsoringRateLimit::Blocks(value));454 limits.sponsored_data_rate_limit = Some(SponsoringRateLimit::Blocks(value));350 }455 }351 "tokenLimit" => {456 EvmCollectionLimits::TokenLimit => {352 limits.token_limit = Some(value);457 limits.token_limit = Some(value);353 }458 }354 "sponsorTransferTimeout" => {459 EvmCollectionLimits::SponsorTransferTimeout => {355 limits.sponsor_transfer_timeout = Some(value);460 limits.sponsor_transfer_timeout = Some(value);356 }461 }357 "sponsorApproveTimeout" => {462 EvmCollectionLimits::SponsorApproveTimeout => {358 limits.sponsor_approve_timeout = Some(value);463 limits.sponsor_approve_timeout = Some(value);359 }464 }360 "ownerCanTransfer" => {465 EvmCollectionLimits::OwnerCanTransfer => {361 limits.owner_can_transfer = Some(convert_value_to_bool()?);466 limits.owner_can_transfer = Some(convert_value_to_bool()?);362 }467 }363 "ownerCanDestroy" => {468 EvmCollectionLimits::OwnerCanDestroy => {364 limits.owner_can_destroy = Some(convert_value_to_bool()?);469 limits.owner_can_destroy = Some(convert_value_to_bool()?);365 }470 }366 "transfersEnabled" => {471 EvmCollectionLimits::TransferEnabled => {367 limits.transfers_enabled = Some(convert_value_to_bool()?);472 limits.transfers_enabled = Some(convert_value_to_bool()?);368 }473 }369 _ => return Err(Error::Revert(format!("unknown limit \"{}\"", limit))),474 _ => return Err(Error::Revert(format!("unknown limit \"{:?}\"", limit))),370 }475 }371476372 let caller = T::CrossAccountId::from_eth(caller);477 let caller = T::CrossAccountId::from_eth(caller);pallets/common/src/eth.rsdiffbeforeafterboth156 }156 }157}157}158159/// [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.160#[derive(Debug, Default, Clone, Copy, AbiCoder)]161#[repr(u8)]162pub enum CollectionLimits {163 /// How many tokens can a user have on one account.164 #[default]165 AccountTokenOwnership,166 /// How many bytes of data are available for sponsorship.167 SponsoredDataSize,168 /// In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]169 SponsoredDataRateLimit,170 /// How many tokens can be mined into this collection.171 TokenLimit,172 /// Timeouts for transfer sponsoring.173 SponsorTransferTimeout,174 /// Timeout for sponsoring an approval in passed blocks.175 SponsorApproveTimeout,176 /// Whether the collection owner of the collection can send tokens (which belong to other users).177 OwnerCanTransfer,178 /// Can the collection owner burn other people's tokens.179 OwnerCanDestroy,180 /// Is it possible to send tokens from this collection between users.181 TransferEnabled,182}158#[derive(Default, Debug, Clone, Copy, AbiCoder)]183#[derive(Default, Debug, Clone, Copy, AbiCoder)]159#[repr(u8)]184#[repr(u8)]160pub enum CollectionPermissions {185pub enum CollectionPermissions {pallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth18}18}191920/// @title A contract that allows you to work with collections.20/// @title A contract that allows you to work with collections.21/// @dev the ERC-165 identifier for this interface is 0xb5e1747f21/// @dev the ERC-165 identifier for this interface is 0x81172a7522contract Collection is Dummy, ERC165 {22contract Collection is Dummy, ERC165 {23 // /// Set collection property.23 // /// Set collection property.24 // ///24 // ///158 return Tuple8(0x0000000000000000000000000000000000000000, 0);158 return Tuple8(0x0000000000000000000000000000000000000000, 0);159 }159 }160161 /// Get current collection limits.162 ///163 /// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:164 /// "accountTokenOwnershipLimit",165 /// "sponsoredDataSize",166 /// "sponsoredDataRateLimit",167 /// "tokenLimit",168 /// "sponsorTransferTimeout",169 /// "sponsorApproveTimeout"170 /// "ownerCanTransfer",171 /// "ownerCanDestroy",172 /// "transfersEnabled"173 /// Return `false` if a limit not set.174 /// @dev EVM selector for this function is: 0xf63bc572,175 /// or in textual repr: collectionLimits()176 function collectionLimits() public view returns (Tuple20[] memory) {177 require(false, stub_error);178 dummy;179 return new Tuple20[](0);180 }160181161 /// Set limits for the collection.182 /// Set limits for the collection.162 /// @dev Throws error if limit not found.183 /// @dev Throws error if limit not found.170 /// "ownerCanTransfer",191 /// "ownerCanTransfer",171 /// "ownerCanDestroy",192 /// "ownerCanDestroy",172 /// "transfersEnabled"193 /// "transfersEnabled"194 /// @param status enable\disable limit. Works only with `true`.173 /// @param value Value of the limit.195 /// @param value Value of the limit.174 /// @dev EVM selector for this function is: 0x4ad890a8,196 /// @dev EVM selector for this function is: 0x88150bd0,175 /// or in textual repr: setCollectionLimit(string,uint256)197 /// or in textual repr: setCollectionLimit(uint8,bool,uint256)176 function setCollectionLimit(string memory limit, uint256 value) public {198 function setCollectionLimit(199 CollectionLimits limit,200 bool status,201 uint256 value202 ) public {177 require(false, stub_error);203 require(false, stub_error);178 limit;204 limit;205 status;179 value;206 value;180 dummy = 0;207 dummy = 0;181 }208 }257 /// Returns nesting for a collection284 /// Returns nesting for a collection258 /// @dev EVM selector for this function is: 0x22d25bfe,285 /// @dev EVM selector for this function is: 0x22d25bfe,259 /// or in textual repr: collectionNestingRestrictedCollectionIds()286 /// or in textual repr: collectionNestingRestrictedCollectionIds()260 function collectionNestingRestrictedCollectionIds() public view returns (Tuple21 memory) {287 function collectionNestingRestrictedCollectionIds() public view returns (Tuple26 memory) {261 require(false, stub_error);288 require(false, stub_error);262 dummy;289 dummy;263 return Tuple21(false, new uint256[](0));290 return Tuple26(false, new uint256[](0));264 }291 }265292266 /// Returns permissions for a collection293 /// Returns permissions for a collection267 /// @dev EVM selector for this function is: 0x5b2eaf4b,294 /// @dev EVM selector for this function is: 0x5b2eaf4b,268 /// or in textual repr: collectionNestingPermissions()295 /// or in textual repr: collectionNestingPermissions()269 function collectionNestingPermissions() public view returns (Tuple24[] memory) {296 function collectionNestingPermissions() public view returns (Tuple29[] memory) {270 require(false, stub_error);297 require(false, stub_error);271 dummy;298 dummy;272 return new Tuple24[](0);299 return new Tuple29[](0);273 }300 }274301275 /// Set the collection access method.302 /// Set the collection access method.449}476}450477451/// @dev anonymous struct478/// @dev anonymous struct452struct Tuple24 {479struct Tuple29 {453 CollectionPermissions field_0;480 CollectionPermissions field_0;454 bool field_1;481 bool field_1;455}482}456483457/// @dev anonymous struct484/// @dev anonymous struct458struct Tuple21 {485struct Tuple26 {459 bool field_0;486 bool field_0;460 uint256[] field_1;487 uint256[] field_1;461}488}489490/// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.491enum CollectionLimits {492 /// @dev How many tokens can a user have on one account.493 AccountTokenOwnership,494 /// @dev How many bytes of data are available for sponsorship.495 SponsoredDataSize,496 /// @dev In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]497 SponsoredDataRateLimit,498 /// @dev How many tokens can be mined into this collection.499 TokenLimit,500 /// @dev Timeouts for transfer sponsoring.501 SponsorTransferTimeout,502 /// @dev Timeout for sponsoring an approval in passed blocks.503 SponsorApproveTimeout,504 /// @dev Whether the collection owner of the collection can send tokens (which belong to other users).505 OwnerCanTransfer,506 /// @dev Can the collection owner burn other people's tokens.507 OwnerCanDestroy,508 /// @dev Is it possible to send tokens from this collection between users.509 TransferEnabled510}511512/// @dev anonymous struct513struct Tuple20 {514 CollectionLimits field_0;515 bool field_1;516 uint256 field_2;517}462518463/// @dev Property struct519/// @dev Property struct464struct Property {520struct Property {pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth42 /// @param permissions Permissions for keys.42 /// @param permissions Permissions for keys.43 /// @dev EVM selector for this function is: 0xbd92983a,43 /// @dev EVM selector for this function is: 0xbd92983a,44 /// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])44 /// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])45 function setTokenPropertyPermissions(Tuple48[] memory permissions) public {45 function setTokenPropertyPermissions(Tuple59[] memory permissions) public {46 require(false, stub_error);46 require(false, stub_error);47 permissions;47 permissions;48 dummy = 0;48 dummy = 0;49 }49 }505051 /// @notice Get permissions for token properties.51 /// @dev EVM selector for this function is: 0xf23d7790,52 /// @dev EVM selector for this function is: 0xf23d7790,52 /// or in textual repr: tokenPropertyPermissions()53 /// or in textual repr: tokenPropertyPermissions()53 function tokenPropertyPermissions() public view returns (Tuple48[] memory) {54 function tokenPropertyPermissions() public view returns (Tuple59[] memory) {54 require(false, stub_error);55 require(false, stub_error);55 dummy;56 dummy;56 return new Tuple48[](0);57 return new Tuple59[](0);57 }58 }585959 // /// @notice Set token property value.60 // /// @notice Set token property value.132 bytes value;133 bytes value;133}134}134135136/// @dev Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.135enum EthTokenPermissions {137enum EthTokenPermissions {138 /// @dev Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]136 Mutable,139 Mutable,140 /// @dev Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]137 TokenOwner,141 TokenOwner,142 /// @dev Permission to change the property for the owner of the token. See [`up_data_structs::PropertyPermission::collection_admin`]138 CollectionAdmin143 CollectionAdmin139}144}140145141/// @dev anonymous struct146/// @dev anonymous struct142struct Tuple48 {147struct Tuple59 {143 string field_0;148 string field_0;144 Tuple46[] field_1;149 Tuple57[] field_1;145}150}146151147/// @dev anonymous struct152/// @dev anonymous struct148struct Tuple46 {153struct Tuple57 {149 EthTokenPermissions field_0;154 EthTokenPermissions field_0;150 bool field_1;155 bool field_1;151}156}152157153/// @title A contract that allows you to work with collections.158/// @title A contract that allows you to work with collections.154/// @dev the ERC-165 identifier for this interface is 0xb5e1747f159/// @dev the ERC-165 identifier for this interface is 0x81172a75155contract Collection is Dummy, ERC165 {160contract Collection is Dummy, ERC165 {156 // /// Set collection property.161 // /// Set collection property.157 // ///162 // ///291 return Tuple30(0x0000000000000000000000000000000000000000, 0);296 return Tuple30(0x0000000000000000000000000000000000000000, 0);292 }297 }298299 /// Get current collection limits.300 ///301 /// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:302 /// "accountTokenOwnershipLimit",303 /// "sponsoredDataSize",304 /// "sponsoredDataRateLimit",305 /// "tokenLimit",306 /// "sponsorTransferTimeout",307 /// "sponsorApproveTimeout"308 /// "ownerCanTransfer",309 /// "ownerCanDestroy",310 /// "transfersEnabled"311 /// Return `false` if a limit not set.312 /// @dev EVM selector for this function is: 0xf63bc572,313 /// or in textual repr: collectionLimits()314 function collectionLimits() public view returns (Tuple33[] memory) {315 require(false, stub_error);316 dummy;317 return new Tuple33[](0);318 }293319294 /// Set limits for the collection.320 /// Set limits for the collection.295 /// @dev Throws error if limit not found.321 /// @dev Throws error if limit not found.303 /// "ownerCanTransfer",329 /// "ownerCanTransfer",304 /// "ownerCanDestroy",330 /// "ownerCanDestroy",305 /// "transfersEnabled"331 /// "transfersEnabled"332 /// @param status enable\disable limit. Works only with `true`.306 /// @param value Value of the limit.333 /// @param value Value of the limit.307 /// @dev EVM selector for this function is: 0x4ad890a8,334 /// @dev EVM selector for this function is: 0x88150bd0,308 /// or in textual repr: setCollectionLimit(string,uint256)335 /// or in textual repr: setCollectionLimit(uint8,bool,uint256)309 function setCollectionLimit(string memory limit, uint256 value) public {336 function setCollectionLimit(337 CollectionLimits limit,338 bool status,339 uint256 value340 ) public {310 require(false, stub_error);341 require(false, stub_error);311 limit;342 limit;343 status;312 value;344 value;313 dummy = 0;345 dummy = 0;314 }346 }390 /// Returns nesting for a collection422 /// Returns nesting for a collection391 /// @dev EVM selector for this function is: 0x22d25bfe,423 /// @dev EVM selector for this function is: 0x22d25bfe,392 /// or in textual repr: collectionNestingRestrictedCollectionIds()424 /// or in textual repr: collectionNestingRestrictedCollectionIds()393 function collectionNestingRestrictedCollectionIds() public view returns (Tuple34 memory) {425 function collectionNestingRestrictedCollectionIds() public view returns (Tuple39 memory) {394 require(false, stub_error);426 require(false, stub_error);395 dummy;427 dummy;396 return Tuple34(false, new uint256[](0));428 return Tuple39(false, new uint256[](0));397 }429 }398430399 /// Returns permissions for a collection431 /// Returns permissions for a collection400 /// @dev EVM selector for this function is: 0x5b2eaf4b,432 /// @dev EVM selector for this function is: 0x5b2eaf4b,401 /// or in textual repr: collectionNestingPermissions()433 /// or in textual repr: collectionNestingPermissions()402 function collectionNestingPermissions() public view returns (Tuple37[] memory) {434 function collectionNestingPermissions() public view returns (Tuple42[] memory) {403 require(false, stub_error);435 require(false, stub_error);404 dummy;436 dummy;405 return new Tuple37[](0);437 return new Tuple42[](0);406 }438 }407439408 /// Set the collection access method.440 /// Set the collection access method.582}614}583615584/// @dev anonymous struct616/// @dev anonymous struct585struct Tuple37 {617struct Tuple42 {586 CollectionPermissions field_0;618 CollectionPermissions field_0;587 bool field_1;619 bool field_1;588}620}589621590/// @dev anonymous struct622/// @dev anonymous struct591struct Tuple34 {623struct Tuple39 {592 bool field_0;624 bool field_0;593 uint256[] field_1;625 uint256[] field_1;594}626}627628/// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.629enum CollectionLimits {630 /// @dev How many tokens can a user have on one account.631 AccountTokenOwnership,632 /// @dev How many bytes of data are available for sponsorship.633 SponsoredDataSize,634 /// @dev In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]635 SponsoredDataRateLimit,636 /// @dev How many tokens can be mined into this collection.637 TokenLimit,638 /// @dev Timeouts for transfer sponsoring.639 SponsorTransferTimeout,640 /// @dev Timeout for sponsoring an approval in passed blocks.641 SponsorApproveTimeout,642 /// @dev Whether the collection owner of the collection can send tokens (which belong to other users).643 OwnerCanTransfer,644 /// @dev Can the collection owner burn other people's tokens.645 OwnerCanDestroy,646 /// @dev Is it possible to send tokens from this collection between users.647 TransferEnabled648}649650/// @dev anonymous struct651struct Tuple33 {652 CollectionLimits field_0;653 bool field_1;654 uint256 field_2;655}595656596/// @dev anonymous struct657/// @dev anonymous struct597struct Tuple30 {658struct Tuple30 {pallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth42 /// @param permissions Permissions for keys.42 /// @param permissions Permissions for keys.43 /// @dev EVM selector for this function is: 0xbd92983a,43 /// @dev EVM selector for this function is: 0xbd92983a,44 /// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])44 /// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])45 function setTokenPropertyPermissions(Tuple53[] memory permissions) public {45 function setTokenPropertyPermissions(Tuple58[] memory permissions) public {46 require(false, stub_error);46 require(false, stub_error);47 permissions;47 permissions;48 dummy = 0;48 dummy = 0;51 /// @notice Get permissions for token properties.51 /// @notice Get permissions for token properties.52 /// @dev EVM selector for this function is: 0xf23d7790,52 /// @dev EVM selector for this function is: 0xf23d7790,53 /// or in textual repr: tokenPropertyPermissions()53 /// or in textual repr: tokenPropertyPermissions()54 function tokenPropertyPermissions() public view returns (Tuple53[] memory) {54 function tokenPropertyPermissions() public view returns (Tuple58[] memory) {55 require(false, stub_error);55 require(false, stub_error);56 dummy;56 dummy;57 return new Tuple53[](0);57 return new Tuple58[](0);58 }58 }595960 // /// @notice Set token property value.60 // /// @notice Set token property value.133 bytes value;133 bytes value;134}134}135135136/// @dev Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.136enum EthTokenPermissions {137enum EthTokenPermissions {138 /// @dev Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]137 Mutable,139 Mutable,140 /// @dev Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]138 TokenOwner,141 TokenOwner,142 /// @dev Permission to change the property for the owner of the token. See [`up_data_structs::PropertyPermission::collection_admin`]139 CollectionAdmin143 CollectionAdmin140}144}141145142/// @dev anonymous struct146/// @dev anonymous struct143struct Tuple53 {147struct Tuple58 {144 string field_0;148 string field_0;145 Tuple51[] field_1;149 Tuple56[] field_1;146}150}147151148/// @dev anonymous struct152/// @dev anonymous struct149struct Tuple51 {153struct Tuple56 {150 EthTokenPermissions field_0;154 EthTokenPermissions field_0;151 bool field_1;155 bool field_1;152}156}153157154/// @title A contract that allows you to work with collections.158/// @title A contract that allows you to work with collections.155/// @dev the ERC-165 identifier for this interface is 0xb5e1747f159/// @dev the ERC-165 identifier for this interface is 0x81172a75156contract Collection is Dummy, ERC165 {160contract Collection is Dummy, ERC165 {157 // /// Set collection property.161 // /// Set collection property.158 // ///162 // ///292 return Tuple29(0x0000000000000000000000000000000000000000, 0);296 return Tuple29(0x0000000000000000000000000000000000000000, 0);293 }297 }298299 /// Get current collection limits.300 ///301 /// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:302 /// "accountTokenOwnershipLimit",303 /// "sponsoredDataSize",304 /// "sponsoredDataRateLimit",305 /// "tokenLimit",306 /// "sponsorTransferTimeout",307 /// "sponsorApproveTimeout"308 /// "ownerCanTransfer",309 /// "ownerCanDestroy",310 /// "transfersEnabled"311 /// Return `false` if a limit not set.312 /// @dev EVM selector for this function is: 0xf63bc572,313 /// or in textual repr: collectionLimits()314 function collectionLimits() public view returns (Tuple32[] memory) {315 require(false, stub_error);316 dummy;317 return new Tuple32[](0);318 }294319295 /// Set limits for the collection.320 /// Set limits for the collection.296 /// @dev Throws error if limit not found.321 /// @dev Throws error if limit not found.304 /// "ownerCanTransfer",329 /// "ownerCanTransfer",305 /// "ownerCanDestroy",330 /// "ownerCanDestroy",306 /// "transfersEnabled"331 /// "transfersEnabled"332 /// @param status enable\disable limit. Works only with `true`.307 /// @param value Value of the limit.333 /// @param value Value of the limit.308 /// @dev EVM selector for this function is: 0x4ad890a8,334 /// @dev EVM selector for this function is: 0x88150bd0,309 /// or in textual repr: setCollectionLimit(string,uint256)335 /// or in textual repr: setCollectionLimit(uint8,bool,uint256)310 function setCollectionLimit(string memory limit, uint256 value) public {336 function setCollectionLimit(337 CollectionLimits limit,338 bool status,339 uint256 value340 ) public {311 require(false, stub_error);341 require(false, stub_error);312 limit;342 limit;343 status;313 value;344 value;314 dummy = 0;345 dummy = 0;315 }346 }391 /// Returns nesting for a collection422 /// Returns nesting for a collection392 /// @dev EVM selector for this function is: 0x22d25bfe,423 /// @dev EVM selector for this function is: 0x22d25bfe,393 /// or in textual repr: collectionNestingRestrictedCollectionIds()424 /// or in textual repr: collectionNestingRestrictedCollectionIds()394 function collectionNestingRestrictedCollectionIds() public view returns (Tuple33 memory) {425 function collectionNestingRestrictedCollectionIds() public view returns (Tuple38 memory) {395 require(false, stub_error);426 require(false, stub_error);396 dummy;427 dummy;397 return Tuple33(false, new uint256[](0));428 return Tuple38(false, new uint256[](0));398 }429 }399430400 /// Returns permissions for a collection431 /// Returns permissions for a collection401 /// @dev EVM selector for this function is: 0x5b2eaf4b,432 /// @dev EVM selector for this function is: 0x5b2eaf4b,402 /// or in textual repr: collectionNestingPermissions()433 /// or in textual repr: collectionNestingPermissions()403 function collectionNestingPermissions() public view returns (Tuple36[] memory) {434 function collectionNestingPermissions() public view returns (Tuple41[] memory) {404 require(false, stub_error);435 require(false, stub_error);405 dummy;436 dummy;406 return new Tuple36[](0);437 return new Tuple41[](0);407 }438 }408439409 /// Set the collection access method.440 /// Set the collection access method.583}614}584615585/// @dev anonymous struct616/// @dev anonymous struct586struct Tuple36 {617struct Tuple41 {587 CollectionPermissions field_0;618 CollectionPermissions field_0;588 bool field_1;619 bool field_1;589}620}590621591/// @dev anonymous struct622/// @dev anonymous struct592struct Tuple33 {623struct Tuple38 {593 bool field_0;624 bool field_0;594 uint256[] field_1;625 uint256[] field_1;595}626}627628/// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.629enum CollectionLimits {630 /// @dev How many tokens can a user have on one account.631 AccountTokenOwnership,632 /// @dev How many bytes of data are available for sponsorship.633 SponsoredDataSize,634 /// @dev In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]635 SponsoredDataRateLimit,636 /// @dev How many tokens can be mined into this collection.637 TokenLimit,638 /// @dev Timeouts for transfer sponsoring.639 SponsorTransferTimeout,640 /// @dev Timeout for sponsoring an approval in passed blocks.641 SponsorApproveTimeout,642 /// @dev Whether the collection owner of the collection can send tokens (which belong to other users).643 OwnerCanTransfer,644 /// @dev Can the collection owner burn other people's tokens.645 OwnerCanDestroy,646 /// @dev Is it possible to send tokens from this collection between users.647 TransferEnabled648}649650/// @dev anonymous struct651struct Tuple32 {652 CollectionLimits field_0;653 bool field_1;654 uint256 field_2;655}596656597/// @dev anonymous struct657/// @dev anonymous struct598struct Tuple29 {658struct Tuple29 {tests/src/eth/abi/fungible.jsondiffbeforeafterboth206 "stateMutability": "view",206 "stateMutability": "view",207 "type": "function"207 "type": "function"208 },208 },209 {210 "inputs": [],211 "name": "collectionLimits",212 "outputs": [213 {214 "components": [215 {216 "internalType": "enum CollectionLimits",217 "name": "field_0",218 "type": "uint8"219 },220 { "internalType": "bool", "name": "field_1", "type": "bool" },221 { "internalType": "uint256", "name": "field_2", "type": "uint256" }222 ],223 "internalType": "struct Tuple20[]",224 "name": "",225 "type": "tuple[]"226 }227 ],228 "stateMutability": "view",229 "type": "function"230 },209 {231 {210 "inputs": [],232 "inputs": [],211 "name": "collectionNestingPermissions",233 "name": "collectionNestingPermissions",219 },241 },220 { "internalType": "bool", "name": "field_1", "type": "bool" }242 { "internalType": "bool", "name": "field_1", "type": "bool" }221 ],243 ],222 "internalType": "struct Tuple24[]",244 "internalType": "struct Tuple29[]",223 "name": "",245 "name": "",224 "type": "tuple[]"246 "type": "tuple[]"225 }247 }240 "type": "uint256[]"262 "type": "uint256[]"241 }263 }242 ],264 ],243 "internalType": "struct Tuple21",265 "internalType": "struct Tuple26",244 "name": "",266 "name": "",245 "type": "tuple"267 "type": "tuple"246 }268 }453 },475 },454 {476 {455 "inputs": [477 "inputs": [456 { "internalType": "string", "name": "limit", "type": "string" },478 {479 "internalType": "enum CollectionLimits",480 "name": "limit",481 "type": "uint8"482 },483 { "internalType": "bool", "name": "status", "type": "bool" },457 { "internalType": "uint256", "name": "value", "type": "uint256" }484 { "internalType": "uint256", "name": "value", "type": "uint256" }458 ],485 ],459 "name": "setCollectionLimit",486 "name": "setCollectionLimit",tests/src/eth/abi/nonFungible.jsondiffbeforeafterboth236 "stateMutability": "view",236 "stateMutability": "view",237 "type": "function"237 "type": "function"238 },238 },239 {240 "inputs": [],241 "name": "collectionLimits",242 "outputs": [243 {244 "components": [245 {246 "internalType": "enum CollectionLimits",247 "name": "field_0",248 "type": "uint8"249 },250 { "internalType": "bool", "name": "field_1", "type": "bool" },251 { "internalType": "uint256", "name": "field_2", "type": "uint256" }252 ],253 "internalType": "struct Tuple33[]",254 "name": "",255 "type": "tuple[]"256 }257 ],258 "stateMutability": "view",259 "type": "function"260 },239 {261 {240 "inputs": [],262 "inputs": [],241 "name": "collectionNestingPermissions",263 "name": "collectionNestingPermissions",249 },271 },250 { "internalType": "bool", "name": "field_1", "type": "bool" }272 { "internalType": "bool", "name": "field_1", "type": "bool" }251 ],273 ],252 "internalType": "struct Tuple37[]",274 "internalType": "struct Tuple42[]",253 "name": "",275 "name": "",254 "type": "tuple[]"276 "type": "tuple[]"255 }277 }270 "type": "uint256[]"292 "type": "uint256[]"271 }293 }272 ],294 ],273 "internalType": "struct Tuple34",295 "internalType": "struct Tuple39",274 "name": "",296 "name": "",275 "type": "tuple"297 "type": "tuple"276 }298 }607 },629 },608 {630 {609 "inputs": [631 "inputs": [610 { "internalType": "string", "name": "limit", "type": "string" },632 {633 "internalType": "enum CollectionLimits",634 "name": "limit",635 "type": "uint8"636 },637 { "internalType": "bool", "name": "status", "type": "bool" },611 { "internalType": "uint256", "name": "value", "type": "uint256" }638 { "internalType": "uint256", "name": "value", "type": "uint256" }612 ],639 ],613 "name": "setCollectionLimit",640 "name": "setCollectionLimit",709 },736 },710 { "internalType": "bool", "name": "field_1", "type": "bool" }737 { "internalType": "bool", "name": "field_1", "type": "bool" }711 ],738 ],712 "internalType": "struct Tuple46[]",739 "internalType": "struct Tuple57[]",713 "name": "field_1",740 "name": "field_1",714 "type": "tuple[]"741 "type": "tuple[]"715 }742 }716 ],743 ],717 "internalType": "struct Tuple48[]",744 "internalType": "struct Tuple59[]",718 "name": "permissions",745 "name": "permissions",719 "type": "tuple[]"746 "type": "tuple[]"720 }747 }775 },802 },776 { "internalType": "bool", "name": "field_1", "type": "bool" }803 { "internalType": "bool", "name": "field_1", "type": "bool" }777 ],804 ],778 "internalType": "struct Tuple46[]",805 "internalType": "struct Tuple57[]",779 "name": "field_1",806 "name": "field_1",780 "type": "tuple[]"807 "type": "tuple[]"781 }808 }782 ],809 ],783 "internalType": "struct Tuple48[]",810 "internalType": "struct Tuple59[]",784 "name": "",811 "name": "",785 "type": "tuple[]"812 "type": "tuple[]"786 }813 }tests/src/eth/abi/reFungible.jsondiffbeforeafterboth218 "stateMutability": "view",218 "stateMutability": "view",219 "type": "function"219 "type": "function"220 },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 },221 {243 {222 "inputs": [],244 "inputs": [],223 "name": "collectionNestingPermissions",245 "name": "collectionNestingPermissions",231 },253 },232 { "internalType": "bool", "name": "field_1", "type": "bool" }254 { "internalType": "bool", "name": "field_1", "type": "bool" }233 ],255 ],234 "internalType": "struct Tuple36[]",256 "internalType": "struct Tuple41[]",235 "name": "",257 "name": "",236 "type": "tuple[]"258 "type": "tuple[]"237 }259 }252 "type": "uint256[]"274 "type": "uint256[]"253 }275 }254 ],276 ],255 "internalType": "struct Tuple33",277 "internalType": "struct Tuple38",256 "name": "",278 "name": "",257 "type": "tuple"279 "type": "tuple"258 }280 }589 },611 },590 {612 {591 "inputs": [613 "inputs": [592 { "internalType": "string", "name": "limit", "type": "string" },614 {615 "internalType": "enum CollectionLimits",616 "name": "limit",617 "type": "uint8"618 },619 { "internalType": "bool", "name": "status", "type": "bool" },593 { "internalType": "uint256", "name": "value", "type": "uint256" }620 { "internalType": "uint256", "name": "value", "type": "uint256" }594 ],621 ],595 "name": "setCollectionLimit",622 "name": "setCollectionLimit",691 },718 },692 { "internalType": "bool", "name": "field_1", "type": "bool" }719 { "internalType": "bool", "name": "field_1", "type": "bool" }693 ],720 ],694 "internalType": "struct Tuple51[]",721 "internalType": "struct Tuple56[]",695 "name": "field_1",722 "name": "field_1",696 "type": "tuple[]"723 "type": "tuple[]"697 }724 }698 ],725 ],699 "internalType": "struct Tuple53[]",726 "internalType": "struct Tuple58[]",700 "name": "permissions",727 "name": "permissions",701 "type": "tuple[]"728 "type": "tuple[]"702 }729 }766 },793 },767 { "internalType": "bool", "name": "field_1", "type": "bool" }794 { "internalType": "bool", "name": "field_1", "type": "bool" }768 ],795 ],769 "internalType": "struct Tuple51[]",796 "internalType": "struct Tuple56[]",770 "name": "field_1",797 "name": "field_1",771 "type": "tuple[]"798 "type": "tuple[]"772 }799 }773 ],800 ],774 "internalType": "struct Tuple53[]",801 "internalType": "struct Tuple58[]",775 "name": "",802 "name": "",776 "type": "tuple[]"803 "type": "tuple[]"777 }804 }tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth13}13}141415/// @title A contract that allows you to work with collections.15/// @title A contract that allows you to work with collections.16/// @dev the ERC-165 identifier for this interface is 0xb5e1747f16/// @dev the ERC-165 identifier for this interface is 0x81172a7517interface Collection is Dummy, ERC165 {17interface Collection is Dummy, ERC165 {18 // /// Set collection property.18 // /// Set collection property.19 // ///19 // ///104 /// or in textual repr: collectionSponsor()104 /// or in textual repr: collectionSponsor()105 function collectionSponsor() external view returns (Tuple8 memory);105 function collectionSponsor() external view returns (Tuple8 memory);106107 /// Get current collection limits.108 ///109 /// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:110 /// "accountTokenOwnershipLimit",111 /// "sponsoredDataSize",112 /// "sponsoredDataRateLimit",113 /// "tokenLimit",114 /// "sponsorTransferTimeout",115 /// "sponsorApproveTimeout"116 /// "ownerCanTransfer",117 /// "ownerCanDestroy",118 /// "transfersEnabled"119 /// Return `false` if a limit not set.120 /// @dev EVM selector for this function is: 0xf63bc572,121 /// or in textual repr: collectionLimits()122 function collectionLimits() external view returns (Tuple19[] memory);106123107 /// Set limits for the collection.124 /// Set limits for the collection.108 /// @dev Throws error if limit not found.125 /// @dev Throws error if limit not found.116 /// "ownerCanTransfer",133 /// "ownerCanTransfer",117 /// "ownerCanDestroy",134 /// "ownerCanDestroy",118 /// "transfersEnabled"135 /// "transfersEnabled"136 /// @param status enable\disable limit. Works only with `true`.119 /// @param value Value of the limit.137 /// @param value Value of the limit.120 /// @dev EVM selector for this function is: 0x4ad890a8,138 /// @dev EVM selector for this function is: 0x88150bd0,121 /// or in textual repr: setCollectionLimit(string,uint256)139 /// or in textual repr: setCollectionLimit(uint8,bool,uint256)122 function setCollectionLimit(string memory limit, uint256 value) external;140 function setCollectionLimit(141 CollectionLimits limit,142 bool status,143 uint256 value144 ) external;123145169 /// Returns nesting for a collection191 /// Returns nesting for a collection170 /// @dev EVM selector for this function is: 0x22d25bfe,192 /// @dev EVM selector for this function is: 0x22d25bfe,171 /// or in textual repr: collectionNestingRestrictedCollectionIds()193 /// or in textual repr: collectionNestingRestrictedCollectionIds()172 function collectionNestingRestrictedCollectionIds() external view returns (Tuple20 memory);194 function collectionNestingRestrictedCollectionIds() external view returns (Tuple24 memory);173195174 /// Returns permissions for a collection196 /// Returns permissions for a collection175 /// @dev EVM selector for this function is: 0x5b2eaf4b,197 /// @dev EVM selector for this function is: 0x5b2eaf4b,176 /// or in textual repr: collectionNestingPermissions()198 /// or in textual repr: collectionNestingPermissions()177 function collectionNestingPermissions() external view returns (Tuple23[] memory);199 function collectionNestingPermissions() external view returns (Tuple27[] memory);178200179 /// Set the collection access method.201 /// Set the collection access method.180 /// @param mode Access mode202 /// @param mode Access mode289}311}290312291/// @dev anonymous struct313/// @dev anonymous struct292struct Tuple23 {314struct Tuple27 {293 CollectionPermissions field_0;315 CollectionPermissions field_0;294 bool field_1;316 bool field_1;295}317}300}322}301323302/// @dev anonymous struct324/// @dev anonymous struct303struct Tuple20 {325struct Tuple24 {304 bool field_0;326 bool field_0;305 uint256[] field_1;327 uint256[] field_1;306}328}329330/// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.331enum CollectionLimits {332 /// @dev How many tokens can a user have on one account.333 AccountTokenOwnership,334 /// @dev How many bytes of data are available for sponsorship.335 SponsoredDataSize,336 /// @dev In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]337 SponsoredDataRateLimit,338 /// @dev How many tokens can be mined into this collection.339 TokenLimit,340 /// @dev Timeouts for transfer sponsoring.341 SponsorTransferTimeout,342 /// @dev Timeout for sponsoring an approval in passed blocks.343 SponsorApproveTimeout,344 /// @dev Whether the collection owner of the collection can send tokens (which belong to other users).345 OwnerCanTransfer,346 /// @dev Can the collection owner burn other people's tokens.347 OwnerCanDestroy,348 /// @dev Is it possible to send tokens from this collection between users.349 TransferEnabled350}351352/// @dev anonymous struct353struct Tuple19 {354 CollectionLimits field_0;355 bool field_1;356 uint256 field_2;357}307358308/// @dev Property struct359/// @dev Property struct309struct Property {360struct Property {tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth30 /// @param permissions Permissions for keys.30 /// @param permissions Permissions for keys.31 /// @dev EVM selector for this function is: 0xbd92983a,31 /// @dev EVM selector for this function is: 0xbd92983a,32 /// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])32 /// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])33 function setTokenPropertyPermissions(Tuple43[] memory permissions) external;33 function setTokenPropertyPermissions(Tuple52[] memory permissions) external;343435 /// @notice Get permissions for token properties.35 /// @dev EVM selector for this function is: 0xf23d7790,36 /// @dev EVM selector for this function is: 0xf23d7790,36 /// or in textual repr: tokenPropertyPermissions()37 /// or in textual repr: tokenPropertyPermissions()37 function tokenPropertyPermissions() external view returns (Tuple43[] memory);38 function tokenPropertyPermissions() external view returns (Tuple52[] memory);383939 // /// @notice Set token property value.40 // /// @notice Set token property value.40 // /// @dev Throws error if `msg.sender` has no permission to edit the property.41 // /// @dev Throws error if `msg.sender` has no permission to edit the property.85 bytes value;86 bytes value;86}87}878889/// @dev Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.88enum EthTokenPermissions {90enum EthTokenPermissions {91 /// @dev Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]89 Mutable,92 Mutable,93 /// @dev Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]90 TokenOwner,94 TokenOwner,95 /// @dev Permission to change the property for the owner of the token. See [`up_data_structs::PropertyPermission::collection_admin`]91 CollectionAdmin96 CollectionAdmin92}97}939894/// @dev anonymous struct99/// @dev anonymous struct95struct Tuple43 {100struct Tuple52 {96 string field_0;101 string field_0;97 Tuple41[] field_1;102 Tuple50[] field_1;98}103}99104100/// @dev anonymous struct105/// @dev anonymous struct101struct Tuple41 {106struct Tuple50 {102 EthTokenPermissions field_0;107 EthTokenPermissions field_0;103 bool field_1;108 bool field_1;104}109}105110106/// @title A contract that allows you to work with collections.111/// @title A contract that allows you to work with collections.107/// @dev the ERC-165 identifier for this interface is 0xb5e1747f112/// @dev the ERC-165 identifier for this interface is 0x81172a75108interface Collection is Dummy, ERC165 {113interface Collection is Dummy, ERC165 {109 // /// Set collection property.114 // /// Set collection property.110 // ///115 // ///195 /// or in textual repr: collectionSponsor()200 /// or in textual repr: collectionSponsor()196 function collectionSponsor() external view returns (Tuple27 memory);201 function collectionSponsor() external view returns (Tuple27 memory);202203 /// Get current collection limits.204 ///205 /// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:206 /// "accountTokenOwnershipLimit",207 /// "sponsoredDataSize",208 /// "sponsoredDataRateLimit",209 /// "tokenLimit",210 /// "sponsorTransferTimeout",211 /// "sponsorApproveTimeout"212 /// "ownerCanTransfer",213 /// "ownerCanDestroy",214 /// "transfersEnabled"215 /// Return `false` if a limit not set.216 /// @dev EVM selector for this function is: 0xf63bc572,217 /// or in textual repr: collectionLimits()218 function collectionLimits() external view returns (Tuple30[] memory);197219198 /// Set limits for the collection.220 /// Set limits for the collection.199 /// @dev Throws error if limit not found.221 /// @dev Throws error if limit not found.207 /// "ownerCanTransfer",229 /// "ownerCanTransfer",208 /// "ownerCanDestroy",230 /// "ownerCanDestroy",209 /// "transfersEnabled"231 /// "transfersEnabled"232 /// @param status enable\disable limit. Works only with `true`.210 /// @param value Value of the limit.233 /// @param value Value of the limit.211 /// @dev EVM selector for this function is: 0x4ad890a8,234 /// @dev EVM selector for this function is: 0x88150bd0,212 /// or in textual repr: setCollectionLimit(string,uint256)235 /// or in textual repr: setCollectionLimit(uint8,bool,uint256)213 function setCollectionLimit(string memory limit, uint256 value) external;236 function setCollectionLimit(237 CollectionLimits limit,238 bool status,239 uint256 value240 ) external;214241260 /// Returns nesting for a collection287 /// Returns nesting for a collection261 /// @dev EVM selector for this function is: 0x22d25bfe,288 /// @dev EVM selector for this function is: 0x22d25bfe,262 /// or in textual repr: collectionNestingRestrictedCollectionIds()289 /// or in textual repr: collectionNestingRestrictedCollectionIds()263 function collectionNestingRestrictedCollectionIds() external view returns (Tuple31 memory);290 function collectionNestingRestrictedCollectionIds() external view returns (Tuple35 memory);264291265 /// Returns permissions for a collection292 /// Returns permissions for a collection266 /// @dev EVM selector for this function is: 0x5b2eaf4b,293 /// @dev EVM selector for this function is: 0x5b2eaf4b,267 /// or in textual repr: collectionNestingPermissions()294 /// or in textual repr: collectionNestingPermissions()268 function collectionNestingPermissions() external view returns (Tuple34[] memory);295 function collectionNestingPermissions() external view returns (Tuple38[] memory);269296270 /// Set the collection access method.297 /// Set the collection access method.271 /// @param mode Access mode298 /// @param mode Access mode380}407}381408382/// @dev anonymous struct409/// @dev anonymous struct383struct Tuple34 {410struct Tuple38 {384 CollectionPermissions field_0;411 CollectionPermissions field_0;385 bool field_1;412 bool field_1;386}413}391}418}392419393/// @dev anonymous struct420/// @dev anonymous struct394struct Tuple31 {421struct Tuple35 {395 bool field_0;422 bool field_0;396 uint256[] field_1;423 uint256[] field_1;397}424}425426/// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.427enum CollectionLimits {428 /// @dev How many tokens can a user have on one account.429 AccountTokenOwnership,430 /// @dev How many bytes of data are available for sponsorship.431 SponsoredDataSize,432 /// @dev In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]433 SponsoredDataRateLimit,434 /// @dev How many tokens can be mined into this collection.435 TokenLimit,436 /// @dev Timeouts for transfer sponsoring.437 SponsorTransferTimeout,438 /// @dev Timeout for sponsoring an approval in passed blocks.439 SponsorApproveTimeout,440 /// @dev Whether the collection owner of the collection can send tokens (which belong to other users).441 OwnerCanTransfer,442 /// @dev Can the collection owner burn other people's tokens.443 OwnerCanDestroy,444 /// @dev Is it possible to send tokens from this collection between users.445 TransferEnabled446}447448/// @dev anonymous struct449struct Tuple30 {450 CollectionLimits field_0;451 bool field_1;452 uint256 field_2;453}398454399/// @dev anonymous struct455/// @dev anonymous struct400struct Tuple27 {456struct Tuple27 {tests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth30 /// @param permissions Permissions for keys.30 /// @param permissions Permissions for keys.31 /// @dev EVM selector for this function is: 0xbd92983a,31 /// @dev EVM selector for this function is: 0xbd92983a,32 /// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])32 /// or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])33 function setTokenPropertyPermissions(Tuple47[] memory permissions) external;33 function setTokenPropertyPermissions(Tuple51[] memory permissions) external;343435 /// @notice Get permissions for token properties.35 /// @notice Get permissions for token properties.36 /// @dev EVM selector for this function is: 0xf23d7790,36 /// @dev EVM selector for this function is: 0xf23d7790,37 /// or in textual repr: tokenPropertyPermissions()37 /// or in textual repr: tokenPropertyPermissions()38 function tokenPropertyPermissions() external view returns (Tuple47[] memory);38 function tokenPropertyPermissions() external view returns (Tuple51[] memory);393940 // /// @notice Set token property value.40 // /// @notice Set token property value.41 // /// @dev Throws error if `msg.sender` has no permission to edit the property.41 // /// @dev Throws error if `msg.sender` has no permission to edit the property.86 bytes value;86 bytes value;87}87}888889/// @dev Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.89enum EthTokenPermissions {90enum EthTokenPermissions {91 /// @dev Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]90 Mutable,92 Mutable,93 /// @dev Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]91 TokenOwner,94 TokenOwner,95 /// @dev Permission to change the property for the owner of the token. See [`up_data_structs::PropertyPermission::collection_admin`]92 CollectionAdmin96 CollectionAdmin93}97}949895/// @dev anonymous struct99/// @dev anonymous struct96struct Tuple47 {100struct Tuple51 {97 string field_0;101 string field_0;98 Tuple45[] field_1;102 Tuple49[] field_1;99}103}100104101/// @dev anonymous struct105/// @dev anonymous struct102struct Tuple45 {106struct Tuple49 {103 EthTokenPermissions field_0;107 EthTokenPermissions field_0;104 bool field_1;108 bool field_1;105}109}106110107/// @title A contract that allows you to work with collections.111/// @title A contract that allows you to work with collections.108/// @dev the ERC-165 identifier for this interface is 0xb5e1747f112/// @dev the ERC-165 identifier for this interface is 0x81172a75109interface Collection is Dummy, ERC165 {113interface Collection is Dummy, ERC165 {110 // /// Set collection property.114 // /// Set collection property.111 // ///115 // ///196 /// or in textual repr: collectionSponsor()200 /// or in textual repr: collectionSponsor()197 function collectionSponsor() external view returns (Tuple26 memory);201 function collectionSponsor() external view returns (Tuple26 memory);202203 /// Get current collection limits.204 ///205 /// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:206 /// "accountTokenOwnershipLimit",207 /// "sponsoredDataSize",208 /// "sponsoredDataRateLimit",209 /// "tokenLimit",210 /// "sponsorTransferTimeout",211 /// "sponsorApproveTimeout"212 /// "ownerCanTransfer",213 /// "ownerCanDestroy",214 /// "transfersEnabled"215 /// Return `false` if a limit not set.216 /// @dev EVM selector for this function is: 0xf63bc572,217 /// or in textual repr: collectionLimits()218 function collectionLimits() external view returns (Tuple29[] memory);198219199 /// Set limits for the collection.220 /// Set limits for the collection.200 /// @dev Throws error if limit not found.221 /// @dev Throws error if limit not found.208 /// "ownerCanTransfer",229 /// "ownerCanTransfer",209 /// "ownerCanDestroy",230 /// "ownerCanDestroy",210 /// "transfersEnabled"231 /// "transfersEnabled"232 /// @param status enable\disable limit. Works only with `true`.211 /// @param value Value of the limit.233 /// @param value Value of the limit.212 /// @dev EVM selector for this function is: 0x4ad890a8,234 /// @dev EVM selector for this function is: 0x88150bd0,213 /// or in textual repr: setCollectionLimit(string,uint256)235 /// or in textual repr: setCollectionLimit(uint8,bool,uint256)214 function setCollectionLimit(string memory limit, uint256 value) external;236 function setCollectionLimit(237 CollectionLimits limit,238 bool status,239 uint256 value240 ) external;215241261 /// Returns nesting for a collection287 /// Returns nesting for a collection262 /// @dev EVM selector for this function is: 0x22d25bfe,288 /// @dev EVM selector for this function is: 0x22d25bfe,263 /// or in textual repr: collectionNestingRestrictedCollectionIds()289 /// or in textual repr: collectionNestingRestrictedCollectionIds()264 function collectionNestingRestrictedCollectionIds() external view returns (Tuple30 memory);290 function collectionNestingRestrictedCollectionIds() external view returns (Tuple34 memory);265291266 /// Returns permissions for a collection292 /// Returns permissions for a collection267 /// @dev EVM selector for this function is: 0x5b2eaf4b,293 /// @dev EVM selector for this function is: 0x5b2eaf4b,268 /// or in textual repr: collectionNestingPermissions()294 /// or in textual repr: collectionNestingPermissions()269 function collectionNestingPermissions() external view returns (Tuple33[] memory);295 function collectionNestingPermissions() external view returns (Tuple37[] memory);270296271 /// Set the collection access method.297 /// Set the collection access method.272 /// @param mode Access mode298 /// @param mode Access mode381}407}382408383/// @dev anonymous struct409/// @dev anonymous struct384struct Tuple33 {410struct Tuple37 {385 CollectionPermissions field_0;411 CollectionPermissions field_0;386 bool field_1;412 bool field_1;387}413}392}418}393419394/// @dev anonymous struct420/// @dev anonymous struct395struct Tuple30 {421struct Tuple34 {396 bool field_0;422 bool field_0;397 uint256[] field_1;423 uint256[] field_1;398}424}425426/// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.427enum CollectionLimits {428 /// @dev How many tokens can a user have on one account.429 AccountTokenOwnership,430 /// @dev How many bytes of data are available for sponsorship.431 SponsoredDataSize,432 /// @dev In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]433 SponsoredDataRateLimit,434 /// @dev How many tokens can be mined into this collection.435 TokenLimit,436 /// @dev Timeouts for transfer sponsoring.437 SponsorTransferTimeout,438 /// @dev Timeout for sponsoring an approval in passed blocks.439 SponsorApproveTimeout,440 /// @dev Whether the collection owner of the collection can send tokens (which belong to other users).441 OwnerCanTransfer,442 /// @dev Can the collection owner burn other people's tokens.443 OwnerCanDestroy,444 /// @dev Is it possible to send tokens from this collection between users.445 TransferEnabled446}447448/// @dev anonymous struct449struct Tuple29 {450 CollectionLimits field_0;451 bool field_1;452 uint256 field_2;453}399454400/// @dev anonymous struct455/// @dev anonymous struct401struct Tuple26 {456struct Tuple26 {tests/src/eth/collectionLimits.test.tsdiffbeforeafterboth1import {IKeyringPair} from '@polkadot/types/types';1import {IKeyringPair} from '@polkadot/types/types';2import {Pallets} from '../util';2import {Pallets} from '../util';3import {expect, itEth, usingEthPlaygrounds} from './util';3import {expect, itEth, usingEthPlaygrounds} from './util';4import {CollectionLimits} from './util/playgrounds/types';45566describe('Can set collection limits', () => {7describe('Can set collection limits', () => {44 transfersEnabled: false,45 transfersEnabled: false,45 };46 };46 47 47 const collection = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);48 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);48 await collection.methods.setCollectionLimit('accountTokenOwnershipLimit', limits.accountTokenOwnershipLimit).send();49 await collectionEvm.methods.setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, limits.accountTokenOwnershipLimit).send();49 await collection.methods.setCollectionLimit('sponsoredDataSize', limits.sponsoredDataSize).send();50 await collectionEvm.methods.setCollectionLimit(CollectionLimits.SponsoredDataSize, true, limits.sponsoredDataSize).send();50 await collection.methods.setCollectionLimit('sponsoredDataRateLimit', limits.sponsoredDataRateLimit).send();51 await collectionEvm.methods.setCollectionLimit(CollectionLimits.SponsoredDataRateLimit, true, limits.sponsoredDataRateLimit).send();51 await collection.methods.setCollectionLimit('tokenLimit', limits.tokenLimit).send();52 await collectionEvm.methods.setCollectionLimit(CollectionLimits.TokenLimit, true, limits.tokenLimit).send();52 await collection.methods.setCollectionLimit('sponsorTransferTimeout', limits.sponsorTransferTimeout).send();53 await collectionEvm.methods.setCollectionLimit(CollectionLimits.SponsorTransferTimeout, true, limits.sponsorTransferTimeout).send();53 await collection.methods.setCollectionLimit('sponsorApproveTimeout', limits.sponsorApproveTimeout).send();54 await collectionEvm.methods.setCollectionLimit(CollectionLimits.SponsorApproveTimeout, true, limits.sponsorApproveTimeout).send();54 await collection.methods.setCollectionLimit('ownerCanTransfer', limits.ownerCanTransfer).send();55 await collectionEvm.methods.setCollectionLimit(CollectionLimits.OwnerCanTransfer, true, limits.ownerCanTransfer).send();55 await collection.methods.setCollectionLimit('ownerCanDestroy', limits.ownerCanDestroy).send();56 await collectionEvm.methods.setCollectionLimit(CollectionLimits.OwnerCanDestroy, true, limits.ownerCanDestroy).send();56 await collection.methods.setCollectionLimit('transfersEnabled', limits.transfersEnabled).send();57 await collectionEvm.methods.setCollectionLimit(CollectionLimits.TransferEnabled, true, limits.transfersEnabled).send();57 58 59 // Check limits from sub:58 const data = (await helper.rft.getData(collectionId))!;60 const data = (await helper.rft.getData(collectionId))!;59 expect(data.raw.limits).to.deep.eq(expectedLimits);61 expect(data.raw.limits).to.deep.eq(expectedLimits);60 expect(await helper.collection.getEffectiveLimits(collectionId)).to.deep.eq(expectedLimits);62 expect(await helper.collection.getEffectiveLimits(collectionId)).to.deep.eq(expectedLimits);63 // Check limits from eth:64 const limitsEvm = await collectionEvm.methods.collectionLimits().call({from: owner});65 expect(limitsEvm).to.have.length(9);66 expect(limitsEvm[0]).to.deep.eq([CollectionLimits.AccountTokenOwnership.toString(), true, limits.accountTokenOwnershipLimit.toString()]);67 expect(limitsEvm[1]).to.deep.eq([CollectionLimits.SponsoredDataSize.toString(), true, limits.sponsoredDataSize.toString()]);68 expect(limitsEvm[2]).to.deep.eq([CollectionLimits.SponsoredDataRateLimit.toString(), true, limits.sponsoredDataRateLimit.toString()]);69 expect(limitsEvm[3]).to.deep.eq([CollectionLimits.TokenLimit.toString(), true, limits.tokenLimit.toString()]);70 expect(limitsEvm[4]).to.deep.eq([CollectionLimits.SponsorTransferTimeout.toString(), true, limits.sponsorTransferTimeout.toString()]);71 expect(limitsEvm[5]).to.deep.eq([CollectionLimits.SponsorApproveTimeout.toString(), true, limits.sponsorApproveTimeout.toString()]);72 expect(limitsEvm[6]).to.deep.eq([CollectionLimits.OwnerCanTransfer.toString(), true, limits.ownerCanTransfer.toString()]);73 expect(limitsEvm[7]).to.deep.eq([CollectionLimits.OwnerCanDestroy.toString(), true, limits.ownerCanDestroy.toString()]);74 expect(limitsEvm[8]).to.deep.eq([CollectionLimits.TransferEnabled.toString(), true, limits.transfersEnabled.toString()]);61 }));75 }));62});76});637785 const {collectionAddress} = await helper.eth.createCollection(testCase.case, owner, 'Limits', 'absolutely anything', 'ISNI', 18);99 const {collectionAddress} = await helper.eth.createCollection(testCase.case, owner, 'Limits', 'absolutely anything', 'ISNI', 18);86 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);100 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);101102 // Cannot set non-existing limit103 await expect(collectionEvm.methods104 .setCollectionLimit(9, true, 1)105 .call()).to.be.rejectedWith('Returned error: VM Exception while processing transaction: revert Value not convertible into enum "CollectionLimits"'); 106 107 // Cannot disable limits87 await expect(collectionEvm.methods108 await expect(collectionEvm.methods88 .setCollectionLimit('badLimit', '1')109 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, false, 200)89 .call()).to.be.rejectedWith('unknown limit "badLimit"');110 .call()).to.be.rejectedWith('Returned error: VM Exception while processing transaction: revert user can\'t disable limits');90 11191 await expect(collectionEvm.methods112 await expect(collectionEvm.methods92 .setCollectionLimit(Object.keys(invalidLimits)[0], invalidLimits.accountTokenOwnershipLimit)113 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, invalidLimits.accountTokenOwnershipLimit)93 .call()).to.be.rejectedWith(`can't convert value to u32 "${invalidLimits.accountTokenOwnershipLimit}"`);114 .call()).to.be.rejectedWith(`can't convert value to u32 "${invalidLimits.accountTokenOwnershipLimit}"`);94 115 95 await expect(collectionEvm.methods116 await expect(collectionEvm.methods96 .setCollectionLimit(Object.keys(invalidLimits)[1], invalidLimits.transfersEnabled)117 .setCollectionLimit(CollectionLimits.TransferEnabled, true, 3)97 .call()).to.be.rejectedWith(`can't convert value to boolean "${invalidLimits.transfersEnabled}"`);118 .call()).to.be.rejectedWith(`can't convert value to boolean "${invalidLimits.transfersEnabled}"`);119120 expect(() => collectionEvm.methods121 .setCollectionLimit(CollectionLimits.SponsoredDataSize, true, -1).send()).to.throw('value out-of-bounds');98 }));122 }));123124 [125 {case: 'nft' as const, requiredPallets: []},126 {case: 'rft' as const, requiredPallets: [Pallets.ReFungible]},127 {case: 'ft' as const, requiredPallets: []},128 ].map(testCase =>129 itEth.ifWithPallets(`Non-owner and non-admin cannot set collection limits for ${testCase.case}`, testCase.requiredPallets || [], async ({helper}) => {130 const owner = await helper.eth.createAccountWithBalance(donor);131 const nonOwner = await helper.eth.createAccountWithBalance(donor);132 const {collectionAddress} = await helper.eth.createCollection(testCase.case, owner, 'Limits', 'absolutely anything', 'FLO', 18);133134 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);135 await expect(collectionEvm.methods136 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)137 .call({from: nonOwner}))138 .to.be.rejectedWith('NoPermission');139140 await expect(collectionEvm.methods141 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)142 .send({from: nonOwner}))143 .to.be.rejected;144 }));99});145});100 146tests/src/eth/createFTCollection.test.tsdiffbeforeafterboth18import {evmToAddress} from '@polkadot/util-crypto';18import {evmToAddress} from '@polkadot/util-crypto';19import {Pallets, requirePalletsOrSkip} from '../util';19import {Pallets, requirePalletsOrSkip} from '../util';20import {expect, itEth, usingEthPlaygrounds} from './util';20import {expect, itEth, usingEthPlaygrounds} from './util';21import { CollectionLimits } from './util/playgrounds/types';212222const DECIMALS = 18;23const DECIMALS = 18;2324196 }197 }197 {198 {198 await expect(peasantCollection.methods199 await expect(peasantCollection.methods199 .setCollectionLimit('accountTokenOwnershipLimit', '1000')200 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)200 .call()).to.be.rejectedWith(EXPECTED_ERROR);201 .call()).to.be.rejectedWith(EXPECTED_ERROR);201 }202 }202 });203 });221 }222 }222 {223 {223 await expect(peasantCollection.methods224 await expect(peasantCollection.methods224 .setCollectionLimit('accountTokenOwnershipLimit', '1000')225 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)225 .call()).to.be.rejectedWith(EXPECTED_ERROR);226 .call()).to.be.rejectedWith(EXPECTED_ERROR);226 }227 }227 }); 228 }); tests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth17import {evmToAddress} from '@polkadot/util-crypto';17import {evmToAddress} from '@polkadot/util-crypto';18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';19import {expect, itEth, usingEthPlaygrounds} from './util';19import {expect, itEth, usingEthPlaygrounds} from './util';20import { CollectionLimits } from './util/playgrounds/types';2021212222describe('Create NFT collection from EVM', () => {23describe('Create NFT collection from EVM', () => {207 }208 }208 {209 {209 await expect(malfeasantCollection.methods210 await expect(malfeasantCollection.methods210 .setCollectionLimit('accountTokenOwnershipLimit', '1000')211 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)211 .call()).to.be.rejectedWith(EXPECTED_ERROR);212 .call()).to.be.rejectedWith(EXPECTED_ERROR);212 }213 }213 });214 });232 }233 }233 {234 {234 await expect(malfeasantCollection.methods235 await expect(malfeasantCollection.methods235 .setCollectionLimit('accountTokenOwnershipLimit', '1000')236 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)236 .call()).to.be.rejectedWith(EXPECTED_ERROR);237 .call()).to.be.rejectedWith(EXPECTED_ERROR);237 }238 }238 });239 });tests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';19import {Pallets, requirePalletsOrSkip} from '../util';19import {Pallets, requirePalletsOrSkip} from '../util';20import {expect, itEth, usingEthPlaygrounds} from './util';20import {expect, itEth, usingEthPlaygrounds} from './util';21import {CollectionLimits} from './util/playgrounds/types';2122222323describe('Create RFT collection from EVM', () => {24describe('Create RFT collection from EVM', () => {239 }240 }240 {241 {241 await expect(peasantCollection.methods242 await expect(peasantCollection.methods242 .setCollectionLimit('accountTokenOwnershipLimit', '1000')243 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)243 .call()).to.be.rejectedWith(EXPECTED_ERROR);244 .call()).to.be.rejectedWith(EXPECTED_ERROR);244 }245 }245 });246 });264 }265 }265 {266 {266 await expect(peasantCollection.methods267 await expect(peasantCollection.methods267 .setCollectionLimit('accountTokenOwnershipLimit', '1000')268 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)268 .call()).to.be.rejectedWith(EXPECTED_ERROR);269 .call()).to.be.rejectedWith(EXPECTED_ERROR);269 }270 }270 });271 });tests/src/eth/events.test.tsdiffbeforeafterboth19import {EthUniqueHelper, itEth, usingEthPlaygrounds} from './util';19import {EthUniqueHelper, itEth, usingEthPlaygrounds} from './util';20import {IEvent, TCollectionMode} from '../util/playgrounds/types';20import {IEvent, TCollectionMode} from '../util/playgrounds/types';21import {Pallets, requirePalletsOrSkip} from '../util';21import {Pallets, requirePalletsOrSkip} from '../util';22import {EthTokenPermissions, NormalizedEvent} from './util/playgrounds/types';22import {CollectionLimits, EthTokenPermissions, NormalizedEvent} from './util/playgrounds/types';232324let donor: IKeyringPair;24let donor: IKeyringPair;25 25 234 });234 });235 const {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['CollectionLimitSet']}]);235 const {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['CollectionLimitSet']}]);236 {236 {237 await collection.methods.setCollectionLimit('ownerCanTransfer', 0n).send({from: owner});237 await collection.methods.setCollectionLimit(CollectionLimits.OwnerCanTransfer, true, 0).send({from: owner});238 await helper.wait.newBlocks(1);238 await helper.wait.newBlocks(1);239 expect(ethEvents).to.be.like([239 expect(ethEvents).to.be.like([240 {240 {tests/src/eth/util/playgrounds/types.tsdiffbeforeafterboth25 TokenOwner,25 TokenOwner,26 CollectionAdmin26 CollectionAdmin27}27}28export enum CollectionLimits {29 AccountTokenOwnership,30 SponsoredDataSize,31 SponsoredDataRateLimit,32 TokenLimit,33 SponsorTransferTimeout,34 SponsorApproveTimeout,35 OwnerCanTransfer,36 OwnerCanDestroy,37 TransferEnabled38}39tests/src/pallet-presence.test.tsdiffbeforeafterboth84 );84 );85 } else if (chain.eq('UNIQUE')) {85 } else if (chain.eq('UNIQUE')) {86 // Insert Unique additional pallets here86 // Insert Unique additional pallets here87 requiredPallets.push(foreignAssets);87 }88 }88 });89 });89 });90 });