From c82d488b9b0ee8869a20c7d45d90f4b4ff20a9e9 Mon Sep 17 00:00:00 2001 From: PFC <81114960+PFC-developer@users.noreply.github.com> Date: Fri, 27 Oct 2023 12:01:33 -0500 Subject: [PATCH] chore: fix clippy. switch to package for dust-collector --- Cargo.lock | 108 ++++++++---------- contracts/hub-tf/Cargo.toml | 6 +- contracts/hub-tf/src/contract.rs | 4 +- contracts/hub-tf/src/execute.rs | 2 +- contracts/hub-tf/src/queries.rs | 6 +- contracts/hub/Cargo.toml | 4 +- contracts/hub/src/queries.rs | 6 +- packages/dust_collector/Cargo.toml | 17 --- packages/dust_collector/README.md | 6 - packages/dust_collector/src/dust_collector.rs | 9 -- packages/dust_collector/src/lib.rs | 2 - packages/steak/src/hub_tf.rs | 2 +- 12 files changed, 65 insertions(+), 107 deletions(-) delete mode 100644 packages/dust_collector/Cargo.toml delete mode 100644 packages/dust_collector/README.md delete mode 100644 packages/dust_collector/src/dust_collector.rs delete mode 100644 packages/dust_collector/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 45a68fee..243fd28e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -491,17 +491,6 @@ dependencies = [ "serde", ] -[[package]] -name = "cw-storage-plus" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6cf70ef7686e2da9ad7b067c5942cd3e88dd9453f7af42f54557f8af300fb0" -dependencies = [ - "cosmwasm-std", - "schemars", - "serde", -] - [[package]] name = "cw-storage-plus" version = "0.16.0" @@ -536,21 +525,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "cw-utils" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ae0b69fa7679de78825b4edeeec045066aa2b2c4b6e063d80042e565bb4da5c" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "cw2 0.15.1", - "schemars", - "semver", - "serde", - "thiserror", -] - [[package]] name = "cw-utils" version = "0.16.0" @@ -593,19 +567,6 @@ dependencies = [ "serde", ] -[[package]] -name = "cw2" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5abb8ecea72e09afff830252963cb60faf945ce6cef2c20a43814516082653da" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "cw-storage-plus 0.15.1", - "schemars", - "serde", -] - [[package]] name = "cw2" version = "0.16.0" @@ -644,19 +605,6 @@ dependencies = [ "serde", ] -[[package]] -name = "cw20" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6025276fb6e603e974c21f3e4606982cdc646080e8fba3198816605505e1d9a" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "cw-utils 0.15.1", - "schemars", - "serde", -] - [[package]] name = "cw20" version = "1.0.1" @@ -1339,22 +1287,40 @@ checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" [[package]] name = "pfc-dust-collector" -version = "3.0.0" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9debbb83cefcd272c751c07f984f75f70be4195e87dddbdb87247bd969d51436" dependencies = [ "cosmwasm-schema", "cosmwasm-std", + "cw-ownable", + "cw-ownable-derive", + "pfc-dust-collector-derive", + "pfc-whitelist", + "pfc-whitelist-derive", "schemars", "serde", ] +[[package]] +name = "pfc-dust-collector-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d72f8e98168a562a454569e5cc70070c4408d1a8f7828efce41fd496e52fb36d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "pfc-fee-split" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5e71d09b61b7c6babdf97bcc98cfef4f60d5e8f662b28d8a5ab42fde1b5c6db" +checksum = "659bc95805fb3ab45d6db2eda7ee71bfe5fa952e4705146e0ce3d8113daaab57" dependencies = [ "cosmwasm-std", - "cw20 0.15.1", + "cw20 1.0.1", "schemars", "serde", ] @@ -1397,7 +1363,7 @@ dependencies = [ [[package]] name = "pfc-steak-hub" -version = "3.0.8" +version = "3.0.10" dependencies = [ "cosmwasm-std", "cw-storage-plus 0.13.4", @@ -1413,7 +1379,7 @@ dependencies = [ [[package]] name = "pfc-steak-hub-tf" -version = "3.0.9" +version = "3.0.10" dependencies = [ "cosmwasm-std", "cw-item-set", @@ -1440,6 +1406,32 @@ dependencies = [ "cw20-base 0.13.4", ] +[[package]] +name = "pfc-whitelist" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "217870c932a72a63c52c9126792a5bd29773b1318b65635d900091c8f54d3a5c" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 1.0.1", + "pfc-whitelist-derive", + "schemars", + "serde", + "thiserror", +] + +[[package]] +name = "pfc-whitelist-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e8cd39f1b0792d2a383d072795fc88ee82bc671374cac0a1ec229ff8abe5da1" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "pin-project-lite" version = "0.2.9" diff --git a/contracts/hub-tf/Cargo.toml b/contracts/hub-tf/Cargo.toml index 9e2e4f2d..f5d5369b 100644 --- a/contracts/hub-tf/Cargo.toml +++ b/contracts/hub-tf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pfc-steak-hub-tf" -version = "3.0.9" +version = "3.0.10" authors = ["larry ", "PFC "] edition = "2018" license = "GPL-3.0-or-later" @@ -26,9 +26,9 @@ prost = {version = "0.11.0", default-features = false, features = ["prost-derive prost-types = {version = "0.11.1", default-features = false} schemars = "0.8.11" pfc-steak = { path = "../../packages/steak" } -pfc-dust-collector = { path = "../../packages/dust_collector" } serde = { version = "1.0.103", default-features = false, features = ["derive"] } -pfc-fee-split = "0.2.3" +pfc-fee-split = "0.2.5" +pfc-dust-collector="0.1.0" #kujira = "0.7.25" osmosis-std-derive="0.13.2" protobuf = { version = "3.1.0", features = ["with-bytes"] } \ No newline at end of file diff --git a/contracts/hub-tf/src/contract.rs b/contracts/hub-tf/src/contract.rs index 86ad9edc..8b47d083 100644 --- a/contracts/hub-tf/src/contract.rs +++ b/contracts/hub-tf/src/contract.rs @@ -97,7 +97,7 @@ pub fn execute(deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg) -> S ExecuteMsg::SetUnbondPeriod { unbond_period } => execute::set_unbond_period(deps, env, info.sender, unbond_period), ExecuteMsg::SetDustCollector { dust_collector } => { execute::set_dust_collector(deps, env, info.sender, dust_collector) } - ExecuteMsg::CollectDust {} => { execute::collect_dust(deps, env) } + ExecuteMsg::CollectDust { max_tokens } => { execute::collect_dust(deps, env, max_tokens) } ExecuteMsg::ReturnDenom {} => { execute::return_denom(deps, env, info.funds) } } } @@ -124,7 +124,7 @@ fn callback( pub fn reply(deps: DepsMut, env: Env, reply: Reply) -> StdResult { match reply.id { REPLY_REGISTER_RECEIVED_COINS => { - execute::collect_dust(deps, env) + execute::collect_dust(deps, env,10) } _ => { Err(StdError::generic_err(format!( diff --git a/contracts/hub-tf/src/execute.rs b/contracts/hub-tf/src/execute.rs index b1f42f44..1561ae7c 100644 --- a/contracts/hub-tf/src/execute.rs +++ b/contracts/hub-tf/src/execute.rs @@ -1070,7 +1070,7 @@ pub fn set_dust_collector( .add_attribute("action", "steakhub/set_dust_collector")) } -pub fn collect_dust(deps: DepsMut, _env: Env) -> StdResult { +pub fn collect_dust(deps: DepsMut, _env: Env, max_tokens: u64) -> StdResult { let state = State::default(); if let Some(_dust_addr) = state.dust_collector.load(deps.storage)? { diff --git a/contracts/hub-tf/src/queries.rs b/contracts/hub-tf/src/queries.rs index 0642e376..3db704d5 100644 --- a/contracts/hub-tf/src/queries.rs +++ b/contracts/hub-tf/src/queries.rs @@ -31,8 +31,8 @@ pub fn config(deps: Deps) -> StdResult { } - let validator_active_vec: Vec = Vec::from_iter(validators_active.into_iter()); - let paused_validators: Vec = Vec::from_iter(validators.into_iter()); + let validator_active_vec: Vec = Vec::from_iter(validators_active); + let paused_validators: Vec = Vec::from_iter(validators); Ok(ConfigResponse { owner: state.owner.load(deps.storage)?.into(), @@ -68,7 +68,7 @@ pub fn state(deps: Deps, env: Env) -> StdResult { validators_active.insert(res?); } validators.extend(validators_active); - let validator_vec: Vec = Vec::from_iter(validators.into_iter()); + let validator_vec: Vec = Vec::from_iter(validators); let delegations = query_delegations(&deps.querier, &validator_vec, &env.contract.address, &denom)?; let total_native: u128 = delegations.iter().map(|d| d.amount).sum(); diff --git a/contracts/hub/Cargo.toml b/contracts/hub/Cargo.toml index bb86e6d3..1820cf79 100644 --- a/contracts/hub/Cargo.toml +++ b/contracts/hub/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pfc-steak-hub" -version = "3.0.8" +version = "3.0.10" authors = ["larry ", "PFC "] edition = "2018" license = "GPL-3.0-or-later" @@ -21,7 +21,7 @@ cw-storage-plus = "0.13" pfc-steak = { path = "../../packages/steak" } serde = { version = "1.0.103", default-features = false, features = ["derive"] } pfc-fee-split = "0.2.3" -pfc-dust-collector = { path = "../../packages/dust_collector" } +pfc-dust-collector = "0.1.0" funds-distributor-api = {git="https://github.com/terra-money/enterprise-contracts.git" , branch="main"} #[dev-dependencies] #serde = { version = "1.0.103", default-features = false, features = ["derive"] } diff --git a/contracts/hub/src/queries.rs b/contracts/hub/src/queries.rs index 16d1e6b2..09ac9998 100644 --- a/contracts/hub/src/queries.rs +++ b/contracts/hub/src/queries.rs @@ -23,8 +23,8 @@ pub fn config(deps: Deps) -> StdResult { for v in validators_active.iter() { validators.remove(v); } - let validator_active_vec: Vec = Vec::from_iter(validators_active.into_iter()); - let paused_validators: Vec = Vec::from_iter(validators.into_iter()); + let validator_active_vec: Vec = Vec::from_iter(validators_active); + let paused_validators: Vec = Vec::from_iter(validators); Ok(ConfigResponse { owner: state.owner.load(deps.storage)?.into(), @@ -57,7 +57,7 @@ pub fn state(deps: Deps, env: Env) -> StdResult { let mut validators: HashSet = HashSet::from_iter(state.validators.load(deps.storage)?); let validators_active: HashSet = HashSet::from_iter(state.validators_active.load(deps.storage)?); validators.extend(validators_active); - let validator_vec: Vec = Vec::from_iter(validators.into_iter()); + let validator_vec: Vec = Vec::from_iter(validators); let delegations = query_delegations(&deps.querier, &validator_vec, &env.contract.address, &denom)?; let total_native: u128 = delegations.iter().map(|d| d.amount).sum(); diff --git a/packages/dust_collector/Cargo.toml b/packages/dust_collector/Cargo.toml deleted file mode 100644 index 20b3bf27..00000000 --- a/packages/dust_collector/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -name = "pfc-dust-collector" -version = "3.0.0" -authors = ["PFC "] -edition = "2018" -description = "Liquid steaking protocol for the cosmos" -license = "GPL-3.0-or-later" -homepage = "https://liquidsteaking.app" -repository = "https://github.com/PFC-developer/steak-contracts" - -[dependencies] -cosmwasm-std = {version="1.2.1", features=["ibc3"]} -cosmwasm-schema = "1.2.1" - -schemars = "0.8.1" -serde = { version = "1.0.103", default-features = false, features = ["derive"] } - diff --git a/packages/dust_collector/README.md b/packages/dust_collector/README.md deleted file mode 100644 index 6b7571ea..00000000 --- a/packages/dust_collector/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Dust Collector Shared Messages -Messages used to call the Dust collector - -## License - -Contents of this repository are open source under [GNU General Public License v3](https://www.gnu.org/licenses/gpl-3.0.en.html) or later. diff --git a/packages/dust_collector/src/dust_collector.rs b/packages/dust_collector/src/dust_collector.rs deleted file mode 100644 index 9f006bc6..00000000 --- a/packages/dust_collector/src/dust_collector.rs +++ /dev/null @@ -1,9 +0,0 @@ - -use cosmwasm_schema::cw_serde; - - -#[cw_serde] -pub enum ExecuteMsg { - /// get some dust - DustReceived(), -} diff --git a/packages/dust_collector/src/lib.rs b/packages/dust_collector/src/lib.rs deleted file mode 100644 index f2f0a6c6..00000000 --- a/packages/dust_collector/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ - -pub mod dust_collector; diff --git a/packages/steak/src/hub_tf.rs b/packages/steak/src/hub_tf.rs index 6d23d0ab..fda9bdb4 100644 --- a/packages/steak/src/hub_tf.rs +++ b/packages/steak/src/hub_tf.rs @@ -112,7 +112,7 @@ pub enum ExecuteMsg { /// Set Dust Collector Contract SetDustCollector { dust_collector: Option }, /// Collect the Dust - CollectDust {}, + CollectDust { max_tokens: u64}, /// Return the Dust in shiny 'base denom' ReturnDenom {}, }