Skip to content

Commit

Permalink
Report for issue #65 updated by RaymondFam
Browse files Browse the repository at this point in the history
  • Loading branch information
code423n4 committed Dec 28, 2022
1 parent 761465f commit 4f36b3e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions data/RaymondFam-Q.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,18 @@ Consider moving the needed assignment before the conditional statement by having
- if ((assets = previewRedeem(shares)) == 0) {
+ assets = previewRedeem(shares);
+ if (assets == 0) {
```
## Zero value check on `withdrawAVAX() in TokenggAVAX.sol
Although `previewWithdraw()` does round up, it could still assign a zero value to `shares` if the input parameter, `assets` is accidentally entered as zero. Consider having a zero value check implemented just as it has been done so on `redeemAVAX()` which is nonetheless a side effect zero value check arising from rounding error check associated with round down issue in `previewRedeem()`.

[File: TokenggAVAX.sol#L180-L189](https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/tokens/TokenggAVAX.sol#L180-L189)

```diff
function withdrawAVAX(uint256 assets) public returns (uint256 shares) {
+ if (assets == 0) {
+ revert ZeroAssets();

shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.
beforeWithdraw(assets, shares);
_burn(msg.sender, shares);
```

0 comments on commit 4f36b3e

Please sign in to comment.