Skip to content

Commit

Permalink
chore: fix clippy. switch to package for dust-collector
Browse files Browse the repository at this point in the history
  • Loading branch information
PFC-developer committed Oct 27, 2023
1 parent 77fb0c8 commit c82d488
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 107 deletions.
108 changes: 50 additions & 58 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions contracts/hub-tf/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pfc-steak-hub-tf"
version = "3.0.9"
version = "3.0.10"
authors = ["larry <[email protected]>", "PFC <[email protected]>"]
edition = "2018"
license = "GPL-3.0-or-later"
Expand All @@ -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"] }
4 changes: 2 additions & 2 deletions contracts/hub-tf/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
}
Expand All @@ -124,7 +124,7 @@ fn callback(
pub fn reply(deps: DepsMut, env: Env, reply: Reply) -> StdResult<Response> {
match reply.id {
REPLY_REGISTER_RECEIVED_COINS => {
execute::collect_dust(deps, env)
execute::collect_dust(deps, env,10)
}
_ => {
Err(StdError::generic_err(format!(
Expand Down
2 changes: 1 addition & 1 deletion contracts/hub-tf/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Response> {
pub fn collect_dust(deps: DepsMut, _env: Env, max_tokens: u64) -> StdResult<Response> {
let state = State::default();

if let Some(_dust_addr) = state.dust_collector.load(deps.storage)? {
Expand Down
6 changes: 3 additions & 3 deletions contracts/hub-tf/src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ pub fn config(deps: Deps) -> StdResult<ConfigResponse> {
}


let validator_active_vec: Vec<String> = Vec::from_iter(validators_active.into_iter());
let paused_validators: Vec<String> = Vec::from_iter(validators.into_iter());
let validator_active_vec: Vec<String> = Vec::from_iter(validators_active);
let paused_validators: Vec<String> = Vec::from_iter(validators);

Ok(ConfigResponse {
owner: state.owner.load(deps.storage)?.into(),
Expand Down Expand Up @@ -68,7 +68,7 @@ pub fn state(deps: Deps, env: Env) -> StdResult<StateResponse> {
validators_active.insert(res?);
}
validators.extend(validators_active);
let validator_vec: Vec<String> = Vec::from_iter(validators.into_iter());
let validator_vec: Vec<String> = 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();

Expand Down
4 changes: 2 additions & 2 deletions contracts/hub/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pfc-steak-hub"
version = "3.0.8"
version = "3.0.10"
authors = ["larry <[email protected]>", "PFC <[email protected]>"]
edition = "2018"
license = "GPL-3.0-or-later"
Expand All @@ -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"] }
6 changes: 3 additions & 3 deletions contracts/hub/src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ pub fn config(deps: Deps) -> StdResult<ConfigResponse> {
for v in validators_active.iter() {
validators.remove(v);
}
let validator_active_vec: Vec<String> = Vec::from_iter(validators_active.into_iter());
let paused_validators: Vec<String> = Vec::from_iter(validators.into_iter());
let validator_active_vec: Vec<String> = Vec::from_iter(validators_active);
let paused_validators: Vec<String> = Vec::from_iter(validators);

Ok(ConfigResponse {
owner: state.owner.load(deps.storage)?.into(),
Expand Down Expand Up @@ -57,7 +57,7 @@ pub fn state(deps: Deps, env: Env) -> StdResult<StateResponse> {
let mut validators: HashSet<String> = HashSet::from_iter(state.validators.load(deps.storage)?);
let validators_active: HashSet<String> = HashSet::from_iter(state.validators_active.load(deps.storage)?);
validators.extend(validators_active);
let validator_vec: Vec<String> = Vec::from_iter(validators.into_iter());
let validator_vec: Vec<String> = 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();
Expand Down
17 changes: 0 additions & 17 deletions packages/dust_collector/Cargo.toml

This file was deleted.

6 changes: 0 additions & 6 deletions packages/dust_collector/README.md

This file was deleted.

9 changes: 0 additions & 9 deletions packages/dust_collector/src/dust_collector.rs

This file was deleted.

2 changes: 0 additions & 2 deletions packages/dust_collector/src/lib.rs

This file was deleted.

2 changes: 1 addition & 1 deletion packages/steak/src/hub_tf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub enum ExecuteMsg {
/// Set Dust Collector Contract
SetDustCollector { dust_collector: Option<String> },
/// Collect the Dust
CollectDust {},
CollectDust { max_tokens: u64},
/// Return the Dust in shiny 'base denom'
ReturnDenom {},
}
Expand Down

0 comments on commit c82d488

Please sign in to comment.