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.soldiffbeforeafterboth--- a/tests/src/eth/api/CollectionHelpers.sol
+++ b/tests/src/eth/api/CollectionHelpers.sol
@@ -18,7 +18,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
interface CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {
/// Create an NFT collection
/// @param name Name of the collection
@@ -65,4 +65,8 @@
/// @dev EVM selector for this function is: 0xc3de1494,
/// or in textual repr: isCollectionExist(address)
function isCollectionExist(address collectionAddress) external view returns (bool);
+
+ /// @dev EVM selector for this function is: 0xd23a7ab1,
+ /// or in textual repr: collectionCreationFee()
+ function collectionCreationFee() external view returns (uint256);
}
tests/src/eth/collectionHelpersAbi.jsondiffbeforeafterboth1[2 {3 "anonymous": false,4 "inputs": [5 {6 "indexed": true,7 "internalType": "address",8 "name": "owner",9 "type": "address"10 },11 {12 "indexed": true,13 "internalType": "address",14 "name": "collectionId",15 "type": "address"16 }17 ],18 "name": "CollectionCreated",19 "type": "event"20 },21 {22 "inputs": [23 { "internalType": "string", "name": "name", "type": "string" },24 { "internalType": "string", "name": "description", "type": "string" },25 { "internalType": "string", "name": "tokenPrefix", "type": "string" },26 { "internalType": "string", "name": "baseUri", "type": "string" }27 ],28 "name": "createERC721MetadataCompatibleCollection",29 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],30 "stateMutability": "payable",31 "type": "function"32 },33 {34 "inputs": [35 { "internalType": "string", "name": "name", "type": "string" },36 { "internalType": "string", "name": "description", "type": "string" },37 { "internalType": "string", "name": "tokenPrefix", "type": "string" },38 { "internalType": "string", "name": "baseUri", "type": "string" }39 ],40 "name": "createERC721MetadataCompatibleRFTCollection",41 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],42 "stateMutability": "payable",43 "type": "function"44 },45 {46 "inputs": [47 { "internalType": "string", "name": "name", "type": "string" },48 { "internalType": "string", "name": "description", "type": "string" },49 { "internalType": "string", "name": "tokenPrefix", "type": "string" }50 ],51 "name": "createNonfungibleCollection",52 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],53 "stateMutability": "payable",54 "type": "function"55 },56 {57 "inputs": [58 { "internalType": "string", "name": "name", "type": "string" },59 { "internalType": "string", "name": "description", "type": "string" },60 { "internalType": "string", "name": "tokenPrefix", "type": "string" }61 ],62 "name": "createRFTCollection",63 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],64 "stateMutability": "payable",65 "type": "function"66 },67 {68 "inputs": [69 {70 "internalType": "address",71 "name": "collectionAddress",72 "type": "address"73 }74 ],75 "name": "isCollectionExist",76 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],77 "stateMutability": "view",78 "type": "function"79 },80 {81 "inputs": [82 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }83 ],84 "name": "supportsInterface",85 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],86 "stateMutability": "view",87 "type": "function"88 }89]1[2 {3 "anonymous": false,4 "inputs": [5 {6 "indexed": true,7 "internalType": "address",8 "name": "owner",9 "type": "address"10 },11 {12 "indexed": true,13 "internalType": "address",14 "name": "collectionId",15 "type": "address"16 }17 ],18 "name": "CollectionCreated",19 "type": "event"20 },21 {22 "inputs": [],23 "name": "collectionCreationFee",24 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],25 "stateMutability": "view",26 "type": "function"27 },28 {29 "inputs": [30 { "internalType": "string", "name": "name", "type": "string" },31 { "internalType": "string", "name": "description", "type": "string" },32 { "internalType": "string", "name": "tokenPrefix", "type": "string" },33 { "internalType": "string", "name": "baseUri", "type": "string" }34 ],35 "name": "createERC721MetadataCompatibleCollection",36 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],37 "stateMutability": "payable",38 "type": "function"39 },40 {41 "inputs": [42 { "internalType": "string", "name": "name", "type": "string" },43 { "internalType": "string", "name": "description", "type": "string" },44 { "internalType": "string", "name": "tokenPrefix", "type": "string" },45 { "internalType": "string", "name": "baseUri", "type": "string" }46 ],47 "name": "createERC721MetadataCompatibleRFTCollection",48 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],49 "stateMutability": "payable",50 "type": "function"51 },52 {53 "inputs": [54 { "internalType": "string", "name": "name", "type": "string" },55 { "internalType": "string", "name": "description", "type": "string" },56 { "internalType": "string", "name": "tokenPrefix", "type": "string" }57 ],58 "name": "createNonfungibleCollection",59 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],60 "stateMutability": "payable",61 "type": "function"62 },63 {64 "inputs": [65 { "internalType": "string", "name": "name", "type": "string" },66 { "internalType": "string", "name": "description", "type": "string" },67 { "internalType": "string", "name": "tokenPrefix", "type": "string" }68 ],69 "name": "createRFTCollection",70 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],71 "stateMutability": "payable",72 "type": "function"73 },74 {75 "inputs": [76 {77 "internalType": "address",78 "name": "collectionAddress",79 "type": "address"80 }81 ],82 "name": "isCollectionExist",83 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],84 "stateMutability": "view",85 "type": "function"86 },87 {88 "inputs": [89 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }90 ],91 "name": "supportsInterface",92 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],93 "stateMutability": "view",94 "type": "function"95 }96]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;