difftreelog
add `collectionHelperAddress` method to `ERC721` & `ERC20` interfaces.
in: master
14 files changed
pallets/fungible/src/erc.rsdiffbeforeafterboth30use pallet_evm_coder_substrate::{call, dispatch_to_evm};30use pallet_evm_coder_substrate::{call, dispatch_to_evm};31use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};31use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};32use pallet_common::{CollectionHandle, erc::CollectionCall};32use pallet_common::{CollectionHandle, erc::CollectionCall};33use sp_core::Get;333434use crate::{35use crate::{35 Allowance, Balance, Config, FungibleHandle, Pallet, SelfWeightOf, TotalSupply,36 Allowance, Balance, Config, FungibleHandle, Pallet, SelfWeightOf, TotalSupply,133 Ok(<Allowance<T>>::get((self.id, owner, spender)).into())134 Ok(<Allowance<T>>::get((self.id, owner, spender)).into())134 }135 }136137 /// @notice Returns collection helper contract address138 fn collection_helper_address(&self) -> Result<address> {139 Ok(T::ContractAddress::get())140 }135}141}136142137#[solidity_interface(name = ERC20Mintable)]143#[solidity_interface(name = ERC20Mintable)]pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth547 event Approval(address indexed owner, address indexed spender, uint256 value);547 event Approval(address indexed owner, address indexed spender, uint256 value);548}548}549549550/// @dev the ERC-165 identifier for this interface is 0x942e8b22550/// @dev the ERC-165 identifier for this interface is 0x8cb847c4551contract ERC20 is Dummy, ERC165, ERC20Events {551contract ERC20 is Dummy, ERC165, ERC20Events {552 /// @dev EVM selector for this function is: 0x06fdde03,552 /// @dev EVM selector for this function is: 0x06fdde03,553 /// or in textual repr: name()553 /// or in textual repr: name()635 return 0;635 return 0;636 }636 }637638 /// @notice Returns collection helper contract address639 /// @dev EVM selector for this function is: 0x1896cce6,640 /// or in textual repr: collectionHelperAddress()641 function collectionHelperAddress() public view returns (address) {642 require(false, stub_error);643 dummy;644 return 0x0000000000000000000000000000000000000000;645 }637}646}638647639contract UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}648contract UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}pallets/nonfungible/src/erc.rsdiffbeforeafterboth42use pallet_evm::{account::CrossAccountId, PrecompileHandle};42use pallet_evm::{account::CrossAccountId, PrecompileHandle};43use pallet_evm_coder_substrate::call;43use pallet_evm_coder_substrate::call;44use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};44use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};45use sp_core::Get;454646use crate::{47use crate::{47 AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, TokenData, TokensMinted,48 AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, TokenData, TokensMinted,490 Err("not implemented".into())491 Err("not implemented".into())491 }492 }493 494 /// @notice Returns collection helper contract address 495 fn collection_helper_address(&self) -> Result<address> {496 Ok(T::ContractAddress::get())497 }492}498}493499494/// @title ERC721 Token that can be irreversibly burned (destroyed).500/// @title ERC721 Token that can be irreversibly burned (destroyed).pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth920920921/// @title ERC-721 Non-Fungible Token Standard921/// @title ERC-721 Non-Fungible Token Standard922/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md922/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md923/// @dev the ERC-165 identifier for this interface is 0x80ac58cd923/// @dev the ERC-165 identifier for this interface is 0x983a942b924contract ERC721 is Dummy, ERC165, ERC721Events {924contract ERC721 is Dummy, ERC165, ERC721Events {925 /// @notice Count all NFTs assigned to an owner925 /// @notice Count all NFTs assigned to an owner926 /// @dev NFTs assigned to the zero address are considered invalid, and this926 /// @dev NFTs assigned to the zero address are considered invalid, and this1051 return 0x0000000000000000000000000000000000000000;1051 return 0x0000000000000000000000000000000000000000;1052 }1052 }10531054 /// @notice Returns collection helper contract address1055 /// @dev EVM selector for this function is: 0x1896cce6,1056 /// or in textual repr: collectionHelperAddress()1057 function collectionHelperAddress() public view returns (address) {1058 require(false, stub_error);1059 dummy;1060 return 0x0000000000000000000000000000000000000000;1061 }1053}1062}105410631055contract UniqueNFT is1064contract UniqueNFT ispallets/refungible/src/erc.rsdiffbeforeafterboth38use pallet_evm::{account::CrossAccountId, PrecompileHandle};38use pallet_evm::{account::CrossAccountId, PrecompileHandle};39use pallet_evm_coder_substrate::{call, dispatch_to_evm};39use pallet_evm_coder_substrate::{call, dispatch_to_evm};40use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};40use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};41use sp_core::H160;41use sp_core::{H160, Get};42use sp_std::{collections::btree_map::BTreeMap, vec::Vec, vec};42use sp_std::{collections::btree_map::BTreeMap, vec::Vec, vec};43use up_data_structs::{43use up_data_structs::{44 CollectionId, CollectionPropertiesVec, mapping::TokenAddressMapping, Property, PropertyKey,44 CollectionId, CollectionPropertiesVec, mapping::TokenAddressMapping, Property, PropertyKey,483 Err("not implemented".into())483 Err("not implemented".into())484 }484 }485 486 /// @notice Returns collection helper contract address487 fn collection_helper_address(&self) -> Result<address> {488 Ok(T::ContractAddress::get())489 }485}490}486491487/// Returns amount of pieces of `token` that `owner` have492/// Returns amount of pieces of `token` that `owner` havepallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth919919920/// @title ERC-721 Non-Fungible Token Standard920/// @title ERC-721 Non-Fungible Token Standard921/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md921/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md922/// @dev the ERC-165 identifier for this interface is 0x58800161922/// @dev the ERC-165 identifier for this interface is 0x4016cd87923contract ERC721 is Dummy, ERC165, ERC721Events {923contract ERC721 is Dummy, ERC165, ERC721Events {924 /// @notice Count all RFTs assigned to an owner924 /// @notice Count all RFTs assigned to an owner925 /// @dev RFTs assigned to the zero address are considered invalid, and this925 /// @dev RFTs assigned to the zero address are considered invalid, and this1048 return 0x0000000000000000000000000000000000000000;1048 return 0x0000000000000000000000000000000000000000;1049 }1049 }10501051 /// @notice Returns collection helper contract address1052 /// @dev EVM selector for this function is: 0x1896cce6,1053 /// or in textual repr: collectionHelperAddress()1054 function collectionHelperAddress() public view returns (address) {1055 require(false, stub_error);1056 dummy;1057 return 0x0000000000000000000000000000000000000000;1058 }1050}1059}105110601052contract UniqueRefungible is1061contract UniqueRefungible istests/src/apiConsts.test.tsdiffbeforeafterbothno syntactic changes
tests/src/eth/abi/fungible.jsondiffbeforeafterboth199 "stateMutability": "view",199 "stateMutability": "view",200 "type": "function"200 "type": "function"201 },201 },202 {203 "inputs": [],204 "name": "collectionHelperAddress",205 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],206 "stateMutability": "view",207 "type": "function"208 },202 {209 {203 "inputs": [],210 "inputs": [],204 "name": "collectionOwner",211 "name": "collectionOwner",tests/src/eth/abi/nonFungible.jsondiffbeforeafterboth229 "stateMutability": "view",229 "stateMutability": "view",230 "type": "function"230 "type": "function"231 },231 },232 {233 "inputs": [],234 "name": "collectionHelperAddress",235 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],236 "stateMutability": "view",237 "type": "function"238 },232 {239 {233 "inputs": [],240 "inputs": [],234 "name": "collectionOwner",241 "name": "collectionOwner",tests/src/eth/abi/reFungible.jsondiffbeforeafterboth211 "stateMutability": "view",211 "stateMutability": "view",212 "type": "function"212 "type": "function"213 },213 },214 {215 "inputs": [],216 "name": "collectionHelperAddress",217 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],218 "stateMutability": "view",219 "type": "function"220 },214 {221 {215 "inputs": [],222 "inputs": [],216 "name": "collectionOwner",223 "name": "collectionOwner",tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth354 event Approval(address indexed owner, address indexed spender, uint256 value);354 event Approval(address indexed owner, address indexed spender, uint256 value);355}355}356356357/// @dev the ERC-165 identifier for this interface is 0x942e8b22357/// @dev the ERC-165 identifier for this interface is 0x8cb847c4358interface ERC20 is Dummy, ERC165, ERC20Events {358interface ERC20 is Dummy, ERC165, ERC20Events {359 /// @dev EVM selector for this function is: 0x06fdde03,359 /// @dev EVM selector for this function is: 0x06fdde03,360 /// or in textual repr: name()360 /// or in textual repr: name()396 /// or in textual repr: allowance(address,address)396 /// or in textual repr: allowance(address,address)397 function allowance(address owner, address spender) external view returns (uint256);397 function allowance(address owner, address spender) external view returns (uint256);398399 /// @notice Returns collection helper contract address400 /// @dev EVM selector for this function is: 0x1896cce6,401 /// or in textual repr: collectionHelperAddress()402 function collectionHelperAddress() external view returns (address);398}403}399404400interface UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}405interface UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth605605606/// @title ERC-721 Non-Fungible Token Standard606/// @title ERC-721 Non-Fungible Token Standard607/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md607/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md608/// @dev the ERC-165 identifier for this interface is 0x80ac58cd608/// @dev the ERC-165 identifier for this interface is 0x983a942b609interface ERC721 is Dummy, ERC165, ERC721Events {609interface ERC721 is Dummy, ERC165, ERC721Events {610 /// @notice Count all NFTs assigned to an owner610 /// @notice Count all NFTs assigned to an owner611 /// @dev NFTs assigned to the zero address are considered invalid, and this611 /// @dev NFTs assigned to the zero address are considered invalid, and this686 /// or in textual repr: isApprovedForAll(address,address)686 /// or in textual repr: isApprovedForAll(address,address)687 function isApprovedForAll(address owner, address operator) external view returns (address);687 function isApprovedForAll(address owner, address operator) external view returns (address);688689 /// @notice Returns collection helper contract address690 /// @dev EVM selector for this function is: 0x1896cce6,691 /// or in textual repr: collectionHelperAddress()692 function collectionHelperAddress() external view returns (address);688}693}689694690interface UniqueNFT is695interface UniqueNFT istests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth604604605/// @title ERC-721 Non-Fungible Token Standard605/// @title ERC-721 Non-Fungible Token Standard606/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md606/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md607/// @dev the ERC-165 identifier for this interface is 0x58800161607/// @dev the ERC-165 identifier for this interface is 0x4016cd87608interface ERC721 is Dummy, ERC165, ERC721Events {608interface ERC721 is Dummy, ERC165, ERC721Events {609 /// @notice Count all RFTs assigned to an owner609 /// @notice Count all RFTs assigned to an owner610 /// @dev RFTs assigned to the zero address are considered invalid, and this610 /// @dev RFTs assigned to the zero address are considered invalid, and this683 /// or in textual repr: isApprovedForAll(address,address)683 /// or in textual repr: isApprovedForAll(address,address)684 function isApprovedForAll(address owner, address operator) external view returns (address);684 function isApprovedForAll(address owner, address operator) external view returns (address);685686 /// @notice Returns collection helper contract address687 /// @dev EVM selector for this function is: 0x1896cce6,688 /// or in textual repr: collectionHelperAddress()689 function collectionHelperAddress() external view returns (address);685}690}686691687interface UniqueRefungible is692interface UniqueRefungible istests/src/eth/collectionHelperAddress.test.tsdiffbeforeafterbothno changes