Skip to content

Created for reviewing the presale app - #1

Open
abramsymons wants to merge 578 commits into
reviewfrom
master
Open

Created for reviewing the presale app#1
abramsymons wants to merge 578 commits into
reviewfrom
master

Conversation

@abramsymons

Copy link
Copy Markdown
Contributor

No description provided.

@abramsymons abramsymons self-assigned this Jul 31, 2022
Comment thread general/mrc20_presale.js Outdated
Comment thread general/mrc20_presale.js Outdated
Comment thread general/mrc20_presale.js Outdated
Comment thread general/mrc20_presale.js
Comment thread general/mrc20_presale.js Outdated
Comment thread general/mrc20_presale.js Outdated

let tokenPrice = toBaseUnit(token.price.toString(), 18)
let finalMaxCap
if (currentTime < PUBLIC_SALE) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

most of the codes in these 3 if, else if, else block is repeated and can be out of if.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixed

Comment thread general/mrc20_presale.js Outdated
Number(Web3.utils.fromWei(sum, 'ether')) >
usdMaxCap
)
throw { message: 'Amount is not valid' }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

what is being checked here in the last else block should also be checked for the previous phases before the public sale.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixed

Comment thread general/mrc20_presale.js Outdated
Number(Web3.utils.fromWei(sum, 'ether')) >
usdMaxCap
)
throw { message: 'Amount is not valid' }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

what is being checked here in the last else block should also be checked for the previous phases before the public sale.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixed

Comment thread general/mrc20_presale.js
}
}
}
await this.writeNodeMem(memory, 5 * 60)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@sadeghte suggested that having such a delay can increase security.
https://github.com/muon-protocol/muon-apps/blob/master/custom/sample.js#L89

Comment thread general/mrc20_presale.js
finalMaxCap = maxCap.sub(sum).toString()
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's safer to check if finalMaxCap > 0 and throw an error otherwise, instead of only relying on smart contract side checking because if in some rare cases it becomes negative, as it's defined as unsigned on, it might result in becoming an attack vector.

ShayanShiravani and others added 30 commits December 15, 2024 17:08
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.