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
--- a/crates/evm-coder/src/solidity.rs
+++ b/crates/evm-coder/src/solidity.rs
@@ -455,7 +455,7 @@
 	}
 }
 
-#[impl_for_tuples(0, 12)]
+#[impl_for_tuples(0, 24)]
 impl SolidityFunctions for Tuple {
 	for_tuples!( where #( Tuple: SolidityFunctions ),* );
 
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -23,7 +23,7 @@
 use pallet_evm_coder_substrate::dispatch_to_evm;
 use sp_core::{H160, U256, H256};
 use sp_std::vec::Vec;
-use up_data_structs::{Property, SponsoringRateLimit, NestingRule, OwnerRestrictedSet};
+use up_data_structs::{Property, SponsoringRateLimit, NestingRule, OwnerRestrictedSet, AccessMode};
 use alloc::format;
 
 use crate::{Pallet, CollectionHandle, Config, CollectionProperties};
@@ -252,6 +252,42 @@
 		save(self);
 		Ok(())
 	}
+
+	fn set_access(&mut self, caller: caller, mode: string) -> Result<void> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		self.check_is_owner_or_admin(&caller)
+			.map_err(dispatch_to_evm::<T>)?;
+		self.collection.permissions.access = Some(match mode.as_str() {
+			"Normal" => AccessMode::Normal,
+			"AllowList" => AccessMode::AllowList,
+			_ => return Err("Not supported access mode".into()),
+		});
+		save(self);
+		Ok(())
+	}
+
+	fn add_to_allow_list(&self, caller: caller, user: address) -> Result<void> {
+		let caller = check_is_owner_or_admin(caller, self)?;
+		let user = T::CrossAccountId::from_eth(user);
+		<Pallet<T>>::toggle_allowlist(self, &caller, &user, true)
+			.map_err(dispatch_to_evm::<T>)?;
+		Ok(())
+	}
+
+	fn remove_from_allow_list(&self, caller: caller, user: address) -> Result<void> {
+		let caller = check_is_owner_or_admin(caller, self)?;
+		let user = T::CrossAccountId::from_eth(user);
+		<Pallet<T>>::toggle_allowlist(self, &caller, &user, false)
+			.map_err(dispatch_to_evm::<T>)?;
+		Ok(())
+	}
+
+	fn set_mint_mode(&mut self, caller: caller, mode: bool) -> Result<void> {
+		check_is_owner_or_admin(caller, self)?;
+		self.collection.permissions.mint_mode = Some(mode);
+		save(self);
+		Ok(())
+	}
 }
 
 fn check_is_owner<T: Config>(caller: caller, collection: &CollectionHandle<T>) -> Result<()> {
@@ -262,6 +298,14 @@
 	Ok(())
 }
 
+fn check_is_owner_or_admin<T: Config>(caller: caller, collection: &CollectionHandle<T>) -> Result<T::CrossAccountId> {
+	let caller = T::CrossAccountId::from_eth(caller);
+	collection
+		.check_is_owner_or_admin(&caller)
+		.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
+	Ok(caller)
+}
+
 fn save<T: Config>(collection: &CollectionHandle<T>) {
 	<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
--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -51,105 +51,6 @@
 	event MintingFinished();
 }
 
-// Selector: 3a54513b
-contract Collection is Dummy, ERC165 {
-	// Selector: setCollectionProperty(string,bytes) 2f073f66
-	function setCollectionProperty(string memory key, bytes memory value)
-		public
-	{
-		require(false, stub_error);
-		key;
-		value;
-		dummy = 0;
-	}
-
-	// Selector: deleteCollectionProperty(string) 7b7debce
-	function deleteCollectionProperty(string memory key) public {
-		require(false, stub_error);
-		key;
-		dummy = 0;
-	}
-
-	// Throws error if key not found
-	//
-	// Selector: collectionProperty(string) cf24fd6d
-	function collectionProperty(string memory key)
-		public
-		view
-		returns (bytes memory)
-	{
-		require(false, stub_error);
-		key;
-		dummy;
-		return hex"";
-	}
-
-	// Selector: ethSetSponsor(address) 8f9af356
-	function ethSetSponsor(address sponsor) public {
-		require(false, stub_error);
-		sponsor;
-		dummy = 0;
-	}
-
-	// Selector: ethConfirmSponsorship() a8580d1a
-	function ethConfirmSponsorship() public {
-		require(false, stub_error);
-		dummy = 0;
-	}
-
-	// Selector: setLimit(string,uint32) 68db30ca
-	function setLimit(string memory limit, uint32 value) public {
-		require(false, stub_error);
-		limit;
-		value;
-		dummy = 0;
-	}
-
-	// Selector: setLimit(string,bool) ea67e4c2
-	function setLimit(string memory limit, bool value) public {
-		require(false, stub_error);
-		limit;
-		value;
-		dummy = 0;
-	}
-
-	// Selector: contractAddress() f6b4dfb4
-	function contractAddress() public view returns (address) {
-		require(false, stub_error);
-		dummy;
-		return 0x0000000000000000000000000000000000000000;
-	}
-
-	// Selector: addAdmin(address) 70480275
-	function addAdmin(address newAdmin) public view {
-		require(false, stub_error);
-		newAdmin;
-		dummy;
-	}
-
-	// Selector: removeAdmin(address) 1785f53c
-	function removeAdmin(address admin) public view {
-		require(false, stub_error);
-		admin;
-		dummy;
-	}
-
-	// Selector: setNesting(bool) e8fc50dd
-	function setNesting(bool enable) public {
-		require(false, stub_error);
-		enable;
-		dummy = 0;
-	}
-
-	// Selector: setNesting(bool,address[]) 7df12a9a
-	function setNesting(bool enable, address[] memory collections) public {
-		require(false, stub_error);
-		enable;
-		collections;
-		dummy = 0;
-	}
-}
-
 // Selector: 41369377
 contract TokenProperties is Dummy, ERC165 {
 	// Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa
@@ -479,6 +380,133 @@
 	}
 }
 
