git.delta.rocks / unique-network / refs/commits / 9272309560ec

difftreelog

CORE-386 Implement eth methods

Trubnikov Sergey2022-06-01parent: #f11d024.patch.diff
in: master

7 files changed

modifiedcrates/evm-coder/src/solidity.rsdiffbeforeafterboth
455 }455 }
456}456}
457457
458#[impl_for_tuples(0, 12)]458#[impl_for_tuples(0, 24)]
459impl SolidityFunctions for Tuple {459impl SolidityFunctions for Tuple {
460 for_tuples!( where #( Tuple: SolidityFunctions ),* );460 for_tuples!( where #( Tuple: SolidityFunctions ),* );
461461
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
23use pallet_evm_coder_substrate::dispatch_to_evm;23use pallet_evm_coder_substrate::dispatch_to_evm;
24use sp_core::{H160, U256, H256};24use sp_core::{H160, U256, H256};
25use sp_std::vec::Vec;25use sp_std::vec::Vec;
26use up_data_structs::{Property, SponsoringRateLimit, NestingRule, OwnerRestrictedSet};26use up_data_structs::{Property, SponsoringRateLimit, NestingRule, OwnerRestrictedSet, AccessMode};
27use alloc::format;27use alloc::format;
2828
29use crate::{Pallet, CollectionHandle, Config, CollectionProperties};29use crate::{Pallet, CollectionHandle, Config, CollectionProperties};
253 Ok(())253 Ok(())
254 }254 }
255
256 fn set_access(&mut self, caller: caller, mode: string) -> Result<void> {
257 let caller = T::CrossAccountId::from_eth(caller);
258 self.check_is_owner_or_admin(&caller)
259 .map_err(dispatch_to_evm::<T>)?;
260 self.collection.permissions.access = Some(match mode.as_str() {
261 "Normal" => AccessMode::Normal,
262 "AllowList" => AccessMode::AllowList,
263 _ => return Err("Not supported access mode".into()),
264 });
265 save(self);
266 Ok(())
267 }
268
269 fn add_to_allow_list(&self, caller: caller, user: address) -> Result<void> {
270 let caller = check_is_owner_or_admin(caller, self)?;
271 let user = T::CrossAccountId::from_eth(user);
272 <Pallet<T>>::toggle_allowlist(self, &caller, &user, true)
273 .map_err(dispatch_to_evm::<T>)?;
274 Ok(())
275 }
276
277 fn remove_from_allow_list(&self, caller: caller, user: address) -> Result<void> {
278 let caller = check_is_owner_or_admin(caller, self)?;
279 let user = T::CrossAccountId::from_eth(user);
280 <Pallet<T>>::toggle_allowlist(self, &caller, &user, false)
281 .map_err(dispatch_to_evm::<T>)?;
282 Ok(())
283 }
284
285 fn set_mint_mode(&mut self, caller: caller, mode: bool) -> Result<void> {
286 check_is_owner_or_admin(caller, self)?;
287 self.collection.permissions.mint_mode = Some(mode);
288 save(self);
289 Ok(())
290 }
255}291}
256292
257fn check_is_owner<T: Config>(caller: caller, collection: &CollectionHandle<T>) -> Result<()> {293fn check_is_owner<T: Config>(caller: caller, collection: &CollectionHandle<T>) -> Result<()> {
262 Ok(())298 Ok(())
263}299}
300
301fn check_is_owner_or_admin<T: Config>(caller: caller, collection: &CollectionHandle<T>) -> Result<T::CrossAccountId> {
302 let caller = T::CrossAccountId::from_eth(caller);
303 collection
304 .check_is_owner_or_admin(&caller)
305 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
306 Ok(caller)
307}
264308
265fn save<T: Config>(collection: &CollectionHandle<T>) {309fn save<T: Config>(collection: &CollectionHandle<T>) {
266 <crate::CollectionById<T>>::insert(collection.id, collection.collection.clone());310 <crate::CollectionById<T>>::insert(collection.id, collection.collection.clone());
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
51 event MintingFinished();51 event MintingFinished();
52}52}
53
54// Selector: 3a54513b
55contract Collection is Dummy, ERC165 {
56 // Selector: setCollectionProperty(string,bytes) 2f073f66
57 function setCollectionProperty(string memory key, bytes memory value)
58 public
59 {
60 require(false, stub_error);
61 key;
62 value;
63 dummy = 0;
64 }
65
66 // Selector: deleteCollectionProperty(string) 7b7debce
67 function deleteCollectionProperty(string memory key) public {
68 require(false, stub_error);
69 key;
70 dummy = 0;
71 }
72
73 // Throws error if key not found
74 //
75 // Selector: collectionProperty(string) cf24fd6d
76 function collectionProperty(string memory key)
77 public
78 view
79 returns (bytes memory)
80 {
81 require(false, stub_error);
82 key;
83 dummy;
84 return hex"";
85 }
86
87 // Selector: ethSetSponsor(address) 8f9af356
88 function ethSetSponsor(address sponsor) public {
89 require(false, stub_error);
90 sponsor;
91 dummy = 0;
92 }
93
94 // Selector: ethConfirmSponsorship() a8580d1a
95 function ethConfirmSponsorship() public {
96 require(false, stub_error);
97 dummy = 0;
98 }
99
100 // Selector: setLimit(string,uint32) 68db30ca
101 function setLimit(string memory limit, uint32 value) public {
102 require(false, stub_error);
103 limit;
104 value;
105 dummy = 0;
106 }
107
108 // Selector: setLimit(string,bool) ea67e4c2
109 function setLimit(string memory limit, bool value) public {
110 require(false, stub_error);
111 limit;
112 value;
113 dummy = 0;
114 }
115
116 // Selector: contractAddress() f6b4dfb4
117 function contractAddress() public view returns (address) {
118 require(false, stub_error);
119 dummy;
120 return 0x0000000000000000000000000000000000000000;
121 }
122
123 // Selector: addAdmin(address) 70480275
124 function addAdmin(address newAdmin) public view {
125 require(false, stub_error);
126 newAdmin;
127 dummy;
128 }
129
130 // Selector: removeAdmin(address) 1785f53c
131 function removeAdmin(address admin) public view {
132 require(false, stub_error);
133 admin;
134 dummy;
135 }
136
137 // Selector: setNesting(bool) e8fc50dd
138 function setNesting(bool enable) public {
139 require(false, stub_error);
140 enable;
141 dummy = 0;
142 }
143
144 // Selector: setNesting(bool,address[]) 7df12a9a
145 function setNesting(bool enable, address[] memory collections) public {
146 require(false, stub_error);
147 enable;
148 collections;
149 dummy = 0;
150 }
151}
15253
153// Selector: 4136937754// Selector: 41369377
154contract TokenProperties is Dummy, ERC165 {55contract TokenProperties is Dummy, ERC165 {
479 }380 }
480}381}
382
383// Selector: f56cd7fa
384contract Collection is Dummy, ERC165 {
385 // Selector: setCollectionProperty(string,bytes) 2f073f66
386 function setCollectionProperty(string memory key, bytes memory value)
387 public
388 {
389 require(false, stub_error);
390 key;
391 value;
392 dummy = 0;
393 }
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 // Throws error if key not found
403 //
404 // Selector: collectionProperty(string) cf24fd6d
405 function collectionProperty(string memory key)
406 public
407 view
408 returns (bytes memory)
409 {
410 require(false, stub_error);
411 key;
412 dummy;
413 return hex"";
414 }
415
416 // Selector: ethSetSponsor(address) 8f9af356
417 function ethSetSponsor(address sponsor) public {
418 require(false, stub_error);
419 sponsor;
420 dummy = 0;
421 }
422
423 // Selector: ethConfirmSponsorship() a8580d1a
424 function ethConfirmSponsorship() public {
425 require(false, stub_error);
426 dummy = 0;
427 }
428
429 // Selector: setLimit(string,uint32) 68db30ca
430 function setLimit(string memory limit, uint32 value) public {
431 require(false, stub_error);
432 limit;
433 value;
434 dummy = 0;
435 }
436
437 // Selector: setLimit(string,bool) ea67e4c2
438 function setLimit(string memory limit, bool value) public {
439 require(false, stub_error);
440 limit;
441 value;
442 dummy = 0;
443 }
444
445 // Selector: contractAddress() f6b4dfb4
446 function contractAddress() public view returns (address) {
447 require(false, stub_error);
448 dummy;
449 return 0x0000000000000000000000000000000000000000;
450 }
451
452 // Selector: addAdmin(address) 70480275
453 function addAdmin(address newAdmin) public view {
454 require(false, stub_error);
455 newAdmin;
456 dummy;
457 }
458
459 // Selector: removeAdmin(address) 1785f53c
460 function removeAdmin(address admin) public view {
461 require(false, stub_error);
462 admin;
463 dummy;
464 }
465
466 // Selector: setNesting(bool) e8fc50dd
467 function setNesting(bool enable) public {
468 require(false, stub_error);
469 enable;
470 dummy = 0;
471 }
472
473 // Selector: setNesting(bool,address[]) 7df12a9a
474 function setNesting(bool enable, address[] memory collections) public {
475 require(false, stub_error);
476 enable;
477 collections;
478 dummy = 0;
479 }
480
481 // Selector: setAccess(string) 488f56aa
482 function setAccess(string memory mode) public {
483 require(false, stub_error);
484 mode;
485 dummy = 0;
486 }
487
488 // Selector: addToAllowList(address) 31f59102
489 function addToAllowList(address user) public view {
490 require(false, stub_error);
491 user;
492 dummy;
493 }
494
495 // Selector: removeFromAllowList(address) eba8dabc
496 function removeFromAllowList(address user) public view {
497 require(false, stub_error);
498 user;
499 dummy;
500 }
501
502 // Selector: setMintMode(bool) 5dea9bd5
503 function setMintMode(bool mode) public {
504 require(false, stub_error);
505 mode;
506 dummy = 0;
507 }
508}
481509
482contract UniqueNFT is510contract UniqueNFT is
483 Dummy,511 Dummy,
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
42 event MintingFinished();42 event MintingFinished();
43}43}
44
45// Selector: 3a54513b
46interface Collection is Dummy, ERC165 {
47 // Selector: setCollectionProperty(string,bytes) 2f073f66
48 function setCollectionProperty(string memory key, bytes memory value)
49 external;
50
51 // Selector: deleteCollectionProperty(string) 7b7debce
52 function deleteCollectionProperty(string memory key) external;
53
54 // Throws error if key not found
55 //
56 // Selector: collectionProperty(string) cf24fd6d
57 function collectionProperty(string memory key)
58 external
59 view
60 returns (bytes memory);
61
62 // Selector: ethSetSponsor(address) 8f9af356
63 function ethSetSponsor(address sponsor) external;
64
65 // Selector: ethConfirmSponsorship() a8580d1a
66 function ethConfirmSponsorship() external;
67
68 // Selector: setLimit(string,uint32) 68db30ca
69 function setLimit(string memory limit, uint32 value) external;
70
71 // Selector: setLimit(string,bool) ea67e4c2
72 function setLimit(string memory limit, bool value) external;
73
74 // Selector: contractAddress() f6b4dfb4
75 function contractAddress() external view returns (address);
76
77 // Selector: addAdmin(address) 70480275
78 function addAdmin(address newAdmin) external view;
79
80 // Selector: removeAdmin(address) 1785f53c
81 function removeAdmin(address admin) external view;
82
83 // Selector: setNesting(bool) e8fc50dd
84 function setNesting(bool enable) external;
85
86 // Selector: setNesting(bool,address[]) 7df12a9a
87 function setNesting(bool enable, address[] memory collections) external;
88}
8944
90// Selector: 4136937745// Selector: 41369377
91interface TokenProperties is Dummy, ERC165 {46interface TokenProperties is Dummy, ERC165 {
258 returns (bool);213 returns (bool);
259}214}
215
216// Selector: f56cd7fa
217interface Collection is Dummy, ERC165 {
218 // Selector: setCollectionProperty(string,bytes) 2f073f66
219 function setCollectionProperty(string memory key, bytes memory value)
220 external;
221
222 // Selector: deleteCollectionProperty(string) 7b7debce
223 function deleteCollectionProperty(string memory key) external;
224
225 // Throws error if key not found
226 //
227 // Selector: collectionProperty(string) cf24fd6d
228 function collectionProperty(string memory key)
229 external
230 view
231 returns (bytes memory);
232
233 // Selector: ethSetSponsor(address) 8f9af356
234 function ethSetSponsor(address sponsor) external;
235
236 // Selector: ethConfirmSponsorship() a8580d1a
237 function ethConfirmSponsorship() external;
238
239 // Selector: setLimit(string,uint32) 68db30ca
240 function setLimit(string memory limit, uint32 value) external;
241
242 // Selector: setLimit(string,bool) ea67e4c2
243 function setLimit(string memory limit, bool value) external;
244
245 // Selector: contractAddress() f6b4dfb4
246 function contractAddress() external view returns (address);
247
248 // Selector: addAdmin(address) 70480275
249 function addAdmin(address newAdmin) external view;
250
251 // Selector: removeAdmin(address) 1785f53c
252 function removeAdmin(address admin) external view;
253
254 // Selector: setNesting(bool) e8fc50dd
255 function setNesting(bool enable) external;
256
257 // Selector: setNesting(bool,address[]) 7df12a9a
258 function setNesting(bool enable, address[] memory collections) external;
259
260 // Selector: setAccess(string) 488f56aa
261 function setAccess(string memory mode) external;
262
263 // Selector: addToAllowList(address) 31f59102
264 function addToAllowList(address user) external view;
265
266 // Selector: removeFromAllowList(address) eba8dabc
267 function removeFromAllowList(address user) external view;
268
269 // Selector: setMintMode(bool) 5dea9bd5
270 function setMintMode(bool mode) external;
271}
260272
261interface UniqueNFT is273interface UniqueNFT is
262 Dummy,274 Dummy,
modifiedtests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth
31 evmCollectionHelpers,31 evmCollectionHelpers,
32 getCollectionAddressFromResult,32 getCollectionAddressFromResult,
33 evmCollection,33 evmCollection,
34 ethBalanceViaSub,
34} from './util/helpers';35} from './util/helpers';
35import {36import {
36 addCollectionAdminExpectSuccess,37 addCollectionAdminExpectSuccess,
221 });222 });
222223
223 //TODO: CORE-302 add eth methods224 //TODO: CORE-302 add eth methods
224 itWeb3.skip('Sponsoring evm address from substrate collection', async ({api, web3}) => {225 itWeb3('Sponsoring collection from evm address via access list', async ({api, web3}) => {
225 const owner = await createEthAccountWithBalance(api, web3);226 const owner = await createEthAccountWithBalance(api, web3);
226 const collectionHelpers = evmCollectionHelpers(web3, owner);227 const collectionHelpers = evmCollectionHelpers(web3, owner);
227 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();228 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();
228 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);229 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
229 const sponsor = await createEthAccountWithBalance(api, web3);230 const sponsor = await createEthAccountWithBalance(api, web3);
230 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);231 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
231 result = await collectionEvm.methods.ethSetSponsor(sponsor).send();232 result = await collectionEvm.methods.ethSetSponsor(sponsor).send({from: owner});
232 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;233 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;
233 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;234 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;
234 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));235 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));
235 await expect(collectionEvm.methods.ethConfirmSponsorship().call()).to.be.rejectedWith('Caller is not set as sponsor');236 await expect(collectionEvm.methods.ethConfirmSponsorship().call()).to.be.rejectedWith('Caller is not set as sponsor');
236237
237 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);
238 await sponsorCollection.methods.ethConfirmSponsorship().send();238 await collectionEvm.methods.ethConfirmSponsorship().send({from: sponsor});
239 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;239 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;
240 expect(collectionSub.sponsorship.isConfirmed).to.be.true;240 expect(collectionSub.sponsorship.isConfirmed).to.be.true;
241 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));241 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));
242242
243 const user = createEthAccount(web3);243 const user = createEthAccount(web3);
244 const userContract = evmCollection(web3, user, collectionIdAddress);
245 const nextTokenId = await userContract.methods.nextTokenId().call();244 const nextTokenId = await collectionEvm.methods.nextTokenId().call();
246
247 expect(nextTokenId).to.be.equal('1');245 expect(nextTokenId).to.be.equal('1');
246
248 await expect(userContract.methods.mintWithTokenURI(247 const oldPermissions = (await getDetailedCollectionInfo(api, collectionId))!.permissions.toHuman();
249 user,248 expect(oldPermissions.mintMode).to.be.false;
250 nextTokenId,249 expect(oldPermissions.access).to.be.equal('Normal');
251 'Test URI',250
252 ).call()).to.be.rejectedWith('PublicMintingNotAllowed');251 await collectionEvm.methods.setAccess('AllowList').send({from: owner});
253 252 await collectionEvm.methods.addToAllowList(user).send({from: owner});
254 // TODO: add this methods to eth253 await collectionEvm.methods.setMintMode(true).send({from: owner});
255 // {254
256 // const tx = api.tx.unique.setPublicAccessMode(collectionId, 'AllowList');255 const newPermissions = (await getDetailedCollectionInfo(api, collectionId))!.permissions.toHuman();
257 // const events = await submitTransactionAsync(owner, tx);256 expect(newPermissions.mintMode).to.be.true;
258 // const result = getCreateCollectionResult(events);257 expect(newPermissions.access).to.be.equal('AllowList');
259 // expect(result.success).to.be.true;
260 // }
261 // {
262 // const tx = api.tx.unique.addToAllowList(collectionId, {Ethereum: userEth});
263 // const events = await submitTransactionAsync(owner, tx);
264 // const result = getCreateCollectionResult(events);
265 // expect(result.success).to.be.true;
266 // }
267 // {
268 // const tx = api.tx.unique.setMintPermission(collectionId, true);
269 // const events = await submitTransactionAsync(owner, tx);
270 // const result = getCreateCollectionResult(events);
271 // expect(result.success).to.be.true;
272 // }
273258
274 // const [alicesBalanceBefore] = await getBalance(api, [alicesPublicKey]);259 // const [alicesBalanceBefore] = await getBalance(api, [alicesPublicKey]);
275260
276 {261 {
277 const nextTokenId = await userContract.methods.nextTokenId().call();262 const nextTokenId = await collectionEvm.methods.nextTokenId().call();
278 expect(nextTokenId).to.be.equal('1');263 expect(nextTokenId).to.be.equal('1');
279 const result = await userContract.methods.mintWithTokenURI(264 const result = await collectionEvm.methods.mintWithTokenURI(
280 user,265 user,
281 nextTokenId,266 nextTokenId,
282 'Test URI',267 'Test URI',
283 ).send();268 ).call({from: user});
269 console.log(result);
284 const events = normalizeEvents(result.events);270 const events = normalizeEvents(result.events);
285271
286 expect(events).to.be.deep.equal([272 expect(events).to.be.deep.equal([
295 },281 },
296 ]);282 ]);
297283
298 expect(await userContract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');284 expect(await collectionEvm.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');
299 }285 }
300 });286 });
301287
302 //TODO: CORE-302 add eth methods
303 itWeb3.skip('Check that transaction via EVM spend money from substrate address', async ({api, web3, privateKeyWrapper}) => {288 itWeb3('Check that transaction via EVM spend money from sponsor address', async ({api, web3}) => {
304 const owner = privateKeyWrapper('//Alice');289 const owner = await createEthAccountWithBalance(api, web3);
305 const user = privateKeyWrapper(`//User/${Date.now()}`);290 const collectionHelpers = evmCollectionHelpers(web3, owner);
306 const userEth = subToEth(user.address);291 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();
307 const collectionId = await createCollectionExpectSuccess();292 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
293 const sponsor = await createEthAccountWithBalance(api, web3);
294 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
295 result = await collectionEvm.methods.ethSetSponsor(sponsor).send();
308 await addCollectionAdminExpectSuccess(owner, collectionId, {Ethereum: userEth});296 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;
297 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;
298 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));
309 await transferBalanceTo(api, owner, user.address);299 await expect(collectionEvm.methods.ethConfirmSponsorship().call()).to.be.rejectedWith('Caller is not set as sponsor');
310
311 const address = collectionIdToAddress(collectionId);300 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);
301 await sponsorCollection.methods.ethConfirmSponsorship().send();
302 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;
303 expect(collectionSub.sponsorship.isConfirmed).to.be.true;
304 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));
305
312 const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: userEth, ...GAS_ARGS});306 const user = createEthAccount(web3);
313307 await collectionEvm.methods.addAdmin(user).send();
308
314 const [userBalanceBefore] = await getBalance(api, [user.address]);309 const ownerBalanceBefore = await ethBalanceViaSub(api, owner);
315310 const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);
316 {311
312
313 const userCollectionEvm = evmCollection(web3, user, collectionIdAddress);
317 const nextTokenId = await contract.methods.nextTokenId().call();314 const nextTokenId = await userCollectionEvm.methods.nextTokenId().call();
318 expect(nextTokenId).to.be.equal('1');315 expect(nextTokenId).to.be.equal('1');
319 await executeEthTxOnSub(web3, api, user, contract, m => m.mintWithTokenURI(316 result = await userCollectionEvm.methods.mintWithTokenURI(
320 userEth,317 user,
321 nextTokenId,318 nextTokenId,
322 'Test URI',319 'Test URI',
323 ));320 ).send();
324321
322 const events = normalizeEvents(result.events);
323 const address = collectionIdToAddress(collectionId);
324
325 expect(events).to.be.deep.equal([
326 {
327 address,
328 event: 'Transfer',
329 args: {
330 from: '0x0000000000000000000000000000000000000000',
331 to: user,
332 tokenId: nextTokenId,
333 },
334 },
335 ]);
325 expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');336 expect(await userCollectionEvm.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');
326 }337
327
328 const [userBalanceAfter] = await getBalance(api, [user.address]);338 const ownerBalanceAfter = await ethBalanceViaSub(api, owner);
339 expect(ownerBalanceAfter).to.be.eq(ownerBalanceBefore);
340 const sponsorBalanceAfter = await ethBalanceViaSub(api, sponsor);
329 expect(userBalanceAfter < userBalanceBefore).to.be.true;341 expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;
330 });342 });
331});343});
332344
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
89 "stateMutability": "view",89 "stateMutability": "view",
90 "type": "function"90 "type": "function"
91 },91 },
92 {
93 "inputs": [
94 { "internalType": "address", "name": "user", "type": "address" }
95 ],
96 "name": "addToAllowList",
97 "outputs": [],
98 "stateMutability": "view",
99 "type": "function"
100 },
92 {101 {
93 "inputs": [102 "inputs": [
94 { "internalType": "address", "name": "approved", "type": "address" },103 { "internalType": "address", "name": "approved", "type": "address" },
298 "stateMutability": "view",307 "stateMutability": "view",
299 "type": "function"308 "type": "function"
300 },309 },
310 {
311 "inputs": [
312 { "internalType": "address", "name": "user", "type": "address" }
313 ],
314 "name": "removeFromAllowList",
315 "outputs": [],
316 "stateMutability": "view",
317 "type": "function"
318 },
301 {319 {
302 "inputs": [320 "inputs": [
303 { "internalType": "address", "name": "from", "type": "address" },321 { "internalType": "address", "name": "from", "type": "address" },
321 "stateMutability": "nonpayable",339 "stateMutability": "nonpayable",
322 "type": "function"340 "type": "function"
323 },341 },
342 {
343 "inputs": [{ "internalType": "string", "name": "mode", "type": "string" }],
344 "name": "setAccess",
345 "outputs": [],
346 "stateMutability": "nonpayable",
347 "type": "function"
348 },
324 {349 {
325 "inputs": [350 "inputs": [
326 { "internalType": "address", "name": "operator", "type": "address" },351 { "internalType": "address", "name": "operator", "type": "address" },
361 "stateMutability": "nonpayable",386 "stateMutability": "nonpayable",
362 "type": "function"387 "type": "function"
363 },388 },
389 {
390 "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],
391 "name": "setMintMode",
392 "outputs": [],
393 "stateMutability": "nonpayable",
394 "type": "function"
395 },
364 {396 {
365 "inputs": [397 "inputs": [
366 { "internalType": "bool", "name": "enable", "type": "bool" },398 { "internalType": "bool", "name": "enable", "type": "bool" },