Skip to content

Commit

Permalink
chore: make fee collection permissionless
Browse files Browse the repository at this point in the history
  • Loading branch information
kerber0x committed Dec 5, 2023
1 parent 12627e3 commit 149890a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 16 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_collector/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fee_collector"
version = "1.1.3"
version = "1.1.4"
authors = ["Kerber0x <[email protected]>"]
edition.workspace = true
description = "Contract to collect the fees accrued by the pools and vaults in the liquidity hub"
Expand Down
14 changes: 1 addition & 13 deletions contracts/liquidity_hub/fee_collector/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,7 @@ use crate::ContractError;

/// Collects fees accrued by the pools and vaults. If a factory is provided then it only collects the
/// fees from its children.
pub fn collect_fees(
deps: DepsMut,
info: MessageInfo,
env: Env,
collect_fees_for: FeesFor,
) -> Result<Response, ContractError> {
let config: Config = CONFIG.load(deps.storage)?;

// only the owner or the contract itself can aggregate the fees
if info.sender != config.owner && info.sender != env.contract.address {
return Err(ContractError::Unauthorized {});
}

pub fn collect_fees(deps: DepsMut, collect_fees_for: FeesFor) -> Result<Response, ContractError> {
let mut collect_fees_messages: Vec<CosmosMsg> = Vec::new();

match collect_fees_for {
Expand Down
2 changes: 1 addition & 1 deletion contracts/liquidity_hub/fee_collector/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub fn execute(
) -> Result<Response, ContractError> {
match msg {
ExecuteMsg::CollectFees { collect_fees_for } => {
commands::collect_fees(deps, info, env, collect_fees_for)
commands::collect_fees(deps, collect_fees_for)
}
ExecuteMsg::UpdateConfig {
owner,
Expand Down

0 comments on commit 149890a

Please sign in to comment.