Skip to content

Commit

Permalink
adds validateion of initial params for provide_liquidity inside pool_…
Browse files Browse the repository at this point in the history
…stable
  • Loading branch information
gangov committed Jul 9, 2024
1 parent a41412f commit 222abf1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
11 changes: 1 addition & 10 deletions contracts/pool_stable/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,7 @@ impl StableLiquidityPoolTrait for StableLiquidityPool {
}
}

if desired_a == 0 || desired_b == 0 {
log!(
&env,
"Pool Stable: ProvideLiquidity: Both tokens must be provided and must be bigger then 0!"
);
panic_with_error!(
env,
ContractError::ProvideLiquidityBothTokensMustBeMoreThanZero
);
}
validate_int_parameters!(desired_a, desired_b);

// sender needs to authorize the deposit
sender.require_auth();
Expand Down
4 changes: 1 addition & 3 deletions contracts/pool_stable/src/tests/liquidity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,7 @@ fn provide_liqudity_too_high_fees() {
}

#[test]
#[should_panic(
expected = "Pool Stable: ProvideLiquidity: Both tokens must be provided and must be bigger then 0!"
)]
#[should_panic(expected = "value cannot be less than or equal zero")]
fn swap_with_no_amounts() {
let env = Env::default();
env.mock_all_auths();
Expand Down

0 comments on commit 222abf1

Please sign in to comment.