Sparkly Fleece Mammoth
Medium
In function engage(string memory _exchangeName) external onlyOperator { _enterCollateralPosition();
https://github.com/sherlock-audit/2024-10-morpho-x-index/blob/main/index-coop-smart-contracts/contracts/adapters/MorphoLeverageStrategyExtension.sol#L274C4-L275C36
_exchangeName is not unique and errors can be made if a name is duplicated for two different leverage positions
- The choice to not require the
_exchangeName
parameter to be unique will lead to the contract not having a way to differentiate between them, if a name is mistakenly passed twice by the operator - emitting of an event having multiple positions with the same name would lead to difficulties in tracking events on-chain
- operator opens a leverage position with eth/usdc at position A
- operator does not keep track of the name and opens another leverage position on eth/usdc at another on position B
No response
No response
- When the function is called, it not know which position to reference. leading to errors inliquidation, rebalancing, or withdrawing assets
- Incorrect emit of events would make monitoring and debugging difficult as it would be hard to distinguish between events related to different leverage positions
- Users might inadvertently engage with the wrong position or have difficulty understanding their current holdings and liabilities.
No response
- require statement to ensure
_exchangeName
is unique - unique names can be enforced by mapping of active leverage positions against a new position to be created