difftreelog
Merge pull request #654 from UniqueNetwork/feature/solidity_methods_renaming
in: master
Feature/solidity methods renaming
21 files changed
pallets/common/src/erc.rsdiffbeforeafterboth592 ///592 ///593 /// @dev Owner can be changed only by current owner593 /// @dev Owner can be changed only by current owner594 /// @param newOwner new owner account594 /// @param newOwner new owner account595 #[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)?;597598pallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth18}18}191920/// @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 0x62e2229022contract 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 owner298 /// @param newOwner new owner account298 /// @param newOwner new owner account299 /// @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;pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth91}91}929293/// @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 0x62e2229095contract 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 owner371 /// @param newOwner new owner account371 /// @param newOwner new owner account372 /// @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;pallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth91}91}929293/// @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 0x62e2229095contract 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 owner371 /// @param newOwner new owner account371 /// @param newOwner new owner account372 /// @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;pallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterbothbinary blob — no preview
pallets/unique/src/eth/mod.rsdiffbeforeafterboth184 /// @return address Address of the newly created collection184 /// @return address Address of the newly created collection185 #[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,pallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterbothbinary blob — no preview
pallets/unique/src/eth/stubs/CollectionHelpers.soldiffbeforeafterboth45 return 0x0000000000000000000000000000000000000000;45 return 0x0000000000000000000000000000000000000000;46 }46 }474748 /// Create an NFT collection48 // /// Create an NFT collection49 /// @param name Name of the collection49 // /// @param name Name of the collection50 /// @param description Informative description of the collection50 // /// @param description Informative description of the collection51 /// @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 applications52 /// @return address Address of the newly created collection52 // /// @return address Address of the newly created collection53 /// @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 }676368 /// @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)tests/src/eth/api/CollectionHelpers.soldiffbeforeafterboth33 string memory tokenPrefix33 string memory tokenPrefix34 ) external payable returns (address);34 ) external payable returns (address);353536 /// Create an NFT collection36 // /// Create an NFT collection37 /// @param name Name of the collection37 // /// @param name Name of the collection38 /// @param description Informative description of the collection38 // /// @param description Informative description of the collection39 /// @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 applications40 /// @return address Address of the newly created collection40 // /// @return address Address of the newly created collection41 /// @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 tokenPrefix47 ) external payable returns (address);484449 /// @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)tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth13}13}141415/// @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 0x62e2229017interface 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 owner196 /// @param newOwner new owner account196 /// @param newOwner new owner account197 /// @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}201201202/// @dev the ERC-165 identifier for this interface is 0x63034ac5202/// @dev the ERC-165 identifier for this interface is 0x63034ac5tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth62}62}636364/// @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 0x62e2229066interface 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 owner245 /// @param newOwner new owner account245 /// @param newOwner new owner account246 /// @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}250250251/// @dev anonymous struct251/// @dev anonymous structtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth62}62}636364/// @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 0x62e2229066interface 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 owner245 /// @param newOwner new owner account245 /// @param newOwner new owner account246 /// @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}250250251/// @dev anonymous struct251/// @dev anonymous structtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth282 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);284284285 await collectionEvm.methods.setOwner(newOwner).send();285 await collectionEvm.methods.changeCollectionOwner(newOwner).send();286286287 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);306306307 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});tests/src/eth/collectionHelpersAbi.jsondiffbeforeafterboth36 "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" },tests/src/eth/fungibleAbi.jsondiffbeforeafterboth115 "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" }tests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth145 "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" },tests/src/eth/reFungibleAbi.jsondiffbeforeafterboth145 "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" },