Skip to content

Commit

Permalink
jasonxiale data for issue #439
Browse files Browse the repository at this point in the history
  • Loading branch information
c4-bot-8 committed Apr 22, 2024
1 parent 4db5c2b commit ab22d88
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions data/jasonxiale-Q.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# [L-01]`CollateralTracker.totalAssets` doesn't follow the documents
## Link:
https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/CollateralTracker.sol#L370-L374

`function CollateralTracker.totalAssets` is defined in [CollateralTracker.sol#L370-L374](https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/CollateralTracker.sol#L370-L374)
```solidity
370 function totalAssets() public view returns (uint256 totalManagedAssets) {
371 unchecked {
372 return s_poolAssets + s_inAMM;
373 }
374 }
```
But quoting from [API documents](https://panoptic.xyz/docs/panoptic-protocol/design#total-balance):
>the amount of funds moved from the PanopticPool to Uniswap (_inAMM()), and the amount of fees that have been collected but are currently locked (_lockedFees()).

# [L-02]`CollateralTracker.maxMint's` implementation isn't correct
## link
https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/CollateralTracker.sol#L444-L448
## Proof of Concept
While containing `COMMISSION_FEE`, in [CollateralTracker.maxMint](https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/CollateralTracker.sol#L444-L448), the function is implementation as:
```solidity
function maxMint(address) external view returns (uint256 maxShares) {
unchecked {
return (convertToShares(type(uint104).max) * DECIMALS) / (DECIMALS + COMMISSION_FEE);
}
}
```
which means:
>maxShares = Math.mulDiv(assets, totalSupply, totalAssets()) * DECIMALS / (DECIMALS + COMMISSION_FEE);
But all others functions calculates [shares as](https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/CollateralTracker.sol#L399-L408)
>shares = Math.mulDiv(assets * (DECIMALS - COMMISSION_FEE), totalSupply,totalAssets() * DECIMALS);

0 comments on commit ab22d88

Please sign in to comment.