Open code423n4 opened 2 years ago
first report that has recommended changing the check in exercise
to be less explicit. The argument is valid, but generally it should be the other way around. There is no need for a user to lose funds for the sake of convenience. Whatever library is used should be capable of generating 1e18 precision to ensure the correct value is sent.
1. Wrong revert message (low)
Revert message is now misleading
Proof of Concept
Revert is performed (correctly) when dutchAuctionReserveStrike is too big, while the message states otherwise:
https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L169
Recommended Mitigation Steps
Consider changing to:
2. New operation initiating user facing functions miss emergency lever (non-critical)
If there be any emergency with system contracts, there is no way to temporary stop the operations.
Proof of Concept
The contract doesn't have pausing functionality for new operation initiation.
For example, createVault and buyOption cannot be temporary paused:
https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L148-L158
https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L203-L207
Recommended Mitigation Steps
Consider making all new actions linked user facing functions pausable, first of all createVault and buyOption.
For example, by using OpenZeppelin's approach:
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/security/Pausable.sol
3. Exact strike msg.value can be cumbersome for users (non-critical)
It can be cumbersome for user to reproduce exact figure when manually dealing with the contract
Proof of Concept
Exercise now require exact strike to be sent over:
https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L271-L272
Strike figure can have many meaningful digits as it's calculated via power law decline:
https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L419
Recommended Mitigation Steps
Consider allowing dust in msg.value (it will also align with premium logic):