git.delta.rocks / unique-network / refs/commits / 4906885c14fb

difftreelog

Merge pull request #654 from UniqueNetwork/feature/solidity_methods_renaming

Yaroslav Bolyukin2022-10-18parents: #e26460b #8f23ca0.patch.diff
in: master
Feature/solidity methods renaming

21 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
592 ///592 ///
593 /// @dev Owner can be changed only by current owner593 /// @dev Owner can be changed only by current owner
594 /// @param newOwner new owner account594 /// @param newOwner new owner account
595 #[solidity(rename_selector = "changeCollectionOwner")]
595 fn set_owner(&mut self, caller: caller, new_owner: address) -> Result<void> {596 fn set_owner(&mut self, caller: caller, new_owner: address) -> Result<void> {
596 self.consume_store_writes(1)?;597 self.consume_store_writes(1)?;
597598
modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
18}18}
1919
20/// @title A contract that allows you to work with collections.20/// @title A contract that allows you to work with collections.
21/// @dev the ERC-165 identifier for this interface is 0x3e1e808321/// @dev the ERC-165 identifier for this interface is 0x62e22290
22contract Collection is Dummy, ERC165 {22contract Collection is Dummy, ERC165 {
23 /// Set collection property.23 /// Set collection property.
24 ///24 ///
296 ///296 ///
297 /// @dev Owner can be changed only by current owner297 /// @dev Owner can be changed only by current owner
298 /// @param newOwner new owner account298 /// @param newOwner new owner account
299 /// @dev EVM selector for this function is: 0x13af4035,299 /// @dev EVM selector for this function is: 0x4f53e226,
300 /// or in textual repr: setOwner(address)300 /// or in textual repr: changeCollectionOwner(address)
301 function setOwner(address newOwner) public {301 function changeCollectionOwner(address newOwner) public {
302 require(false, stub_error);302 require(false, stub_error);
303 newOwner;303 newOwner;
304 dummy = 0;304 dummy = 0;
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
91}91}
9292
93/// @title A contract that allows you to work with collections.93/// @title A contract that allows you to work with collections.
94/// @dev the ERC-165 identifier for this interface is 0x3e1e808394/// @dev the ERC-165 identifier for this interface is 0x62e22290
95contract Collection is Dummy, ERC165 {95contract Collection is Dummy, ERC165 {
96 /// Set collection property.96 /// Set collection property.
97 ///97 ///
369 ///369 ///
370 /// @dev Owner can be changed only by current owner370 /// @dev Owner can be changed only by current owner
371 /// @param newOwner new owner account371 /// @param newOwner new owner account
372 /// @dev EVM selector for this function is: 0x13af4035,372 /// @dev EVM selector for this function is: 0x4f53e226,
373 /// or in textual repr: setOwner(address)373 /// or in textual repr: changeCollectionOwner(address)
374 function setOwner(address newOwner) public {374 function changeCollectionOwner(address newOwner) public {
375 require(false, stub_error);375 require(false, stub_error);
376 newOwner;376 newOwner;
377 dummy = 0;377 dummy = 0;
modifiedpallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth
91}91}
9292
93/// @title A contract that allows you to work with collections.93/// @title A contract that allows you to work with collections.
94/// @dev the ERC-165 identifier for this interface is 0x3e1e808394/// @dev the ERC-165 identifier for this interface is 0x62e22290
95contract Collection is Dummy, ERC165 {95contract Collection is Dummy, ERC165 {
96 /// Set collection property.96 /// Set collection property.
97 ///97 ///
369 ///369 ///
370 /// @dev Owner can be changed only by current owner370 /// @dev Owner can be changed only by current owner
371 /// @param newOwner new owner account371 /// @param newOwner new owner account
372 /// @dev EVM selector for this function is: 0x13af4035,372 /// @dev EVM selector for this function is: 0x4f53e226,
373 /// or in textual repr: setOwner(address)373 /// or in textual repr: changeCollectionOwner(address)
374 function setOwner(address newOwner) public {374 function changeCollectionOwner(address newOwner) public {
375 require(false, stub_error);375 require(false, stub_error);
376 newOwner;376 newOwner;
377 dummy = 0;377 dummy = 0;
modifiedpallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/unique/src/eth/mod.rsdiffbeforeafterboth
184 /// @return address Address of the newly created collection184 /// @return address Address of the newly created collection
185 #[weight(<SelfWeightOf<T>>::create_collection())]185 #[weight(<SelfWeightOf<T>>::create_collection())]
186 #[deprecated(note = "mathod was renamed to `create_nft_collection`, prefer it instead")]186 #[deprecated(note = "mathod was renamed to `create_nft_collection`, prefer it instead")]
187 #[solidity(hide)]
187 fn create_nonfungible_collection(188 fn create_nonfungible_collection(
188 &mut self,189 &mut self,
189 caller: caller,190 caller: caller,
modifiedpallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/unique/src/eth/stubs/CollectionHelpers.soldiffbeforeafterboth
45 return 0x0000000000000000000000000000000000000000;45 return 0x0000000000000000000000000000000000000000;
46 }46 }
4747
48 /// Create an NFT collection48 // /// Create an NFT collection
49 /// @param name Name of the collection49 // /// @param name Name of the collection
50 /// @param description Informative description of the collection50 // /// @param description Informative description of the collection
51 /// @param tokenPrefix Token prefix to represent the collection tokens in UI and user applications51 // /// @param tokenPrefix Token prefix to represent the collection tokens in UI and user applications
52 /// @return address Address of the newly created collection52 // /// @return address Address of the newly created collection
53 /// @dev EVM selector for this function is: 0xe34a6844,53 // /// @dev EVM selector for this function is: 0xe34a6844,
54 /// or in textual repr: createNonfungibleCollection(string,string,string)54 // /// or in textual repr: createNonfungibleCollection(string,string,string)
55 function createNonfungibleCollection(55 // function createNonfungibleCollection(string memory name, string memory description, string memory tokenPrefix) public payable returns (address) {
56 string memory name,56 // require(false, stub_error);
57 string memory description,57 // name;
58 string memory tokenPrefix58 // description;
59 ) public payable returns (address) {59 // tokenPrefix;
60 require(false, stub_error);60 // dummy = 0;
61 name;61 // return 0x0000000000000000000000000000000000000000;
62 description;62 // }
63 tokenPrefix;
64 dummy = 0;
65 return 0x0000000000000000000000000000000000000000;
66 }
6763
68 /// @dev EVM selector for this function is: 0xab173450,64 /// @dev EVM selector for this function is: 0xab173450,
69 /// or in textual repr: createRFTCollection(string,string,string)65 /// or in textual repr: createRFTCollection(string,string,string)
modifiedtests/src/eth/api/CollectionHelpers.soldiffbeforeafterboth
33 string memory tokenPrefix33 string memory tokenPrefix
34 ) external payable returns (address);34 ) external payable returns (address);
3535
36 /// Create an NFT collection36 // /// Create an NFT collection
37 /// @param name Name of the collection37 // /// @param name Name of the collection
38 /// @param description Informative description of the collection38 // /// @param description Informative description of the collection
39 /// @param tokenPrefix Token prefix to represent the collection tokens in UI and user applications39 // /// @param tokenPrefix Token prefix to represent the collection tokens in UI and user applications
40 /// @return address Address of the newly created collection40 // /// @return address Address of the newly created collection
41 /// @dev EVM selector for this function is: 0xe34a6844,41 // /// @dev EVM selector for this function is: 0xe34a6844,
42 /// or in textual repr: createNonfungibleCollection(string,string,string)42 // /// or in textual repr: createNonfungibleCollection(string,string,string)
43 function createNonfungibleCollection(43 // function createNonfungibleCollection(string memory name, string memory description, string memory tokenPrefix) external payable returns (address);
44 string memory name,
45 string memory description,
46 string memory tokenPrefix
47 ) external payable returns (address);
4844
49 /// @dev EVM selector for this function is: 0xab173450,45 /// @dev EVM selector for this function is: 0xab173450,
50 /// or in textual repr: createRFTCollection(string,string,string)46 /// or in textual repr: createRFTCollection(string,string,string)
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
13}13}
1414
15/// @title A contract that allows you to work with collections.15/// @title A contract that allows you to work with collections.
16/// @dev the ERC-165 identifier for this interface is 0x3e1e808316/// @dev the ERC-165 identifier for this interface is 0x62e22290
17interface Collection is Dummy, ERC165 {17interface Collection is Dummy, ERC165 {
18 /// Set collection property.18 /// Set collection property.
19 ///19 ///
194 ///194 ///
195 /// @dev Owner can be changed only by current owner195 /// @dev Owner can be changed only by current owner
196 /// @param newOwner new owner account196 /// @param newOwner new owner account
197 /// @dev EVM selector for this function is: 0x13af4035,197 /// @dev EVM selector for this function is: 0x4f53e226,
198 /// or in textual repr: setOwner(address)198 /// or in textual repr: changeCollectionOwner(address)
199 function setOwner(address newOwner) external;199 function changeCollectionOwner(address newOwner) external;
200}200}
201201
202/// @dev the ERC-165 identifier for this interface is 0x63034ac5202/// @dev the ERC-165 identifier for this interface is 0x63034ac5
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
62}62}
6363
64/// @title A contract that allows you to work with collections.64/// @title A contract that allows you to work with collections.
65/// @dev the ERC-165 identifier for this interface is 0x3e1e808365/// @dev the ERC-165 identifier for this interface is 0x62e22290
66interface Collection is Dummy, ERC165 {66interface Collection is Dummy, ERC165 {
67 /// Set collection property.67 /// Set collection property.
68 ///68 ///
243 ///243 ///
244 /// @dev Owner can be changed only by current owner244 /// @dev Owner can be changed only by current owner
245 /// @param newOwner new owner account245 /// @param newOwner new owner account
246 /// @dev EVM selector for this function is: 0x13af4035,246 /// @dev EVM selector for this function is: 0x4f53e226,
247 /// or in textual repr: setOwner(address)247 /// or in textual repr: changeCollectionOwner(address)
248 function setOwner(address newOwner) external;248 function changeCollectionOwner(address newOwner) external;
249}249}
250250
251/// @dev anonymous struct251/// @dev anonymous struct
modifiedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth
62}62}
6363
64/// @title A contract that allows you to work with collections.64/// @title A contract that allows you to work with collections.
65/// @dev the ERC-165 identifier for this interface is 0x3e1e808365/// @dev the ERC-165 identifier for this interface is 0x62e22290
66interface Collection is Dummy, ERC165 {66interface Collection is Dummy, ERC165 {
67 /// Set collection property.67 /// Set collection property.
68 ///68 ///
243 ///243 ///
244 /// @dev Owner can be changed only by current owner244 /// @dev Owner can be changed only by current owner
245 /// @param newOwner new owner account245 /// @param newOwner new owner account
246 /// @dev EVM selector for this function is: 0x13af4035,246 /// @dev EVM selector for this function is: 0x4f53e226,
247 /// or in textual repr: setOwner(address)247 /// or in textual repr: changeCollectionOwner(address)
248 function setOwner(address newOwner) external;248 function changeCollectionOwner(address newOwner) external;
249}249}
250250
251/// @dev anonymous struct251/// @dev anonymous struct
modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
282 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');282 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
283 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);283 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
284284
285 await collectionEvm.methods.setOwner(newOwner).send();285 await collectionEvm.methods.changeCollectionOwner(newOwner).send();
286286
287 expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.false;287 expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.false;
288 expect(await collectionEvm.methods.isOwnerOrAdmin(newOwner).call()).to.be.true;288 expect(await collectionEvm.methods.isOwnerOrAdmin(newOwner).call()).to.be.true;
293 const newOwner = await helper.eth.createAccountWithBalance(donor);293 const newOwner = await helper.eth.createAccountWithBalance(donor);
294 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');294 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
295 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);295 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
296 const cost = await recordEthFee(helper, owner, () => collectionEvm.methods.setOwner(newOwner).send());296 const cost = await recordEthFee(helper, owner, () => collectionEvm.methods.changeCollectionOwner(newOwner).send());
297 expect(cost < BigInt(0.2 * Number(helper.balance.getOneTokenNominal())));297 expect(cost < BigInt(0.2 * Number(helper.balance.getOneTokenNominal())));
298 expect(cost > 0);298 expect(cost > 0);
299 });299 });
304 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');304 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
305 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);305 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
306306
307 await expect(collectionEvm.methods.setOwner(newOwner).send({from: newOwner})).to.be.rejected;307 await expect(collectionEvm.methods.changeCollectionOwner(newOwner).send({from: newOwner})).to.be.rejected;
308 expect(await collectionEvm.methods.isOwnerOrAdmin(newOwner).call()).to.be.false;308 expect(await collectionEvm.methods.isOwnerOrAdmin(newOwner).call()).to.be.false;
309 });309 });
310});310});
modifiedtests/src/eth/collectionHelpersAbi.jsondiffbeforeafterboth
36 "stateMutability": "payable",36 "stateMutability": "payable",
37 "type": "function"37 "type": "function"
38 },38 },
39 {
40 "inputs": [
41 { "internalType": "string", "name": "name", "type": "string" },
42 { "internalType": "string", "name": "description", "type": "string" },
43 { "internalType": "string", "name": "tokenPrefix", "type": "string" }
44 ],
45 "name": "createNonfungibleCollection",
46 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
47 "stateMutability": "payable",
48 "type": "function"
49 },
50 {39 {
51 "inputs": [40 "inputs": [
52 { "internalType": "string", "name": "name", "type": "string" },41 { "internalType": "string", "name": "name", "type": "string" },
modifiedtests/src/eth/fungibleAbi.jsondiffbeforeafterboth
115 "stateMutability": "nonpayable",115 "stateMutability": "nonpayable",
116 "type": "function"116 "type": "function"
117 },117 },
118 {
119 "inputs": [
120 { "internalType": "address", "name": "newOwner", "type": "address" }
121 ],
122 "name": "changeCollectionOwner",
123 "outputs": [],
124 "stateMutability": "nonpayable",
125 "type": "function"
126 },
118 {127 {
119 "inputs": [],128 "inputs": [],
120 "name": "collectionOwner",129 "name": "collectionOwner",
333 "stateMutability": "nonpayable",342 "stateMutability": "nonpayable",
334 "type": "function"343 "type": "function"
335 },344 },
336 {
337 "inputs": [
338 { "internalType": "address", "name": "newOwner", "type": "address" }
339 ],
340 "name": "setOwner",
341 "outputs": [],
342 "stateMutability": "nonpayable",
343 "type": "function"
344 },
345 {345 {
346 "inputs": [346 "inputs": [
347 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }347 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
145 "stateMutability": "nonpayable",145 "stateMutability": "nonpayable",
146 "type": "function"146 "type": "function"
147 },147 },
148 {
149 "inputs": [
150 { "internalType": "address", "name": "newOwner", "type": "address" }
151 ],
152 "name": "changeCollectionOwner",
153 "outputs": [],
154 "stateMutability": "nonpayable",
155 "type": "function"
156 },
148 {157 {
149 "inputs": [],158 "inputs": [],
150 "name": "collectionOwner",159 "name": "collectionOwner",
476 "stateMutability": "nonpayable",485 "stateMutability": "nonpayable",
477 "type": "function"486 "type": "function"
478 },487 },
479 {
480 "inputs": [
481 { "internalType": "address", "name": "newOwner", "type": "address" }
482 ],
483 "name": "setOwner",
484 "outputs": [],
485 "stateMutability": "nonpayable",
486 "type": "function"
487 },
488 {488 {
489 "inputs": [489 "inputs": [
490 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },490 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
modifiedtests/src/eth/reFungibleAbi.jsondiffbeforeafterboth
145 "stateMutability": "nonpayable",145 "stateMutability": "nonpayable",
146 "type": "function"146 "type": "function"
147 },147 },
148 {
149 "inputs": [
150 { "internalType": "address", "name": "newOwner", "type": "address" }
151 ],
152 "name": "changeCollectionOwner",
153 "outputs": [],
154 "stateMutability": "nonpayable",
155 "type": "function"
156 },
148 {157 {
149 "inputs": [],158 "inputs": [],
150 "name": "collectionOwner",159 "name": "collectionOwner",
476 "stateMutability": "nonpayable",485 "stateMutability": "nonpayable",
477 "type": "function"486 "type": "function"
478 },487 },
479 {
480 "inputs": [
481 { "internalType": "address", "name": "newOwner", "type": "address" }
482 ],
483 "name": "setOwner",
484 "outputs": [],
485 "stateMutability": "nonpayable",
486 "type": "function"
487 },
488 {488 {
489 "inputs": [489 "inputs": [
490 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },490 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },