diff --git a/Cargo.toml b/Cargo.toml index 0273639..7982605 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ members = [ "packages/pfc-astroport_reward_holder", "packages/pfc-fee-split", "packages/pfc-vault", + "packages/pfc-dust-collector", "packages/pfc-dust-collector-kujira", "contracts/pfc-astroport-generator", "contracts/pfc-fee-splitter", diff --git a/packages/pfc-dust-collector/.editorconfig b/packages/pfc-dust-collector/.editorconfig new file mode 100644 index 0000000..3d36f20 --- /dev/null +++ b/packages/pfc-dust-collector/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.rs] +indent_size = 4 diff --git a/packages/pfc-dust-collector/Cargo.toml b/packages/pfc-dust-collector/Cargo.toml new file mode 100644 index 0000000..cd4ef96 --- /dev/null +++ b/packages/pfc-dust-collector/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "pfc-dust-collector" +version = "0.1.0" +authors = ["PFC"] +edition = "2021" +description = "Common helpers for other contracts to use pfc-fee-split" +license = "Apache-2.0" +repository = "https://github.com/PFC-Validator/pfc-fee-split" +keywords = ["cosmos", "cosmwasm"] +[features] +backtraces = ["cosmwasm-std/backtraces"] + +[dependencies] +cosmwasm-std = "1.0.0" +schemars = "0.8.10" +serde = { version = "1.0.103", default-features = false, features = ["derive"] } +pfc-dust-collector-derive = {version ="0.1.0"} +pfc-whitelist-derive = {version ="0.1.0"} +pfc-whitelist={version="0.1.0"} + +cosmwasm-schema = "1.2.1" +cw-ownable = "0.5.0" +cw-ownable-derive = "0.5.0" diff --git a/packages/pfc-dust-collector/src/dust_collector.rs b/packages/pfc-dust-collector/src/dust_collector.rs new file mode 100644 index 0000000..305df99 --- /dev/null +++ b/packages/pfc-dust-collector/src/dust_collector.rs @@ -0,0 +1,60 @@ +use cosmwasm_schema::{cw_serde, QueryResponses}; +use cosmwasm_std::Uint128; +use cw_ownable_derive::{cw_ownable_execute, cw_ownable_query}; + +use pfc_dust_collector_derive::pfc_dust_collect; + +use pfc_whitelist_derive::{pfc_whitelist_exec, pfc_whitelist_query}; +#[cw_serde] +pub struct CollectorResponse { + pub entries: Vec, +} + +#[pfc_dust_collect] +#[pfc_whitelist_exec] +#[cw_ownable_execute] +#[cw_serde] +pub enum ExecuteMsg { + /// get some dust + SetTokenRouter { contract: String }, + /// Set Base denom + SetBaseDenom { denom: String }, + /// minimum of zero + SetAssetMinimum { denom: String, minimum: Uint128 }, + /// passing this asset moving forward will just hold it, and not attempt to convert it. a 'Flush' will send it back (to avoid loops) + ClearAsset { denom: String }, +} + +#[cw_ownable_query] +#[pfc_whitelist_query] +#[cw_serde] +#[derive(QueryResponses)] +pub enum QueryMsg { + #[returns(CollectorResponse)] + Assets { + start_after: Option, + limit: Option, + }, + #[returns(AssetHolding)] + Asset { denom: String }, + #[returns(ConfigResponse)] + Config {}, +} + +#[cw_serde] +pub struct ConfigResponse { + pub token_router: String, + pub base_denom: String, + pub return_contract: String, +} +#[cw_serde] +pub struct AssetMinimum { + pub denom: String, + pub minimum: Uint128, +} +#[cw_serde] +pub struct AssetHolding { + pub denom: String, + pub minimum: Uint128, // only send $ after we have this amount in this coin + pub balance: Uint128, +} diff --git a/packages/pfc-dust-collector/src/lib.rs b/packages/pfc-dust-collector/src/lib.rs new file mode 100644 index 0000000..350ee00 --- /dev/null +++ b/packages/pfc-dust-collector/src/lib.rs @@ -0,0 +1 @@ +pub mod dust_collector;