20,000 USDC
View results
Submission Details
Severity: low
Valid

Not emitting events for important state changes

Summary

When changing state variables events are not emitted.

Vulnerability Details

src\Lender.sol

setLenderFee function

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L84-L87

setBorrowerFee function

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L92-L95

setFeeReceiver function

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L100-L102

src\Staking.sol

deposit function

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Staking.sol#L38-L42

withdraw function

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Staking.sol#L46-L50

claim function

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Staking.sol#L53-L58

Impact

The end user may be confused about state changes

Tools Used

Manual

Recommendations

Emit proper events so that off-chain monitoring can be implemented.

For setLenderFee function emit event LenderFeeUpdated(uint indexed fee)

For setBorrowerFee function emit event BorrowerFeeUpdated(uint indexed fee)

For setFeeReceiver function emit event ReceiverFeeUpdated(uint indexed fee)

For deposit function emit event Deposited(address indexed from, uint256 amount)

For withdraw function emit event Withdrawn(address indexed from, uint256 amount)

For claim function emit event Claimed(address indexed from, uint256 amount)

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.