+// Selector: f56cd7fa
+contract Collection is Dummy, ERC165 {
+	// Selector: setCollectionProperty(string,bytes) 2f073f66
+	function setCollectionProperty(string memory key, bytes memory value)
+		public
+	{
+		require(false, stub_error);
+		key;
+		value;
+		dummy = 0;
+	}
+
+	// Selector: deleteCollectionProperty(string) 7b7debce
+	function deleteCollectionProperty(string memory key) public {
+		require(false, stub_error);
+		key;
+		dummy = 0;
+	}
+
+	// Throws error if key not found
+	//
+	// Selector: collectionProperty(string) cf24fd6d
+	function collectionProperty(string memory key)
+		public
+		view
+		returns (bytes memory)
+	{
+		require(false, stub_error);
+		key;
+		dummy;
+		return hex"";
+	}
+
+	// Selector: ethSetSponsor(address) 8f9af356
+	function ethSetSponsor(address sponsor) public {
+		require(false, stub_error);
+		sponsor;
+		dummy = 0;
+	}
+
+	// Selector: ethConfirmSponsorship() a8580d1a
+	function ethConfirmSponsorship() public {
+		require(false, stub_error);
+		dummy = 0;
+	}
+
+	// Selector: setLimit(string,uint32) 68db30ca
+	function setLimit(string memory limit, uint32 value) public {
+		require(false, stub_error);
+		limit;
+		value;
+		dummy = 0;
+	}
+
+	// Selector: setLimit(string,bool) ea67e4c2
+	function setLimit(string memory limit, bool value) public {
+		require(false, stub_error);
+		limit;
+		value;
+		dummy = 0;
+	}
+
+	// Selector: contractAddress() f6b4dfb4
+	function contractAddress() public view returns (address) {
+		require(false, stub_error);
+		dummy;
+		return 0x0000000000000000000000000000000000000000;
+	}
+
+	// Selector: addAdmin(address) 70480275
+	function addAdmin(address newAdmin) public view {
+		require(false, stub_error);
+		newAdmin;
+		dummy;
+	}
+
+	// Selector: removeAdmin(address) 1785f53c
+	function removeAdmin(address admin) public view {
+		require(false, stub_error);
+		admin;
+		dummy;
+	}
+
+	// Selector: setNesting(bool) e8fc50dd
+	function setNesting(bool enable) public {
+		require(false, stub_error);
+		enable;
+		dummy = 0;
+	}
+
+	// Selector: setNesting(bool,address[]) 7df12a9a
+	function setNesting(bool enable, address[] memory collections) public {
+		require(false, stub_error);
+		enable;
+		collections;
+		dummy = 0;
+	}
+
+	// Selector: setAccess(string) 488f56aa
+	function setAccess(string memory mode) public {
+		require(false, stub_error);
+		mode;
+		dummy = 0;
+	}
+
+	// Selector: addToAllowList(address) 31f59102
+	function addToAllowList(address user) public view {
+		require(false, stub_error);
+		user;
+		dummy;
+	}
+
+	// Selector: removeFromAllowList(address) eba8dabc
+	function removeFromAllowList(address user) public view {
+		require(false, stub_error);
+		user;
+		dummy;
+	}
+
+	// Selector: setMintMode(bool) 5dea9bd5
+	function setMintMode(bool mode) public {
+		require(false, stub_error);
+		mode;
+		dummy = 0;
+	}
+}
+
 contract UniqueNFT is
 	Dummy,
 	ERC165,
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -42,51 +42,6 @@
 	event MintingFinished();
 }
 
