difftreelog
feature/setCollectionLimit Behavior of the `setCollectionLimit` method. Removed method overload: single signature `(string, uint256)` is used for both cases.
in: master
22 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5831,7 +5831,7 @@
[[package]]
name = "pallet-common"
-version = "0.1.10"
+version = "0.1.11"
dependencies = [
"ethereum",
"evm-coder",
pallets/common/CHANGELOG.mddiffbeforeafterboth--- a/pallets/common/CHANGELOG.md
+++ b/pallets/common/CHANGELOG.md
@@ -2,10 +2,22 @@
All notable changes to this project will be documented in this file.
+<!-- bureaucrate goes here -->
+
+## [0.1.11] - 2022-11-16
+
+### Changed
+
+- Behavior of the `setCollectionLimit` method.
+ Removed method overload: single signature `(string, uint256)`
+ is used for both cases.
+
## [0.1.10] - 2022-11-02
+
### Changed
- - Use named structure `EthCrossAccount` in eth functions.
+- Use named structure `EthCrossAccount` in eth functions.
+
## [0.1.9] - 2022-10-13
## Added
@@ -34,8 +46,6 @@
### Added
- New Ethereum API methods: changeOwner, changeOwner(Substrate) and verifyOwnerOrAdmin(Substrate).
-
-<!-- bureaucrate goes here -->
## [v0.1.5] 2022-08-16
pallets/common/Cargo.tomldiffbeforeafterboth--- a/pallets/common/Cargo.toml
+++ b/pallets/common/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "pallet-common"
-version = "0.1.10"
+version = "0.1.11"
license = "GPLv3"
edition = "2021"
pallets/common/src/erc.rsdiffbeforeafterboth--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -303,11 +303,29 @@
/// "tokenLimit",
/// "sponsorTransferTimeout",
/// "sponsorApproveTimeout"
+ /// "ownerCanTransfer",
+ /// "ownerCanDestroy",
+ /// "transfersEnabled"
/// @param value Value of the limit.
#[solidity(rename_selector = "setCollectionLimit")]
- fn set_int_limit(&mut self, caller: caller, limit: string, value: uint32) -> Result<void> {
+ fn set_int_limit(&mut self, caller: caller, limit: string, value: uint256) -> Result<void> {
self.consume_store_reads_and_writes(1, 1)?;
+ let value = value
+ .try_into()
+ .map_err(|_| Error::Revert(format!("can't convert value to u32 \"{}\"", value)))?;
+
+ let convert_value_to_bool = || match value {
+ 0 => Ok(false),
+ 1 => Ok(true),
+ _ => {
+ return Err(Error::Revert(format!(
+ "can't convert value to boolean \"{}\"",
+ value
+ )))
+ }
+ };
+
check_is_owner_or_admin(caller, self)?;
let mut limits = self.limits.clone();
@@ -330,48 +348,16 @@
"sponsorApproveTimeout" => {
limits.sponsor_approve_timeout = Some(value);
}
- _ => {
- return Err(Error::Revert(format!(
- "unknown integer limit \"{}\"",
- limit
- )))
- }
- }
- self.limits = <Pallet<T>>::clamp_limits(self.mode.clone(), &self.limits, limits)
- .map_err(dispatch_to_evm::<T>)?;
- save(self)
- }
-
- /// Set limits for the collection.
- /// @dev Throws error if limit not found.
- /// @param limit Name of the limit. Valid names:
- /// "ownerCanTransfer",
- /// "ownerCanDestroy",
- /// "transfersEnabled"
- /// @param value Value of the limit.
- #[solidity(rename_selector = "setCollectionLimit")]
- fn set_bool_limit(&mut self, caller: caller, limit: string, value: bool) -> Result<void> {
- self.consume_store_reads_and_writes(1, 1)?;
-
- check_is_owner_or_admin(caller, self)?;
- let mut limits = self.limits.clone();
-
- match limit.as_str() {
"ownerCanTransfer" => {
- limits.owner_can_transfer = Some(value);
+ limits.owner_can_transfer = Some(convert_value_to_bool()?);
}
"ownerCanDestroy" => {
- limits.owner_can_destroy = Some(value);
+ limits.owner_can_destroy = Some(convert_value_to_bool()?);
}
"transfersEnabled" => {
- limits.transfers_enabled = Some(value);
- }
- _ => {
- return Err(Error::Revert(format!(
- "unknown boolean limit \"{}\"",
- limit
- )))
+ limits.transfers_enabled = Some(convert_value_to_bool()?);
}
+ _ => return Err(Error::Revert(format!("unknown limit \"{}\"", limit))),
}
self.limits = <Pallet<T>>::clamp_limits(self.mode.clone(), &self.limits, limits)
.map_err(dispatch_to_evm::<T>)?;
pallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterbothbinary blob — no preview
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 0x324a7f5b
+/// @dev the ERC-165 identifier for this interface is 0x8b91d192
contract Collection is Dummy, ERC165 {
// /// Set collection property.
// ///
@@ -167,26 +167,13 @@
/// "tokenLimit",
/// "sponsorTransferTimeout",
/// "sponsorApproveTimeout"
- /// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x6a3841db,
- /// or in textual repr: setCollectionLimit(string,uint32)
- function setCollectionLimit(string memory limit, uint32 value) public {
- require(false, stub_error);
- limit;
- value;
- dummy = 0;
- }
-
- /// Set limits for the collection.
- /// @dev Throws error if limit not found.
- /// @param limit Name of the limit. Valid names:
- /// "ownerCanTransfer",
+ /// "ownerCanTransfer",
/// "ownerCanDestroy",
/// "transfersEnabled"
/// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x993b7fba,
- /// or in textual repr: setCollectionLimit(string,bool)
- function setCollectionLimit(string memory limit, bool value) public {
+ /// @dev EVM selector for this function is: 0x4ad890a8,
+ /// or in textual repr: setCollectionLimit(string,uint256)
+ function setCollectionLimit(string memory limit, uint256 value) public {
require(false, stub_error);
limit;
value;
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
@@ -119,7 +119,7 @@
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x324a7f5b
+/// @dev the ERC-165 identifier for this interface is 0x8b91d192
contract Collection is Dummy, ERC165 {
// /// Set collection property.
// ///
@@ -268,26 +268,13 @@
/// "tokenLimit",
/// "sponsorTransferTimeout",
/// "sponsorApproveTimeout"
- /// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x6a3841db,
- /// or in textual repr: setCollectionLimit(string,uint32)
- function setCollectionLimit(string memory limit, uint32 value) public {
- require(false, stub_error);
- limit;
- value;
- dummy = 0;
- }
-
- /// Set limits for the collection.
- /// @dev Throws error if limit not found.
- /// @param limit Name of the limit. Valid names:
- /// "ownerCanTransfer",
+ /// "ownerCanTransfer",
/// "ownerCanDestroy",
/// "transfersEnabled"
/// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x993b7fba,
- /// or in textual repr: setCollectionLimit(string,bool)
- function setCollectionLimit(string memory limit, bool value) public {
+ /// @dev EVM selector for this function is: 0x4ad890a8,
+ /// or in textual repr: setCollectionLimit(string,uint256)
+ function setCollectionLimit(string memory limit, uint256 value) public {
require(false, stub_error);
limit;
value;
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
@@ -119,7 +119,7 @@
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x324a7f5b
+/// @dev the ERC-165 identifier for this interface is 0x8b91d192
contract Collection is Dummy, ERC165 {
// /// Set collection property.
// ///
@@ -268,26 +268,13 @@
/// "tokenLimit",
/// "sponsorTransferTimeout",
/// "sponsorApproveTimeout"
- /// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x6a3841db,
- /// or in textual repr: setCollectionLimit(string,uint32)
- function setCollectionLimit(string memory limit, uint32 value) public {
- require(false, stub_error);
- limit;
- value;
- dummy = 0;
- }
-
- /// Set limits for the collection.
- /// @dev Throws error if limit not found.
- /// @param limit Name of the limit. Valid names:
- /// "ownerCanTransfer",
+ /// "ownerCanTransfer",
/// "ownerCanDestroy",
/// "transfersEnabled"
/// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x993b7fba,
- /// or in textual repr: setCollectionLimit(string,bool)
- function setCollectionLimit(string memory limit, bool value) public {
+ /// @dev EVM selector for this function is: 0x4ad890a8,
+ /// or in textual repr: setCollectionLimit(string,uint256)
+ function setCollectionLimit(string memory limit, uint256 value) public {
require(false, stub_error);
limit;
value;
pallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterbothbinary blob — no preview
pallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterbothbinary blob — no preview
tests/src/eth/abi/fungible.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": "spender",15 "type": "address"16 },17 {18 "indexed": false,19 "internalType": "uint256",20 "name": "value",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": "from",34 "type": "address"35 },36 {37 "indexed": true,38 "internalType": "address",39 "name": "to",40 "type": "address"41 },42 {43 "indexed": false,44 "internalType": "uint256",45 "name": "value",46 "type": "uint256"47 }48 ],49 "name": "Transfer",50 "type": "event"51 },52 {53 "inputs": [54 {55 "components": [56 { "internalType": "address", "name": "eth", "type": "address" },57 { "internalType": "uint256", "name": "sub", "type": "uint256" }58 ],59 "internalType": "struct EthCrossAccount",60 "name": "newAdmin",61 "type": "tuple"62 }63 ],64 "name": "addCollectionAdminCross",65 "outputs": [],66 "stateMutability": "nonpayable",67 "type": "function"68 },69 {70 "inputs": [71 {72 "components": [73 { "internalType": "address", "name": "eth", "type": "address" },74 { "internalType": "uint256", "name": "sub", "type": "uint256" }75 ],76 "internalType": "struct EthCrossAccount",77 "name": "user",78 "type": "tuple"79 }80 ],81 "name": "addToCollectionAllowListCross",82 "outputs": [],83 "stateMutability": "nonpayable",84 "type": "function"85 },86 {87 "inputs": [88 { "internalType": "address", "name": "owner", "type": "address" },89 { "internalType": "address", "name": "spender", "type": "address" }90 ],91 "name": "allowance",92 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],93 "stateMutability": "view",94 "type": "function"95 },96 {97 "inputs": [98 { "internalType": "address", "name": "user", "type": "address" }99 ],100 "name": "allowed",101 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],102 "stateMutability": "view",103 "type": "function"104 },105 {106 "inputs": [107 { "internalType": "address", "name": "spender", "type": "address" },108 { "internalType": "uint256", "name": "amount", "type": "uint256" }109 ],110 "name": "approve",111 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],112 "stateMutability": "nonpayable",113 "type": "function"114 },115 {116 "inputs": [117 {118 "components": [119 { "internalType": "address", "name": "eth", "type": "address" },120 { "internalType": "uint256", "name": "sub", "type": "uint256" }121 ],122 "internalType": "struct EthCrossAccount",123 "name": "spender",124 "type": "tuple"125 },126 { "internalType": "uint256", "name": "amount", "type": "uint256" }127 ],128 "name": "approveCross",129 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],130 "stateMutability": "nonpayable",131 "type": "function"132 },133 {134 "inputs": [135 { "internalType": "address", "name": "owner", "type": "address" }136 ],137 "name": "balanceOf",138 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],139 "stateMutability": "view",140 "type": "function"141 },142 {143 "inputs": [144 {145 "components": [146 { "internalType": "address", "name": "eth", "type": "address" },147 { "internalType": "uint256", "name": "sub", "type": "uint256" }148 ],149 "internalType": "struct EthCrossAccount",150 "name": "from",151 "type": "tuple"152 },153 { "internalType": "uint256", "name": "amount", "type": "uint256" }154 ],155 "name": "burnFromCross",156 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],157 "stateMutability": "nonpayable",158 "type": "function"159 },160 {161 "inputs": [162 {163 "components": [164 { "internalType": "address", "name": "eth", "type": "address" },165 { "internalType": "uint256", "name": "sub", "type": "uint256" }166 ],167 "internalType": "struct EthCrossAccount",168 "name": "newOwner",169 "type": "tuple"170 }171 ],172 "name": "changeCollectionOwnerCross",173 "outputs": [],174 "stateMutability": "nonpayable",175 "type": "function"176 },177 {178 "inputs": [],179 "name": "collectionAdmins",180 "outputs": [181 {182 "components": [183 { "internalType": "address", "name": "eth", "type": "address" },184 { "internalType": "uint256", "name": "sub", "type": "uint256" }185 ],186 "internalType": "struct EthCrossAccount[]",187 "name": "",188 "type": "tuple[]"189 }190 ],191 "stateMutability": "view",192 "type": "function"193 },194 {195 "inputs": [],196 "name": "collectionOwner",197 "outputs": [198 {199 "components": [200 { "internalType": "address", "name": "eth", "type": "address" },201 { "internalType": "uint256", "name": "sub", "type": "uint256" }202 ],203 "internalType": "struct EthCrossAccount",204 "name": "",205 "type": "tuple"206 }207 ],208 "stateMutability": "view",209 "type": "function"210 },211 {212 "inputs": [213 { "internalType": "string[]", "name": "keys", "type": "string[]" }214 ],215 "name": "collectionProperties",216 "outputs": [217 {218 "components": [219 { "internalType": "string", "name": "field_0", "type": "string" },220 { "internalType": "bytes", "name": "field_1", "type": "bytes" }221 ],222 "internalType": "struct Tuple16[]",223 "name": "",224 "type": "tuple[]"225 }226 ],227 "stateMutability": "view",228 "type": "function"229 },230 {231 "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],232 "name": "collectionProperty",233 "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],234 "stateMutability": "view",235 "type": "function"236 },237 {238 "inputs": [],239 "name": "collectionSponsor",240 "outputs": [241 {242 "components": [243 { "internalType": "address", "name": "field_0", "type": "address" },244 { "internalType": "uint256", "name": "field_1", "type": "uint256" }245 ],246 "internalType": "struct Tuple8",247 "name": "",248 "type": "tuple"249 }250 ],251 "stateMutability": "view",252 "type": "function"253 },254 {255 "inputs": [],256 "name": "confirmCollectionSponsorship",257 "outputs": [],258 "stateMutability": "nonpayable",259 "type": "function"260 },261 {262 "inputs": [],263 "name": "contractAddress",264 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],265 "stateMutability": "view",266 "type": "function"267 },268 {269 "inputs": [],270 "name": "decimals",271 "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],272 "stateMutability": "view",273 "type": "function"274 },275 {276 "inputs": [277 { "internalType": "string[]", "name": "keys", "type": "string[]" }278 ],279 "name": "deleteCollectionProperties",280 "outputs": [],281 "stateMutability": "nonpayable",282 "type": "function"283 },284 {285 "inputs": [],286 "name": "hasCollectionPendingSponsor",287 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],288 "stateMutability": "view",289 "type": "function"290 },291 {292 "inputs": [293 {294 "components": [295 { "internalType": "address", "name": "eth", "type": "address" },296 { "internalType": "uint256", "name": "sub", "type": "uint256" }297 ],298 "internalType": "struct EthCrossAccount",299 "name": "user",300 "type": "tuple"301 }302 ],303 "name": "isOwnerOrAdminCross",304 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],305 "stateMutability": "view",306 "type": "function"307 },308 {309 "inputs": [310 { "internalType": "address", "name": "to", "type": "address" },311 { "internalType": "uint256", "name": "amount", "type": "uint256" }312 ],313 "name": "mint",314 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],315 "stateMutability": "nonpayable",316 "type": "function"317 },318 {319 "inputs": [320 {321 "components": [322 { "internalType": "address", "name": "field_0", "type": "address" },323 { "internalType": "uint256", "name": "field_1", "type": "uint256" }324 ],325 "internalType": "struct Tuple8[]",326 "name": "amounts",327 "type": "tuple[]"328 }329 ],330 "name": "mintBulk",331 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],332 "stateMutability": "nonpayable",333 "type": "function"334 },335 {336 "inputs": [],337 "name": "name",338 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],339 "stateMutability": "view",340 "type": "function"341 },342 {343 "inputs": [344 {345 "components": [346 { "internalType": "address", "name": "eth", "type": "address" },347 { "internalType": "uint256", "name": "sub", "type": "uint256" }348 ],349 "internalType": "struct EthCrossAccount",350 "name": "admin",351 "type": "tuple"352 }353 ],354 "name": "removeCollectionAdminCross",355 "outputs": [],356 "stateMutability": "nonpayable",357 "type": "function"358 },359 {360 "inputs": [],361 "name": "removeCollectionSponsor",362 "outputs": [],363 "stateMutability": "nonpayable",364 "type": "function"365 },366 {367 "inputs": [368 {369 "components": [370 { "internalType": "address", "name": "eth", "type": "address" },371 { "internalType": "uint256", "name": "sub", "type": "uint256" }372 ],373 "internalType": "struct EthCrossAccount",374 "name": "user",375 "type": "tuple"376 }377 ],378 "name": "removeFromCollectionAllowListCross",379 "outputs": [],380 "stateMutability": "nonpayable",381 "type": "function"382 },383 {384 "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],385 "name": "setCollectionAccess",386 "outputs": [],387 "stateMutability": "nonpayable",388 "type": "function"389 },390 {391 "inputs": [392 { "internalType": "string", "name": "limit", "type": "string" },393 { "internalType": "uint32", "name": "value", "type": "uint32" }394 ],395 "name": "setCollectionLimit",396 "outputs": [],397 "stateMutability": "nonpayable",398 "type": "function"399 },400 {401 "inputs": [402 { "internalType": "string", "name": "limit", "type": "string" },403 { "internalType": "bool", "name": "value", "type": "bool" }404 ],405 "name": "setCollectionLimit",406 "outputs": [],407 "stateMutability": "nonpayable",408 "type": "function"409 },410 {411 "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],412 "name": "setCollectionMintMode",413 "outputs": [],414 "stateMutability": "nonpayable",415 "type": "function"416 },417 {418 "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],419 "name": "setCollectionNesting",420 "outputs": [],421 "stateMutability": "nonpayable",422 "type": "function"423 },424 {425 "inputs": [426 { "internalType": "bool", "name": "enable", "type": "bool" },427 {428 "internalType": "address[]",429 "name": "collections",430 "type": "address[]"431 }432 ],433 "name": "setCollectionNesting",434 "outputs": [],435 "stateMutability": "nonpayable",436 "type": "function"437 },438 {439 "inputs": [440 {441 "components": [442 { "internalType": "string", "name": "key", "type": "string" },443 { "internalType": "bytes", "name": "value", "type": "bytes" }444 ],445 "internalType": "struct Property[]",446 "name": "properties",447 "type": "tuple[]"448 }449 ],450 "name": "setCollectionProperties",451 "outputs": [],452 "stateMutability": "nonpayable",453 "type": "function"454 },455 {456 "inputs": [457 {458 "components": [459 { "internalType": "address", "name": "eth", "type": "address" },460 { "internalType": "uint256", "name": "sub", "type": "uint256" }461 ],462 "internalType": "struct EthCrossAccount",463 "name": "sponsor",464 "type": "tuple"465 }466 ],467 "name": "setCollectionSponsorCross",468 "outputs": [],469 "stateMutability": "nonpayable",470 "type": "function"471 },472 {473 "inputs": [474 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }475 ],476 "name": "supportsInterface",477 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],478 "stateMutability": "view",479 "type": "function"480 },481 {482 "inputs": [],483 "name": "symbol",484 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],485 "stateMutability": "view",486 "type": "function"487 },488 {489 "inputs": [],490 "name": "totalSupply",491 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],492 "stateMutability": "view",493 "type": "function"494 },495 {496 "inputs": [497 { "internalType": "address", "name": "to", "type": "address" },498 { "internalType": "uint256", "name": "amount", "type": "uint256" }499 ],500 "name": "transfer",501 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],502 "stateMutability": "nonpayable",503 "type": "function"504 },505 {506 "inputs": [507 {508 "components": [509 { "internalType": "address", "name": "eth", "type": "address" },510 { "internalType": "uint256", "name": "sub", "type": "uint256" }511 ],512 "internalType": "struct EthCrossAccount",513 "name": "to",514 "type": "tuple"515 },516 { "internalType": "uint256", "name": "amount", "type": "uint256" }517 ],518 "name": "transferCross",519 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],520 "stateMutability": "nonpayable",521 "type": "function"522 },523 {524 "inputs": [525 { "internalType": "address", "name": "from", "type": "address" },526 { "internalType": "address", "name": "to", "type": "address" },527 { "internalType": "uint256", "name": "amount", "type": "uint256" }528 ],529 "name": "transferFrom",530 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],531 "stateMutability": "nonpayable",532 "type": "function"533 },534 {535 "inputs": [536 {537 "components": [538 { "internalType": "address", "name": "eth", "type": "address" },539 { "internalType": "uint256", "name": "sub", "type": "uint256" }540 ],541 "internalType": "struct EthCrossAccount",542 "name": "from",543 "type": "tuple"544 },545 {546 "components": [547 { "internalType": "address", "name": "eth", "type": "address" },548 { "internalType": "uint256", "name": "sub", "type": "uint256" }549 ],550 "internalType": "struct EthCrossAccount",551 "name": "to",552 "type": "tuple"553 },554 { "internalType": "uint256", "name": "amount", "type": "uint256" }555 ],556 "name": "transferFromCross",557 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],558 "stateMutability": "nonpayable",559 "type": "function"560 },561 {562 "inputs": [],563 "name": "uniqueCollectionType",564 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],565 "stateMutability": "view",566 "type": "function"567 }568]tests/src/eth/abi/nonFungible.jsondiffbeforeafterboth--- a/tests/src/eth/abi/nonFungible.json
+++ b/tests/src/eth/abi/nonFungible.json
@@ -505,17 +505,7 @@
{
"inputs": [
{ "internalType": "string", "name": "limit", "type": "string" },
- { "internalType": "uint32", "name": "value", "type": "uint32" }
- ],
- "name": "setCollectionLimit",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string", "name": "limit", "type": "string" },
- { "internalType": "bool", "name": "value", "type": "bool" }
+ { "internalType": "uint256", "name": "value", "type": "uint256" }
],
"name": "setCollectionLimit",
"outputs": [],
tests/src/eth/abi/reFungible.jsondiffbeforeafterboth--- a/tests/src/eth/abi/reFungible.json
+++ b/tests/src/eth/abi/reFungible.json
@@ -487,17 +487,7 @@
{
"inputs": [
{ "internalType": "string", "name": "limit", "type": "string" },
- { "internalType": "uint32", "name": "value", "type": "uint32" }
- ],
- "name": "setCollectionLimit",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "string", "name": "limit", "type": "string" },
- { "internalType": "bool", "name": "value", "type": "bool" }
+ { "internalType": "uint256", "name": "value", "type": "uint256" }
],
"name": "setCollectionLimit",
"outputs": [],
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 0x324a7f5b
+/// @dev the ERC-165 identifier for this interface is 0x8b91d192
interface Collection is Dummy, ERC165 {
// /// Set collection property.
// ///
@@ -113,21 +113,13 @@
/// "tokenLimit",
/// "sponsorTransferTimeout",
/// "sponsorApproveTimeout"
- /// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x6a3841db,
- /// or in textual repr: setCollectionLimit(string,uint32)
- function setCollectionLimit(string memory limit, uint32 value) external;
-
- /// Set limits for the collection.
- /// @dev Throws error if limit not found.
- /// @param limit Name of the limit. Valid names:
- /// "ownerCanTransfer",
+ /// "ownerCanTransfer",
/// "ownerCanDestroy",
/// "transfersEnabled"
/// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x993b7fba,
- /// or in textual repr: setCollectionLimit(string,bool)
- function setCollectionLimit(string memory limit, bool value) external;
+ /// @dev EVM selector for this function is: 0x4ad890a8,
+ /// or in textual repr: setCollectionLimit(string,uint256)
+ function setCollectionLimit(string memory limit, uint256 value) external;
/// Get contract address.
/// @dev EVM selector for this function is: 0xf6b4dfb4,
tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -80,7 +80,7 @@
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x324a7f5b
+/// @dev the ERC-165 identifier for this interface is 0x8b91d192
interface Collection is Dummy, ERC165 {
// /// Set collection property.
// ///
@@ -180,21 +180,13 @@
/// "tokenLimit",
/// "sponsorTransferTimeout",
/// "sponsorApproveTimeout"
- /// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x6a3841db,
- /// or in textual repr: setCollectionLimit(string,uint32)
- function setCollectionLimit(string memory limit, uint32 value) external;
-
- /// Set limits for the collection.
- /// @dev Throws error if limit not found.
- /// @param limit Name of the limit. Valid names:
- /// "ownerCanTransfer",
+ /// "ownerCanTransfer",
/// "ownerCanDestroy",
/// "transfersEnabled"
/// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x993b7fba,
- /// or in textual repr: setCollectionLimit(string,bool)
- function setCollectionLimit(string memory limit, bool value) external;
+ /// @dev EVM selector for this function is: 0x4ad890a8,
+ /// or in textual repr: setCollectionLimit(string,uint256)
+ function setCollectionLimit(string memory limit, uint256 value) external;
/// Get contract address.
/// @dev EVM selector for this function is: 0xf6b4dfb4,
tests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -80,7 +80,7 @@
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x324a7f5b
+/// @dev the ERC-165 identifier for this interface is 0x8b91d192
interface Collection is Dummy, ERC165 {
// /// Set collection property.
// ///
@@ -180,21 +180,13 @@
/// "tokenLimit",
/// "sponsorTransferTimeout",
/// "sponsorApproveTimeout"
- /// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x6a3841db,
- /// or in textual repr: setCollectionLimit(string,uint32)
- function setCollectionLimit(string memory limit, uint32 value) external;
-
- /// Set limits for the collection.
- /// @dev Throws error if limit not found.
- /// @param limit Name of the limit. Valid names:
- /// "ownerCanTransfer",
+ /// "ownerCanTransfer",
/// "ownerCanDestroy",
/// "transfersEnabled"
/// @param value Value of the limit.
- /// @dev EVM selector for this function is: 0x993b7fba,
- /// or in textual repr: setCollectionLimit(string,bool)
- function setCollectionLimit(string memory limit, bool value) external;
+ /// @dev EVM selector for this function is: 0x4ad890a8,
+ /// or in textual repr: setCollectionLimit(string,uint256)
+ function setCollectionLimit(string memory limit, uint256 value) external;
/// Get contract address.
/// @dev EVM selector for this function is: 0xf6b4dfb4,
tests/src/eth/createFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createFTCollection.test.ts
+++ b/tests/src/eth/createFTCollection.test.ts
@@ -85,32 +85,44 @@
tokenLimit: 1000000,
sponsorTransferTimeout: 6,
sponsorApproveTimeout: 6,
+ ownerCanTransfer: 0,
+ ownerCanDestroy: 0,
+ transfersEnabled: 0,
+ };
+
+ const expectedLimits = {
+ accountTokenOwnershipLimit: 1000,
+ sponsoredDataSize: 1024,
+ sponsoredDataRateLimit: 30,
+ tokenLimit: 1000000,
+ sponsorTransferTimeout: 6,
+ sponsorApproveTimeout: 6,
ownerCanTransfer: false,
ownerCanDestroy: false,
transfersEnabled: false,
};
-
+
const collection = helper.ethNativeContract.collection(collectionAddress, 'ft', owner);
- await collection.methods['setCollectionLimit(string,uint32)']('accountTokenOwnershipLimit', limits.accountTokenOwnershipLimit).send();
- await collection.methods['setCollectionLimit(string,uint32)']('sponsoredDataSize', limits.sponsoredDataSize).send();
- await collection.methods['setCollectionLimit(string,uint32)']('sponsoredDataRateLimit', limits.sponsoredDataRateLimit).send();
- await collection.methods['setCollectionLimit(string,uint32)']('tokenLimit', limits.tokenLimit).send();
- await collection.methods['setCollectionLimit(string,uint32)']('sponsorTransferTimeout', limits.sponsorTransferTimeout).send();
- await collection.methods['setCollectionLimit(string,uint32)']('sponsorApproveTimeout', limits.sponsorApproveTimeout).send();
- await collection.methods['setCollectionLimit(string,bool)']('ownerCanTransfer', limits.ownerCanTransfer).send();
- await collection.methods['setCollectionLimit(string,bool)']('ownerCanDestroy', limits.ownerCanDestroy).send();
- await collection.methods['setCollectionLimit(string,bool)']('transfersEnabled', limits.transfersEnabled).send();
+ 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 data = (await helper.rft.getData(collectionId))!;
- expect(data.raw.limits.accountTokenOwnershipLimit).to.be.eq(limits.accountTokenOwnershipLimit);
- expect(data.raw.limits.sponsoredDataSize).to.be.eq(limits.sponsoredDataSize);
- expect(data.raw.limits.sponsoredDataRateLimit.blocks).to.be.eq(limits.sponsoredDataRateLimit);
- expect(data.raw.limits.tokenLimit).to.be.eq(limits.tokenLimit);
- expect(data.raw.limits.sponsorTransferTimeout).to.be.eq(limits.sponsorTransferTimeout);
- expect(data.raw.limits.sponsorApproveTimeout).to.be.eq(limits.sponsorApproveTimeout);
- expect(data.raw.limits.ownerCanTransfer).to.be.eq(limits.ownerCanTransfer);
- expect(data.raw.limits.ownerCanDestroy).to.be.eq(limits.ownerCanDestroy);
- expect(data.raw.limits.transfersEnabled).to.be.eq(limits.transfersEnabled);
+ expect(data.raw.limits.accountTokenOwnershipLimit).to.be.eq(expectedLimits.accountTokenOwnershipLimit);
+ expect(data.raw.limits.sponsoredDataSize).to.be.eq(expectedLimits.sponsoredDataSize);
+ expect(data.raw.limits.sponsoredDataRateLimit.blocks).to.be.eq(expectedLimits.sponsoredDataRateLimit);
+ expect(data.raw.limits.tokenLimit).to.be.eq(expectedLimits.tokenLimit);
+ expect(data.raw.limits.sponsorTransferTimeout).to.be.eq(expectedLimits.sponsorTransferTimeout);
+ expect(data.raw.limits.sponsorApproveTimeout).to.be.eq(expectedLimits.sponsorApproveTimeout);
+ expect(data.raw.limits.ownerCanTransfer).to.be.eq(expectedLimits.ownerCanTransfer);
+ expect(data.raw.limits.ownerCanDestroy).to.be.eq(expectedLimits.ownerCanDestroy);
+ expect(data.raw.limits.transfersEnabled).to.be.eq(expectedLimits.transfersEnabled);
});
itEth('Collection address exist', async ({helper}) => {
@@ -257,11 +269,28 @@
});
itEth('(!negative test!) Set limits', async ({helper}) => {
+
+ const invalidLimits = {
+ accountTokenOwnershipLimit: BigInt(Number.MAX_SAFE_INTEGER),
+ transfersEnabled: 3,
+ };
+
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Limits', DECIMALS, 'absolutely anything', 'ISNI');
const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'ft', owner);
await expect(collectionEvm.methods
- .setCollectionLimit('badLimit', 'true')
- .call()).to.be.rejectedWith('unknown boolean limit "badLimit"');
+ .setCollectionLimit('badLimit', '1')
+ .call()).to.be.rejectedWith('unknown limit "badLimit"');
+
+ await expect(collectionEvm.methods
+ .setCollectionLimit(Object.keys(invalidLimits)[0], 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)
+ .call()).to.be.rejectedWith(`can't convert value to boolean "${invalidLimits.transfersEnabled}"`);
});
+
+
+
});
tests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createNFTCollection.test.ts
+++ b/tests/src/eth/createNFTCollection.test.ts
@@ -124,32 +124,44 @@
tokenLimit: 1000000,
sponsorTransferTimeout: 6,
sponsorApproveTimeout: 6,
+ ownerCanTransfer: 0,
+ ownerCanDestroy: 0,
+ transfersEnabled: 0,
+ };
+
+ const expectedLimits = {
+ accountTokenOwnershipLimit: 1000,
+ sponsoredDataSize: 1024,
+ sponsoredDataRateLimit: 30,
+ tokenLimit: 1000000,
+ sponsorTransferTimeout: 6,
+ sponsorApproveTimeout: 6,
ownerCanTransfer: false,
ownerCanDestroy: false,
transfersEnabled: false,
};
const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
- await collection.methods['setCollectionLimit(string,uint32)']('accountTokenOwnershipLimit', limits.accountTokenOwnershipLimit).send();
- await collection.methods['setCollectionLimit(string,uint32)']('sponsoredDataSize', limits.sponsoredDataSize).send();
- await collection.methods['setCollectionLimit(string,uint32)']('sponsoredDataRateLimit', limits.sponsoredDataRateLimit).send();
- await collection.methods['setCollectionLimit(string,uint32)']('tokenLimit', limits.tokenLimit).send();
- await collection.methods['setCollectionLimit(string,uint32)']('sponsorTransferTimeout', limits.sponsorTransferTimeout).send();
- await collection.methods['setCollectionLimit(string,uint32)']('sponsorApproveTimeout', limits.sponsorApproveTimeout).send();
- await collection.methods['setCollectionLimit(string,bool)']('ownerCanTransfer', limits.ownerCanTransfer).send();
- await collection.methods['setCollectionLimit(string,bool)']('ownerCanDestroy', limits.ownerCanDestroy).send();
- await collection.methods['setCollectionLimit(string,bool)']('transfersEnabled', limits.transfersEnabled).send();
+ 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 data = (await helper.nft.getData(collectionId))!;
- expect(data.raw.limits.accountTokenOwnershipLimit).to.be.eq(limits.accountTokenOwnershipLimit);
- expect(data.raw.limits.sponsoredDataSize).to.be.eq(limits.sponsoredDataSize);
- expect(data.raw.limits.sponsoredDataRateLimit.blocks).to.be.eq(limits.sponsoredDataRateLimit);
- expect(data.raw.limits.tokenLimit).to.be.eq(limits.tokenLimit);
- expect(data.raw.limits.sponsorTransferTimeout).to.be.eq(limits.sponsorTransferTimeout);
- expect(data.raw.limits.sponsorApproveTimeout).to.be.eq(limits.sponsorApproveTimeout);
- expect(data.raw.limits.ownerCanTransfer).to.be.eq(limits.ownerCanTransfer);
- expect(data.raw.limits.ownerCanDestroy).to.be.eq(limits.ownerCanDestroy);
- expect(data.raw.limits.transfersEnabled).to.be.eq(limits.transfersEnabled);
+ const data = (await helper.rft.getData(collectionId))!;
+ expect(data.raw.limits.accountTokenOwnershipLimit).to.be.eq(expectedLimits.accountTokenOwnershipLimit);
+ expect(data.raw.limits.sponsoredDataSize).to.be.eq(expectedLimits.sponsoredDataSize);
+ expect(data.raw.limits.sponsoredDataRateLimit.blocks).to.be.eq(expectedLimits.sponsoredDataRateLimit);
+ expect(data.raw.limits.tokenLimit).to.be.eq(expectedLimits.tokenLimit);
+ expect(data.raw.limits.sponsorTransferTimeout).to.be.eq(expectedLimits.sponsorTransferTimeout);
+ expect(data.raw.limits.sponsorApproveTimeout).to.be.eq(expectedLimits.sponsorApproveTimeout);
+ expect(data.raw.limits.ownerCanTransfer).to.be.eq(expectedLimits.ownerCanTransfer);
+ expect(data.raw.limits.ownerCanDestroy).to.be.eq(expectedLimits.ownerCanDestroy);
+ expect(data.raw.limits.transfersEnabled).to.be.eq(expectedLimits.transfersEnabled);
});
itEth('Collection address exist', async ({helper}) => {
@@ -270,12 +282,22 @@
});
itEth('(!negative test!) Set limits', async ({helper}) => {
+ const invalidLimits = {
+ accountTokenOwnershipLimit: BigInt(Number.MAX_SAFE_INTEGER),
+ transfersEnabled: 3,
+ };
+
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');
const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+
+ await expect(collectionEvm.methods
+ .setCollectionLimit(Object.keys(invalidLimits)[0], invalidLimits.accountTokenOwnershipLimit)
+ .call()).to.be.rejectedWith(`can't convert value to u32 "${invalidLimits.accountTokenOwnershipLimit}"`);
+
await expect(collectionEvm.methods
- .setCollectionLimit('badLimit', 'true')
- .call()).to.be.rejectedWith('unknown boolean limit "badLimit"');
+ .setCollectionLimit(Object.keys(invalidLimits)[1], invalidLimits.transfersEnabled)
+ .call()).to.be.rejectedWith(`can't convert value to boolean "${invalidLimits.transfersEnabled}"`);
});
itEth('destroyCollection', async ({helper}) => {
tests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createRFTCollection.test.ts
+++ b/tests/src/eth/createRFTCollection.test.ts
@@ -159,32 +159,44 @@
tokenLimit: 1000000,
sponsorTransferTimeout: 6,
sponsorApproveTimeout: 6,
+ ownerCanTransfer: 0,
+ ownerCanDestroy: 0,
+ transfersEnabled: 0,
+ };
+
+ const expectedLimits = {
+ accountTokenOwnershipLimit: 1000,
+ sponsoredDataSize: 1024,
+ sponsoredDataRateLimit: 30,
+ tokenLimit: 1000000,
+ sponsorTransferTimeout: 6,
+ sponsorApproveTimeout: 6,
ownerCanTransfer: false,
ownerCanDestroy: false,
transfersEnabled: false,
};
-
+
const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);
- await collection.methods['setCollectionLimit(string,uint32)']('accountTokenOwnershipLimit', limits.accountTokenOwnershipLimit).send();
- await collection.methods['setCollectionLimit(string,uint32)']('sponsoredDataSize', limits.sponsoredDataSize).send();
- await collection.methods['setCollectionLimit(string,uint32)']('sponsoredDataRateLimit', limits.sponsoredDataRateLimit).send();
- await collection.methods['setCollectionLimit(string,uint32)']('tokenLimit', limits.tokenLimit).send();
- await collection.methods['setCollectionLimit(string,uint32)']('sponsorTransferTimeout', limits.sponsorTransferTimeout).send();
- await collection.methods['setCollectionLimit(string,uint32)']('sponsorApproveTimeout', limits.sponsorApproveTimeout).send();
- await collection.methods['setCollectionLimit(string,bool)']('ownerCanTransfer', limits.ownerCanTransfer).send();
- await collection.methods['setCollectionLimit(string,bool)']('ownerCanDestroy', limits.ownerCanDestroy).send();
- await collection.methods['setCollectionLimit(string,bool)']('transfersEnabled', limits.transfersEnabled).send();
+ 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 data = (await helper.rft.getData(collectionId))!;
- expect(data.raw.limits.accountTokenOwnershipLimit).to.be.eq(limits.accountTokenOwnershipLimit);
- expect(data.raw.limits.sponsoredDataSize).to.be.eq(limits.sponsoredDataSize);
- expect(data.raw.limits.sponsoredDataRateLimit.blocks).to.be.eq(limits.sponsoredDataRateLimit);
- expect(data.raw.limits.tokenLimit).to.be.eq(limits.tokenLimit);
- expect(data.raw.limits.sponsorTransferTimeout).to.be.eq(limits.sponsorTransferTimeout);
- expect(data.raw.limits.sponsorApproveTimeout).to.be.eq(limits.sponsorApproveTimeout);
- expect(data.raw.limits.ownerCanTransfer).to.be.eq(limits.ownerCanTransfer);
- expect(data.raw.limits.ownerCanDestroy).to.be.eq(limits.ownerCanDestroy);
- expect(data.raw.limits.transfersEnabled).to.be.eq(limits.transfersEnabled);
+ expect(data.raw.limits.accountTokenOwnershipLimit).to.be.eq(expectedLimits.accountTokenOwnershipLimit);
+ expect(data.raw.limits.sponsoredDataSize).to.be.eq(expectedLimits.sponsoredDataSize);
+ expect(data.raw.limits.sponsoredDataRateLimit.blocks).to.be.eq(expectedLimits.sponsoredDataRateLimit);
+ expect(data.raw.limits.tokenLimit).to.be.eq(expectedLimits.tokenLimit);
+ expect(data.raw.limits.sponsorTransferTimeout).to.be.eq(expectedLimits.sponsorTransferTimeout);
+ expect(data.raw.limits.sponsorApproveTimeout).to.be.eq(expectedLimits.sponsorApproveTimeout);
+ expect(data.raw.limits.ownerCanTransfer).to.be.eq(expectedLimits.ownerCanTransfer);
+ expect(data.raw.limits.ownerCanDestroy).to.be.eq(expectedLimits.ownerCanDestroy);
+ expect(data.raw.limits.transfersEnabled).to.be.eq(expectedLimits.transfersEnabled);
});
itEth('Collection address exist', async ({helper}) => {
@@ -305,12 +317,22 @@
});
itEth('(!negative test!) Set limits', async ({helper}) => {
+ const invalidLimits = {
+ accountTokenOwnershipLimit: BigInt(Number.MAX_SAFE_INTEGER),
+ transfersEnabled: 3,
+ };
+
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Limits', 'absolutely anything', 'ISNI');
const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);
+
+ await expect(collectionEvm.methods
+ .setCollectionLimit(Object.keys(invalidLimits)[0], invalidLimits.accountTokenOwnershipLimit)
+ .call()).to.be.rejectedWith(`can't convert value to u32 "${invalidLimits.accountTokenOwnershipLimit}"`);
+
await expect(collectionEvm.methods
- .setCollectionLimit('badLimit', 'true')
- .call()).to.be.rejectedWith('unknown boolean limit "badLimit"');
+ .setCollectionLimit(Object.keys(invalidLimits)[1], invalidLimits.transfersEnabled)
+ .call()).to.be.rejectedWith(`can't convert value to boolean "${invalidLimits.transfersEnabled}"`);
});
itEth('destroyCollection', async ({helper}) => {