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

difftreelog

add `collectionHelperAddress` method to `ERC721` & `ERC20` interfaces.

PraetorP2022-11-24parent: #5aafe0c.patch.diff
in: master

14 files changed

modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
30use 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;
3334
34use 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 }
136
137 /// @notice Returns collection helper contract address
138 fn collection_helper_address(&self) -> Result<address> {
139 Ok(T::ContractAddress::get())
140 }
135}141}
136142
137#[solidity_interface(name = ERC20Mintable)]143#[solidity_interface(name = ERC20Mintable)]
modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
547 event Approval(address indexed owner, address indexed spender, uint256 value);547 event Approval(address indexed owner, address indexed spender, uint256 value);
548}548}
549549
550/// @dev the ERC-165 identifier for this interface is 0x942e8b22550/// @dev the ERC-165 identifier for this interface is 0x8cb847c4
551contract 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 }
637
638 /// @notice Returns collection helper contract address
639 /// @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}
638647
639contract UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}648contract UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
42use 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;
4546
46use 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}
493499
494/// @title ERC721 Token that can be irreversibly burned (destroyed).500/// @title ERC721 Token that can be irreversibly burned (destroyed).
modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
920920
921/// @title ERC-721 Non-Fungible Token Standard921/// @title ERC-721 Non-Fungible Token Standard
922/// @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.md
923/// @dev the ERC-165 identifier for this interface is 0x80ac58cd923/// @dev the ERC-165 identifier for this interface is 0x983a942b
924contract 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 owner
926 /// @dev NFTs assigned to the zero address are considered invalid, and this926 /// @dev NFTs assigned to the zero address are considered invalid, and this
1051 return 0x0000000000000000000000000000000000000000;1051 return 0x0000000000000000000000000000000000000000;
1052 }1052 }
1053
1054 /// @notice Returns collection helper contract address
1055 /// @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}
10541063
1055contract UniqueNFT is1064contract UniqueNFT is
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
38use 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 address
487 fn collection_helper_address(&self) -> Result<address> {
488 Ok(T::ContractAddress::get())
489 }
485}490}
486491
487/// Returns amount of pieces of `token` that `owner` have492/// Returns amount of pieces of `token` that `owner` have
modifiedpallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth
919919
920/// @title ERC-721 Non-Fungible Token Standard920/// @title ERC-721 Non-Fungible Token Standard
921/// @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.md
922/// @dev the ERC-165 identifier for this interface is 0x58800161922/// @dev the ERC-165 identifier for this interface is 0x4016cd87
923contract 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 owner
925 /// @dev RFTs assigned to the zero address are considered invalid, and this925 /// @dev RFTs assigned to the zero address are considered invalid, and this
1048 return 0x0000000000000000000000000000000000000000;1048 return 0x0000000000000000000000000000000000000000;
1049 }1049 }
1050
1051 /// @notice Returns collection helper contract address
1052 /// @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}
10511060
1052contract UniqueRefungible is1061contract UniqueRefungible is
modifiedtests/src/apiConsts.test.tsdiffbeforeafterboth

no syntactic changes

modifiedtests/src/eth/abi/fungible.jsondiffbeforeafterboth
199 "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",
modifiedtests/src/eth/abi/nonFungible.jsondiffbeforeafterboth
229 "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",
modifiedtests/src/eth/abi/reFungible.jsondiffbeforeafterboth
211 "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",
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
354 event Approval(address indexed owner, address indexed spender, uint256 value);354 event Approval(address indexed owner, address indexed spender, uint256 value);
355}355}
356356
357/// @dev the ERC-165 identifier for this interface is 0x942e8b22357/// @dev the ERC-165 identifier for this interface is 0x8cb847c4
358interface 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);
398
399 /// @notice Returns collection helper contract address
400 /// @dev EVM selector for this function is: 0x1896cce6,
401 /// or in textual repr: collectionHelperAddress()
402 function collectionHelperAddress() external view returns (address);
398}403}
399404
400interface UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}405interface UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
605605
606/// @title ERC-721 Non-Fungible Token Standard606/// @title ERC-721 Non-Fungible Token Standard
607/// @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.md
608/// @dev the ERC-165 identifier for this interface is 0x80ac58cd608/// @dev the ERC-165 identifier for this interface is 0x983a942b
609interface 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 owner
611 /// @dev NFTs assigned to the zero address are considered invalid, and this611 /// @dev NFTs assigned to the zero address are considered invalid, and this
686 /// 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);
688
689 /// @notice Returns collection helper contract address
690 /// @dev EVM selector for this function is: 0x1896cce6,
691 /// or in textual repr: collectionHelperAddress()
692 function collectionHelperAddress() external view returns (address);
688}693}
689694
690interface UniqueNFT is695interface UniqueNFT is
modifiedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth
604604
605/// @title ERC-721 Non-Fungible Token Standard605/// @title ERC-721 Non-Fungible Token Standard
606/// @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.md
607/// @dev the ERC-165 identifier for this interface is 0x58800161607/// @dev the ERC-165 identifier for this interface is 0x4016cd87
608interface 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 owner
610 /// @dev RFTs assigned to the zero address are considered invalid, and this610 /// @dev RFTs assigned to the zero address are considered invalid, and this
683 /// 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);
685
686 /// @notice Returns collection helper contract address
687 /// @dev EVM selector for this function is: 0x1896cce6,
688 /// or in textual repr: collectionHelperAddress()
689 function collectionHelperAddress() external view returns (address);
685}690}
686691
687interface UniqueRefungible is692interface UniqueRefungible is
addedtests/src/eth/collectionHelperAddress.test.tsdiffbeforeafterboth

no changes