difftreelog
Merge pull request #829 from UniqueNetwork/feature/remove_and_hide_some_minting_methods_and_events
in: master
24 files changed
pallets/nonfungible/src/erc.rsdiffbeforeafterboth291 },291 },292}292}293294#[derive(ToLog)]295pub enum ERC721UniqueMintableEvents {296 #[allow(dead_code)]297 MintingFinished {},298}299293300/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension294/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension301/// @dev See https://eips.ethereum.org/EIPS/eip-721295/// @dev See https://eips.ethereum.org/EIPS/eip-721544}538}545539546/// @title ERC721 minting logic.540/// @title ERC721 minting logic.547#[solidity_interface(name = ERC721UniqueMintable, events(ERC721UniqueMintableEvents))]541#[solidity_interface(name = ERC721UniqueMintable)]548impl<T: Config> NonfungibleHandle<T> {542impl<T: Config> NonfungibleHandle<T> {549 fn minting_finished(&self) -> Result<bool> {550 Ok(false)551 }552553 /// @notice Function to mint a token.543 /// @notice Function to mint a token.554 /// @param to The new owner544 /// @param to The new owner680 Ok(true)670 Ok(true)681 }671 }682683 /// @dev Not implemented684 fn finish_minting(&mut self, _caller: caller) -> Result<bool> {685 Err("not implementable".into())686 }687}672}688673689fn get_token_property<T: Config>(674fn get_token_property<T: Config>(pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth700 }700 }701}701}702703/// @dev inlined interface704contract ERC721UniqueMintableEvents {705 event MintingFinished();706}707702708/// @title ERC721 minting logic.703/// @title ERC721 minting logic.709/// @dev the ERC-165 identifier for this interface is 0x476ff149704/// @dev the ERC-165 identifier for this interface is 0x3fd94ea6710contract ERC721UniqueMintable is Dummy, ERC165, ERC721UniqueMintableEvents {705contract ERC721UniqueMintable is Dummy, ERC165 {711 /// @dev EVM selector for this function is: 0x05d2035b,712 /// or in textual repr: mintingFinished()713 function mintingFinished() public view returns (bool) {714 require(false, stub_error);715 dummy;716 return false;717 }718719 /// @notice Function to mint a token.706 /// @notice Function to mint a token.720 /// @param to The new owner707 /// @param to The new owner774 // return false;760 // return false;775 // }761 // }776762777 /// @dev Not implemented778 /// @dev EVM selector for this function is: 0x7d64bcb4,779 /// or in textual repr: finishMinting()780 function finishMinting() public returns (bool) {781 require(false, stub_error);782 dummy = 0;783 return false;784 }785}763}786764787/// @title Unique extensions for ERC721.765/// @title Unique extensions for ERC721.pallets/refungible/src/erc.rsdiffbeforeafterboth288 },288 },289}289}290291#[derive(ToLog)]292pub enum ERC721UniqueMintableEvents {293 /// @dev Not supported294 #[allow(dead_code)]295 MintingFinished {},296}297290298/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension291/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension299/// @dev See https://eips.ethereum.org/EIPS/eip-721292/// @dev See https://eips.ethereum.org/EIPS/eip-721576}569}577570578/// @title ERC721 minting logic.571/// @title ERC721 minting logic.579#[solidity_interface(name = ERC721UniqueMintable, events(ERC721UniqueMintableEvents))]572#[solidity_interface(name = ERC721UniqueMintable)]580impl<T: Config> RefungibleHandle<T> {573impl<T: Config> RefungibleHandle<T> {581 fn minting_finished(&self) -> Result<bool> {582 Ok(false)583 }584585 /// @notice Function to mint a token.574 /// @notice Function to mint a token.586 /// @param to The new owner575 /// @param to The new owner719 Ok(true)708 Ok(true)720 }709 }721722 /// @dev Not implemented723 fn finish_minting(&mut self, _caller: caller) -> Result<bool> {724 Err("not implementable".into())725 }726}710}727711728fn get_token_property<T: Config>(712fn get_token_property<T: Config>(pallets/refungible/src/erc_token.rsdiffbeforeafterboth25 ops::Deref,25 ops::Deref,26};26};27use evm_coder::{27use evm_coder::{28 abi::AbiType, ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight,28 abi::AbiType, ToLog, execution::*, generate_stubgen, solidity_interface, solidity, types::*,29 weight,29};30};30use pallet_common::{31use pallet_common::{206 /// @param from The account whose tokens will be burnt.207 /// @param from The account whose tokens will be burnt.207 /// @param amount The amount that will be burnt.208 /// @param amount The amount that will be burnt.208 #[weight(<SelfWeightOf<T>>::burn_from())]209 #[weight(<SelfWeightOf<T>>::burn_from())]210 #[solidity(hide)]209 fn burn_from(&mut self, caller: caller, from: address, amount: uint256) -> Result<bool> {211 fn burn_from(&mut self, caller: caller, from: address, amount: uint256) -> Result<bool> {210 let caller = T::CrossAccountId::from_eth(caller);212 let caller = T::CrossAccountId::from_eth(caller);211 let from = T::CrossAccountId::from_eth(from);213 let from = T::CrossAccountId::from_eth(from);pallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth700 }700 }701}701}702703/// @dev inlined interface704contract ERC721UniqueMintableEvents {705 event MintingFinished();706}707702708/// @title ERC721 minting logic.703/// @title ERC721 minting logic.709/// @dev the ERC-165 identifier for this interface is 0x476ff149704/// @dev the ERC-165 identifier for this interface is 0x3fd94ea6710contract ERC721UniqueMintable is Dummy, ERC165, ERC721UniqueMintableEvents {705contract ERC721UniqueMintable is Dummy, ERC165 {711 /// @dev EVM selector for this function is: 0x05d2035b,712 /// or in textual repr: mintingFinished()713 function mintingFinished() public view returns (bool) {714 require(false, stub_error);715 dummy;716 return false;717 }718719 /// @notice Function to mint a token.706 /// @notice Function to mint a token.720 /// @param to The new owner707 /// @param to The new owner774 // return false;760 // return false;775 // }761 // }776762777 /// @dev Not implemented778 /// @dev EVM selector for this function is: 0x7d64bcb4,779 /// or in textual repr: finishMinting()780 function finishMinting() public returns (bool) {781 require(false, stub_error);782 dummy = 0;783 return false;784 }785}763}786764787/// @title Unique extensions for ERC721.765/// @title Unique extensions for ERC721.pallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungibleToken.soldiffbeforeafterboth383839/// @dev the ERC-165 identifier for this interface is 0xe17a7d2b39/// @dev the ERC-165 identifier for this interface is 0xe17a7d2b40contract ERC20UniqueExtensions is Dummy, ERC165 {40contract ERC20UniqueExtensions is Dummy, ERC165 {41 /// @dev Function that burns an amount of the token of a given account,41 // /// @dev Function that burns an amount of the token of a given account,42 /// deducting from the sender's allowance for said account.42 // /// deducting from the sender's allowance for said account.43 /// @param from The account whose tokens will be burnt.43 // /// @param from The account whose tokens will be burnt.44 /// @param amount The amount that will be burnt.44 // /// @param amount The amount that will be burnt.45 /// @dev EVM selector for this function is: 0x79cc6790,45 // /// @dev EVM selector for this function is: 0x79cc6790,46 /// or in textual repr: burnFrom(address,uint256)46 // /// or in textual repr: burnFrom(address,uint256)47 function burnFrom(address from, uint256 amount) public returns (bool) {47 // function burnFrom(address from, uint256 amount) public returns (bool) {48 require(false, stub_error);48 // require(false, stub_error);49 from;49 // from;50 amount;50 // amount;51 dummy = 0;51 // dummy = 0;52 return false;52 // return false;53 }53 // }545455 /// @dev Function that burns an amount of the token of a given account,55 /// @dev Function that burns an amount of the token of a given account,56 /// deducting from the sender's allowance for said account.56 /// deducting from the sender's allowance for said account.runtime/common/ethereum/sponsoring/refungible.rsdiffbeforeafterboth265265266 match call {266 match call {267 // Readonly267 // Readonly268 ERC165Call(_, _) | MintingFinished => None,268 ERC165Call(_, _) => None,269269270 // Not sponsored270 // Sponsored271 FinishMinting => None,272273 Mint { .. }271 Mint { .. }274 | MintCheckId { .. }272 | MintCheckId { .. }tests/src/check-event/burnItemEvent.test.tsdiffbeforeafterboth32 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});32 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});33 const token = await collection.mintToken(alice, {Substrate: alice.address});33 const token = await collection.mintToken(alice, {Substrate: alice.address});34 await token.burn(alice);34 await token.burn(alice);35 await helper.wait.newBlocks(1);353636 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];37 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];37 const eventStrings = event.map(e => `${e.section}.${e.method}`);38 const eventStrings = event.map(e => `${e.section}.${e.method}`);tests/src/check-event/createCollectionEvent.test.tsdiffbeforeafterboth29 });29 });30 itSub('Check event from createCollection(): ', async ({helper}) => {30 itSub('Check event from createCollection(): ', async ({helper}) => {31 await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});31 await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});32 await helper.wait.newBlocks(1);32 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];33 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];33 const eventStrings = event.map(e => `${e.section}.${e.method}`);34 const eventStrings = event.map(e => `${e.section}.${e.method}`);3435tests/src/check-event/createItemEvent.test.tsdiffbeforeafterboth30 itSub('Check event from createItem(): ', async ({helper}) => {30 itSub('Check event from createItem(): ', async ({helper}) => {31 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});31 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});32 await collection.mintToken(alice, {Substrate: alice.address});32 await collection.mintToken(alice, {Substrate: alice.address});33 await helper.wait.newBlocks(1);33 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];34 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];34 const eventStrings = event.map(e => `${e.section}.${e.method}`);35 const eventStrings = event.map(e => `${e.section}.${e.method}`);3536tests/src/check-event/createMultipleItemsEvent.test.tsdiffbeforeafterboth35 {owner: {Substrate: alice.address}},35 {owner: {Substrate: alice.address}},36 ]);36 ]);373738 await helper.wait.newBlocks(1);38 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];39 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];39 const eventStrings = event.map(e => `${e.section}.${e.method}`);40 const eventStrings = event.map(e => `${e.section}.${e.method}`);4041tests/src/check-event/destroyCollectionEvent.test.tsdiffbeforeafterboth31 itSub('Check event from destroyCollection(): ', async ({helper}) => {31 itSub('Check event from destroyCollection(): ', async ({helper}) => {32 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});32 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});33 await collection.burn(alice);33 await collection.burn(alice);34 await helper.wait.newBlocks(1);34 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];35 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];35 const eventStrings = event.map(e => `${e.section}.${e.method}`);36 const eventStrings = event.map(e => `${e.section}.${e.method}`);3637tests/src/check-event/transferEvent.test.tsdiffbeforeafterboth34 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});34 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});35 const token = await collection.mintToken(alice, {Substrate: alice.address});35 const token = await collection.mintToken(alice, {Substrate: alice.address});36 await token.transfer(alice, {Substrate: bob.address});36 await token.transfer(alice, {Substrate: bob.address});37 await helper.wait.newBlocks(1);37 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];38 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];38 const eventStrings = event.map(e => `${e.section}.${e.method}`);39 const eventStrings = event.map(e => `${e.section}.${e.method}`);3940tests/src/check-event/transferFromEvent.test.tsdiffbeforeafterboth33 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});33 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});34 const token = await collection.mintToken(alice, {Substrate: alice.address});34 const token = await collection.mintToken(alice, {Substrate: alice.address});35 await token.transferFrom(alice, {Substrate: alice.address}, {Substrate: bob.address});35 await token.transferFrom(alice, {Substrate: alice.address}, {Substrate: bob.address});36 await helper.wait.newBlocks(1);36 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];37 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];37 const eventStrings = event.map(e => `${e.section}.${e.method}`);38 const eventStrings = event.map(e => `${e.section}.${e.method}`);3839tests/src/eth/abi/nonFungible.jsondiffbeforeafterboth49 "name": "ApprovalForAll",49 "name": "ApprovalForAll",50 "type": "event"50 "type": "event"51 },51 },52 {53 "anonymous": false,54 "inputs": [],55 "name": "MintingFinished",56 "type": "event"57 },58 {52 {59 "anonymous": false,53 "anonymous": false,60 "inputs": [54 "inputs": [422 "stateMutability": "view",416 "stateMutability": "view",423 "type": "function"417 "type": "function"424 },418 },425 {426 "inputs": [],427 "name": "finishMinting",428 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],429 "stateMutability": "nonpayable",430 "type": "function"431 },432 {419 {433 "inputs": [420 "inputs": [434 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }421 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }515 "stateMutability": "nonpayable",502 "stateMutability": "nonpayable",516 "type": "function"503 "type": "function"517 },504 },518 {519 "inputs": [],520 "name": "mintingFinished",521 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],522 "stateMutability": "view",523 "type": "function"524 },525 {505 {526 "inputs": [],506 "inputs": [],527 "name": "name",507 "name": "name",tests/src/eth/abi/reFungible.jsondiffbeforeafterboth49 "name": "ApprovalForAll",49 "name": "ApprovalForAll",50 "type": "event"50 "type": "event"51 },51 },52 {53 "anonymous": false,54 "inputs": [],55 "name": "MintingFinished",56 "type": "event"57 },58 {52 {59 "anonymous": false,53 "anonymous": false,60 "inputs": [54 "inputs": [404 "stateMutability": "view",398 "stateMutability": "view",405 "type": "function"399 "type": "function"406 },400 },407 {408 "inputs": [],409 "name": "finishMinting",410 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],411 "stateMutability": "nonpayable",412 "type": "function"413 },414 {401 {415 "inputs": [402 "inputs": [416 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }403 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }497 "stateMutability": "nonpayable",484 "stateMutability": "nonpayable",498 "type": "function"485 "type": "function"499 },486 },500 {501 "inputs": [],502 "name": "mintingFinished",503 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],504 "stateMutability": "view",505 "type": "function"506 },507 {487 {508 "inputs": [],488 "inputs": [],509 "name": "name",489 "name": "name",tests/src/eth/abi/reFungibleToken.jsondiffbeforeafterboth96 "stateMutability": "view",96 "stateMutability": "view",97 "type": "function"97 "type": "function"98 },98 },99 {100 "inputs": [101 { "internalType": "address", "name": "from", "type": "address" },102 { "internalType": "uint256", "name": "amount", "type": "uint256" }103 ],104 "name": "burnFrom",105 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],106 "stateMutability": "nonpayable",107 "type": "function"108 },109 {99 {110 "inputs": [100 "inputs": [111 {101 {tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth483 function burn(uint256 tokenId) external;483 function burn(uint256 tokenId) external;484}484}485486/// @dev inlined interface487interface ERC721UniqueMintableEvents {488 event MintingFinished();489}490485491/// @title ERC721 minting logic.486/// @title ERC721 minting logic.492/// @dev the ERC-165 identifier for this interface is 0x476ff149487/// @dev the ERC-165 identifier for this interface is 0x3fd94ea6493interface ERC721UniqueMintable is Dummy, ERC165, ERC721UniqueMintableEvents {488interface ERC721UniqueMintable is Dummy, ERC165 {494 /// @dev EVM selector for this function is: 0x05d2035b,495 /// or in textual repr: mintingFinished()496 function mintingFinished() external view returns (bool);497498 /// @notice Function to mint a token.489 /// @notice Function to mint a token.499 /// @param to The new owner490 /// @param to The new owner529 // /// or in textual repr: mintWithTokenURI(address,uint256,string)519 // /// or in textual repr: mintWithTokenURI(address,uint256,string)530 // function mintWithTokenURI(address to, uint256 tokenId, string memory tokenUri) external returns (bool);520 // function mintWithTokenURI(address to, uint256 tokenId, string memory tokenUri) external returns (bool);531521532 /// @dev Not implemented533 /// @dev EVM selector for this function is: 0x7d64bcb4,534 /// or in textual repr: finishMinting()535 function finishMinting() external returns (bool);536}522}537523538/// @title Unique extensions for ERC721.524/// @title Unique extensions for ERC721.tests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth483 function burn(uint256 tokenId) external;483 function burn(uint256 tokenId) external;484}484}485486/// @dev inlined interface487interface ERC721UniqueMintableEvents {488 event MintingFinished();489}490485491/// @title ERC721 minting logic.486/// @title ERC721 minting logic.492/// @dev the ERC-165 identifier for this interface is 0x476ff149487/// @dev the ERC-165 identifier for this interface is 0x3fd94ea6493interface ERC721UniqueMintable is Dummy, ERC165, ERC721UniqueMintableEvents {488interface ERC721UniqueMintable is Dummy, ERC165 {494 /// @dev EVM selector for this function is: 0x05d2035b,495 /// or in textual repr: mintingFinished()496 function mintingFinished() external view returns (bool);497498 /// @notice Function to mint a token.489 /// @notice Function to mint a token.499 /// @param to The new owner490 /// @param to The new owner529 // /// or in textual repr: mintWithTokenURI(address,uint256,string)519 // /// or in textual repr: mintWithTokenURI(address,uint256,string)530 // function mintWithTokenURI(address to, uint256 tokenId, string memory tokenUri) external returns (bool);520 // function mintWithTokenURI(address to, uint256 tokenId, string memory tokenUri) external returns (bool);531521532 /// @dev Not implemented533 /// @dev EVM selector for this function is: 0x7d64bcb4,534 /// or in textual repr: finishMinting()535 function finishMinting() external returns (bool);536}522}537523538/// @title Unique extensions for ERC721.524/// @title Unique extensions for ERC721.tests/src/eth/api/UniqueRefungibleToken.soldiffbeforeafterboth252526/// @dev the ERC-165 identifier for this interface is 0xe17a7d2b26/// @dev the ERC-165 identifier for this interface is 0xe17a7d2b27interface ERC20UniqueExtensions is Dummy, ERC165 {27interface ERC20UniqueExtensions is Dummy, ERC165 {28 /// @dev Function that burns an amount of the token of a given account,28 // /// @dev Function that burns an amount of the token of a given account,29 /// deducting from the sender's allowance for said account.29 // /// deducting from the sender's allowance for said account.30 /// @param from The account whose tokens will be burnt.30 // /// @param from The account whose tokens will be burnt.31 /// @param amount The amount that will be burnt.31 // /// @param amount The amount that will be burnt.32 /// @dev EVM selector for this function is: 0x79cc6790,32 // /// @dev EVM selector for this function is: 0x79cc6790,33 /// or in textual repr: burnFrom(address,uint256)33 // /// or in textual repr: burnFrom(address,uint256)34 function burnFrom(address from, uint256 amount) external returns (bool);34 // function burnFrom(address from, uint256 amount) external returns (bool);353536 /// @dev Function that burns an amount of the token of a given account,36 /// @dev Function that burns an amount of the token of a given account,37 /// deducting from the sender's allowance for said account.37 /// deducting from the sender's allowance for said account.tests/src/eth/base.test.tsdiffbeforeafterboth108 await checkInterface(helper, '0x5b5e139f', false, true);108 await checkInterface(helper, '0x5b5e139f', false, true);109 });109 });110111 itEth('ERC721UniqueMintable - 0x476ff149 - support', async ({helper}) => {112 await checkInterface(helper, '0x476ff149', true, true);113 });114110115 itEth('ERC721Enumerable - 0x780e9d63 - support', async ({helper}) => {111 itEth('ERC721Enumerable - 0x780e9d63 - support', async ({helper}) => {116 await checkInterface(helper, '0x780e9d63', true, true);112 await checkInterface(helper, '0x780e9d63', true, true);