Added fees#71
Conversation
| return { | ||
| api: { | ||
| refreshContracts: refreshContracts(web3, lumerin, cloneFactory), | ||
| createContract: createContract(web3, cloneFactory, plugins), | ||
| cancelContract: cancelContract(web3), | ||
| createContract: createContract(web3, cloneFactory), | ||
| cancelContract: cancelContract(web3, cloneFactory), | ||
| purchaseContract: purchaseContract(web3, cloneFactory, lumerin), | ||
| editContract: editContract(web3, cloneFactory, lumerin), | ||
| getMarketplaceFee: getMarketplaceFee(cloneFactory), | ||
| setContractDeleteStatus: setContractDeleteStatus( | ||
| web3, | ||
| cloneFactory, |
There was a problem hiding this comment.
The code is creating new instances of the functions refreshContracts, createContract, cancelContract, purchaseContract, editContract, getMarketplaceFee, and setContractDeleteStatus every time this part of the code is executed. This could lead to performance issues if this code is called frequently, as each function creation in JavaScript is a relatively expensive operation.
To improve performance, consider refactoring the code to create these function instances only once and reuse them. This could be achieved by moving the function instantiation to a higher scope or using a design pattern that ensures only a single instance of each function is created, such as the Singleton or Factory patterns.
| const getMarketplaceFee = (cloneFactory) => async () => { | ||
| return await cloneFactory.methods.marketplaceFee().call(); |
There was a problem hiding this comment.
The function getMarketplaceFee is defined as a double arrow function, which is unnecessary and could lead to confusion. The outer function takes cloneFactory as a parameter but the inner function doesn't take any parameters. This could lead to potential issues if you expect to pass parameters to the inner function. I recommend simplifying this by removing the outer function and passing cloneFactory directly to the inner function.
No description provided.