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

difftreelog

chore add `collectionCreationFee` method to CollectionHelpers

Grigoriy Simonov2022-09-27parent: #413ee13.patch.diff
in: master

6 files changed

modifiedpallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/unique/src/eth/stubs/CollectionHelpers.soldiffbeforeafterboth
23}23}
2424
25/// @title Contract, which allows users to operate with collections25/// @title Contract, which allows users to operate with collections
26/// @dev the ERC-165 identifier for this interface is 0x88ee8ef126/// @dev the ERC-165 identifier for this interface is 0x5ad4f440
27contract CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {27contract CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {
28 /// Create an NFT collection28 /// Create an NFT collection
29 /// @param name Name of the collection29 /// @param name Name of the collection
106 return false;106 return false;
107 }107 }
108
109 /// @dev EVM selector for this function is: 0xd23a7ab1,
110 /// or in textual repr: collectionCreationFee()
111 function collectionCreationFee() public view returns (uint256) {
112 require(false, stub_error);
113 dummy;
114 return 0;
115 }
108}116}
109117
modifiedtests/src/eth/api/CollectionHelpers.soldiffbeforeafterboth
18}18}
1919
20/// @title Contract, which allows users to operate with collections20/// @title Contract, which allows users to operate with collections
21/// @dev the ERC-165 identifier for this interface is 0x88ee8ef121/// @dev the ERC-165 identifier for this interface is 0x5ad4f440
22interface CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {22interface CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {
23 /// Create an NFT collection23 /// Create an NFT collection
24 /// @param name Name of the collection24 /// @param name Name of the collection
66 /// or in textual repr: isCollectionExist(address)66 /// or in textual repr: isCollectionExist(address)
67 function isCollectionExist(address collectionAddress) external view returns (bool);67 function isCollectionExist(address collectionAddress) external view returns (bool);
68
69 /// @dev EVM selector for this function is: 0xd23a7ab1,
70 /// or in textual repr: collectionCreationFee()
71 function collectionCreationFee() external view returns (uint256);
68}72}
6973
modifiedtests/src/eth/collectionHelpersAbi.jsondiffbeforeafterboth
18 "name": "CollectionCreated",18 "name": "CollectionCreated",
19 "type": "event"19 "type": "event"
20 },20 },
21 {
22 "inputs": [],
23 "name": "collectionCreationFee",
24 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
25 "stateMutability": "view",
26 "type": "function"
27 },
21 {28 {
22 "inputs": [29 "inputs": [
23 { "internalType": "string", "name": "name", "type": "string" },30 { "internalType": "string", "name": "name", "type": "string" },
modifiedtests/src/eth/payable.test.tsdiffbeforeafterboth
171 expect(finalContractBalance == initialContractBalance).to.be.true;171 expect(finalContractBalance == initialContractBalance).to.be.true;
172 });172 });
173
174 itEth('Get collection creation fee', async({helper}) => {
175 const deployer = await helper.eth.createAccountWithBalance(donor);
176 expect(await helper.eth.getCollectionCreationFee(deployer)).to.be.equal(String(2n * helper.balance.getOneTokenNominal()));
177 });
173178
174 async function deployProxyContract(helper: EthUniqueHelper, deployer: string) {179 async function deployProxyContract(helper: EthUniqueHelper, deployer: string) {
175 return await helper.ethContract.deployByCode(180 return await helper.ethContract.deployByCode(
modifiedtests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth
153 return await this.helper.balance.transferToSubstrate(donor, evmToAddress(recepient), amount * (inTokens ? this.helper.balance.getOneTokenNominal() : 1n));153 return await this.helper.balance.transferToSubstrate(donor, evmToAddress(recepient), amount * (inTokens ? this.helper.balance.getOneTokenNominal() : 1n));
154 }154 }
155
156 async getCollectionCreationFee(signer: string) {
157 const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);
158 return await collectionHelper.methods.collectionCreationFee().call();
159 }
155160
156 async sendEVM(signer: IKeyringPair, contractAddress: string, abi: string, value: string, gasLimit?: number) {161 async sendEVM(signer: IKeyringPair, contractAddress: string, abi: string, value: string, gasLimit?: number) {
157 if(!gasLimit) gasLimit = this.DEFAULT_GAS;162 if(!gasLimit) gasLimit = this.DEFAULT_GAS;