Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ qr-code.svg

/target
/venv
.pre-commit-config.yaml
20 changes: 4 additions & 16 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions catalyst-toolbox/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ rayon = "1.5"
rust_decimal = "1.16"
rust_decimal_macros = "1"
futures = "0.3"
log = "0.4"
once_cell = "1.8"
reqwest = { version = "0.11", features = ["blocking", "json"] }
rand = "0.8.3"
Expand All @@ -61,8 +60,10 @@ symmetric-cipher = { git = "https://github.com/input-output-hk/chain-wallet-libs
graphql_client = { version = "0.10" }
gag = "1"
vit-servicing-station-lib = { git = "https://github.com/input-output-hk/vit-servicing-station.git", branch = "master" }
env_logger = "0.9"
snapshot-lib = { path = "../snapshot-lib" }
fraction = "0.10"
tracing = "0.1"
tracing-subscriber = "0.3"

[dev-dependencies]
rand_chacha = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion catalyst-toolbox/src/bin/catalyst-toolbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use structopt::StructOpt;
pub mod cli;

fn main() -> color_eyre::Result<()> {
env_logger::try_init()?;
tracing_subscriber::fmt().init();
color_eyre::install()?;
cli::Cli::from_args().exec()?;
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion catalyst-toolbox/src/bin/cli/recovery/votes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fn group_by_voter<I: IntoIterator<Item = (Fragment, Option<SpendingCounter>)>>(
.or_insert_with(Vec::new)
.push(vote_cast);
}
Err(e) => log::error!("Invalid transaction: {}", e),
Err(e) => tracing::error!("Invalid transaction: {}", e),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion catalyst-toolbox/src/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::marker::PhantomData;

use ::reqwest::{blocking::Response, StatusCode};
use color_eyre::eyre::Result;
use log::warn;
use serde::Deserialize;
use tracing::warn;

use self::{rate_limit::RateLimitClient, reqwest::ReqwestClient};

Expand Down
3 changes: 2 additions & 1 deletion catalyst-toolbox/src/http/rate_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ use governor::{
};

use color_eyre::Report;
use log::debug;
use serde::Deserialize;
use tracing::debug;

use super::{HttpClient, HttpResponse};

#[derive(Debug)]
pub struct RateLimitClient<T: HttpClient> {
inner: T,
limiter: Option<RateLimiter<NotKeyed, InMemoryState, DefaultClock>>,
Expand Down
1 change: 1 addition & 0 deletions catalyst-toolbox/src/http/reqwest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use super::{HttpClient, HttpResponse};

const BASE_IDEASCALE_URL: &str = "https://cardano.ideascale.com/a/rest/v1/";

#[derive(Debug)]
pub struct ReqwestClient {
client: Client,
base_url: Url,
Expand Down
3 changes: 3 additions & 0 deletions catalyst-toolbox/src/ideascale/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub type Scores = HashMap<u32, f32>;
pub type Sponsors = HashMap<String, String>;

pub fn get_funds_data(client: &impl HttpClient) -> Result<Vec<Fund>, Report> {
info!("getting funds");
client.get("campaigns/groups")?.json()
}

Expand All @@ -25,10 +26,12 @@ pub fn get_proposals_data(
client: &impl HttpClient,
challenge_id: u32,
) -> Result<Vec<Proposal>, Report> {
info!("getting proposal data");
let path = &format!("campaigns/{}/ideas/0/100000", challenge_id);
client.get(path)?.json()
}

pub fn get_funnels_data_for_fund(client: &impl HttpClient) -> Result<Vec<Funnel>, Report> {
info!("getting funnels");
client.get("funnels")?.json()
}
4 changes: 2 additions & 2 deletions catalyst-toolbox/src/ideascale/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub fn fetch_all(
// TODO: Handle error better here
.flat_map(Result::unwrap)
// filter out non approved or staged proposals
.filter(|p| p.approved && filter_proposal_by_stage_type(&p.stage_type, &matches))
.filter(|p| p.approved.as_bool() && filter_proposal_by_stage_type(&p.stage_type, &matches))
.filter(|p| !excluded_proposals.contains(&p.proposal_id))
.collect();

Expand Down Expand Up @@ -139,7 +139,7 @@ pub fn build_challenges(
id: i.to_string(),
rewards_total: c.rewards.to_string(),
proposers_rewards: c.rewards.to_string(),
title: c.title.clone(),
title: c.title.as_str().to_string(),
highlight: sponsors.get(&c.challenge_url).map(|sponsor| {
models::se::Highlight {
sponsor: sponsor.clone(),
Expand Down
188 changes: 0 additions & 188 deletions catalyst-toolbox/src/ideascale/models/de.rs

This file was deleted.

Loading