git.delta.rocks / unique-network / refs/commits / fe32b30721a1

difftreelog

Merge remote-tracking branch 'origin/feature/fractionalizer-contract' into develop

Yaroslav Bolyukin2022-08-11parents: #bc60087 #0265731.patch.diff
in: master

50 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
25use pallet_evm_coder_substrate::dispatch_to_evm;25use pallet_evm_coder_substrate::dispatch_to_evm;
26use sp_std::vec::Vec;26use sp_std::vec::Vec;
27use up_data_structs::{27use up_data_structs::{
28 Property, SponsoringRateLimit, OwnerRestrictedSet, AccessMode, CollectionPermissions,28 AccessMode, CollectionMode, CollectionPermissions, OwnerRestrictedSet, Property,
29 SponsoringRateLimit,
29};30};
30use alloc::format;31use alloc::format;
3132
409 save(self)410 save(self)
410 }411 }
412
413 /// Check that account is the owner or admin of the collection
414 ///
415 /// @param user account to verify
416 /// @return "true" if account is the owner or admin
417 fn verify_owner_or_admin(&self, user: address) -> Result<bool> {
418 Ok(check_is_owner_or_admin(user, self)
419 .map(|_| true)
420 .unwrap_or(false))
421 }
422
423 /// Returns collection type
424 ///
425 /// @return `Fungible` or `NFT` or `ReFungible`
426 fn unique_collection_type(&mut self) -> Result<string> {
427 let mode = match self.collection.mode {
428 CollectionMode::Fungible(_) => "Fungible",
429 CollectionMode::NFT => "NFT",
430 CollectionMode::ReFungible => "ReFungible",
431 };
432 Ok(mode.into())
433 }
411}434}
412435
413fn check_is_owner_or_admin<T: Config>(436fn check_is_owner_or_admin<T: Config>(
463 property_key_from_bytes(b"suffix").expect(EXPECT_CONVERT_ERROR)486 property_key_from_bytes(b"suffix").expect(EXPECT_CONVERT_ERROR)
464 }487 }
488
489 /// Key "parentNft".
490 pub fn parent_nft() -> up_data_structs::PropertyKey {
491 property_key_from_bytes(b"parentNft").expect(EXPECT_CONVERT_ERROR)
492 }
465 }493 }
466494
467 /// Values.495 /// Values.
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
1112 collection: &CollectionHandle<T>,1112 collection: &CollectionHandle<T>,
1113 sender: &T::CrossAccountId,1113 sender: &T::CrossAccountId,
1114 property_permission: PropertyKeyPermission,1114 property_permission: PropertyKeyPermission,
1115 ) -> DispatchResult {1115 ) -> DispatchResult {
1116 Self::set_scoped_property_permission(
1117 collection,
1118 sender,
1119 PropertyScope::None,
1120 property_permission,
1121 )
1122 }
1123
1124 /// Set collection property permission with scope.
1125 ///
1126 /// * `collection` - Collection handler.
1127 /// * `sender` - The owner or administrator of the collection.
1128 /// * `scope` - Property scope.
1129 /// * `property_permission` - Property permission.
1130 pub fn set_scoped_property_permission(
1131 collection: &CollectionHandle<T>,
1132 sender: &T::CrossAccountId,
1133 scope: PropertyScope,
1134 property_permission: PropertyKeyPermission,
1135 ) -> DispatchResult {
1116 collection.check_is_owner_or_admin(sender)?;1136 collection.check_is_owner_or_admin(sender)?;
11171137
1118 let all_permissions = CollectionPropertyPermissions::<T>::get(collection.id);1138 let all_permissions = CollectionPropertyPermissions::<T>::get(collection.id);
11261146
1127 CollectionPropertyPermissions::<T>::try_mutate(collection.id, |permissions| {1147 CollectionPropertyPermissions::<T>::try_mutate(collection.id, |permissions| {
1128 let property_permission = property_permission.clone();1148 let property_permission = property_permission.clone();
1129 permissions.try_set(property_permission.key, property_permission.permission)1149 permissions.try_scoped_set(
1150 scope,
1151 property_permission.key,
1152 property_permission.permission,
1153 )
1130 })1154 })
1131 .map_err(<Error<T>>::from)?;1155 .map_err(<Error<T>>::from)?;
1148 collection: &CollectionHandle<T>,1172 collection: &CollectionHandle<T>,
1149 sender: &T::CrossAccountId,1173 sender: &T::CrossAccountId,
1150 property_permissions: Vec<PropertyKeyPermission>,1174 property_permissions: Vec<PropertyKeyPermission>,
1151 ) -> DispatchResult {1175 ) -> DispatchResult {
1176 Self::set_scoped_token_property_permissions(
1177 collection,
1178 sender,
1179 PropertyScope::None,
1180 property_permissions,
1181 )
1182 }
1183
1184 /// Set token property permission with scope.
1185 ///
1186 /// * `collection` - Collection handler.
1187 /// * `sender` - The owner or administrator of the collection.
1188 /// * `scope` - Property scope.
1189 /// * `property_permissions` - Property permissions.
1190 #[transactional]
1191 pub fn set_scoped_token_property_permissions(
1192 collection: &CollectionHandle<T>,
1193 sender: &T::CrossAccountId,
1194 scope: PropertyScope,
1195 property_permissions: Vec<PropertyKeyPermission>,
1196 ) -> DispatchResult {
1152 for prop_pemission in property_permissions {1197 for prop_pemission in property_permissions {
1153 Self::set_property_permission(collection, sender, prop_pemission)?;1198 Self::set_scoped_property_permission(collection, sender, scope, prop_pemission)?;
1154 }1199 }
11551200
1156 Ok(())1201 Ok(())
1431 .saturating_add(Self::burn_recursively_breadth_raw(max_breadth))1476 .saturating_add(Self::burn_recursively_breadth_raw(max_breadth))
1432 }1477 }
1478
1479 /// The price of retrieving token owner
1480 fn token_owner() -> Weight;
1433}1481}
14341482
1435/// Weight info extension trait for refungible pallet.1483/// Weight info extension trait for refungible pallet.
1568 ///1616 ///
1569 /// * `sender` - Must be either the owner of the token or its admin.1617 /// * `sender` - Must be either the owner of the token or its admin.
1570 /// * `token_id` - The token for which the properties are being set.1618 /// * `token_id` - The token for which the properties are being set.
1571 /// * `properties` - Properties to be set.1619 /// * `property_permissions` - Property permissions to be set.
1572 /// * `budget` - Budget for setting properties.1620 /// * `budget` - Budget for setting properties.
1573 fn set_token_property_permissions(1621 fn set_token_property_permissions(
1574 &self,1622 &self,
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
104 0104 0
105 }105 }
106
107 fn token_owner() -> Weight {
108 0
109 }
106}110}
107111
108/// Implementation of `CommonCollectionOperations` for `FungibleHandle`. It wraps FungibleHandle Pallete112/// Implementation of `CommonCollectionOperations` for `FungibleHandle`. It wraps FungibleHandle Pallete
modifiedpallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
31 );31 );
32}32}
33
34// Selector: 6cf113cd
35contract Collection is Dummy, ERC165 {
36 // Set collection property.
37 //
38 // @param key Property key.
39 // @param value Propery value.
40 //
41 // Selector: setCollectionProperty(string,bytes) 2f073f66
42 function setCollectionProperty(string memory key, bytes memory value)
43 public
44 {
45 require(false, stub_error);
46 key;
47 value;
48 dummy = 0;
49 }
50
51 // Delete collection property.
52 //
53 // @param key Property key.
54 //
55 // Selector: deleteCollectionProperty(string) 7b7debce
56 function deleteCollectionProperty(string memory key) public {
57 require(false, stub_error);
58 key;
59 dummy = 0;
60 }
61
62 // Get collection property.
63 //
64 // @dev Throws error if key not found.
65 //
66 // @param key Property key.
67 // @return bytes The property corresponding to the key.
68 //
69 // Selector: collectionProperty(string) cf24fd6d
70 function collectionProperty(string memory key)
71 public
72 view
73 returns (bytes memory)
74 {
75 require(false, stub_error);
76 key;
77 dummy;
78 return hex"";
79 }
80
81 // Set the sponsor of the collection.
82 //
83 // @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
84 //
85 // @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
86 //
87 // Selector: setCollectionSponsor(address) 7623402e
88 function setCollectionSponsor(address sponsor) public {
89 require(false, stub_error);
90 sponsor;
91 dummy = 0;
92 }
93
94 // Collection sponsorship confirmation.
95 //
96 // @dev After setting the sponsor for the collection, it must be confirmed with this function.
97 //
98 // Selector: confirmCollectionSponsorship() 3c50e97a
99 function confirmCollectionSponsorship() public {
100 require(false, stub_error);
101 dummy = 0;
102 }
103
104 // Set limits for the collection.
105 // @dev Throws error if limit not found.
106 // @param limit Name of the limit. Valid names:
107 // "accountTokenOwnershipLimit",
108 // "sponsoredDataSize",
109 // "sponsoredDataRateLimit",
110 // "tokenLimit",
111 // "sponsorTransferTimeout",
112 // "sponsorApproveTimeout"
113 // @param value Value of the limit.
114 //
115 // Selector: setCollectionLimit(string,uint32) 6a3841db
116 function setCollectionLimit(string memory limit, uint32 value) public {
117 require(false, stub_error);
118 limit;
119 value;
120 dummy = 0;
121 }
122
123 // Set limits for the collection.
124 // @dev Throws error if limit not found.
125 // @param limit Name of the limit. Valid names:
126 // "ownerCanTransfer",
127 // "ownerCanDestroy",
128 // "transfersEnabled"
129 // @param value Value of the limit.
130 //
131 // Selector: setCollectionLimit(string,bool) 993b7fba
132 function setCollectionLimit(string memory limit, bool value) public {
133 require(false, stub_error);
134 limit;
135 value;
136 dummy = 0;
137 }
138
139 // Get contract address.
140 //
141 // Selector: contractAddress() f6b4dfb4
142 function contractAddress() public view returns (address) {
143 require(false, stub_error);
144 dummy;
145 return 0x0000000000000000000000000000000000000000;
146 }
147
148 // Add collection admin by substrate address.
149 // @param new_admin Substrate administrator address.
150 //
151 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
152 function addCollectionAdminSubstrate(uint256 newAdmin) public {
153 require(false, stub_error);
154 newAdmin;
155 dummy = 0;
156 }
157
158 // Remove collection admin by substrate address.
159 // @param admin Substrate administrator address.
160 //
161 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
162 function removeCollectionAdminSubstrate(uint256 admin) public {
163 require(false, stub_error);
164 admin;
165 dummy = 0;
166 }
167
168 // Add collection admin.
169 // @param new_admin Address of the added administrator.
170 //
171 // Selector: addCollectionAdmin(address) 92e462c7
172 function addCollectionAdmin(address newAdmin) public {
173 require(false, stub_error);
174 newAdmin;
175 dummy = 0;
176 }
177
178 // Remove collection admin.
179 //
180 // @param new_admin Address of the removed administrator.
181 //
182 // Selector: removeCollectionAdmin(address) fafd7b42
183 function removeCollectionAdmin(address admin) public {
184 require(false, stub_error);
185 admin;
186 dummy = 0;
187 }
188
189 // Toggle accessibility of collection nesting.
190 //
191 // @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'
192 //
193 // Selector: setCollectionNesting(bool) 112d4586
194 function setCollectionNesting(bool enable) public {
195 require(false, stub_error);
196 enable;
197 dummy = 0;
198 }
199
200 // Toggle accessibility of collection nesting.
201 //
202 // @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
203 // @param collections Addresses of collections that will be available for nesting.
204 //
205 // Selector: setCollectionNesting(bool,address[]) 64872396
206 function setCollectionNesting(bool enable, address[] memory collections)
207 public
208 {
209 require(false, stub_error);
210 enable;
211 collections;
212 dummy = 0;
213 }
214
215 // Set the collection access method.
216 // @param mode Access mode
217 // 0 for Normal
218 // 1 for AllowList
219 //
220 // Selector: setCollectionAccess(uint8) 41835d4c
221 function setCollectionAccess(uint8 mode) public {
222 require(false, stub_error);
223 mode;
224 dummy = 0;
225 }
226
227 // Add the user to the allowed list.
228 //
229 // @param user Address of a trusted user.
230 //
231 // Selector: addToCollectionAllowList(address) 67844fe6
232 function addToCollectionAllowList(address user) public {
233 require(false, stub_error);
234 user;
235 dummy = 0;
236 }
237
238 // Remove the user from the allowed list.
239 //
240 // @param user Address of a removed user.
241 //
242 // Selector: removeFromCollectionAllowList(address) 85c51acb
243 function removeFromCollectionAllowList(address user) public {
244 require(false, stub_error);
245 user;
246 dummy = 0;
247 }
248
249 // Switch permission for minting.
250 //
251 // @param mode Enable if "true".
252 //
253 // Selector: setCollectionMintMode(bool) 00018e84
254 function setCollectionMintMode(bool mode) public {
255 require(false, stub_error);
256 mode;
257 dummy = 0;
258 }
259
260 // Check that account is the owner or admin of the collection
261 //
262 // @param user account to verify
263 // @return "true" if account is the owner or admin
264 //
265 // Selector: verifyOwnerOrAdmin(address) c2282493
266 function verifyOwnerOrAdmin(address user) public view returns (bool) {
267 require(false, stub_error);
268 user;
269 dummy;
270 return false;
271 }
272
273 // Returns collection type
274 //
275 // @return `Fungible` or `NFT` or `ReFungible`
276 //
277 // Selector: uniqueCollectionType() d34b55b8
278 function uniqueCollectionType() public returns (string memory) {
279 require(false, stub_error);
280 dummy = 0;
281 return "";
282 }
283}
33284
34// Selector: 79cc6790285// Selector: 79cc6790
35contract ERC20UniqueExtensions is Dummy, ERC165 {286contract ERC20UniqueExtensions is Dummy, ERC165 {
43 }294 }
44}295}
45
46// Selector: 7d9262e6
47contract Collection is Dummy, ERC165 {
48 // Set collection property.
49 //
50 // @param key Property key.
51 // @param value Propery value.
52 //
53 // Selector: setCollectionProperty(string,bytes) 2f073f66
54 function setCollectionProperty(string memory key, bytes memory value)
55 public
56 {
57 require(false, stub_error);
58 key;
59 value;
60 dummy = 0;
61 }
62
63 // Delete collection property.
64 //
65 // @param key Property key.
66 //
67 // Selector: deleteCollectionProperty(string) 7b7debce
68 function deleteCollectionProperty(string memory key) public {
69 require(false, stub_error);
70 key;
71 dummy = 0;
72 }
73
74 // Get collection property.
75 //
76 // @dev Throws error if key not found.
77 //
78 // @param key Property key.
79 // @return bytes The property corresponding to the key.
80 //
81 // Selector: collectionProperty(string) cf24fd6d
82 function collectionProperty(string memory key)
83 public
84 view
85 returns (bytes memory)
86 {
87 require(false, stub_error);
88 key;
89 dummy;
90 return hex"";
91 }
92
93 // Set the sponsor of the collection.
94 //
95 // @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
96 //
97 // @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
98 //
99 // Selector: setCollectionSponsor(address) 7623402e
100 function setCollectionSponsor(address sponsor) public {
101 require(false, stub_error);
102 sponsor;
103 dummy = 0;
104 }
105
106 // Collection sponsorship confirmation.
107 //
108 // @dev After setting the sponsor for the collection, it must be confirmed with this function.
109 //
110 // Selector: confirmCollectionSponsorship() 3c50e97a
111 function confirmCollectionSponsorship() public {
112 require(false, stub_error);
113 dummy = 0;
114 }
115
116 // Set limits for the collection.
117 // @dev Throws error if limit not found.
118 // @param limit Name of the limit. Valid names:
119 // "accountTokenOwnershipLimit",
120 // "sponsoredDataSize",
121 // "sponsoredDataRateLimit",
122 // "tokenLimit",
123 // "sponsorTransferTimeout",
124 // "sponsorApproveTimeout"
125 // @param value Value of the limit.
126 //
127 // Selector: setCollectionLimit(string,uint32) 6a3841db
128 function setCollectionLimit(string memory limit, uint32 value) public {
129 require(false, stub_error);
130 limit;
131 value;
132 dummy = 0;
133 }
134
135 // Set limits for the collection.
136 // @dev Throws error if limit not found.
137 // @param limit Name of the limit. Valid names:
138 // "ownerCanTransfer",
139 // "ownerCanDestroy",
140 // "transfersEnabled"
141 // @param value Value of the limit.
142 //
143 // Selector: setCollectionLimit(string,bool) 993b7fba
144 function setCollectionLimit(string memory limit, bool value) public {
145 require(false, stub_error);
146 limit;
147 value;
148 dummy = 0;
149 }
150
151 // Get contract address.
152 //
153 // Selector: contractAddress() f6b4dfb4
154 function contractAddress() public view returns (address) {
155 require(false, stub_error);
156 dummy;
157 return 0x0000000000000000000000000000000000000000;
158 }
159
160 // Add collection admin by substrate address.
161 // @param new_admin Substrate administrator address.
162 //
163 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
164 function addCollectionAdminSubstrate(uint256 newAdmin) public {
165 require(false, stub_error);
166 newAdmin;
167 dummy = 0;
168 }
169
170 // Remove collection admin by substrate address.
171 // @param admin Substrate administrator address.
172 //
173 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
174 function removeCollectionAdminSubstrate(uint256 admin) public {
175 require(false, stub_error);
176 admin;
177 dummy = 0;
178 }
179
180 // Add collection admin.
181 // @param new_admin Address of the added administrator.
182 //
183 // Selector: addCollectionAdmin(address) 92e462c7
184 function addCollectionAdmin(address newAdmin) public {
185 require(false, stub_error);
186 newAdmin;
187 dummy = 0;
188 }
189
190 // Remove collection admin.
191 //
192 // @param new_admin Address of the removed administrator.
193 //
194 // Selector: removeCollectionAdmin(address) fafd7b42
195 function removeCollectionAdmin(address admin) public {
196 require(false, stub_error);
197 admin;
198 dummy = 0;
199 }
200
201 // Toggle accessibility of collection nesting.
202 //
203 // @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'
204 //
205 // Selector: setCollectionNesting(bool) 112d4586
206 function setCollectionNesting(bool enable) public {
207 require(false, stub_error);
208 enable;
209 dummy = 0;
210 }
211
212 // Toggle accessibility of collection nesting.
213 //
214 // @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
215 // @param collections Addresses of collections that will be available for nesting.
216 //
217 // Selector: setCollectionNesting(bool,address[]) 64872396
218 function setCollectionNesting(bool enable, address[] memory collections)
219 public
220 {
221 require(false, stub_error);
222 enable;
223 collections;
224 dummy = 0;
225 }
226
227 // Set the collection access method.
228 // @param mode Access mode
229 // 0 for Normal
230 // 1 for AllowList
231 //
232 // Selector: setCollectionAccess(uint8) 41835d4c
233 function setCollectionAccess(uint8 mode) public {
234 require(false, stub_error);
235 mode;
236 dummy = 0;
237 }
238
239 // Add the user to the allowed list.
240 //
241 // @param user Address of a trusted user.
242 //
243 // Selector: addToCollectionAllowList(address) 67844fe6
244 function addToCollectionAllowList(address user) public {
245 require(false, stub_error);
246 user;
247 dummy = 0;
248 }
249
250 // Remove the user from the allowed list.
251 //
252 // @param user Address of a removed user.
253 //
254 // Selector: removeFromCollectionAllowList(address) 85c51acb
255 function removeFromCollectionAllowList(address user) public {
256 require(false, stub_error);
257 user;
258 dummy = 0;
259 }
260
261 // Switch permission for minting.
262 //
263 // @param mode Enable if "true".
264 //
265 // Selector: setCollectionMintMode(bool) 00018e84
266 function setCollectionMintMode(bool mode) public {
267 require(false, stub_error);
268 mode;
269 dummy = 0;
270 }
271}
272296
273// Selector: 942e8b22297// Selector: 942e8b22
274contract ERC20 is Dummy, ERC165, ERC20Events {298contract ERC20 is Dummy, ERC165, ERC20Events {
modifiedpallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth
17use super::*;17use super::*;
18use crate::{Pallet, Config, NonfungibleHandle};18use crate::{Pallet, Config, NonfungibleHandle};
1919
20use sp_std::prelude::*;20use frame_benchmarking::{benchmarks, account};
21use pallet_common::benchmarking::{create_collection_raw, property_key, property_value};21use pallet_common::{
22 bench_init,
23 benchmarking::{create_collection_raw, property_key, property_value},
24 CommonCollectionOperations,
25};
22use frame_benchmarking::{benchmarks, account};26use sp_std::prelude::*;
23use up_data_structs::{CollectionMode, MAX_ITEMS_PER_BATCH, MAX_PROPERTIES_PER_ITEM, budget::Unlimited};27use up_data_structs::{CollectionMode, MAX_ITEMS_PER_BATCH, MAX_PROPERTIES_PER_ITEM, budget::Unlimited};
24use pallet_common::bench_init;
2528
26const SEED: u32 = 1;29const SEED: u32 = 1;
2730
209 let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();212 let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();
210 }: {<Pallet<T>>::delete_token_properties(&collection, &owner, item, to_delete.into_iter(), &Unlimited)?}213 }: {<Pallet<T>>::delete_token_properties(&collection, &owner, item, to_delete.into_iter(), &Unlimited)?}
214
215 token_owner {
216 bench_init!{
217 owner: sub; collection: collection(owner);
218 owner: cross_from_sub;
219 };
220 let item = create_max_item(&collection, &owner, owner.clone())?;
221
222 }: {collection.token_owner(item)}
211}223}
212224
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
119 .saturating_sub(Self::burn_recursively_self_raw().saturating_mul(amount as u64 + 1))119 .saturating_sub(Self::burn_recursively_self_raw().saturating_mul(amount as u64 + 1))
120 }120 }
121
122 fn token_owner() -> Weight {
123 <SelfWeightOf<T>>::token_owner()
124 }
121}125}
122126
123fn map_create_data<T: Config>(127fn map_create_data<T: Config>(
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
784 <PalletCommon<T>>::set_token_property_permissions(collection, sender, property_permissions)784 <PalletCommon<T>>::set_token_property_permissions(collection, sender, property_permissions)
785 }785 }
786
787 /// Set property permissions for the token with scope.
788 ///
789 /// Sender should be the owner or admin of token's collection.
790 pub fn set_scoped_token_property_permissions(
791 collection: &CollectionHandle<T>,
792 sender: &T::CrossAccountId,
793 scope: PropertyScope,
794 property_permissions: Vec<PropertyKeyPermission>,
795 ) -> DispatchResult {
796 <PalletCommon<T>>::set_scoped_token_property_permissions(
797 collection,
798 sender,
799 scope,
800 property_permissions,
801 )
802 }
786803
787 /// Set property permissions for the collection.804 /// Set property permissions for the collection.
788 ///805 ///
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
373 }373 }
374}374}
375
376// Selector: 6cf113cd
377contract Collection is Dummy, ERC165 {
378 // Set collection property.
379 //
380 // @param key Property key.
381 // @param value Propery value.
382 //
383 // Selector: setCollectionProperty(string,bytes) 2f073f66
384 function setCollectionProperty(string memory key, bytes memory value)
385 public
386 {
387 require(false, stub_error);
388 key;
389 value;
390 dummy = 0;
391 }
392
393 // Delete collection property.
394 //
395 // @param key Property key.
396 //
397 // Selector: deleteCollectionProperty(string) 7b7debce
398 function deleteCollectionProperty(string memory key) public {
399 require(false, stub_error);
400 key;
401 dummy = 0;
402 }
403
404 // Get collection property.
405 //
406 // @dev Throws error if key not found.
407 //
408 // @param key Property key.
409 // @return bytes The property corresponding to the key.
410 //
411 // Selector: collectionProperty(string) cf24fd6d
412 function collectionProperty(string memory key)
413 public
414 view
415 returns (bytes memory)
416 {
417 require(false, stub_error);
418 key;
419 dummy;
420 return hex"";
421 }
422
423 // Set the sponsor of the collection.
424 //
425 // @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
426 //
427 // @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
428 //
429 // Selector: setCollectionSponsor(address) 7623402e
430 function setCollectionSponsor(address sponsor) public {
431 require(false, stub_error);
432 sponsor;
433 dummy = 0;
434 }
435
436 // Collection sponsorship confirmation.
437 //
438 // @dev After setting the sponsor for the collection, it must be confirmed with this function.
439 //
440 // Selector: confirmCollectionSponsorship() 3c50e97a
441 function confirmCollectionSponsorship() public {
442 require(false, stub_error);
443 dummy = 0;
444 }
445
446 // Set limits for the collection.
447 // @dev Throws error if limit not found.
448 // @param limit Name of the limit. Valid names:
449 // "accountTokenOwnershipLimit",
450 // "sponsoredDataSize",
451 // "sponsoredDataRateLimit",
452 // "tokenLimit",
453 // "sponsorTransferTimeout",
454 // "sponsorApproveTimeout"
455 // @param value Value of the limit.
456 //
457 // Selector: setCollectionLimit(string,uint32) 6a3841db
458 function setCollectionLimit(string memory limit, uint32 value) public {
459 require(false, stub_error);
460 limit;
461 value;
462 dummy = 0;
463 }
464
465 // Set limits for the collection.
466 // @dev Throws error if limit not found.
467 // @param limit Name of the limit. Valid names:
468 // "ownerCanTransfer",
469 // "ownerCanDestroy",
470 // "transfersEnabled"
471 // @param value Value of the limit.
472 //
473 // Selector: setCollectionLimit(string,bool) 993b7fba
474 function setCollectionLimit(string memory limit, bool value) public {
475 require(false, stub_error);
476 limit;
477 value;
478 dummy = 0;
479 }
480
481 // Get contract address.
482 //
483 // Selector: contractAddress() f6b4dfb4
484 function contractAddress() public view returns (address) {
485 require(false, stub_error);
486 dummy;
487 return 0x0000000000000000000000000000000000000000;
488 }
489
490 // Add collection admin by substrate address.
491 // @param new_admin Substrate administrator address.
492 //
493 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
494 function addCollectionAdminSubstrate(uint256 newAdmin) public {
495 require(false, stub_error);
496 newAdmin;
497 dummy = 0;
498 }
499
500 // Remove collection admin by substrate address.
501 // @param admin Substrate administrator address.
502 //
503 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
504 function removeCollectionAdminSubstrate(uint256 admin) public {
505 require(false, stub_error);
506 admin;
507 dummy = 0;
508 }
509
510 // Add collection admin.
511 // @param new_admin Address of the added administrator.
512 //
513 // Selector: addCollectionAdmin(address) 92e462c7
514 function addCollectionAdmin(address newAdmin) public {
515 require(false, stub_error);
516 newAdmin;
517 dummy = 0;
518 }
519
520 // Remove collection admin.
521 //
522 // @param new_admin Address of the removed administrator.
523 //
524 // Selector: removeCollectionAdmin(address) fafd7b42
525 function removeCollectionAdmin(address admin) public {
526 require(false, stub_error);
527 admin;
528 dummy = 0;
529 }
530
531 // Toggle accessibility of collection nesting.
532 //
533 // @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'
534 //
535 // Selector: setCollectionNesting(bool) 112d4586
536 function setCollectionNesting(bool enable) public {
537 require(false, stub_error);
538 enable;
539 dummy = 0;
540 }
541
542 // Toggle accessibility of collection nesting.
543 //
544 // @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
545 // @param collections Addresses of collections that will be available for nesting.
546 //
547 // Selector: setCollectionNesting(bool,address[]) 64872396
548 function setCollectionNesting(bool enable, address[] memory collections)
549 public
550 {
551 require(false, stub_error);
552 enable;
553 collections;
554 dummy = 0;
555 }
556
557 // Set the collection access method.
558 // @param mode Access mode
559 // 0 for Normal
560 // 1 for AllowList
561 //
562 // Selector: setCollectionAccess(uint8) 41835d4c
563 function setCollectionAccess(uint8 mode) public {
564 require(false, stub_error);
565 mode;
566 dummy = 0;
567 }
568
569 // Add the user to the allowed list.
570 //
571 // @param user Address of a trusted user.
572 //
573 // Selector: addToCollectionAllowList(address) 67844fe6
574 function addToCollectionAllowList(address user) public {
575 require(false, stub_error);
576 user;
577 dummy = 0;
578 }
579
580 // Remove the user from the allowed list.
581 //
582 // @param user Address of a removed user.
583 //
584 // Selector: removeFromCollectionAllowList(address) 85c51acb
585 function removeFromCollectionAllowList(address user) public {
586 require(false, stub_error);
587 user;
588 dummy = 0;
589 }
590
591 // Switch permission for minting.
592 //
593 // @param mode Enable if "true".
594 //
595 // Selector: setCollectionMintMode(bool) 00018e84
596 function setCollectionMintMode(bool mode) public {
597 require(false, stub_error);
598 mode;
599 dummy = 0;
600 }
601
602 // Check that account is the owner or admin of the collection
603 //
604 // @param user account to verify
605 // @return "true" if account is the owner or admin
606 //
607 // Selector: verifyOwnerOrAdmin(address) c2282493
608 function verifyOwnerOrAdmin(address user) public view returns (bool) {
609 require(false, stub_error);
610 user;
611 dummy;
612 return false;
613 }
614
615 // Returns collection type
616 //
617 // @return `Fungible` or `NFT` or `ReFungible`
618 //
619 // Selector: uniqueCollectionType() d34b55b8
620 function uniqueCollectionType() public returns (string memory) {
621 require(false, stub_error);
622 dummy = 0;
623 return "";
624 }
625}
375626
376// Selector: 780e9d63627// Selector: 780e9d63
377contract ERC721Enumerable is Dummy, ERC165 {628contract ERC721Enumerable is Dummy, ERC165 {
415 }666 }
416}667}
417
418// Selector: 7d9262e6
419contract Collection is Dummy, ERC165 {
420 // Set collection property.
421 //
422 // @param key Property key.
423 // @param value Propery value.
424 //
425 // Selector: setCollectionProperty(string,bytes) 2f073f66
426 function setCollectionProperty(string memory key, bytes memory value)
427 public
428 {
429 require(false, stub_error);
430 key;
431 value;
432 dummy = 0;
433 }
434
435 // Delete collection property.
436 //
437 // @param key Property key.
438 //
439 // Selector: deleteCollectionProperty(string) 7b7debce
440 function deleteCollectionProperty(string memory key) public {
441 require(false, stub_error);
442 key;
443 dummy = 0;
444 }
445
446 // Get collection property.
447 //
448 // @dev Throws error if key not found.
449 //
450 // @param key Property key.
451 // @return bytes The property corresponding to the key.
452 //
453 // Selector: collectionProperty(string) cf24fd6d
454 function collectionProperty(string memory key)
455 public
456 view
457 returns (bytes memory)
458 {
459 require(false, stub_error);
460 key;
461 dummy;
462 return hex"";
463 }
464
465 // Set the sponsor of the collection.
466 //
467 // @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
468 //
469 // @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
470 //
471 // Selector: setCollectionSponsor(address) 7623402e
472 function setCollectionSponsor(address sponsor) public {
473 require(false, stub_error);
474 sponsor;
475 dummy = 0;
476 }
477
478 // Collection sponsorship confirmation.
479 //
480 // @dev After setting the sponsor for the collection, it must be confirmed with this function.
481 //
482 // Selector: confirmCollectionSponsorship() 3c50e97a
483 function confirmCollectionSponsorship() public {
484 require(false, stub_error);
485 dummy = 0;
486 }
487
488 // Set limits for the collection.
489 // @dev Throws error if limit not found.
490 // @param limit Name of the limit. Valid names:
491 // "accountTokenOwnershipLimit",
492 // "sponsoredDataSize",
493 // "sponsoredDataRateLimit",
494 // "tokenLimit",
495 // "sponsorTransferTimeout",
496 // "sponsorApproveTimeout"
497 // @param value Value of the limit.
498 //
499 // Selector: setCollectionLimit(string,uint32) 6a3841db
500 function setCollectionLimit(string memory limit, uint32 value) public {
501 require(false, stub_error);
502 limit;
503 value;
504 dummy = 0;
505 }
506
507 // Set limits for the collection.
508 // @dev Throws error if limit not found.
509 // @param limit Name of the limit. Valid names:
510 // "ownerCanTransfer",
511 // "ownerCanDestroy",
512 // "transfersEnabled"
513 // @param value Value of the limit.
514 //
515 // Selector: setCollectionLimit(string,bool) 993b7fba
516 function setCollectionLimit(string memory limit, bool value) public {
517 require(false, stub_error);
518 limit;
519 value;
520 dummy = 0;
521 }
522
523 // Get contract address.
524 //
525 // Selector: contractAddress() f6b4dfb4
526 function contractAddress() public view returns (address) {
527 require(false, stub_error);
528 dummy;
529 return 0x0000000000000000000000000000000000000000;
530 }
531
532 // Add collection admin by substrate address.
533 // @param new_admin Substrate administrator address.
534 //
535 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
536 function addCollectionAdminSubstrate(uint256 newAdmin) public {
537 require(false, stub_error);
538 newAdmin;
539 dummy = 0;
540 }
541
542 // Remove collection admin by substrate address.
543 // @param admin Substrate administrator address.
544 //
545 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
546 function removeCollectionAdminSubstrate(uint256 admin) public {
547 require(false, stub_error);
548 admin;
549 dummy = 0;
550 }
551
552 // Add collection admin.
553 // @param new_admin Address of the added administrator.
554 //
555 // Selector: addCollectionAdmin(address) 92e462c7
556 function addCollectionAdmin(address newAdmin) public {
557 require(false, stub_error);
558 newAdmin;
559 dummy = 0;
560 }
561
562 // Remove collection admin.
563 //
564 // @param new_admin Address of the removed administrator.
565 //
566 // Selector: removeCollectionAdmin(address) fafd7b42
567 function removeCollectionAdmin(address admin) public {
568 require(false, stub_error);
569 admin;
570 dummy = 0;
571 }
572
573 // Toggle accessibility of collection nesting.
574 //
575 // @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'
576 //
577 // Selector: setCollectionNesting(bool) 112d4586
578 function setCollectionNesting(bool enable) public {
579 require(false, stub_error);
580 enable;
581 dummy = 0;
582 }
583
584 // Toggle accessibility of collection nesting.
585 //
586 // @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
587 // @param collections Addresses of collections that will be available for nesting.
588 //
589 // Selector: setCollectionNesting(bool,address[]) 64872396
590 function setCollectionNesting(bool enable, address[] memory collections)
591 public
592 {
593 require(false, stub_error);
594 enable;
595 collections;
596 dummy = 0;
597 }
598
599 // Set the collection access method.
600 // @param mode Access mode
601 // 0 for Normal
602 // 1 for AllowList
603 //
604 // Selector: setCollectionAccess(uint8) 41835d4c
605 function setCollectionAccess(uint8 mode) public {
606 require(false, stub_error);
607 mode;
608 dummy = 0;
609 }
610
611 // Add the user to the allowed list.
612 //
613 // @param user Address of a trusted user.
614 //
615 // Selector: addToCollectionAllowList(address) 67844fe6
616 function addToCollectionAllowList(address user) public {
617 require(false, stub_error);
618 user;
619 dummy = 0;
620 }
621
622 // Remove the user from the allowed list.
623 //
624 // @param user Address of a removed user.
625 //
626 // Selector: removeFromCollectionAllowList(address) 85c51acb
627 function removeFromCollectionAllowList(address user) public {
628 require(false, stub_error);
629 user;
630 dummy = 0;
631 }
632
633 // Switch permission for minting.
634 //
635 // @param mode Enable if "true".
636 //
637 // Selector: setCollectionMintMode(bool) 00018e84
638 function setCollectionMintMode(bool mode) public {
639 require(false, stub_error);
640 mode;
641 dummy = 0;
642 }
643}
644668
645// Selector: d74d154f669// Selector: d74d154f
646contract ERC721UniqueExtensions is Dummy, ERC165 {670contract ERC721UniqueExtensions is Dummy, ERC165 {
modifiedpallets/nonfungible/src/weights.rsdiffbeforeafterboth
3//! Autogenerated weights for pallet_nonfungible3//! Autogenerated weights for pallet_nonfungible
4//!4//!
5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
6//! DATE: 2022-07-20, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`6//! DATE: 2022-08-01, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`
7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 10247//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
88
9// Executed Command:9// Executed Command:
46 fn set_token_property_permissions(b: u32, ) -> Weight;46 fn set_token_property_permissions(b: u32, ) -> Weight;
47 fn set_token_properties(b: u32, ) -> Weight;47 fn set_token_properties(b: u32, ) -> Weight;
48 fn delete_token_properties(b: u32, ) -> Weight;48 fn delete_token_properties(b: u32, ) -> Weight;
49 fn token_owner() -> Weight;
49}50}
5051
51/// Weights for pallet_nonfungible using the Substrate node and recommended hardware.52/// Weights for pallet_nonfungible using the Substrate node and recommended hardware.
56 // Storage: Nonfungible TokenData (r:0 w:1)57 // Storage: Nonfungible TokenData (r:0 w:1)
57 // Storage: Nonfungible Owned (r:0 w:1)58 // Storage: Nonfungible Owned (r:0 w:1)
58 fn create_item() -> Weight {59 fn create_item() -> Weight {
59 (20_328_000 as Weight)60 (20_909_000 as Weight)
60 .saturating_add(T::DbWeight::get().reads(2 as Weight))61 .saturating_add(T::DbWeight::get().reads(2 as Weight))
61 .saturating_add(T::DbWeight::get().writes(4 as Weight))62 .saturating_add(T::DbWeight::get().writes(4 as Weight))
62 }63 }
65 // Storage: Nonfungible TokenData (r:0 w:4)66 // Storage: Nonfungible TokenData (r:0 w:4)
66 // Storage: Nonfungible Owned (r:0 w:4)67 // Storage: Nonfungible Owned (r:0 w:4)
67 fn create_multiple_items(b: u32, ) -> Weight {68 fn create_multiple_items(b: u32, ) -> Weight {
68 (10_134_000 as Weight)69 (12_601_000 as Weight)
69 // Standard Error: 3_00070 // Standard Error: 1_000
70 .saturating_add((4_927_000 as Weight).saturating_mul(b as Weight))71 .saturating_add((4_920_000 as Weight).saturating_mul(b as Weight))
71 .saturating_add(T::DbWeight::get().reads(2 as Weight))72 .saturating_add(T::DbWeight::get().reads(2 as Weight))
72 .saturating_add(T::DbWeight::get().writes(2 as Weight))73 .saturating_add(T::DbWeight::get().writes(2 as Weight))
73 .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(b as Weight)))74 .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(b as Weight)))
77 // Storage: Nonfungible TokenData (r:0 w:4)78 // Storage: Nonfungible TokenData (r:0 w:4)
78 // Storage: Nonfungible Owned (r:0 w:4)79 // Storage: Nonfungible Owned (r:0 w:4)
79 fn create_multiple_items_ex(b: u32, ) -> Weight {80 fn create_multiple_items_ex(b: u32, ) -> Weight {
80 (5_710_000 as Weight)81 (0 as Weight)
81 // Standard Error: 4_00082 // Standard Error: 3_000
82 .saturating_add((7_578_000 as Weight).saturating_mul(b as Weight))83 .saturating_add((7_734_000 as Weight).saturating_mul(b as Weight))
83 .saturating_add(T::DbWeight::get().reads(1 as Weight))84 .saturating_add(T::DbWeight::get().reads(1 as Weight))
84 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))85 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
85 .saturating_add(T::DbWeight::get().writes(1 as Weight))86 .saturating_add(T::DbWeight::get().writes(1 as Weight))
93 // Storage: Nonfungible Owned (r:0 w:1)94 // Storage: Nonfungible Owned (r:0 w:1)
94 // Storage: Nonfungible TokenProperties (r:0 w:1)95 // Storage: Nonfungible TokenProperties (r:0 w:1)
95 fn burn_item() -> Weight {96 fn burn_item() -> Weight {
96 (28_433_000 as Weight)97 (29_746_000 as Weight)
97 .saturating_add(T::DbWeight::get().reads(5 as Weight))98 .saturating_add(T::DbWeight::get().reads(5 as Weight))
98 .saturating_add(T::DbWeight::get().writes(5 as Weight))99 .saturating_add(T::DbWeight::get().writes(5 as Weight))
99 }100 }
105 // Storage: Nonfungible Owned (r:0 w:1)106 // Storage: Nonfungible Owned (r:0 w:1)
106 // Storage: Nonfungible TokenProperties (r:0 w:1)107 // Storage: Nonfungible TokenProperties (r:0 w:1)
107 fn burn_recursively_self_raw() -> Weight {108 fn burn_recursively_self_raw() -> Weight {
108 (34_435_000 as Weight)109 (36_077_000 as Weight)
109 .saturating_add(T::DbWeight::get().reads(5 as Weight))110 .saturating_add(T::DbWeight::get().reads(5 as Weight))
110 .saturating_add(T::DbWeight::get().writes(5 as Weight))111 .saturating_add(T::DbWeight::get().writes(5 as Weight))
111 }112 }
119 // Storage: Common CollectionById (r:1 w:0)120 // Storage: Common CollectionById (r:1 w:0)
120 fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight {121 fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight {
121 (0 as Weight)122 (0 as Weight)
122 // Standard Error: 1_539_000123 // Standard Error: 1_605_000
123 .saturating_add((304_456_000 as Weight).saturating_mul(b as Weight))124 .saturating_add((312_391_000 as Weight).saturating_mul(b as Weight))
124 .saturating_add(T::DbWeight::get().reads(7 as Weight))125 .saturating_add(T::DbWeight::get().reads(7 as Weight))
125 .saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(b as Weight)))126 .saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(b as Weight)))
126 .saturating_add(T::DbWeight::get().writes(6 as Weight))127 .saturating_add(T::DbWeight::get().writes(6 as Weight))
131 // Storage: Nonfungible Allowance (r:1 w:0)132 // Storage: Nonfungible Allowance (r:1 w:0)
132 // Storage: Nonfungible Owned (r:0 w:2)133 // Storage: Nonfungible Owned (r:0 w:2)
133 fn transfer() -> Weight {134 fn transfer() -> Weight {
134 (24_376_000 as Weight)135 (25_248_000 as Weight)
135 .saturating_add(T::DbWeight::get().reads(4 as Weight))136 .saturating_add(T::DbWeight::get().reads(4 as Weight))
136 .saturating_add(T::DbWeight::get().writes(5 as Weight))137 .saturating_add(T::DbWeight::get().writes(5 as Weight))
137 }138 }
138 // Storage: Nonfungible TokenData (r:1 w:0)139 // Storage: Nonfungible TokenData (r:1 w:0)
139 // Storage: Nonfungible Allowance (r:1 w:1)140 // Storage: Nonfungible Allowance (r:1 w:1)
140 fn approve() -> Weight {141 fn approve() -> Weight {
141 (15_890_000 as Weight)142 (16_321_000 as Weight)
142 .saturating_add(T::DbWeight::get().reads(2 as Weight))143 .saturating_add(T::DbWeight::get().reads(2 as Weight))
143 .saturating_add(T::DbWeight::get().writes(1 as Weight))144 .saturating_add(T::DbWeight::get().writes(1 as Weight))
144 }145 }
147 // Storage: Nonfungible AccountBalance (r:2 w:2)148 // Storage: Nonfungible AccountBalance (r:2 w:2)
148 // Storage: Nonfungible Owned (r:0 w:2)149 // Storage: Nonfungible Owned (r:0 w:2)
149 fn transfer_from() -> Weight {150 fn transfer_from() -> Weight {
150 (28_634_000 as Weight)151 (29_325_000 as Weight)
151 .saturating_add(T::DbWeight::get().reads(4 as Weight))152 .saturating_add(T::DbWeight::get().reads(4 as Weight))
152 .saturating_add(T::DbWeight::get().writes(6 as Weight))153 .saturating_add(T::DbWeight::get().writes(6 as Weight))
153 }154 }
159 // Storage: Nonfungible Owned (r:0 w:1)160 // Storage: Nonfungible Owned (r:0 w:1)
160 // Storage: Nonfungible TokenProperties (r:0 w:1)161 // Storage: Nonfungible TokenProperties (r:0 w:1)
161 fn burn_from() -> Weight {162 fn burn_from() -> Weight {
162 (32_201_000 as Weight)163 (33_323_000 as Weight)
163 .saturating_add(T::DbWeight::get().reads(5 as Weight))164 .saturating_add(T::DbWeight::get().reads(5 as Weight))
164 .saturating_add(T::DbWeight::get().writes(6 as Weight))165 .saturating_add(T::DbWeight::get().writes(6 as Weight))
165 }166 }
166 // Storage: Common CollectionPropertyPermissions (r:1 w:1)167 // Storage: Common CollectionPropertyPermissions (r:1 w:1)
167 fn set_token_property_permissions(b: u32, ) -> Weight {168 fn set_token_property_permissions(b: u32, ) -> Weight {
168 (0 as Weight)169 (0 as Weight)
169 // Standard Error: 57_000170 // Standard Error: 62_000
170 .saturating_add((15_232_000 as Weight).saturating_mul(b as Weight))171 .saturating_add((16_222_000 as Weight).saturating_mul(b as Weight))
171 .saturating_add(T::DbWeight::get().reads(1 as Weight))172 .saturating_add(T::DbWeight::get().reads(1 as Weight))
172 .saturating_add(T::DbWeight::get().writes(1 as Weight))173 .saturating_add(T::DbWeight::get().writes(1 as Weight))
173 }174 }
174 // Storage: Common CollectionPropertyPermissions (r:1 w:0)175 // Storage: Common CollectionPropertyPermissions (r:1 w:0)
175 // Storage: Nonfungible TokenProperties (r:1 w:1)176 // Storage: Nonfungible TokenProperties (r:1 w:1)
176 fn set_token_properties(b: u32, ) -> Weight {177 fn set_token_properties(b: u32, ) -> Weight {
177 (0 as Weight)178 (0 as Weight)
178 // Standard Error: 1_648_000179 // Standard Error: 1_750_000
179 .saturating_add((288_654_000 as Weight).saturating_mul(b as Weight))180 .saturating_add((304_476_000 as Weight).saturating_mul(b as Weight))
180 .saturating_add(T::DbWeight::get().reads(2 as Weight))181 .saturating_add(T::DbWeight::get().reads(2 as Weight))
181 .saturating_add(T::DbWeight::get().writes(1 as Weight))182 .saturating_add(T::DbWeight::get().writes(1 as Weight))
182 }183 }
183 // Storage: Common CollectionPropertyPermissions (r:1 w:0)184 // Storage: Common CollectionPropertyPermissions (r:1 w:0)
184 // Storage: Nonfungible TokenProperties (r:1 w:1)185 // Storage: Nonfungible TokenProperties (r:1 w:1)
185 fn delete_token_properties(b: u32, ) -> Weight {186 fn delete_token_properties(b: u32, ) -> Weight {
186 (0 as Weight)187 (0 as Weight)
187 // Standard Error: 1_632_000188 // Standard Error: 1_638_000
188 .saturating_add((289_190_000 as Weight).saturating_mul(b as Weight))189 .saturating_add((294_096_000 as Weight).saturating_mul(b as Weight))
189 .saturating_add(T::DbWeight::get().reads(2 as Weight))190 .saturating_add(T::DbWeight::get().reads(2 as Weight))
190 .saturating_add(T::DbWeight::get().writes(1 as Weight))191 .saturating_add(T::DbWeight::get().writes(1 as Weight))
191 }192 }
193 // Storage: Nonfungible TokenData (r:1 w:0)
194 fn token_owner() -> Weight {
195 (2_986_000 as Weight)
196 .saturating_add(T::DbWeight::get().reads(1 as Weight))
197 }
192}198}
193199
194// For backwards compatibility and tests200// For backwards compatibility and tests
198 // Storage: Nonfungible TokenData (r:0 w:1)204 // Storage: Nonfungible TokenData (r:0 w:1)
199 // Storage: Nonfungible Owned (r:0 w:1)205 // Storage: Nonfungible Owned (r:0 w:1)
200 fn create_item() -> Weight {206 fn create_item() -> Weight {
201 (20_328_000 as Weight)207 (20_909_000 as Weight)
202 .saturating_add(RocksDbWeight::get().reads(2 as Weight))208 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
203 .saturating_add(RocksDbWeight::get().writes(4 as Weight))209 .saturating_add(RocksDbWeight::get().writes(4 as Weight))
204 }210 }
207 // Storage: Nonfungible TokenData (r:0 w:4)213 // Storage: Nonfungible TokenData (r:0 w:4)
208 // Storage: Nonfungible Owned (r:0 w:4)214 // Storage: Nonfungible Owned (r:0 w:4)
209 fn create_multiple_items(b: u32, ) -> Weight {215 fn create_multiple_items(b: u32, ) -> Weight {
210 (10_134_000 as Weight)216 (12_601_000 as Weight)
211 // Standard Error: 3_000217 // Standard Error: 1_000
212 .saturating_add((4_927_000 as Weight).saturating_mul(b as Weight))218 .saturating_add((4_920_000 as Weight).saturating_mul(b as Weight))
213 .saturating_add(RocksDbWeight::get().reads(2 as Weight))219 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
214 .saturating_add(RocksDbWeight::get().writes(2 as Weight))220 .saturating_add(RocksDbWeight::get().writes(2 as Weight))
215 .saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(b as Weight)))221 .saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(b as Weight)))
219 // Storage: Nonfungible TokenData (r:0 w:4)225 // Storage: Nonfungible TokenData (r:0 w:4)
220 // Storage: Nonfungible Owned (r:0 w:4)226 // Storage: Nonfungible Owned (r:0 w:4)
221 fn create_multiple_items_ex(b: u32, ) -> Weight {227 fn create_multiple_items_ex(b: u32, ) -> Weight {
222 (5_710_000 as Weight)228 (0 as Weight)
223 // Standard Error: 4_000229 // Standard Error: 3_000
224 .saturating_add((7_578_000 as Weight).saturating_mul(b as Weight))230 .saturating_add((7_734_000 as Weight).saturating_mul(b as Weight))
225 .saturating_add(RocksDbWeight::get().reads(1 as Weight))231 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
226 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))232 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
227 .saturating_add(RocksDbWeight::get().writes(1 as Weight))233 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
235 // Storage: Nonfungible Owned (r:0 w:1)241 // Storage: Nonfungible Owned (r:0 w:1)
236 // Storage: Nonfungible TokenProperties (r:0 w:1)242 // Storage: Nonfungible TokenProperties (r:0 w:1)
237 fn burn_item() -> Weight {243 fn burn_item() -> Weight {
238 (28_433_000 as Weight)244 (29_746_000 as Weight)
239 .saturating_add(RocksDbWeight::get().reads(5 as Weight))245 .saturating_add(RocksDbWeight::get().reads(5 as Weight))
240 .saturating_add(RocksDbWeight::get().writes(5 as Weight))246 .saturating_add(RocksDbWeight::get().writes(5 as Weight))
241 }247 }
247 // Storage: Nonfungible Owned (r:0 w:1)253 // Storage: Nonfungible Owned (r:0 w:1)
248 // Storage: Nonfungible TokenProperties (r:0 w:1)254 // Storage: Nonfungible TokenProperties (r:0 w:1)
249 fn burn_recursively_self_raw() -> Weight {255 fn burn_recursively_self_raw() -> Weight {
250 (34_435_000 as Weight)256 (36_077_000 as Weight)
251 .saturating_add(RocksDbWeight::get().reads(5 as Weight))257 .saturating_add(RocksDbWeight::get().reads(5 as Weight))
252 .saturating_add(RocksDbWeight::get().writes(5 as Weight))258 .saturating_add(RocksDbWeight::get().writes(5 as Weight))
253 }259 }
261 // Storage: Common CollectionById (r:1 w:0)267 // Storage: Common CollectionById (r:1 w:0)
262 fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight {268 fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight {
263 (0 as Weight)269 (0 as Weight)
264 // Standard Error: 1_539_000270 // Standard Error: 1_605_000
265 .saturating_add((304_456_000 as Weight).saturating_mul(b as Weight))271 .saturating_add((312_391_000 as Weight).saturating_mul(b as Weight))
266 .saturating_add(RocksDbWeight::get().reads(7 as Weight))272 .saturating_add(RocksDbWeight::get().reads(7 as Weight))
267 .saturating_add(RocksDbWeight::get().reads((4 as Weight).saturating_mul(b as Weight)))273 .saturating_add(RocksDbWeight::get().reads((4 as Weight).saturating_mul(b as Weight)))
268 .saturating_add(RocksDbWeight::get().writes(6 as Weight))274 .saturating_add(RocksDbWeight::get().writes(6 as Weight))
273 // Storage: Nonfungible Allowance (r:1 w:0)279 // Storage: Nonfungible Allowance (r:1 w:0)
274 // Storage: Nonfungible Owned (r:0 w:2)280 // Storage: Nonfungible Owned (r:0 w:2)
275 fn transfer() -> Weight {281 fn transfer() -> Weight {
276 (24_376_000 as Weight)282 (25_248_000 as Weight)
277 .saturating_add(RocksDbWeight::get().reads(4 as Weight))283 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
278 .saturating_add(RocksDbWeight::get().writes(5 as Weight))284 .saturating_add(RocksDbWeight::get().writes(5 as Weight))
279 }285 }
280 // Storage: Nonfungible TokenData (r:1 w:0)286 // Storage: Nonfungible TokenData (r:1 w:0)
281 // Storage: Nonfungible Allowance (r:1 w:1)287 // Storage: Nonfungible Allowance (r:1 w:1)
282 fn approve() -> Weight {288 fn approve() -> Weight {
283 (15_890_000 as Weight)289 (16_321_000 as Weight)
284 .saturating_add(RocksDbWeight::get().reads(2 as Weight))290 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
285 .saturating_add(RocksDbWeight::get().writes(1 as Weight))291 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
286 }292 }
289 // Storage: Nonfungible AccountBalance (r:2 w:2)295 // Storage: Nonfungible AccountBalance (r:2 w:2)
290 // Storage: Nonfungible Owned (r:0 w:2)296 // Storage: Nonfungible Owned (r:0 w:2)
291 fn transfer_from() -> Weight {297 fn transfer_from() -> Weight {
292 (28_634_000 as Weight)298 (29_325_000 as Weight)
293 .saturating_add(RocksDbWeight::get().reads(4 as Weight))299 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
294 .saturating_add(RocksDbWeight::get().writes(6 as Weight))300 .saturating_add(RocksDbWeight::get().writes(6 as Weight))
295 }301 }
301 // Storage: Nonfungible Owned (r:0 w:1)307 // Storage: Nonfungible Owned (r:0 w:1)
302 // Storage: Nonfungible TokenProperties (r:0 w:1)308 // Storage: Nonfungible TokenProperties (r:0 w:1)
303 fn burn_from() -> Weight {309 fn burn_from() -> Weight {
304 (32_201_000 as Weight)310 (33_323_000 as Weight)
305 .saturating_add(RocksDbWeight::get().reads(5 as Weight))311 .saturating_add(RocksDbWeight::get().reads(5 as Weight))
306 .saturating_add(RocksDbWeight::get().writes(6 as Weight))312 .saturating_add(RocksDbWeight::get().writes(6 as Weight))
307 }313 }
308 // Storage: Common CollectionPropertyPermissions (r:1 w:1)314 // Storage: Common CollectionPropertyPermissions (r:1 w:1)
309 fn set_token_property_permissions(b: u32, ) -> Weight {315 fn set_token_property_permissions(b: u32, ) -> Weight {
310 (0 as Weight)316 (0 as Weight)
311 // Standard Error: 57_000317 // Standard Error: 62_000
312 .saturating_add((15_232_000 as Weight).saturating_mul(b as Weight))318 .saturating_add((16_222_000 as Weight).saturating_mul(b as Weight))
313 .saturating_add(RocksDbWeight::get().reads(1 as Weight))319 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
314 .saturating_add(RocksDbWeight::get().writes(1 as Weight))320 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
315 }321 }
316 // Storage: Common CollectionPropertyPermissions (r:1 w:0)322 // Storage: Common CollectionPropertyPermissions (r:1 w:0)
317 // Storage: Nonfungible TokenProperties (r:1 w:1)323 // Storage: Nonfungible TokenProperties (r:1 w:1)
318 fn set_token_properties(b: u32, ) -> Weight {324 fn set_token_properties(b: u32, ) -> Weight {
319 (0 as Weight)325 (0 as Weight)
320 // Standard Error: 1_648_000326 // Standard Error: 1_750_000
321 .saturating_add((288_654_000 as Weight).saturating_mul(b as Weight))327 .saturating_add((304_476_000 as Weight).saturating_mul(b as Weight))
322 .saturating_add(RocksDbWeight::get().reads(2 as Weight))328 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
323 .saturating_add(RocksDbWeight::get().writes(1 as Weight))329 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
324 }330 }
325 // Storage: Common CollectionPropertyPermissions (r:1 w:0)331 // Storage: Common CollectionPropertyPermissions (r:1 w:0)
326 // Storage: Nonfungible TokenProperties (r:1 w:1)332 // Storage: Nonfungible TokenProperties (r:1 w:1)
327 fn delete_token_properties(b: u32, ) -> Weight {333 fn delete_token_properties(b: u32, ) -> Weight {
328 (0 as Weight)334 (0 as Weight)
329 // Standard Error: 1_632_000335 // Standard Error: 1_638_000
330 .saturating_add((289_190_000 as Weight).saturating_mul(b as Weight))336 .saturating_add((294_096_000 as Weight).saturating_mul(b as Weight))
331 .saturating_add(RocksDbWeight::get().reads(2 as Weight))337 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
332 .saturating_add(RocksDbWeight::get().writes(1 as Weight))338 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
333 }339 }
340 // Storage: Nonfungible TokenData (r:1 w:0)
341 fn token_owner() -> Weight {
342 (2_986_000 as Weight)
343 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
344 }
334}345}
335346
modifiedpallets/refungible/src/benchmarking.rsdiffbeforeafterboth
17use super::*;17use super::*;
18use crate::{Pallet, Config, RefungibleHandle};18use crate::{Pallet, Config, RefungibleHandle};
1919
20use sp_std::prelude::*;20use core::convert::TryInto;
21use pallet_common::benchmarking::{create_collection_raw, property_key, property_value, create_data};21use core::iter::IntoIterator;
22use frame_benchmarking::{benchmarks, account};22use frame_benchmarking::{benchmarks, account};
23use up_data_structs::{23use pallet_common::{
24 CollectionMode, MAX_ITEMS_PER_BATCH, MAX_PROPERTIES_PER_ITEM, CUSTOM_DATA_LIMIT,24 bench_init,
25 budget::Unlimited,25 benchmarking::{create_collection_raw, property_key, property_value, create_data},
26};26};
27use pallet_common::bench_init;27use sp_core::H160;
28use core::convert::TryInto;28use sp_std::prelude::*;
29use core::iter::IntoIterator;29use up_data_structs::{
30 CollectionMode, MAX_ITEMS_PER_BATCH, MAX_PROPERTIES_PER_ITEM, CUSTOM_DATA_LIMIT,
31 budget::Unlimited,
32};
3033
31const SEED: u32 = 1;34const SEED: u32 = 1;
3235
33fn create_max_item_data<CrossAccountId: Ord>(36fn create_max_item_data<CrossAccountId: Ord>(
34 users: impl IntoIterator<Item = (CrossAccountId, u128)>,37 users: impl IntoIterator<Item = (CrossAccountId, u128)>,
35) -> CreateRefungibleExData<CrossAccountId> {38) -> CreateRefungibleExData<CrossAccountId> {
36 let const_data = create_data::<CUSTOM_DATA_LIMIT>();
37 CreateRefungibleExData {39 CreateRefungibleExData {
38 const_data,
39 users: users40 users: users
40 .into_iter()41 .into_iter()
41 .collect::<BTreeMap<_, _>>()42 .collect::<BTreeMap<_, _>>()
59) -> Result<RefungibleHandle<T>, DispatchError> {61) -> Result<RefungibleHandle<T>, DispatchError> {
60 create_collection_raw(62 create_collection_raw(
61 owner,63 owner,
62 CollectionMode::NFT,64 CollectionMode::ReFungible,
63 <Pallet<T>>::init_collection,65 <Pallet<T>>::init_collection,
64 RefungibleHandle::cast,66 RefungibleHandle::cast,
65 )67 )
278 let item = create_max_item(&collection, &sender, [(owner.clone(), 100)])?;281 let item = create_max_item(&collection, &sender, [(owner.clone(), 100)])?;
279 }: {<Pallet<T>>::repartition(&collection, &owner, item, 200)?}282 }: {<Pallet<T>>::repartition(&collection, &owner, item, 200)?}
283
284 set_parent_nft_unchecked {
285 bench_init!{
286 owner: sub; collection: collection(owner);
287 sender: cross_from_sub(owner); owner: cross_sub;
288 };
289 let item = create_max_item(&collection, &sender, [(owner.clone(), 100)])?;
290
291 }: {<Pallet<T>>::set_parent_nft_unchecked(&collection, item, owner, T::CrossAccountId::from_eth(H160::default()))?}
292
293 token_owner {
294 bench_init!{
295 owner: sub; collection: collection(owner);
296 sender: cross_from_sub(owner); owner: cross_sub;
297 };
298 let item = create_max_item(&collection, &sender, [(owner.clone(), 100)])?;
299 }: {<Pallet<T>>::token_owner(collection.id, item)}
280}300}
281301
modifiedpallets/refungible/src/common.rsdiffbeforeafterboth
149 0149 0
150 }150 }
151
152 fn token_owner() -> Weight {
153 <SelfWeightOf<T>>::token_owner()
154 }
151}155}
152156
153fn map_create_data<T: Config>(157fn map_create_data<T: Config>(
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
41use sp_core::H160;41use sp_core::H160;
42use sp_std::{collections::btree_map::BTreeMap, vec::Vec, vec};42use sp_std::{collections::btree_map::BTreeMap, vec::Vec, vec};
43use up_data_structs::{43use up_data_structs::{
44 CollectionId, CollectionPropertiesVec, Property, PropertyKey, PropertyKeyPermission,44 CollectionId, CollectionPropertiesVec, mapping::TokenAddressMapping, Property, PropertyKey,
45 PropertyPermission, TokenId,45 PropertyKeyPermission, PropertyPermission, TokenId,
46};46};
4747
413}413}
414414
415/// Returns amount of pieces of `token` that `owner` have415/// Returns amount of pieces of `token` that `owner` have
416fn balance<T: Config>(416pub fn balance<T: Config>(
417 collection: &RefungibleHandle<T>,417 collection: &RefungibleHandle<T>,
418 token: TokenId,418 token: TokenId,
419 owner: &T::CrossAccountId,419 owner: &T::CrossAccountId,
424}424}
425425
426/// Throws if `owner_balance` is lower than total amount of `token` pieces426/// Throws if `owner_balance` is lower than total amount of `token` pieces
427fn ensure_single_owner<T: Config>(427pub fn ensure_single_owner<T: Config>(
428 collection: &RefungibleHandle<T>,428 collection: &RefungibleHandle<T>,
429 token: TokenId,429 token: TokenId,
430 owner_balance: u128,430 owner_balance: u128,
789 Ok(true)789 Ok(true)
790 }790 }
791
792 /// Returns EVM address for refungible token
793 ///
794 /// @param token ID of the token
795 fn token_contract_address(&self, token: uint256) -> Result<address> {
796 Ok(T::EvmTokenAddressMapping::token_to_address(
797 self.id,
798 token.try_into().map_err(|_| "token id overflow")?,
799 ))
800 }
791}801}
792802
793#[solidity_interface(803#[solidity_interface(
modifiedpallets/refungible/src/erc_token.rsdiffbeforeafterboth
2121
22extern crate alloc;22extern crate alloc;
23
24#[cfg(not(feature = "std"))]
25use alloc::format;
26
23use core::{27use core::{
24 char::{REPLACEMENT_CHARACTER, decode_utf16},28 char::{REPLACEMENT_CHARACTER, decode_utf16},
25 convert::TryInto,29 convert::TryInto,
26 ops::Deref,30 ops::Deref,
27};31};
28use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight};32use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};
29use pallet_common::{33use pallet_common::{
30 CommonWeightInfo,34 CommonWeightInfo,
31 erc::{CommonEvmHandler, PrecompileResult},35 erc::{CommonEvmHandler, PrecompileResult, static_property::key},
36 eth::map_eth_to_id,
32};37};
33use pallet_evm::{account::CrossAccountId, PrecompileHandle};38use pallet_evm::{account::CrossAccountId, PrecompileHandle};
34use pallet_evm_coder_substrate::{call, dispatch_to_evm, WithRecorder};39use pallet_evm_coder_substrate::{call, dispatch_to_evm, WithRecorder};
35use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};40use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};
41use sp_core::H160;
36use sp_std::vec::Vec;42use sp_std::vec::Vec;
37use up_data_structs::TokenId;43use up_data_structs::{mapping::TokenAddressMapping, PropertyScope, TokenId};
3844
39use crate::{45use crate::{
40 Allowance, Balance, common::CommonWeights, Config, Pallet, RefungibleHandle, SelfWeightOf,46 Allowance, Balance, common::CommonWeights, Config, Pallet, RefungibleHandle, SelfWeightOf,
41 weights::WeightInfo, TotalSupply,47 TokenProperties, TotalSupply, weights::WeightInfo,
42};48};
4349
44pub struct RefungibleTokenHandle<T: Config>(pub RefungibleHandle<T>, pub TokenId);50pub struct RefungibleTokenHandle<T: Config>(pub RefungibleHandle<T>, pub TokenId);
51
52#[solidity_interface(name = "ERC1633")]
53impl<T: Config> RefungibleTokenHandle<T> {
54 fn parent_token(&self) -> Result<address> {
55 self.consume_store_reads(2)?;
56 let props = <TokenProperties<T>>::get((self.id, self.1));
57 let key = key::parent_nft();
58
59 let key_scoped = PropertyScope::Eth
60 .apply(key)
61 .expect("property key shouldn't exceed length limit");
62 if let Some(value) = props.get(&key_scoped) {
63 Ok(H160::from_slice(value.as_slice()))
64 } else {
65 Ok(*T::CrossTokenAddressMapping::token_to_address(self.id, self.1).as_eth())
66 }
67 }
68
69 fn parent_token_id(&self) -> Result<uint256> {
70 self.consume_store_reads(2)?;
71 let props = <TokenProperties<T>>::get((self.id, self.1));
72 let key = key::parent_nft();
73
74 let key_scoped = PropertyScope::Eth
75 .apply(key)
76 .expect("property key shouldn't exceed length limit");
77 if let Some(value) = props.get(&key_scoped) {
78 let nft_token_address = H160::from_slice(value.as_slice());
79 let nft_token_account = T::CrossAccountId::from_eth(nft_token_address);
80 let (_, token_id) = T::CrossTokenAddressMapping::address_to_token(&nft_token_account)
81 .ok_or("parent NFT should contain NFT token address")?;
82
83 Ok(token_id.into())
84 } else {
85 Ok(self.1.into())
86 }
87 }
88}
89
90#[solidity_interface(name = "ERC1633UniqueExtensions")]
91impl<T: Config> RefungibleTokenHandle<T> {
92 #[solidity(rename_selector = "setParentNFT")]
93 #[weight(<CommonWeights<T>>::token_owner() + <SelfWeightOf<T>>::set_parent_nft_unchecked())]
94 fn set_parent_nft(
95 &mut self,
96 caller: caller,
97 collection: address,
98 nft_id: uint256,
99 ) -> Result<bool> {
100 self.consume_store_reads(1)?;
101 let caller = T::CrossAccountId::from_eth(caller);
102 let nft_collection = map_eth_to_id(&collection).ok_or("collection not found")?;
103 let nft_token = nft_id.try_into()?;
104
105 <Pallet<T>>::set_parent_nft(&self.0, self.1, caller, nft_collection, nft_token)
106 .map_err(dispatch_to_evm::<T>)?;
107
108 Ok(true)
109 }
110}
45111
46#[derive(ToLog)]112#[derive(ToLog)]
47pub enum ERC20Events {113pub enum ERC20Events {
120 .weight_calls_budget(<StructureWeight<T>>::find_parent());186 .weight_calls_budget(<StructureWeight<T>>::find_parent());
121187
122 <Pallet<T>>::transfer(self, &caller, &to, self.1, amount, &budget)188 <Pallet<T>>::transfer(self, &caller, &to, self.1, amount, &budget)
123 .map_err(|_| "transfer error")?;189 .map_err(dispatch_to_evm::<T>)?;
124 Ok(true)190 Ok(true)
125 }191 }
126192
241307
242#[solidity_interface(name = "UniqueRefungibleToken", is(ERC20, ERC20UniqueExtensions,))]308#[solidity_interface(
309 name = "UniqueRefungibleToken",
310 is(ERC20, ERC20UniqueExtensions, ERC1633, ERC1633UniqueExtensions)
311)]
243impl<T: Config> RefungibleTokenHandle<T> where T::AccountId: From<[u8; 32]> {}312impl<T: Config> RefungibleTokenHandle<T> where T::AccountId: From<[u8; 32]> {}
244313
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
99use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};99use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
100use pallet_evm_coder_substrate::WithRecorder;100use pallet_evm_coder_substrate::WithRecorder;
101use pallet_common::{101use pallet_common::{
102 CommonCollectionOperations, Error as CommonError, Event as CommonEvent,102 CollectionHandle, CommonCollectionOperations,
103 dispatch::CollectionDispatch,
104 erc::static_property::{key, property_value_from_bytes},
105 Error as CommonError,
103 eth::collection_id_to_address, Pallet as PalletCommon,106 eth::collection_id_to_address,
107 Event as CommonEvent, Pallet as PalletCommon,
104};108};
105use pallet_structure::Pallet as PalletStructure;109use pallet_structure::Pallet as PalletStructure;
106use scale_info::TypeInfo;110use scale_info::TypeInfo;
107use sp_core::H160;111use sp_core::H160;
108use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, TransactionOutcome};112use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, TransactionOutcome};
109use sp_std::{vec::Vec, vec, collections::btree_map::BTreeMap};113use sp_std::{vec::Vec, vec, collections::btree_map::BTreeMap};
110use up_data_structs::{114use up_data_structs::{
111 AccessMode, budget::Budget, CollectionId, CreateCollectionData, CustomDataLimit,115 AccessMode, budget::Budget, CollectionId, CollectionMode, CollectionPropertiesVec,
112 mapping::TokenAddressMapping, MAX_REFUNGIBLE_PIECES, MAX_ITEMS_PER_BATCH, TokenId, Property,116 CreateCollectionData, CustomDataLimit, mapping::TokenAddressMapping, MAX_ITEMS_PER_BATCH,
113 PropertyKey, PropertyKeyPermission, PropertyPermission, PropertyScope, PropertyValue,117 MAX_REFUNGIBLE_PIECES, Property, PropertyKey, PropertyKeyPermission, PropertyPermission,
114 TrySetProperty, CollectionPropertiesVec,118 PropertyScope, PropertyValue, TokenId, TrySetProperty,
115};119};
116use frame_support::BoundedBTreeMap;120use frame_support::BoundedBTreeMap;
117use derivative::Derivative;121use derivative::Derivative;
1341 <PalletCommon<T>>::set_token_property_permissions(collection, sender, property_permissions)1345 <PalletCommon<T>>::set_token_property_permissions(collection, sender, property_permissions)
1342 }1346 }
1347
1348 pub fn set_scoped_token_property_permissions(
1349 collection: &RefungibleHandle<T>,
1350 sender: &T::CrossAccountId,
1351 scope: PropertyScope,
1352 property_permissions: Vec<PropertyKeyPermission>,
1353 ) -> DispatchResult {
1354 <PalletCommon<T>>::set_scoped_token_property_permissions(
1355 collection,
1356 sender,
1357 scope,
1358 property_permissions,
1359 )
1360 }
13431361
1344 /// Returns 10 token in no particular order.1362 /// Returns 10 token in no particular order.
1345 ///1363 ///
1363 }1381 }
1364 }1382 }
1383
1384 /// Sets the NFT token as a parent for the RFT token
1385 ///
1386 /// Throws if `sender` is not the owner of the NFT token.
1387 /// Throws if `sender` is not the owner of all of the RFT token pieces.
1388 pub fn set_parent_nft(
1389 collection: &RefungibleHandle<T>,
1390 rft_token_id: TokenId,
1391 sender: T::CrossAccountId,
1392 nft_collection: CollectionId,
1393 nft_token: TokenId,
1394 ) -> DispatchResult {
1395 let handle = <CollectionHandle<T>>::try_get(nft_collection)?;
1396 if handle.mode != CollectionMode::NFT {
1397 return Err("Only NFT token could be parent to RFT".into());
1398 }
1399 let dispatch = T::CollectionDispatch::dispatch(handle);
1400 let dispatch = dispatch.as_dyn();
1401
1402 let owner = dispatch.token_owner(nft_token).ok_or("owner not found")?;
1403 if owner != sender {
1404 return Err("Only owned token could be set as parent".into());
1405 }
1406
1407 let nft_token_address =
1408 T::CrossTokenAddressMapping::token_to_address(nft_collection, nft_token);
1409
1410 Self::set_parent_nft_unchecked(collection, rft_token_id, sender, nft_token_address)
1411 }
1412
1413 /// Sets the NFT token as a parent for the RFT token
1414 ///
1415 /// `sender` should be the owner of the NFT token.
1416 /// Throws if `sender` is not the owner of all of the RFT token pieces.
1417 pub fn set_parent_nft_unchecked(
1418 collection: &RefungibleHandle<T>,
1419 rft_token_id: TokenId,
1420 sender: T::CrossAccountId,
1421 nft_token_address: T::CrossAccountId,
1422 ) -> DispatchResult {
1423 let owner_balance = <Balance<T>>::get((collection.id, rft_token_id, &sender));
1424 let total_supply = <TotalSupply<T>>::get((collection.id, rft_token_id));
1425 if total_supply != owner_balance {
1426 return Err("token has multiple owners".into());
1427 }
1428
1429 let parent_nft_property_key = key::parent_nft();
1430
1431 let parent_nft_property_value =
1432 property_value_from_bytes(&nft_token_address.as_eth().to_fixed_bytes())
1433 .expect("address should fit in value length limit");
1434
1435 <Pallet<T>>::set_scoped_token_property(
1436 collection.id,
1437 rft_token_id,
1438 PropertyScope::Eth,
1439 Property {
1440 key: parent_nft_property_key,
1441 value: parent_nft_property_value,
1442 },
1443 )?;
1444
1445 Ok(())
1446 }
1365}1447}
13661448
modifiedpallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth
371 }371 }
372}372}
373
374// Selector: 6cf113cd
375contract Collection is Dummy, ERC165 {
376 // Set collection property.
377 //
378 // @param key Property key.
379 // @param value Propery value.
380 //
381 // Selector: setCollectionProperty(string,bytes) 2f073f66
382 function setCollectionProperty(string memory key, bytes memory value)
383 public
384 {
385 require(false, stub_error);
386 key;
387 value;
388 dummy = 0;
389 }
390
391 // Delete collection property.
392 //
393 // @param key Property key.
394 //
395 // Selector: deleteCollectionProperty(string) 7b7debce
396 function deleteCollectionProperty(string memory key) public {
397 require(false, stub_error);
398 key;
399 dummy = 0;
400 }
401
402 // Get collection property.
403 //
404 // @dev Throws error if key not found.
405 //
406 // @param key Property key.
407 // @return bytes The property corresponding to the key.
408 //
409 // Selector: collectionProperty(string) cf24fd6d
410 function collectionProperty(string memory key)
411 public
412 view
413 returns (bytes memory)
414 {
415 require(false, stub_error);
416 key;
417 dummy;
418 return hex"";
419 }
420
421 // Set the sponsor of the collection.
422 //
423 // @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
424 //
425 // @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
426 //
427 // Selector: setCollectionSponsor(address) 7623402e
428 function setCollectionSponsor(address sponsor) public {
429 require(false, stub_error);
430 sponsor;
431 dummy = 0;
432 }
433
434 // Collection sponsorship confirmation.
435 //
436 // @dev After setting the sponsor for the collection, it must be confirmed with this function.
437 //
438 // Selector: confirmCollectionSponsorship() 3c50e97a
439 function confirmCollectionSponsorship() public {
440 require(false, stub_error);
441 dummy = 0;
442 }
443
444 // Set limits for the collection.
445 // @dev Throws error if limit not found.
446 // @param limit Name of the limit. Valid names:
447 // "accountTokenOwnershipLimit",
448 // "sponsoredDataSize",
449 // "sponsoredDataRateLimit",
450 // "tokenLimit",
451 // "sponsorTransferTimeout",
452 // "sponsorApproveTimeout"
453 // @param value Value of the limit.
454 //
455 // Selector: setCollectionLimit(string,uint32) 6a3841db
456 function setCollectionLimit(string memory limit, uint32 value) public {
457 require(false, stub_error);
458 limit;
459 value;
460 dummy = 0;
461 }
462
463 // Set limits for the collection.
464 // @dev Throws error if limit not found.
465 // @param limit Name of the limit. Valid names:
466 // "ownerCanTransfer",
467 // "ownerCanDestroy",
468 // "transfersEnabled"
469 // @param value Value of the limit.
470 //
471 // Selector: setCollectionLimit(string,bool) 993b7fba
472 function setCollectionLimit(string memory limit, bool value) public {
473 require(false, stub_error);
474 limit;
475 value;
476 dummy = 0;
477 }
478
479 // Get contract address.
480 //
481 // Selector: contractAddress() f6b4dfb4
482 function contractAddress() public view returns (address) {
483 require(false, stub_error);
484 dummy;
485 return 0x0000000000000000000000000000000000000000;
486 }
487
488 // Add collection admin by substrate address.
489 // @param new_admin Substrate administrator address.
490 //
491 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
492 function addCollectionAdminSubstrate(uint256 newAdmin) public {
493 require(false, stub_error);
494 newAdmin;
495 dummy = 0;
496 }
497
498 // Remove collection admin by substrate address.
499 // @param admin Substrate administrator address.
500 //
501 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
502 function removeCollectionAdminSubstrate(uint256 admin) public {
503 require(false, stub_error);
504 admin;
505 dummy = 0;
506 }
507
508 // Add collection admin.
509 // @param new_admin Address of the added administrator.
510 //
511 // Selector: addCollectionAdmin(address) 92e462c7
512 function addCollectionAdmin(address newAdmin) public {
513 require(false, stub_error);
514 newAdmin;
515 dummy = 0;
516 }
517
518 // Remove collection admin.
519 //
520 // @param new_admin Address of the removed administrator.
521 //
522 // Selector: removeCollectionAdmin(address) fafd7b42
523 function removeCollectionAdmin(address admin) public {
524 require(false, stub_error);
525 admin;
526 dummy = 0;
527 }
528
529 // Toggle accessibility of collection nesting.
530 //
531 // @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'
532 //
533 // Selector: setCollectionNesting(bool) 112d4586
534 function setCollectionNesting(bool enable) public {
535 require(false, stub_error);
536 enable;
537 dummy = 0;
538 }
539
540 // Toggle accessibility of collection nesting.
541 //
542 // @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
543 // @param collections Addresses of collections that will be available for nesting.
544 //
545 // Selector: setCollectionNesting(bool,address[]) 64872396
546 function setCollectionNesting(bool enable, address[] memory collections)
547 public
548 {
549 require(false, stub_error);
550 enable;
551 collections;
552 dummy = 0;
553 }
554
555 // Set the collection access method.
556 // @param mode Access mode
557 // 0 for Normal
558 // 1 for AllowList
559 //
560 // Selector: setCollectionAccess(uint8) 41835d4c
561 function setCollectionAccess(uint8 mode) public {
562 require(false, stub_error);
563 mode;
564 dummy = 0;
565 }
566
567 // Add the user to the allowed list.
568 //
569 // @param user Address of a trusted user.
570 //
571 // Selector: addToCollectionAllowList(address) 67844fe6
572 function addToCollectionAllowList(address user) public {
573 require(false, stub_error);
574 user;
575 dummy = 0;
576 }
577
578 // Remove the user from the allowed list.
579 //
580 // @param user Address of a removed user.
581 //
582 // Selector: removeFromCollectionAllowList(address) 85c51acb
583 function removeFromCollectionAllowList(address user) public {
584 require(false, stub_error);
585 user;
586 dummy = 0;
587 }
588
589 // Switch permission for minting.
590 //
591 // @param mode Enable if "true".
592 //
593 // Selector: setCollectionMintMode(bool) 00018e84
594 function setCollectionMintMode(bool mode) public {
595 require(false, stub_error);
596 mode;
597 dummy = 0;
598 }
599
600 // Check that account is the owner or admin of the collection
601 //
602 // @param user account to verify
603 // @return "true" if account is the owner or admin
604 //
605 // Selector: verifyOwnerOrAdmin(address) c2282493
606 function verifyOwnerOrAdmin(address user) public view returns (bool) {
607 require(false, stub_error);
608 user;
609 dummy;
610 return false;
611 }
612
613 // Returns collection type
614 //
615 // @return `Fungible` or `NFT` or `ReFungible`
616 //
617 // Selector: uniqueCollectionType() d34b55b8
618 function uniqueCollectionType() public returns (string memory) {
619 require(false, stub_error);
620 dummy = 0;
621 return "";
622 }
623}
373624
374// Selector: 780e9d63625// Selector: 780e9d63
375contract ERC721Enumerable is Dummy, ERC165 {626contract ERC721Enumerable is Dummy, ERC165 {
413 }664 }
414}665}
415666
416// Selector: 7d9262e6667// Selector: 7c3bef89
417contract Collection is Dummy, ERC165 {
418 // Set collection property.
419 //
420 // @param key Property key.
421 // @param value Propery value.
422 //
423 // Selector: setCollectionProperty(string,bytes) 2f073f66
424 function setCollectionProperty(string memory key, bytes memory value)
425 public
426 {
427 require(false, stub_error);
428 key;
429 value;
430 dummy = 0;
431 }
432
433 // Delete collection property.
434 //
435 // @param key Property key.
436 //
437 // Selector: deleteCollectionProperty(string) 7b7debce
438 function deleteCollectionProperty(string memory key) public {
439 require(false, stub_error);
440 key;
441 dummy = 0;
442 }
443
444 // Get collection property.
445 //
446 // @dev Throws error if key not found.
447 //
448 // @param key Property key.
449 // @return bytes The property corresponding to the key.
450 //
451 // Selector: collectionProperty(string) cf24fd6d
452 function collectionProperty(string memory key)
453 public
454 view
455 returns (bytes memory)
456 {
457 require(false, stub_error);
458 key;
459 dummy;
460 return hex"";
461 }
462
463 // Set the sponsor of the collection.
464 //
465 // @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
466 //
467 // @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
468 //
469 // Selector: setCollectionSponsor(address) 7623402e
470 function setCollectionSponsor(address sponsor) public {
471 require(false, stub_error);
472 sponsor;
473 dummy = 0;
474 }
475
476 // Collection sponsorship confirmation.
477 //
478 // @dev After setting the sponsor for the collection, it must be confirmed with this function.
479 //
480 // Selector: confirmCollectionSponsorship() 3c50e97a
481 function confirmCollectionSponsorship() public {
482 require(false, stub_error);
483 dummy = 0;
484 }
485
486 // Set limits for the collection.
487 // @dev Throws error if limit not found.
488 // @param limit Name of the limit. Valid names:
489 // "accountTokenOwnershipLimit",
490 // "sponsoredDataSize",
491 // "sponsoredDataRateLimit",
492 // "tokenLimit",
493 // "sponsorTransferTimeout",
494 // "sponsorApproveTimeout"
495 // @param value Value of the limit.
496 //
497 // Selector: setCollectionLimit(string,uint32) 6a3841db
498 function setCollectionLimit(string memory limit, uint32 value) public {
499 require(false, stub_error);
500 limit;
501 value;
502 dummy = 0;
503 }
504
505 // Set limits for the collection.
506 // @dev Throws error if limit not found.
507 // @param limit Name of the limit. Valid names:
508 // "ownerCanTransfer",
509 // "ownerCanDestroy",
510 // "transfersEnabled"
511 // @param value Value of the limit.
512 //
513 // Selector: setCollectionLimit(string,bool) 993b7fba
514 function setCollectionLimit(string memory limit, bool value) public {
515 require(false, stub_error);
516 limit;
517 value;
518 dummy = 0;
519 }
520
521 // Get contract address.
522 //
523 // Selector: contractAddress() f6b4dfb4
524 function contractAddress() public view returns (address) {
525 require(false, stub_error);
526 dummy;
527 return 0x0000000000000000000000000000000000000000;
528 }
529
530 // Add collection admin by substrate address.
531 // @param new_admin Substrate administrator address.
532 //
533 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
534 function addCollectionAdminSubstrate(uint256 newAdmin) public {
535 require(false, stub_error);
536 newAdmin;
537 dummy = 0;
538 }
539
540 // Remove collection admin by substrate address.
541 // @param admin Substrate administrator address.
542 //
543 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
544 function removeCollectionAdminSubstrate(uint256 admin) public {
545 require(false, stub_error);
546 admin;
547 dummy = 0;
548 }
549
550 // Add collection admin.
551 // @param new_admin Address of the added administrator.
552 //
553 // Selector: addCollectionAdmin(address) 92e462c7
554 function addCollectionAdmin(address newAdmin) public {
555 require(false, stub_error);
556 newAdmin;
557 dummy = 0;
558 }
559
560 // Remove collection admin.
561 //
562 // @param new_admin Address of the removed administrator.
563 //
564 // Selector: removeCollectionAdmin(address) fafd7b42
565 function removeCollectionAdmin(address admin) public {
566 require(false, stub_error);
567 admin;
568 dummy = 0;
569 }
570
571 // Toggle accessibility of collection nesting.
572 //
573 // @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'
574 //
575 // Selector: setCollectionNesting(bool) 112d4586
576 function setCollectionNesting(bool enable) public {
577 require(false, stub_error);
578 enable;
579 dummy = 0;
580 }
581
582 // Toggle accessibility of collection nesting.
583 //
584 // @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
585 // @param collections Addresses of collections that will be available for nesting.
586 //
587 // Selector: setCollectionNesting(bool,address[]) 64872396
588 function setCollectionNesting(bool enable, address[] memory collections)
589 public
590 {
591 require(false, stub_error);
592 enable;
593 collections;
594 dummy = 0;
595 }
596
597 // Set the collection access method.
598 // @param mode Access mode
599 // 0 for Normal
600 // 1 for AllowList
601 //
602 // Selector: setCollectionAccess(uint8) 41835d4c
603 function setCollectionAccess(uint8 mode) public {
604 require(false, stub_error);
605 mode;
606 dummy = 0;
607 }
608
609 // Add the user to the allowed list.
610 //
611 // @param user Address of a trusted user.
612 //
613 // Selector: addToCollectionAllowList(address) 67844fe6
614 function addToCollectionAllowList(address user) public {
615 require(false, stub_error);
616 user;
617 dummy = 0;
618 }
619
620 // Remove the user from the allowed list.
621 //
622 // @param user Address of a removed user.
623 //
624 // Selector: removeFromCollectionAllowList(address) 85c51acb
625 function removeFromCollectionAllowList(address user) public {
626 require(false, stub_error);
627 user;
628 dummy = 0;
629 }
630
631 // Switch permission for minting.
632 //
633 // @param mode Enable if "true".
634 //
635 // Selector: setCollectionMintMode(bool) 00018e84
636 function setCollectionMintMode(bool mode) public {
637 require(false, stub_error);
638 mode;
639 dummy = 0;
640 }
641}
642
643// Selector: d74d154f
644contract ERC721UniqueExtensions is Dummy, ERC165 {668contract ERC721UniqueExtensions is Dummy, ERC165 {
645 // @notice Transfer ownership of an RFT669 // @notice Transfer ownership of an RFT
646 // @dev Throws unless `msg.sender` is the current owner. Throws if `to`670 // @dev Throws unless `msg.sender` is the current owner. Throws if `to`
720 return false;744 return false;
721 }745 }
746
747 // Returns EVM address for refungible token
748 //
749 // @param token ID of the token
750 //
751 // Selector: tokenContractAddress(uint256) ab76fac6
752 function tokenContractAddress(uint256 token) public view returns (address) {
753 require(false, stub_error);
754 token;
755 dummy;
756 return 0x0000000000000000000000000000000000000000;
757 }
722}758}
723759
724contract UniqueRefungible is760contract UniqueRefungible is
modifiedpallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungibleToken.soldiffbeforeafterboth
31 );31 );
32}32}
33
34// Selector: 042f1106
35contract ERC1633UniqueExtensions is Dummy, ERC165 {
36 // Selector: setParentNFT(address,uint256) 042f1106
37 function setParentNFT(address collection, uint256 nftId)
38 public
39 returns (bool)
40 {
41 require(false, stub_error);
42 collection;
43 nftId;
44 dummy = 0;
45 return false;
46 }
47}
48
49// Selector: 5755c3f2
50contract ERC1633 is Dummy, ERC165 {
51 // Selector: parentToken() 80a54001
52 function parentToken() public view returns (address) {
53 require(false, stub_error);
54 dummy;
55 return 0x0000000000000000000000000000000000000000;
56 }
57
58 // Selector: parentTokenId() d7f083f3
59 function parentTokenId() public view returns (uint256) {
60 require(false, stub_error);
61 dummy;
62 return 0;
63 }
64}
3365
34// Selector: 942e8b2266// Selector: 942e8b22
35contract ERC20 is Dummy, ERC165, ERC20Events {67contract ERC20 is Dummy, ERC165, ERC20Events {
214 Dummy,
215 ERC165,
216 ERC20,
217 ERC20UniqueExtensions,
218 ERC1633,
219 ERC1633UniqueExtensions
220{}
182221
modifiedpallets/refungible/src/weights.rsdiffbeforeafterboth
3//! Autogenerated weights for pallet_refungible3//! Autogenerated weights for pallet_refungible
4//!4//!
5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
6//! DATE: 2022-07-20, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`6//! DATE: 2022-08-01, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`
7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 10247//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
88
9// Executed Command:9// Executed Command:
53 fn set_token_properties(b: u32, ) -> Weight;53 fn set_token_properties(b: u32, ) -> Weight;
54 fn delete_token_properties(b: u32, ) -> Weight;54 fn delete_token_properties(b: u32, ) -> Weight;
55 fn repartition_item() -> Weight;55 fn repartition_item() -> Weight;
56 fn set_parent_nft_unchecked() -> Weight;
57 fn token_owner() -> Weight;
56}58}
5759
58/// Weights for pallet_refungible using the Substrate node and recommended hardware.60/// Weights for pallet_refungible using the Substrate node and recommended hardware.
65 // Storage: Refungible TokenData (r:0 w:1)67 // Storage: Refungible TokenData (r:0 w:1)
66 // Storage: Refungible Owned (r:0 w:1)68 // Storage: Refungible Owned (r:0 w:1)
67 fn create_item() -> Weight {69 fn create_item() -> Weight {
68 (21_310_000 as Weight)70 (25_197_000 as Weight)
69 .saturating_add(T::DbWeight::get().reads(2 as Weight))71 .saturating_add(T::DbWeight::get().reads(2 as Weight))
70 .saturating_add(T::DbWeight::get().writes(6 as Weight))72 .saturating_add(T::DbWeight::get().writes(6 as Weight))
71 }73 }
76 // Storage: Refungible TokenData (r:0 w:4)78 // Storage: Refungible TokenData (r:0 w:4)
77 // Storage: Refungible Owned (r:0 w:4)79 // Storage: Refungible Owned (r:0 w:4)
78 fn create_multiple_items(b: u32, ) -> Weight {80 fn create_multiple_items(b: u32, ) -> Weight {
79 (9_552_000 as Weight)81 (10_852_000 as Weight)
80 // Standard Error: 2_00082 // Standard Error: 2_000
81 .saturating_add((7_056_000 as Weight).saturating_mul(b as Weight))83 .saturating_add((8_087_000 as Weight).saturating_mul(b as Weight))
82 .saturating_add(T::DbWeight::get().reads(2 as Weight))84 .saturating_add(T::DbWeight::get().reads(2 as Weight))
83 .saturating_add(T::DbWeight::get().writes(2 as Weight))85 .saturating_add(T::DbWeight::get().writes(2 as Weight))
84 .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))86 .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))
90 // Storage: Refungible TokenData (r:0 w:4)92 // Storage: Refungible TokenData (r:0 w:4)
91 // Storage: Refungible Owned (r:0 w:4)93 // Storage: Refungible Owned (r:0 w:4)
92 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {94 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {
93 (4_857_000 as Weight)95 (9_978_000 as Weight)
94 // Standard Error: 2_00096 // Standard Error: 2_000
95 .saturating_add((9_838_000 as Weight).saturating_mul(b as Weight))97 .saturating_add((10_848_000 as Weight).saturating_mul(b as Weight))
96 .saturating_add(T::DbWeight::get().reads(1 as Weight))98 .saturating_add(T::DbWeight::get().reads(1 as Weight))
97 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))99 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
98 .saturating_add(T::DbWeight::get().writes(1 as Weight))100 .saturating_add(T::DbWeight::get().writes(1 as Weight))
105 // Storage: Refungible Balance (r:0 w:4)107 // Storage: Refungible Balance (r:0 w:4)
106 // Storage: Refungible Owned (r:0 w:4)108 // Storage: Refungible Owned (r:0 w:4)
107 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {109 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {
108 (11_335_000 as Weight)110 (15_419_000 as Weight)
109 // Standard Error: 2_000111 // Standard Error: 2_000
110 .saturating_add((6_784_000 as Weight).saturating_mul(b as Weight))112 .saturating_add((7_813_000 as Weight).saturating_mul(b as Weight))
111 .saturating_add(T::DbWeight::get().reads(1 as Weight))113 .saturating_add(T::DbWeight::get().reads(1 as Weight))
112 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))114 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
113 .saturating_add(T::DbWeight::get().writes(3 as Weight))115 .saturating_add(T::DbWeight::get().writes(3 as Weight))
118 // Storage: Refungible AccountBalance (r:1 w:1)120 // Storage: Refungible AccountBalance (r:1 w:1)
119 // Storage: Refungible Owned (r:0 w:1)121 // Storage: Refungible Owned (r:0 w:1)
120 fn burn_item_partial() -> Weight {122 fn burn_item_partial() -> Weight {
121 (21_239_000 as Weight)123 (25_578_000 as Weight)
122 .saturating_add(T::DbWeight::get().reads(3 as Weight))124 .saturating_add(T::DbWeight::get().reads(3 as Weight))
123 .saturating_add(T::DbWeight::get().writes(4 as Weight))125 .saturating_add(T::DbWeight::get().writes(4 as Weight))
124 }126 }
130 // Storage: Refungible Owned (r:0 w:1)132 // Storage: Refungible Owned (r:0 w:1)
131 // Storage: Refungible TokenProperties (r:0 w:1)133 // Storage: Refungible TokenProperties (r:0 w:1)
132 fn burn_item_fully() -> Weight {134 fn burn_item_fully() -> Weight {
133 (29_426_000 as Weight)135 (33_593_000 as Weight)
134 .saturating_add(T::DbWeight::get().reads(4 as Weight))136 .saturating_add(T::DbWeight::get().reads(4 as Weight))
135 .saturating_add(T::DbWeight::get().writes(7 as Weight))137 .saturating_add(T::DbWeight::get().writes(7 as Weight))
136 }138 }
137 // Storage: Refungible Balance (r:2 w:2)139 // Storage: Refungible Balance (r:2 w:2)
138 fn transfer_normal() -> Weight {140 fn transfer_normal() -> Weight {
139 (17_743_000 as Weight)141 (21_049_000 as Weight)
140 .saturating_add(T::DbWeight::get().reads(2 as Weight))142 .saturating_add(T::DbWeight::get().reads(2 as Weight))
141 .saturating_add(T::DbWeight::get().writes(2 as Weight))143 .saturating_add(T::DbWeight::get().writes(2 as Weight))
142 }144 }
143 // Storage: Refungible Balance (r:2 w:2)145 // Storage: Refungible Balance (r:2 w:2)
144 // Storage: Refungible AccountBalance (r:1 w:1)146 // Storage: Refungible AccountBalance (r:1 w:1)
145 // Storage: Refungible Owned (r:0 w:1)147 // Storage: Refungible Owned (r:0 w:1)
146 fn transfer_creating() -> Weight {148 fn transfer_creating() -> Weight {
147 (20_699_000 as Weight)149 (24_646_000 as Weight)
148 .saturating_add(T::DbWeight::get().reads(3 as Weight))150 .saturating_add(T::DbWeight::get().reads(3 as Weight))
149 .saturating_add(T::DbWeight::get().writes(4 as Weight))151 .saturating_add(T::DbWeight::get().writes(4 as Weight))
150 }152 }
151 // Storage: Refungible Balance (r:2 w:2)153 // Storage: Refungible Balance (r:2 w:2)
152 // Storage: Refungible AccountBalance (r:1 w:1)154 // Storage: Refungible AccountBalance (r:1 w:1)
153 // Storage: Refungible Owned (r:0 w:1)155 // Storage: Refungible Owned (r:0 w:1)
154 fn transfer_removing() -> Weight {156 fn transfer_removing() -> Weight {
155 (22_833_000 as Weight)157 (26_570_000 as Weight)
156 .saturating_add(T::DbWeight::get().reads(3 as Weight))158 .saturating_add(T::DbWeight::get().reads(3 as Weight))
157 .saturating_add(T::DbWeight::get().writes(4 as Weight))159 .saturating_add(T::DbWeight::get().writes(4 as Weight))
158 }160 }
159 // Storage: Refungible Balance (r:2 w:2)161 // Storage: Refungible Balance (r:2 w:2)
160 // Storage: Refungible AccountBalance (r:2 w:2)162 // Storage: Refungible AccountBalance (r:2 w:2)
161 // Storage: Refungible Owned (r:0 w:2)163 // Storage: Refungible Owned (r:0 w:2)
162 fn transfer_creating_removing() -> Weight {164 fn transfer_creating_removing() -> Weight {
163 (24_936_000 as Weight)165 (28_906_000 as Weight)
164 .saturating_add(T::DbWeight::get().reads(4 as Weight))166 .saturating_add(T::DbWeight::get().reads(4 as Weight))
165 .saturating_add(T::DbWeight::get().writes(6 as Weight))167 .saturating_add(T::DbWeight::get().writes(6 as Weight))
166 }168 }
167 // Storage: Refungible Balance (r:1 w:0)169 // Storage: Refungible Balance (r:1 w:0)
168 // Storage: Refungible Allowance (r:0 w:1)170 // Storage: Refungible Allowance (r:0 w:1)
169 fn approve() -> Weight {171 fn approve() -> Weight {
170 (13_446_000 as Weight)172 (16_451_000 as Weight)
171 .saturating_add(T::DbWeight::get().reads(1 as Weight))173 .saturating_add(T::DbWeight::get().reads(1 as Weight))
172 .saturating_add(T::DbWeight::get().writes(1 as Weight))174 .saturating_add(T::DbWeight::get().writes(1 as Weight))
173 }175 }
174 // Storage: Refungible Allowance (r:1 w:1)176 // Storage: Refungible Allowance (r:1 w:1)
175 // Storage: Refungible Balance (r:2 w:2)177 // Storage: Refungible Balance (r:2 w:2)
176 fn transfer_from_normal() -> Weight {178 fn transfer_from_normal() -> Weight {
177 (24_777_000 as Weight)179 (29_545_000 as Weight)
178 .saturating_add(T::DbWeight::get().reads(3 as Weight))180 .saturating_add(T::DbWeight::get().reads(3 as Weight))
179 .saturating_add(T::DbWeight::get().writes(3 as Weight))181 .saturating_add(T::DbWeight::get().writes(3 as Weight))
180 }182 }
183 // Storage: Refungible AccountBalance (r:1 w:1)185 // Storage: Refungible AccountBalance (r:1 w:1)
184 // Storage: Refungible Owned (r:0 w:1)186 // Storage: Refungible Owned (r:0 w:1)
185 fn transfer_from_creating() -> Weight {187 fn transfer_from_creating() -> Weight {
186 (28_483_000 as Weight)188 (33_392_000 as Weight)
187 .saturating_add(T::DbWeight::get().reads(4 as Weight))189 .saturating_add(T::DbWeight::get().reads(4 as Weight))
188 .saturating_add(T::DbWeight::get().writes(5 as Weight))190 .saturating_add(T::DbWeight::get().writes(5 as Weight))
189 }191 }
192 // Storage: Refungible AccountBalance (r:1 w:1)194 // Storage: Refungible AccountBalance (r:1 w:1)
193 // Storage: Refungible Owned (r:0 w:1)195 // Storage: Refungible Owned (r:0 w:1)
194 fn transfer_from_removing() -> Weight {196 fn transfer_from_removing() -> Weight {
195 (29_896_000 as Weight)197 (35_446_000 as Weight)
196 .saturating_add(T::DbWeight::get().reads(4 as Weight))198 .saturating_add(T::DbWeight::get().reads(4 as Weight))
197 .saturating_add(T::DbWeight::get().writes(5 as Weight))199 .saturating_add(T::DbWeight::get().writes(5 as Weight))
198 }200 }
201 // Storage: Refungible AccountBalance (r:2 w:2)203 // Storage: Refungible AccountBalance (r:2 w:2)
202 // Storage: Refungible Owned (r:0 w:2)204 // Storage: Refungible Owned (r:0 w:2)
203 fn transfer_from_creating_removing() -> Weight {205 fn transfer_from_creating_removing() -> Weight {
204 (32_070_000 as Weight)206 (37_762_000 as Weight)
205 .saturating_add(T::DbWeight::get().reads(5 as Weight))207 .saturating_add(T::DbWeight::get().reads(5 as Weight))
206 .saturating_add(T::DbWeight::get().writes(7 as Weight))208 .saturating_add(T::DbWeight::get().writes(7 as Weight))
207 }209 }
214 // Storage: Refungible Owned (r:0 w:1)216 // Storage: Refungible Owned (r:0 w:1)
215 // Storage: Refungible TokenProperties (r:0 w:1)217 // Storage: Refungible TokenProperties (r:0 w:1)
216 fn burn_from() -> Weight {218 fn burn_from() -> Weight {
217 (36_789_000 as Weight)219 (42_620_000 as Weight)
218 .saturating_add(T::DbWeight::get().reads(5 as Weight))220 .saturating_add(T::DbWeight::get().reads(5 as Weight))
219 .saturating_add(T::DbWeight::get().writes(8 as Weight))221 .saturating_add(T::DbWeight::get().writes(8 as Weight))
220 }222 }
221 // Storage: Common CollectionPropertyPermissions (r:1 w:1)223 // Storage: Common CollectionPropertyPermissions (r:1 w:1)
222 fn set_token_property_permissions(b: u32, ) -> Weight {224 fn set_token_property_permissions(b: u32, ) -> Weight {
223 (0 as Weight)225 (0 as Weight)
224 // Standard Error: 62_000226 // Standard Error: 65_000
225 .saturating_add((15_803_000 as Weight).saturating_mul(b as Weight))227 .saturating_add((16_513_000 as Weight).saturating_mul(b as Weight))
226 .saturating_add(T::DbWeight::get().reads(1 as Weight))228 .saturating_add(T::DbWeight::get().reads(1 as Weight))
227 .saturating_add(T::DbWeight::get().writes(1 as Weight))229 .saturating_add(T::DbWeight::get().writes(1 as Weight))
228 }230 }
229 // Storage: Common CollectionPropertyPermissions (r:1 w:0)231 // Storage: Common CollectionPropertyPermissions (r:1 w:0)
230 // Storage: Refungible TokenProperties (r:1 w:1)232 // Storage: Refungible TokenProperties (r:1 w:1)
231 fn set_token_properties(b: u32, ) -> Weight {233 fn set_token_properties(b: u32, ) -> Weight {
232 (0 as Weight)234 (0 as Weight)
233 // Standard Error: 1_668_000235 // Standard Error: 1_583_000
234 .saturating_add((302_308_000 as Weight).saturating_mul(b as Weight))236 .saturating_add((291_392_000 as Weight).saturating_mul(b as Weight))
235 .saturating_add(T::DbWeight::get().reads(2 as Weight))237 .saturating_add(T::DbWeight::get().reads(2 as Weight))
236 .saturating_add(T::DbWeight::get().writes(1 as Weight))238 .saturating_add(T::DbWeight::get().writes(1 as Weight))
237 }239 }
238 // Storage: Common CollectionPropertyPermissions (r:1 w:0)240 // Storage: Common CollectionPropertyPermissions (r:1 w:0)
239 // Storage: Refungible TokenProperties (r:1 w:1)241 // Storage: Refungible TokenProperties (r:1 w:1)
240 fn delete_token_properties(b: u32, ) -> Weight {242 fn delete_token_properties(b: u32, ) -> Weight {
241 (0 as Weight)243 (0 as Weight)
242 // Standard Error: 1_619_000244 // Standard Error: 1_699_000
243 .saturating_add((294_574_000 as Weight).saturating_mul(b as Weight))245 .saturating_add((293_270_000 as Weight).saturating_mul(b as Weight))
244 .saturating_add(T::DbWeight::get().reads(2 as Weight))246 .saturating_add(T::DbWeight::get().reads(2 as Weight))
245 .saturating_add(T::DbWeight::get().writes(1 as Weight))247 .saturating_add(T::DbWeight::get().writes(1 as Weight))
246 }248 }
247 // Storage: Refungible TotalSupply (r:1 w:1)249 // Storage: Refungible TotalSupply (r:1 w:1)
248 // Storage: Refungible Balance (r:1 w:1)250 // Storage: Refungible Balance (r:1 w:1)
249 fn repartition_item() -> Weight {251 fn repartition_item() -> Weight {
250 (8_325_000 as Weight)252 (19_206_000 as Weight)
251 .saturating_add(T::DbWeight::get().reads(2 as Weight))253 .saturating_add(T::DbWeight::get().reads(2 as Weight))
252 .saturating_add(T::DbWeight::get().writes(2 as Weight))254 .saturating_add(T::DbWeight::get().writes(2 as Weight))
253 }255 }
256 // Storage: Refungible Balance (r:1 w:0)
257 // Storage: Refungible TotalSupply (r:1 w:0)
258 // Storage: Refungible TokenProperties (r:1 w:1)
259 fn set_parent_nft_unchecked() -> Weight {
260 (10_189_000 as Weight)
261 .saturating_add(T::DbWeight::get().reads(3 as Weight))
262 .saturating_add(T::DbWeight::get().writes(1 as Weight))
263 }
264 // Storage: Refungible Balance (r:2 w:0)
265 fn token_owner() -> Weight {
266 (8_205_000 as Weight)
267 .saturating_add(T::DbWeight::get().reads(2 as Weight))
268 }
254}269}
255270
256// For backwards compatibility and tests271// For backwards compatibility and tests
262 // Storage: Refungible TokenData (r:0 w:1)277 // Storage: Refungible TokenData (r:0 w:1)
263 // Storage: Refungible Owned (r:0 w:1)278 // Storage: Refungible Owned (r:0 w:1)
264 fn create_item() -> Weight {279 fn create_item() -> Weight {
265 (21_310_000 as Weight)280 (25_197_000 as Weight)
266 .saturating_add(RocksDbWeight::get().reads(2 as Weight))281 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
267 .saturating_add(RocksDbWeight::get().writes(6 as Weight))282 .saturating_add(RocksDbWeight::get().writes(6 as Weight))
268 }283 }
273 // Storage: Refungible TokenData (r:0 w:4)288 // Storage: Refungible TokenData (r:0 w:4)
274 // Storage: Refungible Owned (r:0 w:4)289 // Storage: Refungible Owned (r:0 w:4)
275 fn create_multiple_items(b: u32, ) -> Weight {290 fn create_multiple_items(b: u32, ) -> Weight {
276 (9_552_000 as Weight)291 (10_852_000 as Weight)
277 // Standard Error: 2_000292 // Standard Error: 2_000
278 .saturating_add((7_056_000 as Weight).saturating_mul(b as Weight))293 .saturating_add((8_087_000 as Weight).saturating_mul(b as Weight))
279 .saturating_add(RocksDbWeight::get().reads(2 as Weight))294 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
280 .saturating_add(RocksDbWeight::get().writes(2 as Weight))295 .saturating_add(RocksDbWeight::get().writes(2 as Weight))
281 .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))296 .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))
287 // Storage: Refungible TokenData (r:0 w:4)302 // Storage: Refungible TokenData (r:0 w:4)
288 // Storage: Refungible Owned (r:0 w:4)303 // Storage: Refungible Owned (r:0 w:4)
289 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {304 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {
290 (4_857_000 as Weight)305 (9_978_000 as Weight)
291 // Standard Error: 2_000306 // Standard Error: 2_000
292 .saturating_add((9_838_000 as Weight).saturating_mul(b as Weight))307 .saturating_add((10_848_000 as Weight).saturating_mul(b as Weight))
293 .saturating_add(RocksDbWeight::get().reads(1 as Weight))308 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
294 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))309 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
295 .saturating_add(RocksDbWeight::get().writes(1 as Weight))310 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
302 // Storage: Refungible Balance (r:0 w:4)317 // Storage: Refungible Balance (r:0 w:4)
303 // Storage: Refungible Owned (r:0 w:4)318 // Storage: Refungible Owned (r:0 w:4)
304 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {319 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {
305 (11_335_000 as Weight)320 (15_419_000 as Weight)
306 // Standard Error: 2_000321 // Standard Error: 2_000
307 .saturating_add((6_784_000 as Weight).saturating_mul(b as Weight))322 .saturating_add((7_813_000 as Weight).saturating_mul(b as Weight))
308 .saturating_add(RocksDbWeight::get().reads(1 as Weight))323 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
309 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))324 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
310 .saturating_add(RocksDbWeight::get().writes(3 as Weight))325 .saturating_add(RocksDbWeight::get().writes(3 as Weight))
315 // Storage: Refungible AccountBalance (r:1 w:1)330 // Storage: Refungible AccountBalance (r:1 w:1)
316 // Storage: Refungible Owned (r:0 w:1)331 // Storage: Refungible Owned (r:0 w:1)
317 fn burn_item_partial() -> Weight {332 fn burn_item_partial() -> Weight {
318 (21_239_000 as Weight)333 (25_578_000 as Weight)
319 .saturating_add(RocksDbWeight::get().reads(3 as Weight))334 .saturating_add(RocksDbWeight::get().reads(3 as Weight))
320 .saturating_add(RocksDbWeight::get().writes(4 as Weight))335 .saturating_add(RocksDbWeight::get().writes(4 as Weight))
321 }336 }
327 // Storage: Refungible Owned (r:0 w:1)342 // Storage: Refungible Owned (r:0 w:1)
328 // Storage: Refungible TokenProperties (r:0 w:1)343 // Storage: Refungible TokenProperties (r:0 w:1)
329 fn burn_item_fully() -> Weight {344 fn burn_item_fully() -> Weight {
330 (29_426_000 as Weight)345 (33_593_000 as Weight)
331 .saturating_add(RocksDbWeight::get().reads(4 as Weight))346 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
332 .saturating_add(RocksDbWeight::get().writes(7 as Weight))347 .saturating_add(RocksDbWeight::get().writes(7 as Weight))
333 }348 }
334 // Storage: Refungible Balance (r:2 w:2)349 // Storage: Refungible Balance (r:2 w:2)
335 fn transfer_normal() -> Weight {350 fn transfer_normal() -> Weight {
336 (17_743_000 as Weight)351 (21_049_000 as Weight)
337 .saturating_add(RocksDbWeight::get().reads(2 as Weight))352 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
338 .saturating_add(RocksDbWeight::get().writes(2 as Weight))353 .saturating_add(RocksDbWeight::get().writes(2 as Weight))
339 }354 }
340 // Storage: Refungible Balance (r:2 w:2)355 // Storage: Refungible Balance (r:2 w:2)
341 // Storage: Refungible AccountBalance (r:1 w:1)356 // Storage: Refungible AccountBalance (r:1 w:1)
342 // Storage: Refungible Owned (r:0 w:1)357 // Storage: Refungible Owned (r:0 w:1)
343 fn transfer_creating() -> Weight {358 fn transfer_creating() -> Weight {
344 (20_699_000 as Weight)359 (24_646_000 as Weight)
345 .saturating_add(RocksDbWeight::get().reads(3 as Weight))360 .saturating_add(RocksDbWeight::get().reads(3 as Weight))
346 .saturating_add(RocksDbWeight::get().writes(4 as Weight))361 .saturating_add(RocksDbWeight::get().writes(4 as Weight))
347 }362 }
348 // Storage: Refungible Balance (r:2 w:2)363 // Storage: Refungible Balance (r:2 w:2)
349 // Storage: Refungible AccountBalance (r:1 w:1)364 // Storage: Refungible AccountBalance (r:1 w:1)
350 // Storage: Refungible Owned (r:0 w:1)365 // Storage: Refungible Owned (r:0 w:1)
351 fn transfer_removing() -> Weight {366 fn transfer_removing() -> Weight {
352 (22_833_000 as Weight)367 (26_570_000 as Weight)
353 .saturating_add(RocksDbWeight::get().reads(3 as Weight))368 .saturating_add(RocksDbWeight::get().reads(3 as Weight))
354 .saturating_add(RocksDbWeight::get().writes(4 as Weight))369 .saturating_add(RocksDbWeight::get().writes(4 as Weight))
355 }370 }
356 // Storage: Refungible Balance (r:2 w:2)371 // Storage: Refungible Balance (r:2 w:2)
357 // Storage: Refungible AccountBalance (r:2 w:2)372 // Storage: Refungible AccountBalance (r:2 w:2)
358 // Storage: Refungible Owned (r:0 w:2)373 // Storage: Refungible Owned (r:0 w:2)
359 fn transfer_creating_removing() -> Weight {374 fn transfer_creating_removing() -> Weight {
360 (24_936_000 as Weight)375 (28_906_000 as Weight)
361 .saturating_add(RocksDbWeight::get().reads(4 as Weight))376 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
362 .saturating_add(RocksDbWeight::get().writes(6 as Weight))377 .saturating_add(RocksDbWeight::get().writes(6 as Weight))
363 }378 }
364 // Storage: Refungible Balance (r:1 w:0)379 // Storage: Refungible Balance (r:1 w:0)
365 // Storage: Refungible Allowance (r:0 w:1)380 // Storage: Refungible Allowance (r:0 w:1)
366 fn approve() -> Weight {381 fn approve() -> Weight {
367 (13_446_000 as Weight)382 (16_451_000 as Weight)
368 .saturating_add(RocksDbWeight::get().reads(1 as Weight))383 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
369 .saturating_add(RocksDbWeight::get().writes(1 as Weight))384 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
370 }385 }
371 // Storage: Refungible Allowance (r:1 w:1)386 // Storage: Refungible Allowance (r:1 w:1)
372 // Storage: Refungible Balance (r:2 w:2)387 // Storage: Refungible Balance (r:2 w:2)
373 fn transfer_from_normal() -> Weight {388 fn transfer_from_normal() -> Weight {
374 (24_777_000 as Weight)389 (29_545_000 as Weight)
375 .saturating_add(RocksDbWeight::get().reads(3 as Weight))390 .saturating_add(RocksDbWeight::get().reads(3 as Weight))
376 .saturating_add(RocksDbWeight::get().writes(3 as Weight))391 .saturating_add(RocksDbWeight::get().writes(3 as Weight))
377 }392 }
380 // Storage: Refungible AccountBalance (r:1 w:1)395 // Storage: Refungible AccountBalance (r:1 w:1)
381 // Storage: Refungible Owned (r:0 w:1)396 // Storage: Refungible Owned (r:0 w:1)
382 fn transfer_from_creating() -> Weight {397 fn transfer_from_creating() -> Weight {
383 (28_483_000 as Weight)398 (33_392_000 as Weight)
384 .saturating_add(RocksDbWeight::get().reads(4 as Weight))399 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
385 .saturating_add(RocksDbWeight::get().writes(5 as Weight))400 .saturating_add(RocksDbWeight::get().writes(5 as Weight))
386 }401 }
389 // Storage: Refungible AccountBalance (r:1 w:1)404 // Storage: Refungible AccountBalance (r:1 w:1)
390 // Storage: Refungible Owned (r:0 w:1)405 // Storage: Refungible Owned (r:0 w:1)
391 fn transfer_from_removing() -> Weight {406 fn transfer_from_removing() -> Weight {
392 (29_896_000 as Weight)407 (35_446_000 as Weight)
393 .saturating_add(RocksDbWeight::get().reads(4 as Weight))408 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
394 .saturating_add(RocksDbWeight::get().writes(5 as Weight))409 .saturating_add(RocksDbWeight::get().writes(5 as Weight))
395 }410 }
398 // Storage: Refungible AccountBalance (r:2 w:2)413 // Storage: Refungible AccountBalance (r:2 w:2)
399 // Storage: Refungible Owned (r:0 w:2)414 // Storage: Refungible Owned (r:0 w:2)
400 fn transfer_from_creating_removing() -> Weight {415 fn transfer_from_creating_removing() -> Weight {
401 (32_070_000 as Weight)416 (37_762_000 as Weight)
402 .saturating_add(RocksDbWeight::get().reads(5 as Weight))417 .saturating_add(RocksDbWeight::get().reads(5 as Weight))
403 .saturating_add(RocksDbWeight::get().writes(7 as Weight))418 .saturating_add(RocksDbWeight::get().writes(7 as Weight))
404 }419 }
411 // Storage: Refungible Owned (r:0 w:1)426 // Storage: Refungible Owned (r:0 w:1)
412 // Storage: Refungible TokenProperties (r:0 w:1)427 // Storage: Refungible TokenProperties (r:0 w:1)
413 fn burn_from() -> Weight {428 fn burn_from() -> Weight {
414 (36_789_000 as Weight)429 (42_620_000 as Weight)
415 .saturating_add(RocksDbWeight::get().reads(5 as Weight))430 .saturating_add(RocksDbWeight::get().reads(5 as Weight))
416 .saturating_add(RocksDbWeight::get().writes(8 as Weight))431 .saturating_add(RocksDbWeight::get().writes(8 as Weight))
417 }432 }
418 // Storage: Common CollectionPropertyPermissions (r:1 w:1)433 // Storage: Common CollectionPropertyPermissions (r:1 w:1)
419 fn set_token_property_permissions(b: u32, ) -> Weight {434 fn set_token_property_permissions(b: u32, ) -> Weight {
420 (0 as Weight)435 (0 as Weight)
421 // Standard Error: 62_000436 // Standard Error: 65_000
422 .saturating_add((15_803_000 as Weight).saturating_mul(b as Weight))437 .saturating_add((16_513_000 as Weight).saturating_mul(b as Weight))
423 .saturating_add(RocksDbWeight::get().reads(1 as Weight))438 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
424 .saturating_add(RocksDbWeight::get().writes(1 as Weight))439 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
425 }440 }
426 // Storage: Common CollectionPropertyPermissions (r:1 w:0)441 // Storage: Common CollectionPropertyPermissions (r:1 w:0)
427 // Storage: Refungible TokenProperties (r:1 w:1)442 // Storage: Refungible TokenProperties (r:1 w:1)
428 fn set_token_properties(b: u32, ) -> Weight {443 fn set_token_properties(b: u32, ) -> Weight {
429 (0 as Weight)444 (0 as Weight)
430 // Standard Error: 1_668_000445 // Standard Error: 1_583_000
431 .saturating_add((302_308_000 as Weight).saturating_mul(b as Weight))446 .saturating_add((291_392_000 as Weight).saturating_mul(b as Weight))
432 .saturating_add(RocksDbWeight::get().reads(2 as Weight))447 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
433 .saturating_add(RocksDbWeight::get().writes(1 as Weight))448 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
434 }449 }
435 // Storage: Common CollectionPropertyPermissions (r:1 w:0)450 // Storage: Common CollectionPropertyPermissions (r:1 w:0)
436 // Storage: Refungible TokenProperties (r:1 w:1)451 // Storage: Refungible TokenProperties (r:1 w:1)
437 fn delete_token_properties(b: u32, ) -> Weight {452 fn delete_token_properties(b: u32, ) -> Weight {
438 (0 as Weight)453 (0 as Weight)
439 // Standard Error: 1_619_000454 // Standard Error: 1_699_000
440 .saturating_add((294_574_000 as Weight).saturating_mul(b as Weight))455 .saturating_add((293_270_000 as Weight).saturating_mul(b as Weight))
441 .saturating_add(RocksDbWeight::get().reads(2 as Weight))456 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
442 .saturating_add(RocksDbWeight::get().writes(1 as Weight))457 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
443 }458 }
444 // Storage: Refungible TotalSupply (r:1 w:1)459 // Storage: Refungible TotalSupply (r:1 w:1)
445 // Storage: Refungible Balance (r:1 w:1)460 // Storage: Refungible Balance (r:1 w:1)
446 fn repartition_item() -> Weight {461 fn repartition_item() -> Weight {
447 (8_325_000 as Weight)462 (19_206_000 as Weight)
448 .saturating_add(RocksDbWeight::get().reads(2 as Weight))463 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
449 .saturating_add(RocksDbWeight::get().writes(2 as Weight))464 .saturating_add(RocksDbWeight::get().writes(2 as Weight))
450 }465 }
466 // Storage: Refungible Balance (r:1 w:0)
467 // Storage: Refungible TotalSupply (r:1 w:0)
468 // Storage: Refungible TokenProperties (r:1 w:1)
469 fn set_parent_nft_unchecked() -> Weight {
470 (10_189_000 as Weight)
471 .saturating_add(RocksDbWeight::get().reads(3 as Weight))
472 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
473 }
474 // Storage: Refungible Balance (r:2 w:0)
475 fn token_owner() -> Weight {
476 (8_205_000 as Weight)
477 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
478 }
451}479}
452480
modifiedpallets/unique/src/eth/mod.rsdiffbeforeafterboth
17//! Implementation of CollectionHelpers contract.17//! Implementation of CollectionHelpers contract.
1818
19use core::marker::PhantomData;19use core::marker::PhantomData;
20use ethereum as _;
20use evm_coder::{execution::*, generate_stubgen, solidity_interface, solidity, weight, types::*};21use evm_coder::{execution::*, generate_stubgen, solidity_interface, solidity, weight, types::*};
22use frame_support::traits::Get;
21use ethereum as _;23use pallet_common::{
24 CollectionById, CollectionHandle,
25 dispatch::CollectionDispatch,
26 erc::{
27 CollectionHelpersEvents,
28 static_property::{key, value as property_value},
29 },
30 Pallet as PalletCommon,
31};
22use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};32use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
23use pallet_evm::{OnMethodCall, PrecompileResult, account::CrossAccountId, PrecompileHandle};33use pallet_evm::{account::CrossAccountId, OnMethodCall, PrecompileHandle, PrecompileResult};
34use pallet_evm_coder_substrate::dispatch_to_evm;
24use up_data_structs::{35use up_data_structs::{
25 CollectionName, CollectionDescription, CollectionTokenPrefix, CreateCollectionData,36 CollectionName, CollectionDescription, CollectionTokenPrefix, CreateCollectionData,
26 CollectionMode, PropertyValue,37 CollectionMode, PropertyKeyPermission, PropertyPermission, PropertyScope, PropertyValue,
27};38};
28use frame_support::traits::Get;39
29use pallet_common::{
30 CollectionById,
31 erc::{
32 static_property::{key, value as property_value},
33 CollectionHelpersEvents,
34 },
35 dispatch::CollectionDispatch,
36};
37use crate::{SelfWeightOf, Config, weights::WeightInfo};40use crate::{Config, SelfWeightOf, weights::WeightInfo};
3841
39use sp_std::vec::Vec;42use sp_std::{vec, vec::Vec};
40use alloc::format;43use alloc::format;
4144
42/// See [`CollectionHelpersCall`]45/// See [`CollectionHelpersCall`]
151 Ok(data)154 Ok(data)
152}155}
156
157fn parent_nft_property_permissions() -> PropertyKeyPermission {
158 PropertyKeyPermission {
159 key: key::parent_nft(),
160 permission: PropertyPermission {
161 mutable: false,
162 collection_admin: false,
163 token_owner: true,
164 },
165 }
166}
167
168fn create_refungible_collection_internal<
169 T: Config + pallet_nonfungible::Config + pallet_refungible::Config,
170>(
171 caller: caller,
172 name: string,
173 description: string,
174 token_prefix: string,
175 base_uri: string,
176 add_properties: bool,
177) -> Result<address> {
178 let (caller, name, description, token_prefix, base_uri_value) =
179 convert_data::<T>(caller, name, description, token_prefix, base_uri)?;
180 let data = make_data::<T>(
181 name,
182 CollectionMode::ReFungible,
183 description,
184 token_prefix,
185 base_uri_value,
186 add_properties,
187 )?;
188
189 let collection_id = T::CollectionDispatch::create(caller.clone(), data)
190 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
191
192 let handle = <CollectionHandle<T>>::try_get(collection_id).map_err(dispatch_to_evm::<T>)?;
193 <PalletCommon<T>>::set_scoped_token_property_permissions(
194 &handle,
195 &caller,
196 PropertyScope::Eth,
197 vec![parent_nft_property_permissions()],
198 )
199 .map_err(dispatch_to_evm::<T>)?;
200
201 let address = pallet_common::eth::collection_id_to_address(collection_id);
202 Ok(address)
203}
153204
154/// @title Contract, which allows users to operate with collections205/// @title Contract, which allows users to operate with collections
155#[solidity_interface(name = "CollectionHelpers", events(CollectionHelpersEvents))]206#[solidity_interface(name = "CollectionHelpers", events(CollectionHelpersEvents))]
216267
217 #[weight(<SelfWeightOf<T>>::create_collection())]268 #[weight(<SelfWeightOf<T>>::create_collection())]
218 fn create_refungible_collection(269 fn create_refungible_collection(
219 &self,270 &mut self,
220 caller: caller,271 caller: caller,
221 name: string,272 name: string,
222 description: string,273 description: string,
223 token_prefix: string,274 token_prefix: string,
224 ) -> Result<address> {275 ) -> Result<address> {
225 let (caller, name, description, token_prefix, _base_uri) =
226 convert_data::<T>(caller, name, description, token_prefix, "".into())?;
227 let data = make_data::<T>(276 create_refungible_collection_internal::<T>(
277 caller,
228 name,278 name,
229 CollectionMode::ReFungible,
230 description,279 description,
231 token_prefix,280 token_prefix,
232 Default::default(),281 Default::default(),
233 false,282 false,
234 )?;283 )
235 let collection_id = T::CollectionDispatch::create(caller, data)
236 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
237
238 let address = pallet_common::eth::collection_id_to_address(collection_id);
239 Ok(address)
240 }284 }
241285
242 #[weight(<SelfWeightOf<T>>::create_collection())]286 #[weight(<SelfWeightOf<T>>::create_collection())]
249 token_prefix: string,293 token_prefix: string,
250 base_uri: string,294 base_uri: string,
251 ) -> Result<address> {295 ) -> Result<address> {
252 let (caller, name, description, token_prefix, base_uri_value) =
253 convert_data::<T>(caller, name, description, token_prefix, base_uri)?;296 create_refungible_collection_internal::<T>(
254 let data = make_data::<T>(297 caller,
255 name,298 name,
256 CollectionMode::NFT,299 description,
257 description,300 token_prefix,
258 token_prefix,301 base_uri,
259 base_uri_value,302 true,
260 true,303 )
261 )?;
262 let collection_id = T::CollectionDispatch::create(caller, data)
263 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
264
265 let address = pallet_common::eth::collection_id_to_address(collection_id);
266 Ok(address)
267 }304 }
268305
269 /// Check if a collection exists306 /// Check if a collection exists
modifiedpallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/unique/src/eth/stubs/CollectionHelpers.soldiffbeforeafterboth
72 string memory name,72 string memory name,
73 string memory description,73 string memory description,
74 string memory tokenPrefix74 string memory tokenPrefix
75 ) public view returns (address) {75 ) public returns (address) {
76 require(false, stub_error);76 require(false, stub_error);
77 name;77 name;
78 description;78 description;
79 tokenPrefix;79 tokenPrefix;
80 dummy;80 dummy = 0;
81 return 0x0000000000000000000000000000000000000000;81 return 0x0000000000000000000000000000000000000000;
82 }82 }
8383
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
1050pub enum PropertyScope {1050pub enum PropertyScope {
1051 None,1051 None,
1052 Rmrk,1052 Rmrk,
1053 Eth,
1053}1054}
10541055
1055impl PropertyScope {1056impl PropertyScope {
1058 let scope_str: &[u8] = match self {1059 let scope_str: &[u8] = match self {
1059 Self::None => return Ok(key),1060 Self::None => return Ok(key),
1060 Self::Rmrk => b"rmrk",1061 Self::Rmrk => b"rmrk",
1062 Self::Eth => b"eth",
1061 };1063 };
10621064
1063 [scope_str, b":", key.as_slice()]1065 [scope_str, b":", key.as_slice()]
modifiedruntime/common/weights.rsdiffbeforeafterboth
117 max_weight_of!(burn_recursively_breadth_raw(amount))117 max_weight_of!(burn_recursively_breadth_raw(amount))
118 }118 }
119
120 fn token_owner() -> Weight {
121 max_weight_of!(token_owner())
122 }
119}123}
120124
121#[cfg(feature = "refungible")]125#[cfg(feature = "refungible")]
modifiedtests/package.jsondiffbeforeafterboth
8 "@polkadot/typegen": "8.7.2-15",8 "@polkadot/typegen": "8.7.2-15",
9 "@types/chai": "^4.3.1",9 "@types/chai": "^4.3.1",
10 "@types/chai-as-promised": "^7.1.5",10 "@types/chai-as-promised": "^7.1.5",
11 "@types/chai-like": "^1.1.1",
11 "@types/mocha": "^9.1.1",12 "@types/mocha": "^9.1.1",
12 "@types/node": "^17.0.35",13 "@types/node": "^17.0.35",
13 "@typescript-eslint/eslint-plugin": "^5.26.0",14 "@typescript-eslint/eslint-plugin": "^5.26.0",
96 "@polkadot/util-crypto": "9.4.1",97 "@polkadot/util-crypto": "9.4.1",
97 "bignumber.js": "^9.0.2",98 "bignumber.js": "^9.0.2",
98 "chai-as-promised": "^7.1.1",99 "chai-as-promised": "^7.1.1",
100 "chai-like": "^1.1.1",
99 "find-process": "^1.4.7",101 "find-process": "^1.4.7",
100 "solc": "0.8.14-fixed",102 "solc": "0.8.14-fixed",
101 "web3": "^1.7.3"103 "web3": "^1.7.3"
modifiedtests/src/eth/api/CollectionHelpers.soldiffbeforeafterboth
48 string memory name,48 string memory name,
49 string memory description,49 string memory description,
50 string memory tokenPrefix50 string memory tokenPrefix
51 ) external view returns (address);51 ) external returns (address);
5252
53 // Selector: createERC721MetadataCompatibleRFTCollection(string,string,string,string) a559638853 // Selector: createERC721MetadataCompatibleRFTCollection(string,string,string,string) a5596388
54 function createERC721MetadataCompatibleRFTCollection(54 function createERC721MetadataCompatibleRFTCollection(
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
22 );22 );
23}23}
24
25// Selector: 6cf113cd
26interface Collection is Dummy, ERC165 {
27 // Set collection property.
28 //
29 // @param key Property key.
30 // @param value Propery value.
31 //
32 // Selector: setCollectionProperty(string,bytes) 2f073f66
33 function setCollectionProperty(string memory key, bytes memory value)
34 external;
35
36 // Delete collection property.
37 //
38 // @param key Property key.
39 //
40 // Selector: deleteCollectionProperty(string) 7b7debce
41 function deleteCollectionProperty(string memory key) external;
42
43 // Get collection property.
44 //
45 // @dev Throws error if key not found.
46 //
47 // @param key Property key.
48 // @return bytes The property corresponding to the key.
49 //
50 // Selector: collectionProperty(string) cf24fd6d
51 function collectionProperty(string memory key)
52 external
53 view
54 returns (bytes memory);
55
56 // Set the sponsor of the collection.
57 //
58 // @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
59 //
60 // @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
61 //
62 // Selector: setCollectionSponsor(address) 7623402e
63 function setCollectionSponsor(address sponsor) external;
64
65 // Collection sponsorship confirmation.
66 //
67 // @dev After setting the sponsor for the collection, it must be confirmed with this function.
68 //
69 // Selector: confirmCollectionSponsorship() 3c50e97a
70 function confirmCollectionSponsorship() external;
71
72 // Set limits for the collection.
73 // @dev Throws error if limit not found.
74 // @param limit Name of the limit. Valid names:
75 // "accountTokenOwnershipLimit",
76 // "sponsoredDataSize",
77 // "sponsoredDataRateLimit",
78 // "tokenLimit",
79 // "sponsorTransferTimeout",
80 // "sponsorApproveTimeout"
81 // @param value Value of the limit.
82 //
83 // Selector: setCollectionLimit(string,uint32) 6a3841db
84 function setCollectionLimit(string memory limit, uint32 value) external;
85
86 // Set limits for the collection.
87 // @dev Throws error if limit not found.
88 // @param limit Name of the limit. Valid names:
89 // "ownerCanTransfer",
90 // "ownerCanDestroy",
91 // "transfersEnabled"
92 // @param value Value of the limit.
93 //
94 // Selector: setCollectionLimit(string,bool) 993b7fba
95 function setCollectionLimit(string memory limit, bool value) external;
96
97 // Get contract address.
98 //
99 // Selector: contractAddress() f6b4dfb4
100 function contractAddress() external view returns (address);
101
102 // Add collection admin by substrate address.
103 // @param new_admin Substrate administrator address.
104 //
105 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
106 function addCollectionAdminSubstrate(uint256 newAdmin) external;
107
108 // Remove collection admin by substrate address.
109 // @param admin Substrate administrator address.
110 //
111 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
112 function removeCollectionAdminSubstrate(uint256 admin) external;
113
114 // Add collection admin.
115 // @param new_admin Address of the added administrator.
116 //
117 // Selector: addCollectionAdmin(address) 92e462c7
118 function addCollectionAdmin(address newAdmin) external;
119
120 // Remove collection admin.
121 //
122 // @param new_admin Address of the removed administrator.
123 //
124 // Selector: removeCollectionAdmin(address) fafd7b42
125 function removeCollectionAdmin(address admin) external;
126
127 // Toggle accessibility of collection nesting.
128 //
129 // @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'
130 //
131 // Selector: setCollectionNesting(bool) 112d4586
132 function setCollectionNesting(bool enable) external;
133
134 // Toggle accessibility of collection nesting.
135 //
136 // @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
137 // @param collections Addresses of collections that will be available for nesting.
138 //
139 // Selector: setCollectionNesting(bool,address[]) 64872396
140 function setCollectionNesting(bool enable, address[] memory collections)
141 external;
142
143 // Set the collection access method.
144 // @param mode Access mode
145 // 0 for Normal
146 // 1 for AllowList
147 //
148 // Selector: setCollectionAccess(uint8) 41835d4c
149 function setCollectionAccess(uint8 mode) external;
150
151 // Add the user to the allowed list.
152 //
153 // @param user Address of a trusted user.
154 //
155 // Selector: addToCollectionAllowList(address) 67844fe6
156 function addToCollectionAllowList(address user) external;
157
158 // Remove the user from the allowed list.
159 //
160 // @param user Address of a removed user.
161 //
162 // Selector: removeFromCollectionAllowList(address) 85c51acb
163 function removeFromCollectionAllowList(address user) external;
164
165 // Switch permission for minting.
166 //
167 // @param mode Enable if "true".
168 //
169 // Selector: setCollectionMintMode(bool) 00018e84
170 function setCollectionMintMode(bool mode) external;
171
172 // Check that account is the owner or admin of the collection
173 //
174 // @param user account to verify
175 // @return "true" if account is the owner or admin
176 //
177 // Selector: verifyOwnerOrAdmin(address) c2282493
178 function verifyOwnerOrAdmin(address user) external view returns (bool);
179
180 // Returns collection type
181 //
182 // @return `Fungible` or `NFT` or `ReFungible`
183 //
184 // Selector: uniqueCollectionType() d34b55b8
185 function uniqueCollectionType() external returns (string memory);
186}
24187
25// Selector: 79cc6790188// Selector: 79cc6790
26interface ERC20UniqueExtensions is Dummy, ERC165 {189interface ERC20UniqueExtensions is Dummy, ERC165 {
27 // Selector: burnFrom(address,uint256) 79cc6790190 // Selector: burnFrom(address,uint256) 79cc6790
28 function burnFrom(address from, uint256 amount) external returns (bool);191 function burnFrom(address from, uint256 amount) external returns (bool);
29}192}
30
31// Selector: 7d9262e6
32interface Collection is Dummy, ERC165 {
33 // Set collection property.
34 //
35 // @param key Property key.
36 // @param value Propery value.
37 //
38 // Selector: setCollectionProperty(string,bytes) 2f073f66
39 function setCollectionProperty(string memory key, bytes memory value)
40 external;
41
42 // Delete collection property.
43 //
44 // @param key Property key.
45 //
46 // Selector: deleteCollectionProperty(string) 7b7debce
47 function deleteCollectionProperty(string memory key) external;
48
49 // Get collection property.
50 //
51 // @dev Throws error if key not found.
52 //
53 // @param key Property key.
54 // @return bytes The property corresponding to the key.
55 //
56 // Selector: collectionProperty(string) cf24fd6d
57 function collectionProperty(string memory key)
58 external
59 view
60 returns (bytes memory);
61
62 // Set the sponsor of the collection.
63 //
64 // @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
65 //
66 // @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
67 //
68 // Selector: setCollectionSponsor(address) 7623402e
69 function setCollectionSponsor(address sponsor) external;
70
71 // Collection sponsorship confirmation.
72 //
73 // @dev After setting the sponsor for the collection, it must be confirmed with this function.
74 //
75 // Selector: confirmCollectionSponsorship() 3c50e97a
76 function confirmCollectionSponsorship() external;
77
78 // Set limits for the collection.
79 // @dev Throws error if limit not found.
80 // @param limit Name of the limit. Valid names:
81 // "accountTokenOwnershipLimit",
82 // "sponsoredDataSize",
83 // "sponsoredDataRateLimit",
84 // "tokenLimit",
85 // "sponsorTransferTimeout",
86 // "sponsorApproveTimeout"
87 // @param value Value of the limit.
88 //
89 // Selector: setCollectionLimit(string,uint32) 6a3841db
90 function setCollectionLimit(string memory limit, uint32 value) external;
91
92 // Set limits for the collection.
93 // @dev Throws error if limit not found.
94 // @param limit Name of the limit. Valid names:
95 // "ownerCanTransfer",
96 // "ownerCanDestroy",
97 // "transfersEnabled"
98 // @param value Value of the limit.
99 //
100 // Selector: setCollectionLimit(string,bool) 993b7fba
101 function setCollectionLimit(string memory limit, bool value) external;
102
103 // Get contract address.
104 //
105 // Selector: contractAddress() f6b4dfb4
106 function contractAddress() external view returns (address);
107
108 // Add collection admin by substrate address.
109 // @param new_admin Substrate administrator address.
110 //
111 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
112 function addCollectionAdminSubstrate(uint256 newAdmin) external;
113
114 // Remove collection admin by substrate address.
115 // @param admin Substrate administrator address.
116 //
117 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
118 function removeCollectionAdminSubstrate(uint256 admin) external;
119
120 // Add collection admin.
121 // @param new_admin Address of the added administrator.
122 //
123 // Selector: addCollectionAdmin(address) 92e462c7
124 function addCollectionAdmin(address newAdmin) external;
125
126 // Remove collection admin.
127 //
128 // @param new_admin Address of the removed administrator.
129 //
130 // Selector: removeCollectionAdmin(address) fafd7b42
131 function removeCollectionAdmin(address admin) external;
132
133 // Toggle accessibility of collection nesting.
134 //
135 // @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'
136 //
137 // Selector: setCollectionNesting(bool) 112d4586
138 function setCollectionNesting(bool enable) external;
139
140 // Toggle accessibility of collection nesting.
141 //
142 // @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
143 // @param collections Addresses of collections that will be available for nesting.
144 //
145 // Selector: setCollectionNesting(bool,address[]) 64872396
146 function setCollectionNesting(bool enable, address[] memory collections)
147 external;
148
149 // Set the collection access method.
150 // @param mode Access mode
151 // 0 for Normal
152 // 1 for AllowList
153 //
154 // Selector: setCollectionAccess(uint8) 41835d4c
155 function setCollectionAccess(uint8 mode) external;
156
157 // Add the user to the allowed list.
158 //
159 // @param user Address of a trusted user.
160 //
161 // Selector: addToCollectionAllowList(address) 67844fe6
162 function addToCollectionAllowList(address user) external;
163
164 // Remove the user from the allowed list.
165 //
166 // @param user Address of a removed user.
167 //
168 // Selector: removeFromCollectionAllowList(address) 85c51acb
169 function removeFromCollectionAllowList(address user) external;
170
171 // Switch permission for minting.
172 //
173 // @param mode Enable if "true".
174 //
175 // Selector: setCollectionMintMode(bool) 00018e84
176 function setCollectionMintMode(bool mode) external;
177}
178193
179// Selector: 942e8b22194// Selector: 942e8b22
180interface ERC20 is Dummy, ERC165, ERC20Events {195interface ERC20 is Dummy, ERC165, ERC20Events {
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
250 function finishMinting() external returns (bool);250 function finishMinting() external returns (bool);
251}251}
252
253// Selector: 6cf113cd
254interface Collection is Dummy, ERC165 {
255 // Set collection property.
256 //
257 // @param key Property key.
258 // @param value Propery value.
259 //
260 // Selector: setCollectionProperty(string,bytes) 2f073f66
261 function setCollectionProperty(string memory key, bytes memory value)
262 external;
263
264 // Delete collection property.
265 //
266 // @param key Property key.
267 //
268 // Selector: deleteCollectionProperty(string) 7b7debce
269 function deleteCollectionProperty(string memory key) external;
270
271 // Get collection property.
272 //
273 // @dev Throws error if key not found.
274 //
275 // @param key Property key.
276 // @return bytes The property corresponding to the key.
277 //
278 // Selector: collectionProperty(string) cf24fd6d
279 function collectionProperty(string memory key)
280 external
281 view
282 returns (bytes memory);
283
284 // Set the sponsor of the collection.
285 //
286 // @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
287 //
288 // @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
289 //
290 // Selector: setCollectionSponsor(address) 7623402e
291 function setCollectionSponsor(address sponsor) external;
292
293 // Collection sponsorship confirmation.
294 //
295 // @dev After setting the sponsor for the collection, it must be confirmed with this function.
296 //
297 // Selector: confirmCollectionSponsorship() 3c50e97a
298 function confirmCollectionSponsorship() external;
299
300 // Set limits for the collection.
301 // @dev Throws error if limit not found.
302 // @param limit Name of the limit. Valid names:
303 // "accountTokenOwnershipLimit",
304 // "sponsoredDataSize",
305 // "sponsoredDataRateLimit",
306 // "tokenLimit",
307 // "sponsorTransferTimeout",
308 // "sponsorApproveTimeout"
309 // @param value Value of the limit.
310 //
311 // Selector: setCollectionLimit(string,uint32) 6a3841db
312 function setCollectionLimit(string memory limit, uint32 value) external;
313
314 // Set limits for the collection.
315 // @dev Throws error if limit not found.
316 // @param limit Name of the limit. Valid names:
317 // "ownerCanTransfer",
318 // "ownerCanDestroy",
319 // "transfersEnabled"
320 // @param value Value of the limit.
321 //
322 // Selector: setCollectionLimit(string,bool) 993b7fba
323 function setCollectionLimit(string memory limit, bool value) external;
324
325 // Get contract address.
326 //
327 // Selector: contractAddress() f6b4dfb4
328 function contractAddress() external view returns (address);
329
330 // Add collection admin by substrate address.
331 // @param new_admin Substrate administrator address.
332 //
333 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
334 function addCollectionAdminSubstrate(uint256 newAdmin) external;
335
336 // Remove collection admin by substrate address.
337 // @param admin Substrate administrator address.
338 //
339 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
340 function removeCollectionAdminSubstrate(uint256 admin) external;
341
342 // Add collection admin.
343 // @param new_admin Address of the added administrator.
344 //
345 // Selector: addCollectionAdmin(address) 92e462c7
346 function addCollectionAdmin(address newAdmin) external;
347
348 // Remove collection admin.
349 //
350 // @param new_admin Address of the removed administrator.
351 //
352 // Selector: removeCollectionAdmin(address) fafd7b42
353 function removeCollectionAdmin(address admin) external;
354
355 // Toggle accessibility of collection nesting.
356 //
357 // @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'
358 //
359 // Selector: setCollectionNesting(bool) 112d4586
360 function setCollectionNesting(bool enable) external;
361
362 // Toggle accessibility of collection nesting.
363 //
364 // @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
365 // @param collections Addresses of collections that will be available for nesting.
366 //
367 // Selector: setCollectionNesting(bool,address[]) 64872396
368 function setCollectionNesting(bool enable, address[] memory collections)
369 external;
370
371 // Set the collection access method.
372 // @param mode Access mode
373 // 0 for Normal
374 // 1 for AllowList
375 //
376 // Selector: setCollectionAccess(uint8) 41835d4c
377 function setCollectionAccess(uint8 mode) external;
378
379 // Add the user to the allowed list.
380 //
381 // @param user Address of a trusted user.
382 //
383 // Selector: addToCollectionAllowList(address) 67844fe6
384 function addToCollectionAllowList(address user) external;
385
386 // Remove the user from the allowed list.
387 //
388 // @param user Address of a removed user.
389 //
390 // Selector: removeFromCollectionAllowList(address) 85c51acb
391 function removeFromCollectionAllowList(address user) external;
392
393 // Switch permission for minting.
394 //
395 // @param mode Enable if "true".
396 //
397 // Selector: setCollectionMintMode(bool) 00018e84
398 function setCollectionMintMode(bool mode) external;
399
400 // Check that account is the owner or admin of the collection
401 //
402 // @param user account to verify
403 // @return "true" if account is the owner or admin
404 //
405 // Selector: verifyOwnerOrAdmin(address) c2282493
406 function verifyOwnerOrAdmin(address user) external view returns (bool);
407
408 // Returns collection type
409 //
410 // @return `Fungible` or `NFT` or `ReFungible`
411 //
412 // Selector: uniqueCollectionType() d34b55b8
413 function uniqueCollectionType() external returns (string memory);
414}
252415
253// Selector: 780e9d63416// Selector: 780e9d63
254interface ERC721Enumerable is Dummy, ERC165 {417interface ERC721Enumerable is Dummy, ERC165 {
276 function totalSupply() external view returns (uint256);439 function totalSupply() external view returns (uint256);
277}440}
278
279// Selector: 7d9262e6
280interface Collection is Dummy, ERC165 {
281 // Set collection property.
282 //
283 // @param key Property key.
284 // @param value Propery value.
285 //
286 // Selector: setCollectionProperty(string,bytes) 2f073f66
287 function setCollectionProperty(string memory key, bytes memory value)
288 external;
289
290 // Delete collection property.
291 //
292 // @param key Property key.
293 //
294 // Selector: deleteCollectionProperty(string) 7b7debce
295 function deleteCollectionProperty(string memory key) external;
296
297 // Get collection property.
298 //
299 // @dev Throws error if key not found.
300 //
301 // @param key Property key.
302 // @return bytes The property corresponding to the key.
303 //
304 // Selector: collectionProperty(string) cf24fd6d
305 function collectionProperty(string memory key)
306 external
307 view
308 returns (bytes memory);
309
310 // Set the sponsor of the collection.
311 //
312 // @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
313 //
314 // @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
315 //
316 // Selector: setCollectionSponsor(address) 7623402e
317 function setCollectionSponsor(address sponsor) external;
318
319 // Collection sponsorship confirmation.
320 //
321 // @dev After setting the sponsor for the collection, it must be confirmed with this function.
322 //
323 // Selector: confirmCollectionSponsorship() 3c50e97a
324 function confirmCollectionSponsorship() external;
325
326 // Set limits for the collection.
327 // @dev Throws error if limit not found.
328 // @param limit Name of the limit. Valid names:
329 // "accountTokenOwnershipLimit",
330 // "sponsoredDataSize",
331 // "sponsoredDataRateLimit",
332 // "tokenLimit",
333 // "sponsorTransferTimeout",
334 // "sponsorApproveTimeout"
335 // @param value Value of the limit.
336 //
337 // Selector: setCollectionLimit(string,uint32) 6a3841db
338 function setCollectionLimit(string memory limit, uint32 value) external;
339
340 // Set limits for the collection.
341 // @dev Throws error if limit not found.
342 // @param limit Name of the limit. Valid names:
343 // "ownerCanTransfer",
344 // "ownerCanDestroy",
345 // "transfersEnabled"
346 // @param value Value of the limit.
347 //
348 // Selector: setCollectionLimit(string,bool) 993b7fba
349 function setCollectionLimit(string memory limit, bool value) external;
350
351 // Get contract address.
352 //
353 // Selector: contractAddress() f6b4dfb4
354 function contractAddress() external view returns (address);
355
356 // Add collection admin by substrate address.
357 // @param new_admin Substrate administrator address.
358 //
359 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
360 function addCollectionAdminSubstrate(uint256 newAdmin) external;
361
362 // Remove collection admin by substrate address.
363 // @param admin Substrate administrator address.
364 //
365 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
366 function removeCollectionAdminSubstrate(uint256 admin) external;
367
368 // Add collection admin.
369 // @param new_admin Address of the added administrator.
370 //
371 // Selector: addCollectionAdmin(address) 92e462c7
372 function addCollectionAdmin(address newAdmin) external;
373
374 // Remove collection admin.
375 //
376 // @param new_admin Address of the removed administrator.
377 //
378 // Selector: removeCollectionAdmin(address) fafd7b42
379 function removeCollectionAdmin(address admin) external;
380
381 // Toggle accessibility of collection nesting.
382 //
383 // @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'
384 //
385 // Selector: setCollectionNesting(bool) 112d4586
386 function setCollectionNesting(bool enable) external;
387
388 // Toggle accessibility of collection nesting.
389 //
390 // @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
391 // @param collections Addresses of collections that will be available for nesting.
392 //
393 // Selector: setCollectionNesting(bool,address[]) 64872396
394 function setCollectionNesting(bool enable, address[] memory collections)
395 external;
396
397 // Set the collection access method.
398 // @param mode Access mode
399 // 0 for Normal
400 // 1 for AllowList
401 //
402 // Selector: setCollectionAccess(uint8) 41835d4c
403 function setCollectionAccess(uint8 mode) external;
404
405 // Add the user to the allowed list.
406 //
407 // @param user Address of a trusted user.
408 //
409 // Selector: addToCollectionAllowList(address) 67844fe6
410 function addToCollectionAllowList(address user) external;
411
412 // Remove the user from the allowed list.
413 //
414 // @param user Address of a removed user.
415 //
416 // Selector: removeFromCollectionAllowList(address) 85c51acb
417 function removeFromCollectionAllowList(address user) external;
418
419 // Switch permission for minting.
420 //
421 // @param mode Enable if "true".
422 //
423 // Selector: setCollectionMintMode(bool) 00018e84
424 function setCollectionMintMode(bool mode) external;
425}
426441
427// Selector: d74d154f442// Selector: d74d154f
428interface ERC721UniqueExtensions is Dummy, ERC165 {443interface ERC721UniqueExtensions is Dummy, ERC165 {
modifiedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth
248 function finishMinting() external returns (bool);248 function finishMinting() external returns (bool);
249}249}
250
251// Selector: 6cf113cd
252interface Collection is Dummy, ERC165 {
253 // Set collection property.
254 //
255 // @param key Property key.
256 // @param value Propery value.
257 //
258 // Selector: setCollectionProperty(string,bytes) 2f073f66
259 function setCollectionProperty(string memory key, bytes memory value)
260 external;
261
262 // Delete collection property.
263 //
264 // @param key Property key.
265 //
266 // Selector: deleteCollectionProperty(string) 7b7debce
267 function deleteCollectionProperty(string memory key) external;
268
269 // Get collection property.
270 //
271 // @dev Throws error if key not found.
272 //
273 // @param key Property key.
274 // @return bytes The property corresponding to the key.
275 //
276 // Selector: collectionProperty(string) cf24fd6d
277 function collectionProperty(string memory key)
278 external
279 view
280 returns (bytes memory);
281
282 // Set the sponsor of the collection.
283 //
284 // @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
285 //
286 // @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
287 //
288 // Selector: setCollectionSponsor(address) 7623402e
289 function setCollectionSponsor(address sponsor) external;
290
291 // Collection sponsorship confirmation.
292 //
293 // @dev After setting the sponsor for the collection, it must be confirmed with this function.
294 //
295 // Selector: confirmCollectionSponsorship() 3c50e97a
296 function confirmCollectionSponsorship() external;
297
298 // Set limits for the collection.
299 // @dev Throws error if limit not found.
300 // @param limit Name of the limit. Valid names:
301 // "accountTokenOwnershipLimit",
302 // "sponsoredDataSize",
303 // "sponsoredDataRateLimit",
304 // "tokenLimit",
305 // "sponsorTransferTimeout",
306 // "sponsorApproveTimeout"
307 // @param value Value of the limit.
308 //
309 // Selector: setCollectionLimit(string,uint32) 6a3841db
310 function setCollectionLimit(string memory limit, uint32 value) external;
311
312 // Set limits for the collection.
313 // @dev Throws error if limit not found.
314 // @param limit Name of the limit. Valid names:
315 // "ownerCanTransfer",
316 // "ownerCanDestroy",
317 // "transfersEnabled"
318 // @param value Value of the limit.
319 //
320 // Selector: setCollectionLimit(string,bool) 993b7fba
321 function setCollectionLimit(string memory limit, bool value) external;
322
323 // Get contract address.
324 //
325 // Selector: contractAddress() f6b4dfb4
326 function contractAddress() external view returns (address);
327
328 // Add collection admin by substrate address.
329 // @param new_admin Substrate administrator address.
330 //
331 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
332 function addCollectionAdminSubstrate(uint256 newAdmin) external;
333
334 // Remove collection admin by substrate address.
335 // @param admin Substrate administrator address.
336 //
337 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
338 function removeCollectionAdminSubstrate(uint256 admin) external;
339
340 // Add collection admin.
341 // @param new_admin Address of the added administrator.
342 //
343 // Selector: addCollectionAdmin(address) 92e462c7
344 function addCollectionAdmin(address newAdmin) external;
345
346 // Remove collection admin.
347 //
348 // @param new_admin Address of the removed administrator.
349 //
350 // Selector: removeCollectionAdmin(address) fafd7b42
351 function removeCollectionAdmin(address admin) external;
352
353 // Toggle accessibility of collection nesting.
354 //
355 // @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'
356 //
357 // Selector: setCollectionNesting(bool) 112d4586
358 function setCollectionNesting(bool enable) external;
359
360 // Toggle accessibility of collection nesting.
361 //
362 // @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
363 // @param collections Addresses of collections that will be available for nesting.
364 //
365 // Selector: setCollectionNesting(bool,address[]) 64872396
366 function setCollectionNesting(bool enable, address[] memory collections)
367 external;
368
369 // Set the collection access method.
370 // @param mode Access mode
371 // 0 for Normal
372 // 1 for AllowList
373 //
374 // Selector: setCollectionAccess(uint8) 41835d4c
375 function setCollectionAccess(uint8 mode) external;
376
377 // Add the user to the allowed list.
378 //
379 // @param user Address of a trusted user.
380 //
381 // Selector: addToCollectionAllowList(address) 67844fe6
382 function addToCollectionAllowList(address user) external;
383
384 // Remove the user from the allowed list.
385 //
386 // @param user Address of a removed user.
387 //
388 // Selector: removeFromCollectionAllowList(address) 85c51acb
389 function removeFromCollectionAllowList(address user) external;
390
391 // Switch permission for minting.
392 //
393 // @param mode Enable if "true".
394 //
395 // Selector: setCollectionMintMode(bool) 00018e84
396 function setCollectionMintMode(bool mode) external;
397
398 // Check that account is the owner or admin of the collection
399 //
400 // @param user account to verify
401 // @return "true" if account is the owner or admin
402 //
403 // Selector: verifyOwnerOrAdmin(address) c2282493
404 function verifyOwnerOrAdmin(address user) external view returns (bool);
405
406 // Returns collection type
407 //
408 // @return `Fungible` or `NFT` or `ReFungible`
409 //
410 // Selector: uniqueCollectionType() d34b55b8
411 function uniqueCollectionType() external returns (string memory);
412}
250413
251// Selector: 780e9d63414// Selector: 780e9d63
252interface ERC721Enumerable is Dummy, ERC165 {415interface ERC721Enumerable is Dummy, ERC165 {
274 function totalSupply() external view returns (uint256);437 function totalSupply() external view returns (uint256);
275}438}
276439
277// Selector: 7d9262e6440// Selector: 7c3bef89
278interface Collection is Dummy, ERC165 {
279 // Set collection property.
280 //
281 // @param key Property key.
282 // @param value Propery value.
283 //
284 // Selector: setCollectionProperty(string,bytes) 2f073f66
285 function setCollectionProperty(string memory key, bytes memory value)
286 external;
287
288 // Delete collection property.
289 //
290 // @param key Property key.
291 //
292 // Selector: deleteCollectionProperty(string) 7b7debce
293 function deleteCollectionProperty(string memory key) external;
294
295 // Get collection property.
296 //
297 // @dev Throws error if key not found.
298 //
299 // @param key Property key.
300 // @return bytes The property corresponding to the key.
301 //
302 // Selector: collectionProperty(string) cf24fd6d
303 function collectionProperty(string memory key)
304 external
305 view
306 returns (bytes memory);
307
308 // Set the sponsor of the collection.
309 //
310 // @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
311 //
312 // @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
313 //
314 // Selector: setCollectionSponsor(address) 7623402e
315 function setCollectionSponsor(address sponsor) external;
316
317 // Collection sponsorship confirmation.
318 //
319 // @dev After setting the sponsor for the collection, it must be confirmed with this function.
320 //
321 // Selector: confirmCollectionSponsorship() 3c50e97a
322 function confirmCollectionSponsorship() external;
323
324 // Set limits for the collection.
325 // @dev Throws error if limit not found.
326 // @param limit Name of the limit. Valid names:
327 // "accountTokenOwnershipLimit",
328 // "sponsoredDataSize",
329 // "sponsoredDataRateLimit",
330 // "tokenLimit",
331 // "sponsorTransferTimeout",
332 // "sponsorApproveTimeout"
333 // @param value Value of the limit.
334 //
335 // Selector: setCollectionLimit(string,uint32) 6a3841db
336 function setCollectionLimit(string memory limit, uint32 value) external;
337
338 // Set limits for the collection.
339 // @dev Throws error if limit not found.
340 // @param limit Name of the limit. Valid names:
341 // "ownerCanTransfer",
342 // "ownerCanDestroy",
343 // "transfersEnabled"
344 // @param value Value of the limit.
345 //
346 // Selector: setCollectionLimit(string,bool) 993b7fba
347 function setCollectionLimit(string memory limit, bool value) external;
348
349 // Get contract address.
350 //
351 // Selector: contractAddress() f6b4dfb4
352 function contractAddress() external view returns (address);
353
354 // Add collection admin by substrate address.
355 // @param new_admin Substrate administrator address.
356 //
357 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
358 function addCollectionAdminSubstrate(uint256 newAdmin) external;
359
360 // Remove collection admin by substrate address.
361 // @param admin Substrate administrator address.
362 //
363 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
364 function removeCollectionAdminSubstrate(uint256 admin) external;
365
366 // Add collection admin.
367 // @param new_admin Address of the added administrator.
368 //
369 // Selector: addCollectionAdmin(address) 92e462c7
370 function addCollectionAdmin(address newAdmin) external;
371
372 // Remove collection admin.
373 //
374 // @param new_admin Address of the removed administrator.
375 //
376 // Selector: removeCollectionAdmin(address) fafd7b42
377 function removeCollectionAdmin(address admin) external;
378
379 // Toggle accessibility of collection nesting.
380 //
381 // @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'
382 //
383 // Selector: setCollectionNesting(bool) 112d4586
384 function setCollectionNesting(bool enable) external;
385
386 // Toggle accessibility of collection nesting.
387 //
388 // @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
389 // @param collections Addresses of collections that will be available for nesting.
390 //
391 // Selector: setCollectionNesting(bool,address[]) 64872396
392 function setCollectionNesting(bool enable, address[] memory collections)
393 external;
394
395 // Set the collection access method.
396 // @param mode Access mode
397 // 0 for Normal
398 // 1 for AllowList
399 //
400 // Selector: setCollectionAccess(uint8) 41835d4c
401 function setCollectionAccess(uint8 mode) external;
402
403 // Add the user to the allowed list.
404 //
405 // @param user Address of a trusted user.
406 //
407 // Selector: addToCollectionAllowList(address) 67844fe6
408 function addToCollectionAllowList(address user) external;
409
410 // Remove the user from the allowed list.
411 //
412 // @param user Address of a removed user.
413 //
414 // Selector: removeFromCollectionAllowList(address) 85c51acb
415 function removeFromCollectionAllowList(address user) external;
416
417 // Switch permission for minting.
418 //
419 // @param mode Enable if "true".
420 //
421 // Selector: setCollectionMintMode(bool) 00018e84
422 function setCollectionMintMode(bool mode) external;
423}
424
425// Selector: d74d154f
426interface ERC721UniqueExtensions is Dummy, ERC165 {441interface ERC721UniqueExtensions is Dummy, ERC165 {
427 // @notice Transfer ownership of an RFT442 // @notice Transfer ownership of an RFT
428 // @dev Throws unless `msg.sender` is the current owner. Throws if `to`443 // @dev Throws unless `msg.sender` is the current owner. Throws if `to`
474 external489 external
475 returns (bool);490 returns (bool);
491
492 // Returns EVM address for refungible token
493 //
494 // @param token ID of the token
495 //
496 // Selector: tokenContractAddress(uint256) ab76fac6
497 function tokenContractAddress(uint256 token)
498 external
499 view
500 returns (address);
476}501}
477502
478interface UniqueRefungible is503interface UniqueRefungible is
modifiedtests/src/eth/api/UniqueRefungibleToken.soldiffbeforeafterboth
22 );22 );
23}23}
24
25// Selector: 042f1106
26interface ERC1633UniqueExtensions is Dummy, ERC165 {
27 // Selector: setParentNFT(address,uint256) 042f1106
28 function setParentNFT(address collection, uint256 nftId)
29 external
30 returns (bool);
31}
32
33// Selector: 5755c3f2
34interface ERC1633 is Dummy, ERC165 {
35 // Selector: parentToken() 80a54001
36 function parentToken() external view returns (address);
37
38 // Selector: parentTokenId() d7f083f3
39 function parentTokenId() external view returns (uint256);
40}
2441
25// Selector: 942e8b2242// Selector: 942e8b22
26interface ERC20 is Dummy, ERC165, ERC20Events {43interface ERC20 is Dummy, ERC165, ERC20Events {
115 Dummy,132 Dummy,
116 ERC165,133 ERC165,
117 ERC20,134 ERC20,
118 ERC20UniqueExtensions135 ERC20UniqueExtensions,
136 ERC1633,
137 ERC1633UniqueExtensions
119{}138{}
120139
modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
60 .to.be.eq(newAdmin.address.toLocaleLowerCase());60 .to.be.eq(newAdmin.address.toLocaleLowerCase());
61 });61 });
62
63 itWeb3('Verify owner or admin', async ({api, web3, privateKeyWrapper}) => {
64 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
65 const collectionHelper = evmCollectionHelpers(web3, owner);
66
67 const result = await collectionHelper.methods
68 .createNonfungibleCollection('A', 'B', 'C')
69 .send();
70 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
71
72 const newAdmin = createEthAccount(web3);
73 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
74 expect(await collectionEvm.methods.verifyOwnerOrAdmin(newAdmin).call()).to.be.false;
75 await collectionEvm.methods.addCollectionAdmin(newAdmin).send();
76 expect(await collectionEvm.methods.verifyOwnerOrAdmin(newAdmin).call()).to.be.true;
77 });
6278
63 itWeb3('(!negative tests!) Add admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {79 itWeb3('(!negative tests!) Add admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {
64 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);80 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
modifiedtests/src/eth/collectionHelpersAbi.jsondiffbeforeafterboth
61 ],61 ],
62 "name": "createRefungibleCollection",62 "name": "createRefungibleCollection",
63 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],63 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
64 "stateMutability": "view",64 "stateMutability": "nonpayable",
65 "type": "function"65 "type": "function"
66 },66 },
67 {67 {
addedtests/src/eth/fractionalizer/Fractionalizer.bindiffbeforeafterboth

no changes

addedtests/src/eth/fractionalizer/Fractionalizer.soldiffbeforeafterboth

no changes

addedtests/src/eth/fractionalizer/FractionalizerAbi.jsondiffbeforeafterboth

no changes

addedtests/src/eth/fractionalizer/fractionalizer.test.tsdiffbeforeafterboth

no changes

modifiedtests/src/eth/fungibleAbi.jsondiffbeforeafterboth
301 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],301 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
302 "stateMutability": "nonpayable",302 "stateMutability": "nonpayable",
303 "type": "function"303 "type": "function"
304 }304 },
305 {
306 "inputs": [],
307 "name": "uniqueCollectionType",
308 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
309 "stateMutability": "nonpayable",
310 "type": "function"
311 },
312 {
313 "inputs": [
314 { "internalType": "address", "name": "user", "type": "address" }
315 ],
316 "name": "verifyOwnerOrAdmin",
317 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
318 "stateMutability": "view",
319 "type": "function"
320 }
305]321]
306322
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
526 "outputs": [],526 "outputs": [],
527 "stateMutability": "nonpayable",527 "stateMutability": "nonpayable",
528 "type": "function"528 "type": "function"
529 }529 },
530 {
531 "inputs": [],
532 "name": "uniqueCollectionType",
533 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
534 "stateMutability": "nonpayable",
535 "type": "function"
536 },
537 {
538 "inputs": [
539 { "internalType": "address", "name": "user", "type": "address" }
540 ],
541 "name": "verifyOwnerOrAdmin",
542 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
543 "stateMutability": "view",
544 "type": "function"
545 }
530]546]
531547
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17import {createCollectionExpectSuccess, UNIQUE, requirePallets, Pallets} from '../util/helpers';17import {createCollectionExpectSuccess, UNIQUE, requirePallets, Pallets} from '../util/helpers';
18import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, evmCollection, evmCollectionHelpers, GAS_ARGS, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, tokenIdToAddress} from './util/helpers';18import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, evmCollection, evmCollectionHelpers, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, tokenIdToAddress, uniqueRefungibleToken} from './util/helpers';
19import reFungibleTokenAbi from './reFungibleTokenAbi.json';
20import {expect} from 'chai';19import {expect} from 'chai';
2120
22describe('Refungible: Information getting', () => {21describe('Refungible: Information getting', () => {
88 await contract.methods.mint(caller, tokenId).send();87 await contract.methods.mint(caller, tokenId).send();
8988
90 const tokenAddress = tokenIdToAddress(collectionId, tokenId);89 const tokenAddress = tokenIdToAddress(collectionId, tokenId);
91 const tokenContract = new web3.eth.Contract(reFungibleTokenAbi as any, tokenAddress, {from: caller, ...GAS_ARGS});90 const tokenContract = uniqueRefungibleToken(web3, tokenAddress, caller);
9291
93 await tokenContract.methods.repartition(2).send();92 await tokenContract.methods.repartition(2).send();
94 await tokenContract.methods.transfer(receiver, 1).send();93 await tokenContract.methods.transfer(receiver, 1).send();
112 await contract.methods.mint(caller, tokenId).send();111 await contract.methods.mint(caller, tokenId).send();
113112
114 const tokenAddress = tokenIdToAddress(collectionId, tokenId);113 const tokenAddress = tokenIdToAddress(collectionId, tokenId);
115 const tokenContract = new web3.eth.Contract(reFungibleTokenAbi as any, tokenAddress, {from: caller, ...GAS_ARGS});114 const tokenContract = uniqueRefungibleToken(web3, tokenAddress, caller);
116115
117 await tokenContract.methods.repartition(2).send();116 await tokenContract.methods.repartition(2).send();
118 await tokenContract.methods.transfer(receiver, 1).send();117 await tokenContract.methods.transfer(receiver, 1).send();
258 await contract.methods.mint(caller, tokenId).send();257 await contract.methods.mint(caller, tokenId).send();
259258
260 const address = tokenIdToAddress(collectionId, tokenId);259 const address = tokenIdToAddress(collectionId, tokenId);
261 const tokenContract = new web3.eth.Contract(reFungibleTokenAbi as any, address, {from: caller, ...GAS_ARGS});260 const tokenContract = uniqueRefungibleToken(web3, address, caller);
262 await tokenContract.methods.repartition(15).send();261 await tokenContract.methods.repartition(15).send();
263262
264 {263 {
353 await contract.methods.mint(caller, tokenId).send();352 await contract.methods.mint(caller, tokenId).send();
354353
355 const tokenAddress = tokenIdToAddress(collectionId, tokenId);354 const tokenAddress = tokenIdToAddress(collectionId, tokenId);
356 const tokenContract = new web3.eth.Contract(reFungibleTokenAbi as any, tokenAddress, {from: caller, ...GAS_ARGS});355 const tokenContract = uniqueRefungibleToken(web3, tokenAddress, caller);
357356
358 await tokenContract.methods.repartition(2).send();357 await tokenContract.methods.repartition(2).send();
359 await tokenContract.methods.transfer(receiver, 1).send();358 await tokenContract.methods.transfer(receiver, 1).send();
385 await contract.methods.mint(caller, tokenId).send();384 await contract.methods.mint(caller, tokenId).send();
386385
387 const tokenAddress = tokenIdToAddress(collectionId, tokenId);386 const tokenAddress = tokenIdToAddress(collectionId, tokenId);
388 const tokenContract = new web3.eth.Contract(reFungibleTokenAbi as any, tokenAddress, {from: caller, ...GAS_ARGS});387 const tokenContract = uniqueRefungibleToken(web3, tokenAddress, caller);
389388
390 await tokenContract.methods.repartition(2).send();389 await tokenContract.methods.repartition(2).send();
391 390
modifiedtests/src/eth/reFungibleAbi.jsondiffbeforeafterboth
480 "stateMutability": "view",480 "stateMutability": "view",
481 "type": "function"481 "type": "function"
482 },482 },
483 {
484 "inputs": [
485 { "internalType": "uint256", "name": "token", "type": "uint256" }
486 ],
487 "name": "tokenContractAddress",
488 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
489 "stateMutability": "view",
490 "type": "function"
491 },
483 {492 {
484 "inputs": [493 "inputs": [
485 { "internalType": "address", "name": "owner", "type": "address" },494 { "internalType": "address", "name": "owner", "type": "address" },
526 "outputs": [],535 "outputs": [],
527 "stateMutability": "nonpayable",536 "stateMutability": "nonpayable",
528 "type": "function"537 "type": "function"
529 }538 },
539 {
540 "inputs": [],
541 "name": "uniqueCollectionType",
542 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
543 "stateMutability": "nonpayable",
544 "type": "function"
545 },
546 {
547 "inputs": [
548 { "internalType": "address", "name": "user", "type": "address" }
549 ],
550 "name": "verifyOwnerOrAdmin",
551 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
552 "stateMutability": "view",
553 "type": "function"
554 }
530]555]
531556
modifiedtests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17import {approve, createCollection, createRefungibleToken, transfer, transferFrom, UNIQUE, requirePallets, Pallets} from '../util/helpers';17import {approve, createCollection, createRefungibleToken, transfer, transferFrom, UNIQUE, requirePallets, Pallets} from '../util/helpers';
18import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, evmCollection, evmCollectionHelpers, GAS_ARGS, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, tokenIdToAddress, transferBalanceToEth} from './util/helpers';18import {collectionIdFromAddress, collectionIdToAddress, createEthAccount, createEthAccountWithBalance, createNonfungibleCollection, createRefungibleCollection, evmCollection, evmCollectionHelpers, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, tokenIdToAddress, transferBalanceToEth, uniqueNFT, uniqueRefungible, uniqueRefungibleToken} from './util/helpers';
19import reFungibleTokenAbi from './reFungibleTokenAbi.json';
2019
21import chai from 'chai';20import chai from 'chai';
22import chaiAsPromised from 'chai-as-promised';21import chaiAsPromised from 'chai-as-promised';
38 const tokenId = (await createRefungibleToken(api, alice, collectionId, 200n, {Ethereum: caller})).itemId;37 const tokenId = (await createRefungibleToken(api, alice, collectionId, 200n, {Ethereum: caller})).itemId;
3938
40 const address = tokenIdToAddress(collectionId, tokenId);39 const address = tokenIdToAddress(collectionId, tokenId);
41 const contract = new web3.eth.Contract(reFungibleTokenAbi as any, address, {from: caller, ...GAS_ARGS});40 const contract = uniqueRefungibleToken(web3, address, caller);
42 const totalSupply = await contract.methods.totalSupply().call();41 const totalSupply = await contract.methods.totalSupply().call();
4342
44 expect(totalSupply).to.equal('200');43 expect(totalSupply).to.equal('200');
54 const tokenId = (await createRefungibleToken(api, alice, collectionId, 200n, {Ethereum: caller})).itemId;53 const tokenId = (await createRefungibleToken(api, alice, collectionId, 200n, {Ethereum: caller})).itemId;
5554
56 const address = tokenIdToAddress(collectionId, tokenId);55 const address = tokenIdToAddress(collectionId, tokenId);
57 const contract = new web3.eth.Contract(reFungibleTokenAbi as any, address, {from: caller, ...GAS_ARGS});56 const contract = uniqueRefungibleToken(web3, address, caller);
58 const balance = await contract.methods.balanceOf(caller).call();57 const balance = await contract.methods.balanceOf(caller).call();
5958
60 expect(balance).to.equal('200');59 expect(balance).to.equal('200');
70 const tokenId = (await createRefungibleToken(api, alice, collectionId, 200n, {Ethereum: caller})).itemId;69 const tokenId = (await createRefungibleToken(api, alice, collectionId, 200n, {Ethereum: caller})).itemId;
7170
72 const address = tokenIdToAddress(collectionId, tokenId);71 const address = tokenIdToAddress(collectionId, tokenId);
73 const contract = new web3.eth.Contract(reFungibleTokenAbi as any, address, {from: caller, ...GAS_ARGS});72 const contract = uniqueRefungibleToken(web3, address, caller);
74 const decimals = await contract.methods.decimals().call();73 const decimals = await contract.methods.decimals().call();
7574
76 expect(decimals).to.equal('0');75 expect(decimals).to.equal('0');
90 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);89 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
91 const receiver = createEthAccount(web3);90 const receiver = createEthAccount(web3);
92 const contract = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});91 const contract = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});
93 92
94 const nextTokenId = await contract.methods.nextTokenId().call();93 const nextTokenId = await contract.methods.nextTokenId().call();
95 expect(nextTokenId).to.be.equal('1');94 expect(nextTokenId).to.be.equal('1');
96 result = await contract.methods.mint(95 result = await contract.methods.mint(
123 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);122 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
124 const receiver = createEthAccount(web3);123 const receiver = createEthAccount(web3);
125 const contract = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});124 const contract = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});
126 125
127 const nextTokenId = await contract.methods.nextTokenId().call();126 const nextTokenId = await contract.methods.nextTokenId().call();
128 expect(nextTokenId).to.be.equal('1');127 expect(nextTokenId).to.be.equal('1');
129 result = await contract.methods.mint(128 result = await contract.methods.mint(
130 receiver,129 receiver,
131 nextTokenId,130 nextTokenId,
132 ).send();131 ).send();
133 132
134 // Set URL133 // Set URL
135 await contract.methods.setProperty(nextTokenId, 'url', Buffer.from('Token URI')).send();134 await contract.methods.setProperty(nextTokenId, 'url', Buffer.from('Token URI')).send();
136 135
137 const events = normalizeEvents(result.events);136 const events = normalizeEvents(result.events);
138 const address = collectionIdToAddress(collectionId);137 const address = collectionIdToAddress(collectionId);
139138
159 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);158 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
160 const receiver = createEthAccount(web3);159 const receiver = createEthAccount(web3);
161 const contract = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});160 const contract = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});
162 161
163 const nextTokenId = await contract.methods.nextTokenId().call();162 const nextTokenId = await contract.methods.nextTokenId().call();
164 expect(nextTokenId).to.be.equal('1');163 expect(nextTokenId).to.be.equal('1');
165 result = await contract.methods.mint(164 result = await contract.methods.mint(
166 receiver,165 receiver,
167 nextTokenId,166 nextTokenId,
168 ).send();167 ).send();
169 168
170 const events = normalizeEvents(result.events);169 const events = normalizeEvents(result.events);
171 const address = collectionIdToAddress(collectionId);170 const address = collectionIdToAddress(collectionId);
172171
192 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);191 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
193 const receiver = createEthAccount(web3);192 const receiver = createEthAccount(web3);
194 const contract = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});193 const contract = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});
195 194
196 const nextTokenId = await contract.methods.nextTokenId().call();195 const nextTokenId = await contract.methods.nextTokenId().call();
197 expect(nextTokenId).to.be.equal('1');196 expect(nextTokenId).to.be.equal('1');
198 result = await contract.methods.mint(197 result = await contract.methods.mint(
199 receiver,198 receiver,
200 nextTokenId,199 nextTokenId,
201 ).send();200 ).send();
202 201
203 // Set suffix202 // Set suffix
204 const suffix = '/some/suffix';203 const suffix = '/some/suffix';
205 await contract.methods.setProperty(nextTokenId, 'suffix', Buffer.from(suffix)).send();204 await contract.methods.setProperty(nextTokenId, 'suffix', Buffer.from(suffix)).send();
241240
242 const spender = createEthAccount(web3);241 const spender = createEthAccount(web3);
243242
244 const contract = new web3.eth.Contract(reFungibleTokenAbi as any, address, {from: owner, ...GAS_ARGS});243 const contract = uniqueRefungibleToken(web3, address, owner);
245244
246 {245 {
247 const result = await contract.methods.approve(spender, 100).send({from: owner});246 const result = await contract.methods.approve(spender, 100).send({from: owner});
282 const receiver = createEthAccount(web3);281 const receiver = createEthAccount(web3);
283282
284 const address = tokenIdToAddress(collectionId, tokenId);283 const address = tokenIdToAddress(collectionId, tokenId);
285 const contract = new web3.eth.Contract(reFungibleTokenAbi as any, address, {from: owner, ...GAS_ARGS});284 const contract = uniqueRefungibleToken(web3, address, owner);
286285
287 await contract.methods.approve(spender, 100).send();286 await contract.methods.approve(spender, 100).send();
288287
336 await transferBalanceToEth(api, alice, receiver);335 await transferBalanceToEth(api, alice, receiver);
337336
338 const address = tokenIdToAddress(collectionId, tokenId);337 const address = tokenIdToAddress(collectionId, tokenId);
339 const contract = new web3.eth.Contract(reFungibleTokenAbi as any, address, {from: owner, ...GAS_ARGS});338 const contract = uniqueRefungibleToken(web3, address, owner);
340339
341 {340 {
342 const result = await contract.methods.transfer(receiver, 50).send({from: owner});341 const result = await contract.methods.transfer(receiver, 50).send({from: owner});
379 const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n, {Ethereum: owner})).itemId;378 const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n, {Ethereum: owner})).itemId;
380379
381 const address = tokenIdToAddress(collectionId, tokenId);380 const address = tokenIdToAddress(collectionId, tokenId);
382 const contract = new web3.eth.Contract(reFungibleTokenAbi as any, address, {from: owner, ...GAS_ARGS});381 const contract = uniqueRefungibleToken(web3, address, owner);
383382
384 await contract.methods.repartition(200).send({from: owner});383 await contract.methods.repartition(200).send({from: owner});
385 expect(+await contract.methods.balanceOf(owner).call()).to.be.equal(200);384 expect(+await contract.methods.balanceOf(owner).call()).to.be.equal(200);
386 await contract.methods.transfer(receiver, 110).send({from: owner});385 await contract.methods.transfer(receiver, 110).send({from: owner});
387 expect(+await contract.methods.balanceOf(owner).call()).to.be.equal(90);386 expect(+await contract.methods.balanceOf(owner).call()).to.be.equal(90);
388 expect(+await contract.methods.balanceOf(receiver).call()).to.be.equal(110);387 expect(+await contract.methods.balanceOf(receiver).call()).to.be.equal(110);
389 388
390 await expect(contract.methods.repartition(80).send({from: owner})).to.eventually.be.rejected;389 await expect(contract.methods.repartition(80).send({from: owner})).to.eventually.be.rejected;
391390
392 await contract.methods.transfer(receiver, 90).send({from: owner});391 await contract.methods.transfer(receiver, 90).send({from: owner});
409 const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n, {Ethereum: owner})).itemId;408 const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n, {Ethereum: owner})).itemId;
410409
411 const address = tokenIdToAddress(collectionId, tokenId);410 const address = tokenIdToAddress(collectionId, tokenId);
412 const contract = new web3.eth.Contract(reFungibleTokenAbi as any, address, {from: owner, ...GAS_ARGS});411 const contract = uniqueRefungibleToken(web3, address, owner);
413412
414 const result = await contract.methods.repartition(200).send();413 const result = await contract.methods.repartition(200).send();
415 const events = normalizeEvents(result.events);414 const events = normalizeEvents(result.events);
438 const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n, {Ethereum: owner})).itemId;437 const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n, {Ethereum: owner})).itemId;
439438
440 const address = tokenIdToAddress(collectionId, tokenId);439 const address = tokenIdToAddress(collectionId, tokenId);
441 const contract = new web3.eth.Contract(reFungibleTokenAbi as any, address, {from: owner, ...GAS_ARGS});440 const contract = uniqueRefungibleToken(web3, address, owner);
442441
443 const result = await contract.methods.repartition(50).send();442 const result = await contract.methods.repartition(50).send();
444 const events = normalizeEvents(result.events);443 const events = normalizeEvents(result.events);
468467
469 const address = tokenIdToAddress(collectionId, tokenId);468 const address = tokenIdToAddress(collectionId, tokenId);
470469
471 const tokenContract = new web3.eth.Contract(reFungibleTokenAbi as any, address, {from: caller, ...GAS_ARGS});470 const tokenContract = uniqueRefungibleToken(web3, address, caller);
472 await tokenContract.methods.repartition(2).send();471 await tokenContract.methods.repartition(2).send();
473 await tokenContract.methods.transfer(receiver, 1).send();472 await tokenContract.methods.transfer(receiver, 1).send();
474473
475 const events = await recordEvents(contract, async () => 474 const events = await recordEvents(contract, async () =>
476 await tokenContract.methods.burnFrom(caller, 1).send());475 await tokenContract.methods.burnFrom(caller, 1).send());
477 expect(events).to.deep.equal([476 expect(events).to.deep.equal([
478 {477 {
504 const tokenId = (await createRefungibleToken(api, alice, collectionId, 200n, {Ethereum: owner})).itemId;503 const tokenId = (await createRefungibleToken(api, alice, collectionId, 200n, {Ethereum: owner})).itemId;
505504
506 const address = tokenIdToAddress(collectionId, tokenId);505 const address = tokenIdToAddress(collectionId, tokenId);
507 const contract = new web3.eth.Contract(reFungibleTokenAbi as any, address, {from: owner, ...GAS_ARGS});506 const contract = uniqueRefungibleToken(web3, address, owner);
508507
509 const cost = await recordEthFee(api, owner, () => contract.methods.approve(spender, 100).send({from: owner}));508 const cost = await recordEthFee(api, owner, () => contract.methods.approve(spender, 100).send({from: owner}));
510 expect(cost < BigInt(0.2 * Number(UNIQUE)));509 expect(cost < BigInt(0.2 * Number(UNIQUE)));
521 const tokenId = (await createRefungibleToken(api, alice, collectionId, 200n, {Ethereum: owner})).itemId;520 const tokenId = (await createRefungibleToken(api, alice, collectionId, 200n, {Ethereum: owner})).itemId;
522521
523 const address = tokenIdToAddress(collectionId, tokenId);522 const address = tokenIdToAddress(collectionId, tokenId);
524 const contract = new web3.eth.Contract(reFungibleTokenAbi as any, address, {from: owner, ...GAS_ARGS});523 const contract = uniqueRefungibleToken(web3, address, owner);
525524
526 await contract.methods.approve(spender, 100).send({from: owner});525 await contract.methods.approve(spender, 100).send({from: owner});
527526
540 const tokenId = (await createRefungibleToken(api, alice, collectionId, 200n, {Ethereum: owner})).itemId;539 const tokenId = (await createRefungibleToken(api, alice, collectionId, 200n, {Ethereum: owner})).itemId;
541540
542 const address = tokenIdToAddress(collectionId, tokenId);541 const address = tokenIdToAddress(collectionId, tokenId);
543 const contract = new web3.eth.Contract(reFungibleTokenAbi as any, address, {from: owner, ...GAS_ARGS});542 const contract = uniqueRefungibleToken(web3, address, owner);
544543
545 const cost = await recordEthFee(api, owner, () => contract.methods.transfer(receiver, 100).send({from: owner}));544 const cost = await recordEthFee(api, owner, () => contract.methods.transfer(receiver, 100).send({from: owner}));
546 expect(cost < BigInt(0.2 * Number(UNIQUE)));545 expect(cost < BigInt(0.2 * Number(UNIQUE)));
562 const tokenId = (await createRefungibleToken(api, alice, collectionId, 200n)).itemId;561 const tokenId = (await createRefungibleToken(api, alice, collectionId, 200n)).itemId;
563562
564 const address = tokenIdToAddress(collectionId, tokenId);563 const address = tokenIdToAddress(collectionId, tokenId);
565 const contract = new web3.eth.Contract(reFungibleTokenAbi as any, address);564 const contract = uniqueRefungibleToken(web3, address);
566565
567 const events = await recordEvents(contract, async () => {566 const events = await recordEvents(contract, async () => {
568 expect(await approve(api, collectionId, tokenId, alice, {Ethereum: receiver}, 100n)).to.be.true;567 expect(await approve(api, collectionId, tokenId, alice, {Ethereum: receiver}, 100n)).to.be.true;
593 expect(await approve(api, collectionId, tokenId, alice, bob.address, 100n)).to.be.true;592 expect(await approve(api, collectionId, tokenId, alice, bob.address, 100n)).to.be.true;
594593
595 const address = tokenIdToAddress(collectionId, tokenId);594 const address = tokenIdToAddress(collectionId, tokenId);
596 const contract = new web3.eth.Contract(reFungibleTokenAbi as any, address);595 const contract = uniqueRefungibleToken(web3, address);
597596
598 const events = await recordEvents(contract, async () => {597 const events = await recordEvents(contract, async () => {
599 expect(await transferFrom(api, collectionId, tokenId, bob, alice, {Ethereum: receiver}, 51n)).to.be.true;598 expect(await transferFrom(api, collectionId, tokenId, bob, alice, {Ethereum: receiver}, 51n)).to.be.true;
631 const tokenId = (await createRefungibleToken(api, alice, collectionId, 200n)).itemId;630 const tokenId = (await createRefungibleToken(api, alice, collectionId, 200n)).itemId;
632631
633 const address = tokenIdToAddress(collectionId, tokenId);632 const address = tokenIdToAddress(collectionId, tokenId);
634 const contract = new web3.eth.Contract(reFungibleTokenAbi as any, address);633 const contract = uniqueRefungibleToken(web3, address);
635634
636 const events = await recordEvents(contract, async () => {635 const events = await recordEvents(contract, async () => {
637 expect(await transfer(api, collectionId, tokenId, alice, {Ethereum: receiver}, 51n)).to.be.true;636 expect(await transfer(api, collectionId, tokenId, alice, {Ethereum: receiver}, 51n)).to.be.true;
648 },647 },
649 },648 },
650 ]);649 ]);
650 });
651});
652
653describe('ERC 1633 implementation', () => {
654 itWeb3('Parent NFT token address and id', async ({api, web3, privateKeyWrapper}) => {
655 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
656
657 const {collectionIdAddress: nftCollectionAddress} = await createNonfungibleCollection(api, web3, owner);
658 const nftContract = uniqueNFT(web3, nftCollectionAddress, owner);
659 const nftTokenId = await nftContract.methods.nextTokenId().call();
660 await nftContract.methods.mint(owner, nftTokenId).send();
661 const nftCollectionId = collectionIdFromAddress(nftCollectionAddress);
662
663 const {collectionIdAddress, collectionId} = await createRefungibleCollection(api, web3, owner);
664 const refungibleContract = uniqueRefungible(web3, collectionIdAddress, owner);
665 const refungibleTokenId = await refungibleContract.methods.nextTokenId().call();
666 await refungibleContract.methods.mint(owner, refungibleTokenId).send();
667
668 const rftTokenAddress = tokenIdToAddress(collectionId, refungibleTokenId);
669 const refungibleTokenContract = uniqueRefungibleToken(web3, rftTokenAddress, owner);
670 await refungibleTokenContract.methods.setParentNFT(nftCollectionAddress, nftTokenId).send();
671
672 const tokenAddress = await refungibleTokenContract.methods.parentToken().call();
673 const tokenId = await refungibleTokenContract.methods.parentTokenId().call();
674 const nftTokenAddress = tokenIdToAddress(nftCollectionId, nftTokenId);
675 expect(tokenAddress).to.be.equal(nftTokenAddress);
676 expect(tokenId).to.be.equal(nftTokenId);
677 });
678
679 itWeb3('Default parent token address and id', async ({api, web3, privateKeyWrapper}) => {
680 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
681
682 const {collectionIdAddress, collectionId} = await createRefungibleCollection(api, web3, owner);
683 const refungibleContract = uniqueRefungible(web3, collectionIdAddress, owner);
684 const refungibleTokenId = await refungibleContract.methods.nextTokenId().call();
685 await refungibleContract.methods.mint(owner, refungibleTokenId).send();
686
687 const rftTokenAddress = tokenIdToAddress(collectionId, refungibleTokenId);
688 const refungibleTokenContract = uniqueRefungibleToken(web3, rftTokenAddress, owner);
689
690 const tokenAddress = await refungibleTokenContract.methods.parentToken().call();
691 const tokenId = await refungibleTokenContract.methods.parentTokenId().call();
692 expect(tokenAddress).to.be.equal(rftTokenAddress);
693 expect(tokenId).to.be.equal(refungibleTokenId);
651 });694 });
652});695});
653696
modifiedtests/src/eth/reFungibleTokenAbi.jsondiffbeforeafterboth
102 "stateMutability": "view",102 "stateMutability": "view",
103 "type": "function"103 "type": "function"
104 },104 },
105 {
106 "inputs": [],
107 "name": "parentToken",
108 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
109 "stateMutability": "view",
110 "type": "function"
111 },
112 {
113 "inputs": [],
114 "name": "parentTokenId",
115 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
116 "stateMutability": "view",
117 "type": "function"
118 },
105 {119 {
106 "inputs": [120 "inputs": [
107 { "internalType": "uint256", "name": "amount", "type": "uint256" }121 { "internalType": "uint256", "name": "amount", "type": "uint256" }
111 "stateMutability": "nonpayable",125 "stateMutability": "nonpayable",
112 "type": "function"126 "type": "function"
113 },127 },
128 {
129 "inputs": [
130 { "internalType": "address", "name": "collection", "type": "address" },
131 { "internalType": "uint256", "name": "nftId", "type": "uint256" }
132 ],
133 "name": "setParentNFT",
134 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
135 "stateMutability": "nonpayable",
136 "type": "function"
137 },
114 {138 {
115 "inputs": [139 "inputs": [
116 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }140 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
modifiedtests/src/eth/util/helpers.tsdiffbeforeafterboth
32import fungibleAbi from '../fungibleAbi.json';32import fungibleAbi from '../fungibleAbi.json';
33import nonFungibleAbi from '../nonFungibleAbi.json';33import nonFungibleAbi from '../nonFungibleAbi.json';
34import refungibleAbi from '../reFungibleAbi.json';34import refungibleAbi from '../reFungibleAbi.json';
35import refungibleTokenAbi from '../reFungibleTokenAbi.json';
35import contractHelpersAbi from './contractHelpersAbi.json';36import contractHelpersAbi from './contractHelpersAbi.json';
3637
37export const GAS_ARGS = {gas: 2500000};38export const GAS_ARGS = {gas: 2500000};
102 return Web3.utils.toChecksumAddress('0x' + buf.toString('hex'));103 return Web3.utils.toChecksumAddress('0x' + buf.toString('hex'));
103}104}
105
106export function tokenIdFromAddress(address: string) {
107 if (!address.startsWith('0x'))
108 throw 'address not starts with "0x"';
109 if (address.length > 42)
110 throw 'address length is more than 20 bytes';
111 return {
112 collectionId: Number('0x' + address.substring(address.length - 16, address.length - 8)),
113 tokenId: Number('0x' + address.substring(address.length - 8)),
114 };
115}
116
104export function tokenIdToCross(collection: number, token: number): CrossAccountId {117export function tokenIdToCross(collection: number, token: number): CrossAccountId {
105 return {118 return {
128 expect(result.success).to.be.true;141 expect(result.success).to.be.true;
129}142}
143
144export async function createRefungibleCollection(api: ApiPromise, web3: Web3, owner: string) {
145 const collectionHelper = evmCollectionHelpers(web3, owner);
146 const result = await collectionHelper.methods
147 .createRefungibleCollection('A', 'B', 'C')
148 .send();
149 return await getCollectionAddressFromResult(api, result);
150}
151
152
153export async function createNonfungibleCollection(api: ApiPromise, web3: Web3, owner: string) {
154 const collectionHelper = evmCollectionHelpers(web3, owner);
155 const result = await collectionHelper.methods
156 .createNonfungibleCollection('A', 'B', 'C')
157 .send();
158 return await getCollectionAddressFromResult(api, result);
159}
160
161export function uniqueNFT(web3: Web3, address: string, owner: string) {
162 return new web3.eth.Contract(nonFungibleAbi as any, address, {
163 from: owner,
164 ...GAS_ARGS,
165 });
166}
167
168export function uniqueRefungible(web3: Web3, collectionAddress: string, owner: string) {
169 return new web3.eth.Contract(refungibleAbi as any, collectionAddress, {
170 from: owner,
171 ...GAS_ARGS,
172 });
173}
174
175export function uniqueRefungibleToken(web3: Web3, tokenAddress: string, owner: string | undefined = undefined) {
176 return new web3.eth.Contract(refungibleTokenAbi as any, tokenAddress, {
177 from: owner,
178 ...GAS_ARGS,
179 });
180}
130181
131export async function itWeb3(name: string, cb: (apis: { web3: Web3, api: ApiPromise, privateKeyWrapper: (account: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean } = {}) {182export async function itWeb3(name: string, cb: (apis: { web3: Web3, api: ApiPromise, privateKeyWrapper: (account: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean } = {}) {
132 let i: any = it;183 let i: any = it;
199 return Web3.utils.toChecksumAddress(subToEthLowercase(eth));250 return Web3.utils.toChecksumAddress(subToEthLowercase(eth));
200}251}
252
253export interface CompiledContract {
254 abi: any,
255 object: string,
256}
201257
202export function compileContract(name: string, src: string) {258export function compileContract(name: string, src: string) : CompiledContract {
203 const out = JSON.parse(solc.compile(JSON.stringify({259 const out = JSON.parse(solc.compile(JSON.stringify({
204 language: 'Solidity',260 language: 'Solidity',
205 sources: {261 sources: {
modifiedtests/src/interfaces/augment-api-query.tsdiffbeforeafterboth
266 * 266 *
267 * Currently used to store RMRK data.267 * Currently used to store RMRK data.
268 **/268 **/
269 tokenAuxProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: UpDataStructsPropertyScope | 'None' | 'Rmrk' | number | Uint8Array, arg4: Bytes | string | Uint8Array) => Observable<Option<Bytes>>, [u32, u32, UpDataStructsPropertyScope, Bytes]> & QueryableStorageEntry<ApiType, [u32, u32, UpDataStructsPropertyScope, Bytes]>;269 tokenAuxProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: UpDataStructsPropertyScope | 'None' | 'Rmrk' | 'Eth' | number | Uint8Array, arg4: Bytes | string | Uint8Array) => Observable<Option<Bytes>>, [u32, u32, UpDataStructsPropertyScope, Bytes]> & QueryableStorageEntry<ApiType, [u32, u32, UpDataStructsPropertyScope, Bytes]>;
270 /**270 /**
271 * Used to enumerate token's children.271 * Used to enumerate token's children.
272 **/272 **/
modifiedtests/src/interfaces/default/types.tsdiffbeforeafterboth
2521export interface UpDataStructsPropertyScope extends Enum {2521export interface UpDataStructsPropertyScope extends Enum {
2522 readonly isNone: boolean;2522 readonly isNone: boolean;
2523 readonly isRmrk: boolean;2523 readonly isRmrk: boolean;
2524 readonly isEth: boolean;
2524 readonly type: 'None' | 'Rmrk';2525 readonly type: 'None' | 'Rmrk' | 'Eth';
2525}2526}
25262527
2527/** @name UpDataStructsRpcCollection */2528/** @name UpDataStructsRpcCollection */
modifiedtests/src/interfaces/lookup.tsdiffbeforeafterboth
2978 * Lookup397: up_data_structs::PropertyScope2978 * Lookup397: up_data_structs::PropertyScope
2979 **/2979 **/
2980 UpDataStructsPropertyScope: {2980 UpDataStructsPropertyScope: {
2981 _enum: ['None', 'Rmrk']2981 _enum: ['None', 'Rmrk', 'Eth']
2982 },2982 },
2983 /**2983 /**
2984 * Lookup399: pallet_nonfungible::pallet::Error<T>2984 * Lookup399: pallet_nonfungible::pallet::Error<T>
modifiedtests/src/interfaces/types-lookup.tsdiffbeforeafterboth
3126 export interface UpDataStructsPropertyScope extends Enum {3126 export interface UpDataStructsPropertyScope extends Enum {
3127 readonly isNone: boolean;3127 readonly isNone: boolean;
3128 readonly isRmrk: boolean;3128 readonly isRmrk: boolean;
3129 readonly isEth: boolean;
3129 readonly type: 'None' | 'Rmrk';3130 readonly type: 'None' | 'Rmrk' | 'Eth';
3130 }3131 }
31313132
3132 /** @name PalletNonfungibleError (399) */3133 /** @name PalletNonfungibleError (399) */
modifiedtests/yarn.lockdiffbeforeafterboth
963 dependencies:963 dependencies:
964 "@types/chai" "*"964 "@types/chai" "*"
965965
966"@types/chai-like@^1.1.1":
967 version "1.1.1"
968 resolved "https://registry.yarnpkg.com/@types/chai-like/-/chai-like-1.1.1.tgz#c454039b0a2f92664fb5b7b7a2a66c3358783ae7"
969 integrity sha512-s46EZsupBuVhLn66DbRee5B0SELLmL4nFXVrBiV29BxLGm9Sh7Bful623j3AfiQRu2zAP4cnlZ3ETWB3eWc4bA==
970 dependencies:
971 "@types/chai" "*"
972
973"@types/chai-things@^0.0.35":
974 version "0.0.35"
975 resolved "https://registry.yarnpkg.com/@types/chai-things/-/chai-things-0.0.35.tgz#4b5d9ec032067faa62b3bf7bb40dc0bec941945f"
976 integrity sha512-BC8FwMf9FHj87XT4dgTwbdb8dNRilGqYWGmwLPdJ54YNk6K2PlcFTt68NGHjgPDnms8zIYcOtmPePd0mPNTo/Q==
977 dependencies:
978 "@types/chai" "*"
979
966"@types/chai@*", "@types/chai@^4.3.1":980"@types/chai@*", "@types/chai@^4.3.1":
967 version "4.3.1"981 version "4.3.1"
968 resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.1.tgz#e2c6e73e0bdeb2521d00756d099218e9f5d90a04"982 resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.1.tgz#e2c6e73e0bdeb2521d00756d099218e9f5d90a04"
1544 integrity sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==1558 integrity sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==
1545 dependencies:1559 dependencies:
1546 check-error "^1.0.2"1560 check-error "^1.0.2"
1561
1562chai-like@^1.1.1:
1563 version "1.1.1"
1564 resolved "https://registry.yarnpkg.com/chai-like/-/chai-like-1.1.1.tgz#8c558a414c34514e814d497c772547ceb7958f64"
1565 integrity sha512-VKa9z/SnhXhkT1zIjtPACFWSoWsqVoaz1Vg+ecrKo5DCKVlgL30F/pEyEvXPBOVwCgLZcWUleCM/C1okaKdTTA==
1566
1567chai-things@^0.2.0:
1568 version "0.2.0"
1569 resolved "https://registry.yarnpkg.com/chai-things/-/chai-things-0.2.0.tgz#c55128378f9bb399e994f00052151984ed6ebe70"
1570 integrity sha512-6ns0SU21xdRCoEXVKH3HGbwnsgfVMXQ+sU5V8PI9rfxaITos8lss1vUxbF1FAcJKjfqmmmLVlr/z3sLes00w+A==
15471571
1548chai@^4.3.6:1572chai@^4.3.6:
1549 version "4.3.6"1573 version "4.3.6"