Skip to content

Commit

Permalink
Short circuit if no amounts to release
Browse files Browse the repository at this point in the history
Add FIXME in passing
  • Loading branch information
maurolacy committed Oct 27, 2023
1 parent 8192f72 commit 722b2f2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions contracts/provider/native-staking-proxy/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,15 @@ impl NativeStakingProxyContract<'_> {
.querier
.query_balance(ctx.env.contract.address, cfg.denom)?;
// But discount burned stake
// FIXME: this is not accurate, as it doesn't take into account the unbonding period
let burned = self.burned.load(ctx.deps.storage)?;
let balance = coin(balance.amount.u128().saturating_sub(burned), &balance.denom);

// Short circuit if there are no funds to send
if balance.amount.is_zero() {
return Ok(Response::new());
}

// Send them to the parent contract via `release_proxy_stake`
let msg = to_binary(&native_staking_callback::ExecMsg::ReleaseProxyStake {})?;

Expand Down

0 comments on commit 722b2f2

Please sign in to comment.