diff --git a/contracts/external/cw-abc/src/commands.rs b/contracts/external/cw-abc/src/commands.rs index 9a3ddf8ca..205f94cfc 100644 --- a/contracts/external/cw-abc/src/commands.rs +++ b/contracts/external/cw-abc/src/commands.rs @@ -262,10 +262,10 @@ fn calculate_exit_fee( CommonsPhase::Closed => return Ok(Uint128::zero()), }; - // TODO more normal check? - debug_assert!( + // Ensure the exit fee is not greater than 100% + ensure!( exit_fee <= StdDecimal::percent(100), - "Exit tax must be <= 100%" + ContractError::InvalidExitFee {} ); // This won't ever overflow because it's checked diff --git a/contracts/external/cw-abc/src/error.rs b/contracts/external/cw-abc/src/error.rs index d62661331..6c343f21b 100644 --- a/contracts/external/cw-abc/src/error.rs +++ b/contracts/external/cw-abc/src/error.rs @@ -28,6 +28,9 @@ pub enum ContractError { #[error("Hatch phase config error {0}")] HatchPhaseConfigError(String), + #[error("Invalid exit fee, must be less than 100%.")] + InvalidExitFee {}, + #[error("Invalid subdenom: {subdenom:?}")] InvalidSubdenom { subdenom: String },