Skip to content

Added fees#71

Merged
alex-sandrk merged 1 commit into
devfrom
feat/fee
Sep 13, 2023
Merged

Added fees#71
alex-sandrk merged 1 commit into
devfrom
feat/fee

Conversation

@bohdan-titan
Copy link
Copy Markdown
Contributor

No description provided.

Comment on lines 92 to 102
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,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +161 to +162
const getMarketplaceFee = (cloneFactory) => async () => {
return await cloneFactory.methods.marketplaceFee().call();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@alex-sandrk alex-sandrk merged commit 4af0597 into dev Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants