Skip to content

Commit

Permalink
fix: ignore possible errors when closing positions due to rewards cal…
Browse files Browse the repository at this point in the history
…culations
  • Loading branch information
kerber0x committed Feb 6, 2024
1 parent b82b979 commit 5766435
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contracts/liquidity_hub/pool-network/incentive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "incentive"
version = "1.0.6"
version = "1.0.8"
authors = ["kaimen-sano <[email protected]>"]
edition.workspace = true
description = "An incentive manager for an LP token"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,11 @@ pub fn close_position(
) -> Result<Response, ContractError> {
//query and check if the user has pending rewards
let rewards_query_result = get_rewards(deps.as_ref(), info.sender.clone().into_string());
match rewards_query_result {
Ok(rewards_response) => {
// can't close a position if there are pending rewards
if !rewards_response.rewards.is_empty() {
return Err(ContractError::PendingRewards {});
}
}
Err(error) => {
//if it has nothing to claim, then close the position
match error {
ContractError::NothingToClaim {} => {}
_ => return Err(ContractError::InvalidReward {}),
}

if let Ok(rewards_response) = rewards_query_result {
// can't close a position if there are pending rewards
if !rewards_response.rewards.is_empty() {
return Err(ContractError::PendingRewards {});
}
}

Expand Down

0 comments on commit 5766435

Please sign in to comment.