Created for reviewing the presale app - #1
Conversation
|
|
||
| let tokenPrice = toBaseUnit(token.price.toString(), 18) | ||
| let finalMaxCap | ||
| if (currentTime < PUBLIC_SALE) { |
There was a problem hiding this comment.
most of the codes in these 3 if, else if, else block is repeated and can be out of if.
| Number(Web3.utils.fromWei(sum, 'ether')) > | ||
| usdMaxCap | ||
| ) | ||
| throw { message: 'Amount is not valid' } |
There was a problem hiding this comment.
what is being checked here in the last else block should also be checked for the previous phases before the public sale.
| Number(Web3.utils.fromWei(sum, 'ether')) > | ||
| usdMaxCap | ||
| ) | ||
| throw { message: 'Amount is not valid' } |
There was a problem hiding this comment.
what is being checked here in the last else block should also be checked for the previous phases before the public sale.
| } | ||
| } | ||
| } | ||
| await this.writeNodeMem(memory, 5 * 60) |
There was a problem hiding this comment.
@sadeghte suggested that having such a delay can increase security.
https://github.com/muon-protocol/muon-apps/blob/master/custom/sample.js#L89
| finalMaxCap = maxCap.sub(sum).toString() | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
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.
Add chatGPT app
layerzero dvn
layerzero_dvn: more chains
AI safe wallet
ai_safe_wallet: bugfix
app ai_safe_wallet
muon tss reward
muon reward app: avalanche
layerzero dvn testnet
layerzero_dvn: more chains
echoes slot machine app
No description provided.