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

difftreelog

CORE-302 Fix shema => schema

Trubnikov Sergey2022-04-27parent: #4647586.patch.diff
in: master

6 files changed

modifiedpallets/evm-collection/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-collection/src/eth.rs
+++ b/pallets/evm-collection/src/eth.rs
@@ -130,20 +130,20 @@
 		Ok(())
 	}
 
-	fn set_offchain_shema(
+	fn set_offchain_schema(
 		&self,
 		caller: caller,
 		collection_address: address,
-		shema: string,
+		schema: string,
 	) -> Result<void> {
 		let mut collection = collection_from_address(collection_address, &self.0)?;
 		check_is_owner(caller, &collection)?;
 
-		let shema = shema
+		let schema = schema
 			.into_bytes()
 			.try_into()
 			.map_err(|_| error_feild_too_long(stringify!(shema), OFFCHAIN_SCHEMA_LIMIT))?;
-		// collection.offchain_schema = shema;
+		// collection.offchain_schema = schema;
 		collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
 		Ok(())
 	}
modifiedpallets/evm-collection/src/stubs/Collection.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/evm-collection/src/stubs/Collection.soldiffbeforeafterboth
before · pallets/evm-collection/src/stubs/Collection.sol
1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56// Common stubs holder7contract Dummy {8	uint8 dummy;9	string stub_error = "this contract is implemented in native";10}1112contract ERC165 is Dummy {13	function supportsInterface(bytes4 interfaceID)14		external15		view16		returns (bool)17	{18		require(false, stub_error);19		interfaceID;20		return true;21	}22}2324// Selector: 037b69c825contract Collection is Dummy, ERC165 {26	// Selector: create721Collection(string,string,string) 951c015127	function create721Collection(28		string memory name,29		string memory description,30		string memory tokenPrefix31	) public view returns (address) {32		require(false, stub_error);33		name;34		description;35		tokenPrefix;36		dummy;37		return 0x0000000000000000000000000000000000000000;38	}3940	// Selector: setSponsor(address,address) f01fba9341	function setSponsor(address collectionAddress, address sponsor)42		public43		view44	{45		require(false, stub_error);46		collectionAddress;47		sponsor;48		dummy;49	}5051	// Selector: confirmSponsorship(address) abc0000152	function confirmSponsorship(address collectionAddress) public view {53		require(false, stub_error);54		collectionAddress;55		dummy;56	}5758	// Selector: setOffchainShema(address,string) d7dc2de359	function setOffchainShema(address collectionAddress, string memory shema)60		public61		view62	{63		require(false, stub_error);64		collectionAddress;65		shema;66		dummy;67	}6869	// Selector: setVariableOnChainSchema(address,string) 582691c370	function setVariableOnChainSchema(71		address collectionAddress,72		string memory variable73	) public view {74		require(false, stub_error);75		collectionAddress;76		variable;77		dummy;78	}7980	// Selector: setConstOnChainSchema(address,string) 921456e781	function setConstOnChainSchema(82		address collectionAddress,83		string memory constOnChain84	) public view {85		require(false, stub_error);86		collectionAddress;87		constOnChain;88		dummy;89	}9091	// Selector: setLimits(address,string) d05638cc92	function setLimits(address collectionAddress, string memory limitsJson)93		public94		view95	{96		require(false, stub_error);97		collectionAddress;98		limitsJson;99		dummy;100	}101}
after · pallets/evm-collection/src/stubs/Collection.sol
1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56// Common stubs holder7contract Dummy {8	uint8 dummy;9	string stub_error = "this contract is implemented in native";10}1112contract ERC165 is Dummy {13	function supportsInterface(bytes4 interfaceID)14		external15		view16		returns (bool)17	{18		require(false, stub_error);19		interfaceID;20		return true;21	}22}2324// Selector: f83ad95b25contract Collection is Dummy, ERC165 {26	// Selector: create721Collection(string,string,string) 951c015127	function create721Collection(28		string memory name,29		string memory description,30		string memory tokenPrefix31	) public view returns (address) {32		require(false, stub_error);33		name;34		description;35		tokenPrefix;36		dummy;37		return 0x0000000000000000000000000000000000000000;38	}3940	// Selector: setSponsor(address,address) f01fba9341	function setSponsor(address collectionAddress, address sponsor)42		public43		view44	{45		require(false, stub_error);46		collectionAddress;47		sponsor;48		dummy;49	}5051	// Selector: confirmSponsorship(address) abc0000152	function confirmSponsorship(address collectionAddress) public view {53		require(false, stub_error);54		collectionAddress;55		dummy;56	}5758	// Selector: setOffchainSchema(address,string) 2c9d9d7059	function setOffchainSchema(address collectionAddress, string memory shema)60		public61		view62	{63		require(false, stub_error);64		collectionAddress;65		shema;66		dummy;67	}6869	// Selector: setVariableOnChainSchema(address,string) 582691c370	function setVariableOnChainSchema(71		address collectionAddress,72		string memory variable73	) public view {74		require(false, stub_error);75		collectionAddress;76		variable;77		dummy;78	}7980	// Selector: setConstOnChainSchema(address,string) 921456e781	function setConstOnChainSchema(82		address collectionAddress,83		string memory constOnChain84	) public view {85		require(false, stub_error);86		collectionAddress;87		constOnChain;88		dummy;89	}9091	// Selector: setLimits(address,string) d05638cc92	function setLimits(address collectionAddress, string memory limitsJson)93		public94		view95	{96		require(false, stub_error);97		collectionAddress;98		limitsJson;99		dummy;100	}101}
modifiedtests/src/eth/api/Collection.soldiffbeforeafterboth
--- a/tests/src/eth/api/Collection.sol
+++ b/tests/src/eth/api/Collection.sol
@@ -12,7 +12,7 @@
 	function supportsInterface(bytes4 interfaceID) external view returns (bool);
 }
 
