Skip to content

Commit d2a8d7b

Browse files
authored
Merge branch 'main' into nixos-cleanup
2 parents 8b72ffd + 0d43013 commit d2a8d7b

File tree

24 files changed

+630
-298
lines changed

24 files changed

+630
-298
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
/.vscode
2+
/.vs
3+
/.idea
4+
25

36
qr-code.svg
47

58
/target
69
/venv
710
/.direnv
11+
/.pre-commit-config.yaml
12+
/result*

Cargo.lock

Lines changed: 12 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

catalyst-toolbox/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ rayon = "1.5"
3737
rust_decimal = "1.16"
3838
rust_decimal_macros = "1"
3939
futures = "0.3"
40-
log = "0.4"
4140
once_cell = "1.8"
4241
reqwest = { version = "0.11", features = ["blocking", "json"] }
4342
rand = "0.8.3"
@@ -61,8 +60,10 @@ symmetric-cipher = { git = "https://github.com/input-output-hk/chain-wallet-libs
6160
graphql_client = { version = "0.10" }
6261
gag = "1"
6362
vit-servicing-station-lib = { git = "https://github.com/input-output-hk/vit-servicing-station.git", branch = "master" }
64-
env_logger = "0.9"
6563
snapshot-lib = { path = "../snapshot-lib" }
64+
fraction = "0.10"
65+
tracing = "0.1"
66+
tracing-subscriber = "0.3"
6667

6768
[dev-dependencies]
6869
rand_chacha = "0.3"

catalyst-toolbox/src/bin/catalyst-toolbox.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use structopt::StructOpt;
33
pub mod cli;
44

55
fn main() -> color_eyre::Result<()> {
6-
env_logger::try_init()?;
6+
tracing_subscriber::fmt().init();
77
color_eyre::install()?;
88
cli::Cli::from_args().exec()?;
99
Ok(())

catalyst-toolbox/src/bin/cli/recovery/votes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn group_by_voter<I: IntoIterator<Item = (Fragment, Option<SpendingCounter>)>>(
8181
.or_insert_with(Vec::new)
8282
.push(vote_cast);
8383
}
84-
Err(e) => log::error!("Invalid transaction: {}", e),
84+
Err(e) => tracing::error!("Invalid transaction: {}", e),
8585
}
8686
}
8787
}

catalyst-toolbox/src/http/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::marker::PhantomData;
22

33
use ::reqwest::{blocking::Response, StatusCode};
44
use color_eyre::eyre::Result;
5-
use log::warn;
65
use serde::Deserialize;
6+
use tracing::warn;
77

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

catalyst-toolbox/src/http/rate_limit.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ use governor::{
77
};
88

99
use color_eyre::Report;
10-
use log::debug;
1110
use serde::Deserialize;
11+
use tracing::debug;
1212

1313
use super::{HttpClient, HttpResponse};
1414

15+
#[derive(Debug)]
1516
pub struct RateLimitClient<T: HttpClient> {
1617
inner: T,
1718
limiter: Option<RateLimiter<NotKeyed, InMemoryState, DefaultClock>>,

catalyst-toolbox/src/http/reqwest.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use super::{HttpClient, HttpResponse};
1010

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

13+
#[derive(Debug)]
1314
pub struct ReqwestClient {
1415
client: Client,
1516
base_url: Url,

catalyst-toolbox/src/ideascale/fetch.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pub type Scores = HashMap<u32, f32>;
99
pub type Sponsors = HashMap<String, String>;
1010

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

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

3234
pub fn get_funnels_data_for_fund(client: &impl HttpClient) -> Result<Vec<Funnel>, Report> {
35+
info!("getting funnels");
3336
client.get("funnels")?.json()
3437
}

catalyst-toolbox/src/ideascale/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub fn fetch_all(
7979
// TODO: Handle error better here
8080
.flat_map(Result::unwrap)
8181
// filter out non approved or staged proposals
82-
.filter(|p| p.approved && filter_proposal_by_stage_type(&p.stage_type, &matches))
82+
.filter(|p| p.approved.as_bool() && filter_proposal_by_stage_type(&p.stage_type, &matches))
8383
.filter(|p| !excluded_proposals.contains(&p.proposal_id))
8484
.collect();
8585

@@ -139,7 +139,7 @@ pub fn build_challenges(
139139
id: i.to_string(),
140140
rewards_total: c.rewards.to_string(),
141141
proposers_rewards: c.rewards.to_string(),
142-
title: c.title.clone(),
142+
title: c.title.as_str().to_string(),
143143
highlight: sponsors.get(&c.challenge_url).map(|sponsor| {
144144
models::se::Highlight {
145145
sponsor: sponsor.clone(),

0 commit comments

Comments
 (0)