From 149890abb102ffaae7dc95938bde7bf6e0f1e187 Mon Sep 17 00:00:00 2001 From: Kerber0x Date: Tue, 5 Dec 2023 14:28:49 +0000 Subject: [PATCH] chore: make fee collection permissionless --- Cargo.lock | 2 +- contracts/liquidity_hub/fee_collector/Cargo.toml | 2 +- .../liquidity_hub/fee_collector/src/commands.rs | 14 +------------- .../liquidity_hub/fee_collector/src/contract.rs | 2 +- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e2e7ade2..c7293902 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -509,7 +509,7 @@ dependencies = [ [[package]] name = "fee_collector" -version = "1.1.3" +version = "1.1.4" dependencies = [ "cosmwasm-schema", "cosmwasm-std", diff --git a/contracts/liquidity_hub/fee_collector/Cargo.toml b/contracts/liquidity_hub/fee_collector/Cargo.toml index 53121bda..14d253d3 100644 --- a/contracts/liquidity_hub/fee_collector/Cargo.toml +++ b/contracts/liquidity_hub/fee_collector/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fee_collector" -version = "1.1.3" +version = "1.1.4" authors = ["Kerber0x "] edition.workspace = true description = "Contract to collect the fees accrued by the pools and vaults in the liquidity hub" diff --git a/contracts/liquidity_hub/fee_collector/src/commands.rs b/contracts/liquidity_hub/fee_collector/src/commands.rs index 379c09da..44047ff3 100644 --- a/contracts/liquidity_hub/fee_collector/src/commands.rs +++ b/contracts/liquidity_hub/fee_collector/src/commands.rs @@ -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 { - 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 { let mut collect_fees_messages: Vec = Vec::new(); match collect_fees_for { diff --git a/contracts/liquidity_hub/fee_collector/src/contract.rs b/contracts/liquidity_hub/fee_collector/src/contract.rs index 5a0ce7cf..f6e0dfd4 100644 --- a/contracts/liquidity_hub/fee_collector/src/contract.rs +++ b/contracts/liquidity_hub/fee_collector/src/contract.rs @@ -111,7 +111,7 @@ pub fn execute( ) -> Result { 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,