-// Selector: 037b69c8
+// Selector: f83ad95b
 interface Collection is Dummy, ERC165 {
 	// Selector: create721Collection(string,string,string) 951c0151
 	function create721Collection(
@@ -29,8 +29,8 @@
 	// Selector: confirmSponsorship(address) abc00001
 	function confirmSponsorship(address collectionAddress) external view;
 
-	// Selector: setOffchainShema(address,string) d7dc2de3
-	function setOffchainShema(address collectionAddress, string memory shema)
+	// Selector: setOffchainSchema(address,string) 2c9d9d70
+	function setOffchainSchema(address collectionAddress, string memory shema)
 		external
 		view;
 
modifiedtests/src/eth/collectionAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/collectionAbi.json
+++ b/tests/src/eth/collectionAbi.json
@@ -60,7 +60,7 @@
       },
       { "internalType": "string", "name": "shema", "type": "string" }
     ],
-    "name": "setOffchainShema",
+    "name": "setOffchainSchema",
     "outputs": [],
     "stateMutability": "view",
     "type": "function"
modifiedtests/src/eth/createCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createCollection.test.ts
+++ b/tests/src/eth/createCollection.test.ts
@@ -79,15 +79,15 @@
     expect(collection.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));
   });
   
-  itWeb3('Set offchain shema', async ({api, web3}) => {
+  itWeb3('Set offchain schema', async ({api, web3}) => {
     const owner = await createEthAccountWithBalance(api, web3);
     const helper = collectionHelper(web3, owner);
-    let result = await helper.methods.create721Collection('Shema collection', '2', '2').send();
+    let result = await helper.methods.create721Collection('Schema collection', '2', '2').send();
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
-    const shema = 'Some shema';
-    result = await helper.methods.setOffchainShema(collectionIdAddress, shema).send();
+    const schema = 'Some schema';
+    result = await helper.methods.setOffchainSchema(collectionIdAddress, schema).send();
     const collection = (await getDetailedCollectionInfo(api, collectionId))!;
-    expect(collection.offchainSchema.toHuman()).to.be.eq(shema);
+    expect(collection.offchainSchema.toHuman()).to.be.eq(schema);
   });
   
   itWeb3('Set variable on chain schema', async ({api, web3}) => {
@@ -106,10 +106,10 @@
     const helper = collectionHelper(web3, owner);
     let result = await helper.methods.create721Collection('Const collection', '4', '4').send();
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
-    const constShema = 'Some const';
-    result = await helper.methods.setConstOnChainSchema(collectionIdAddress, constShema).send();
+    const constSchema = 'Some const';
+    result = await helper.methods.setConstOnChainSchema(collectionIdAddress, constSchema).send();
     const collection = (await getDetailedCollectionInfo(api, collectionId))!;
-    expect(collection.constOnChainSchema.toHuman()).to.be.eq(constShema);
+    expect(collection.constOnChainSchema.toHuman()).to.be.eq(constSchema);
   });
 
   itWeb3('Set limits', async ({api, web3}) => {
@@ -178,7 +178,7 @@
     expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');
 
     // TODO: this wont work right now, need release 919000 first
-    // await helper.methods.setOffchainShema(collectionIdAddress, 'https://offchain-service.local/token-info/{id}').send();
+    // await helper.methods.setOffchainSchema(collectionIdAddress, 'https://offchain-service.local/token-info/{id}').send();
     // const tokenUri = await contract.methods.tokenURI(nextTokenId).call();
     // expect(tokenUri).to.be.equal(`https://offchain-service.local/token-info/${nextTokenId}`);
   });
@@ -248,9 +248,9 @@
         .call()).to.be.rejectedWith(EXPECTED_ERROR);
     }
     {
-      const shema = 'Some shema';
+      const schema = 'Some schema';
       await expect(helper.methods
-        .setOffchainShema(collectionAddressWithBadPrefix, shema)
+        .setOffchainSchema(collectionAddressWithBadPrefix, schema)
         .call()).to.be.rejectedWith(EXPECTED_ERROR);
     }
     {
@@ -293,9 +293,9 @@
         .call()).to.be.rejectedWith('Caller is not set as sponsor');
     }
     {
-      const shema = 'Some shema';
+      const schema = 'Some schema';
       await expect(helperFromNotOwner.methods
-        .setOffchainShema(collectionIdAddress, shema)
+        .setOffchainSchema(collectionIdAddress, schema)
         .call()).to.be.rejectedWith(EXPECTED_ERROR);
     }
     {
@@ -318,22 +318,22 @@
     }
   });
 
