Skip to content

Commit 753d20f

Browse files
committed
Improve documentation comments
1 parent cf815f6 commit 753d20f

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

src/main.rs

+7
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,21 @@ use crate::spec::CheckpointSpecification;
1212
mod spec;
1313
mod variant;
1414

15+
/// URL of the default RPC provider
1516
const DEFAULT_RPC_URL: &str = "https://eth.merkle.io";
17+
18+
/// Default filename for output checkpoint file
1619
const DEFAULT_OUTPUT_PATH: &str = ".cfmms-checkpoint.json";
1720

21+
/// CLI parameters
1822
#[derive(Parser)]
1923
struct Opts {
24+
/// URL to the Ethereum RPC provider
2025
#[clap(short, long)]
2126
rpc: Option<Url>,
27+
/// Path to the input CSV file
2228
r#in: PathBuf,
29+
/// Path to write the output checkpoint JSON file to
2330
out: Option<PathBuf>,
2431
}
2532

src/spec.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Logic and types for checkpoint specification
12
use std::{path::Path, sync::Arc};
23

34
use alloy::primitives::{Address, BlockNumber};
@@ -14,8 +15,10 @@ use serde::{Deserialize, Serialize};
1415

1516
use crate::variant::AmmVariant;
1617

18+
/// Default fee for AMM pools
1719
pub const DEFAULT_FEE: u32 = 300;
1820

21+
/// Represents a single row of CSV
1922
#[derive(Clone, Debug, Deserialize, Serialize)]
2023
pub struct SpecificationEntry {
2124
pub variant: AmmVariant,
@@ -25,6 +28,7 @@ pub struct SpecificationEntry {
2528
}
2629

2730
impl SpecificationEntry {
31+
/// Retrieves both the associated AMM factory and pool for this [`SpecificationEntry`]
2832
async fn fetch(
2933
&self,
3034
provider: Arc<ReqwestProvider>,
@@ -63,10 +67,12 @@ impl SpecificationEntry {
6367
}
6468
}
6569

70+
/// Represents a sequence of CSV rows
6671
#[derive(Clone, Debug, Deserialize, Serialize)]
6772
pub struct CheckpointSpecification(pub Vec<SpecificationEntry>);
6873

6974
impl CheckpointSpecification {
75+
/// Reads a [`CheckpointSpecification`] from disk
7076
pub fn load<P>(path: P) -> eyre::Result<Self>
7177
where
7278
P: AsRef<Path>,
@@ -78,6 +84,8 @@ impl CheckpointSpecification {
7884
))
7985
}
8086

87+
/// Retrieves the entire set of AMM factories and pools specified in this
88+
/// [`CheckpointSpecification`]
8189
pub async fn fetch(
8290
&self,
8391
provider: Arc<ReqwestProvider>,

src/variant.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
//! Types for handling types of AMMs
12
use serde::{Deserialize, Serialize};
23

4+
/// Represents a type of AMM pool
35
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
46
pub enum AmmVariant {
57
UniswapV2,

0 commit comments

Comments
 (0)