-// Selector: 3a54513b
-interface Collection is Dummy, ERC165 {
-	// Selector: setCollectionProperty(string,bytes) 2f073f66
-	function setCollectionProperty(string memory key, bytes memory value)
-		external;
-
-	// Selector: deleteCollectionProperty(string) 7b7debce
-	function deleteCollectionProperty(string memory key) external;
-
-	// Throws error if key not found
-	//
-	// Selector: collectionProperty(string) cf24fd6d
-	function collectionProperty(string memory key)
-		external
-		view
-		returns (bytes memory);
-
-	// Selector: ethSetSponsor(address) 8f9af356
-	function ethSetSponsor(address sponsor) external;
-
-	// Selector: ethConfirmSponsorship() a8580d1a
-	function ethConfirmSponsorship() external;
-
-	// Selector: setLimit(string,uint32) 68db30ca
-	function setLimit(string memory limit, uint32 value) external;
-
-	// Selector: setLimit(string,bool) ea67e4c2
-	function setLimit(string memory limit, bool value) external;
-
-	// Selector: contractAddress() f6b4dfb4
-	function contractAddress() external view returns (address);
-
-	// Selector: addAdmin(address) 70480275
-	function addAdmin(address newAdmin) external view;
-
-	// Selector: removeAdmin(address) 1785f53c
-	function removeAdmin(address admin) external view;
-
-	// Selector: setNesting(bool) e8fc50dd
-	function setNesting(bool enable) external;
-
-	// Selector: setNesting(bool,address[]) 7df12a9a
-	function setNesting(bool enable, address[] memory collections) external;
-}
-
 // Selector: 41369377
 interface TokenProperties is Dummy, ERC165 {
 	// Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa
@@ -258,6 +213,63 @@
 		returns (bool);
 }
 
+// Selector: f56cd7fa
+interface Collection is Dummy, ERC165 {
+	// Selector: setCollectionProperty(string,bytes) 2f073f66
+	function setCollectionProperty(string memory key, bytes memory value)
+		external;
+
+	// Selector: deleteCollectionProperty(string) 7b7debce
+	function deleteCollectionProperty(string memory key) external;
+
+	// Throws error if key not found
+	//
+	// Selector: collectionProperty(string) cf24fd6d
+	function collectionProperty(string memory key)
+		external
+		view
+		returns (bytes memory);
+
+	// Selector: ethSetSponsor(address) 8f9af356
+	function ethSetSponsor(address sponsor) external;
+
+	// Selector: ethConfirmSponsorship() a8580d1a
+	function ethConfirmSponsorship() external;
+
+	// Selector: setLimit(string,uint32) 68db30ca
+	function setLimit(string memory limit, uint32 value) external;
+
+	// Selector: setLimit(string,bool) ea67e4c2
+	function setLimit(string memory limit, bool value) external;
+
+	// Selector: contractAddress() f6b4dfb4
+	function contractAddress() external view returns (address);
+
+	// Selector: addAdmin(address) 70480275
+	function addAdmin(address newAdmin) external view;
+
+	// Selector: removeAdmin(address) 1785f53c
+	function removeAdmin(address admin) external view;
+
+	// Selector: setNesting(bool) e8fc50dd
+	function setNesting(bool enable) external;
+
+	// Selector: setNesting(bool,address[]) 7df12a9a
+	function setNesting(bool enable, address[] memory collections) external;
+
+	// Selector: setAccess(string) 488f56aa
+	function setAccess(string memory mode) external;
+
+	// Selector: addToAllowList(address) 31f59102
+	function addToAllowList(address user) external view;
+
+	// Selector: removeFromAllowList(address) eba8dabc
+	function removeFromAllowList(address user) external view;
+
+	// Selector: setMintMode(bool) 5dea9bd5
+	function setMintMode(bool mode) external;
+}
+
 interface UniqueNFT is
 	Dummy,
 	ERC165,
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
--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -91,6 +91,15 @@
   },
   {
     "inputs": [
+      { "internalType": "address", "name": "user", "type": "address" }
+    ],
+    "name": "addToAllowList",
+    "outputs": [],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "approved", "type": "address" },
       { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
     ],
@@ -300,6 +309,15 @@
   },
   {
     "inputs": [
+      { "internalType": "address", "name": "user", "type": "address" }
+    ],
+    "name": "removeFromAllowList",
+    "outputs": [],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "from", "type": "address" },
       { "internalType": "address", "name": "to", "type": "address" },
       { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
@@ -322,6 +340,13 @@
     "type": "function"
   },
   {
+    "inputs": [{ "internalType": "string", "name": "mode", "type": "string" }],
+    "name": "setAccess",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
     "inputs": [
       { "internalType": "address", "name": "operator", "type": "address" },
       { "internalType": "bool", "name": "approved", "type": "bool" }
@@ -362,6 +387,13 @@
     "type": "function"
   },
   {
+    "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],
+    "name": "setMintMode",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
     "inputs": [
       { "internalType": "bool", "name": "enable", "type": "bool" },
       {