-  itWeb3('(!negative test!) Set offchain shema (length limit)', async ({api, web3}) => {
+  itWeb3('(!negative test!) Set offchain schema (length limit)', async ({api, web3}) => {
     const owner = await createEthAccountWithBalance(api, web3);
     const helper = collectionHelper(web3, owner);
-    const result = await helper.methods.create721Collection('Shema collection', 'A', 'A').send();
+    const result = await helper.methods.create721Collection('Schema collection', 'A', 'A').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const OFFCHAIN_SCHEMA_LIMIT = 8192;
-    const shema = 'A'.repeat(OFFCHAIN_SCHEMA_LIMIT + 1);
+    const schema = 'A'.repeat(OFFCHAIN_SCHEMA_LIMIT + 1);
     await expect(helper.methods
-      .setOffchainShema(collectionIdAddress, shema)
-      .call()).to.be.rejectedWith('shema is too long. Max length is ' + OFFCHAIN_SCHEMA_LIMIT);
+      .setOffchainSchema(collectionIdAddress, schema)
+      .call()).to.be.rejectedWith('schema is too long. Max length is ' + OFFCHAIN_SCHEMA_LIMIT);
   });
 
   itWeb3('(!negative test!) Set variable on chain schema (length limit)', async ({api, web3}) => {
     const owner = await createEthAccountWithBalance(api, web3);
     const helper = collectionHelper(web3, owner);
-    const result = await helper.methods.create721Collection('Shema collection', 'A', 'A').send();
+    const result = await helper.methods.create721Collection('Schema collection', 'A', 'A').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const VARIABLE_ON_CHAIN_SCHEMA_LIMIT = 8192;
     const variable = 'A'.repeat(VARIABLE_ON_CHAIN_SCHEMA_LIMIT + 1);
@@ -345,7 +345,7 @@
   itWeb3('(!negative test!) Set const on chain schema (length limit)', async ({api, web3}) => {
     const owner = await createEthAccountWithBalance(api, web3);
     const helper = collectionHelper(web3, owner);
-    const result = await helper.methods.create721Collection('Shema collection', 'A', 'A').send();
+    const result = await helper.methods.create721Collection('Schema collection', 'A', 'A').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const CONST_ON_CHAIN_SCHEMA_LIMIT = 32768;
     const constData = 'A'.repeat(CONST_ON_CHAIN_SCHEMA_LIMIT + 1);
@@ -357,7 +357,7 @@
   itWeb3('(!negative test!) Set limits', async ({api, web3}) => {
     const owner = await createEthAccountWithBalance(api, web3);
     const helper = collectionHelper(web3, owner);
-    const result = await helper.methods.create721Collection('Shema collection', 'A', 'A').send();
+    const result = await helper.methods.create721Collection('Schema collection', 'A', 'A').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const badJson = '{accountTokenOwnershipLimit: 1000}';
     await expect(helper.methods