difftreelog
chore add `collectionCreationFee` method to CollectionHelpers
in: master
6 files changed
pallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterbothbinary blob — no preview
pallets/unique/src/eth/stubs/CollectionHelpers.soldiffbeforeafterboth--- a/pallets/unique/src/eth/stubs/CollectionHelpers.sol
+++ b/pallets/unique/src/eth/stubs/CollectionHelpers.sol
@@ -23,7 +23,7 @@
}
/// @title Contract, which allows users to operate with collections
-/// @dev the ERC-165 identifier for this interface is 0x88ee8ef1
+/// @dev the ERC-165 identifier for this interface is 0x5ad4f440
contract CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {
/// Create an NFT collection
/// @param name Name of the collection
@@ -105,4 +105,12 @@
dummy;
return false;
}
+
+ /// @dev EVM selector for this function is: 0xd23a7ab1,
+ /// or in textual repr: collectionCreationFee()
+ function collectionCreationFee() public view returns (uint256) {
+ require(false, stub_error);
+ dummy;
+ return 0;
+ }
}
tests/src/eth/api/CollectionHelpers.soldiffbeforeafterboth1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56/// @dev common stubs holder7interface Dummy {89}1011interface ERC165 is Dummy {12 function supportsInterface(bytes4 interfaceID) external view returns (bool);13}1415/// @dev inlined interface16interface CollectionHelpersEvents {17 event CollectionCreated(address indexed owner, address indexed collectionId);18}1920/// @title Contract, which allows users to operate with collections21/// @dev the ERC-165 identifier for this interface is 0x88ee8ef122interface CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {23 /// Create an NFT collection24 /// @param name Name of the collection25 /// @param description Informative description of the collection26 /// @param tokenPrefix Token prefix to represent the collection tokens in UI and user applications27 /// @return address Address of the newly created collection28 /// @dev EVM selector for this function is: 0xe34a6844,29 /// or in textual repr: createNonfungibleCollection(string,string,string)30 function createNonfungibleCollection(31 string memory name,32 string memory description,33 string memory tokenPrefix34 ) external payable returns (address);3536 /// @dev EVM selector for this function is: 0xa634a5f9,37 /// or in textual repr: createERC721MetadataCompatibleCollection(string,string,string,string)38 function createERC721MetadataCompatibleCollection(39 string memory name,40 string memory description,41 string memory tokenPrefix,42 string memory baseUri43 ) external payable returns (address);4445 /// @dev EVM selector for this function is: 0xab173450,46 /// or in textual repr: createRFTCollection(string,string,string)47 function createRFTCollection(48 string memory name,49 string memory description,50 string memory tokenPrefix51 ) external payable returns (address);5253 /// @dev EVM selector for this function is: 0xa5596388,54 /// or in textual repr: createERC721MetadataCompatibleRFTCollection(string,string,string,string)55 function createERC721MetadataCompatibleRFTCollection(56 string memory name,57 string memory description,58 string memory tokenPrefix,59 string memory baseUri60 ) external payable returns (address);6162 /// Check if a collection exists63 /// @param collectionAddress Address of the collection in question64 /// @return bool Does the collection exist?65 /// @dev EVM selector for this function is: 0xc3de1494,66 /// or in textual repr: isCollectionExist(address)67 function isCollectionExist(address collectionAddress) external view returns (bool);68}1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56/// @dev common stubs holder7interface Dummy {89}1011interface ERC165 is Dummy {12 function supportsInterface(bytes4 interfaceID) external view returns (bool);13}1415/// @dev inlined interface16interface CollectionHelpersEvents {17 event CollectionCreated(address indexed owner, address indexed collectionId);18}1920/// @title Contract, which allows users to operate with collections21/// @dev the ERC-165 identifier for this interface is 0x5ad4f44022interface CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {23 /// Create an NFT collection24 /// @param name Name of the collection25 /// @param description Informative description of the collection26 /// @param tokenPrefix Token prefix to represent the collection tokens in UI and user applications27 /// @return address Address of the newly created collection28 /// @dev EVM selector for this function is: 0xe34a6844,29 /// or in textual repr: createNonfungibleCollection(string,string,string)30 function createNonfungibleCollection(31 string memory name,32 string memory description,33 string memory tokenPrefix34 ) external payable returns (address);3536 /// @dev EVM selector for this function is: 0xa634a5f9,37 /// or in textual repr: createERC721MetadataCompatibleCollection(string,string,string,string)38 function createERC721MetadataCompatibleCollection(39 string memory name,40 string memory description,41 string memory tokenPrefix,42 string memory baseUri43 ) external payable returns (address);4445 /// @dev EVM selector for this function is: 0xab173450,46 /// or in textual repr: createRFTCollection(string,string,string)47 function createRFTCollection(48 string memory name,49 string memory description,50 string memory tokenPrefix51 ) external payable returns (address);5253 /// @dev EVM selector for this function is: 0xa5596388,54 /// or in textual repr: createERC721MetadataCompatibleRFTCollection(string,string,string,string)55 function createERC721MetadataCompatibleRFTCollection(56 string memory name,57 string memory description,58 string memory tokenPrefix,59 string memory baseUri60 ) external payable returns (address);6162 /// Check if a collection exists63 /// @param collectionAddress Address of the collection in question64 /// @return bool Does the collection exist?65 /// @dev EVM selector for this function is: 0xc3de1494,66 /// or in textual repr: isCollectionExist(address)67 function isCollectionExist(address collectionAddress) external view returns (bool);6869 /// @dev EVM selector for this function is: 0xd23a7ab1,70 /// or in textual repr: collectionCreationFee()71 function collectionCreationFee() external view returns (uint256);72}tests/src/eth/collectionHelpersAbi.jsondiffbeforeafterboth--- a/tests/src/eth/collectionHelpersAbi.json
+++ b/tests/src/eth/collectionHelpersAbi.json
@@ -19,6 +19,13 @@
"type": "event"
},
{
+ "inputs": [],
+ "name": "collectionCreationFee",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
"inputs": [
{ "internalType": "string", "name": "name", "type": "string" },
{ "internalType": "string", "name": "description", "type": "string" },
tests/src/eth/payable.test.tsdiffbeforeafterboth--- a/tests/src/eth/payable.test.ts
+++ b/tests/src/eth/payable.test.ts
@@ -171,6 +171,11 @@
expect(finalContractBalance == initialContractBalance).to.be.true;
});
+ itEth('Get collection creation fee', async({helper}) => {
+ const deployer = await helper.eth.createAccountWithBalance(donor);
+ expect(await helper.eth.getCollectionCreationFee(deployer)).to.be.equal(String(2n * helper.balance.getOneTokenNominal()));
+ });
+
async function deployProxyContract(helper: EthUniqueHelper, deployer: string) {
return await helper.ethContract.deployByCode(
deployer,
tests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -152,6 +152,11 @@
async transferBalanceFromSubstrate(donor: IKeyringPair, recepient: string, amount=1000n, inTokens=true) {
return await this.helper.balance.transferToSubstrate(donor, evmToAddress(recepient), amount * (inTokens ? this.helper.balance.getOneTokenNominal() : 1n));
}
+
+ async getCollectionCreationFee(signer: string) {
+ const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);
+ return await collectionHelper.methods.collectionCreationFee().call();
+ }
async sendEVM(signer: IKeyringPair, contractAddress: string, abi: string, value: string, gasLimit?: number) {
if(!gasLimit) gasLimit = this.DEFAULT_GAS;