Skip to content

Commit

Permalink
fix: fee distributor claim floor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kerber0x authored Jun 25, 2024
1 parent 78df4e7 commit 3e75ebf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 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/fee_distributor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fee_distributor"
version = "0.9.3"
version = "0.9.4"
authors = ["Kerber0x <[email protected]>"]
edition.workspace = true
description = "Contract to distribute the fees collected by the Fee Collector."
Expand Down
4 changes: 3 additions & 1 deletion contracts/liquidity_hub/fee_distributor/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ pub fn claim(deps: DepsMut, info: MessageInfo) -> Result<Response, ContractError
}))?;

for fee in epoch.total.iter() {
let reward = fee.amount * bonding_weight_response.share;
let reward = fee
.amount
.checked_mul_floor(bonding_weight_response.share)?;

if reward.is_zero() {
// nothing to claim
Expand Down
7 changes: 6 additions & 1 deletion contracts/liquidity_hub/fee_distributor/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use cosmwasm_std::{DivideByZeroError, OverflowError, StdError, Uint64};
use cosmwasm_std::{
CheckedMultiplyFractionError, DivideByZeroError, OverflowError, StdError, Uint64,
};
use cw_utils::ParseReplyError;
use semver::Version;
use thiserror::Error;
Expand Down Expand Up @@ -53,6 +55,9 @@ pub enum ContractError {
#[error("{0}")]
ParseReplyError(#[from] ParseReplyError),

#[error("{0}")]
CheckedMultiplyFractionError(#[from] CheckedMultiplyFractionError),

#[error("Attempt to migrate to version {new_version}, but contract is on a higher version {current_version}")]
MigrateInvalidVersion {
new_version: Version,
Expand Down

0 comments on commit 3e75ebf

Please sign in to comment.