Skip to content

Incorrect event emission #338

@0x3agle

Description

@0x3agle

Description

In CashAsset::disableWithdrawFee(), the event WithdrawFeeDisabled is emitted even in case the exchangeRate is below 1e18 and the temporaryWithdrawFeeEnabled is not yet set to false.

Impact

Low: This can lead to incorrect assumptions in off-chain infrastructure due to incorrect events

Recommendation

Updating the code to only emit an event in case the if() is entered.

  /**
   * @notice Disable withdraw fee when the cash asset is back to being solvent
   */
  function disableWithdrawFee() external {
    uint exchangeRate = _getExchangeRate();
    if (exchangeRate >= 1e18 && temporaryWithdrawFeeEnabled) {
      temporaryWithdrawFeeEnabled = false;
      smFeePercentage = previousSmFeePercentage;
      emit WithdrawFeeDisabled(exchangeRate);
    }
  }

References

https://github.com/lyra-finance/v2-core/blob/master/src/assets/CashAsset.sol#L274

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions