Skip to content

Commit

Permalink
Don't try to pay without funds
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauro Lacy committed May 17, 2022
1 parent e7503cc commit 6b41232
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions contracts/tgrade-tc-payments/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ fn end_block<Q: CustomQuery>(deps: DepsMut<Q>, env: Env) -> Result<Response, Con
.query_balance(env.contract.address, config.denom.clone())?
.amount
.u128();

if total_funds == 0 {
// Nothing to distribute
return Ok(resp);
}

// Divide the minimum balance among all members
let num_members = (oc_members.len() + ap_members.len()) as u32;
let mut member_pay = total_funds / num_members as u128;
Expand Down

0 comments on commit 6b41232

Please sign in to comment.