-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stats): account abstraction wallets charts (#1201)
* new wallets * other aa charts * add new charts to configs & endpoint & etc. * small comment * comment fix * fix import * random minor non-functional tweaks * rewrite new_aa_wallets query to plain sql for readability * fix comments
- Loading branch information
Showing
17 changed files
with
529 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
use crate::{ | ||
data_source::kinds::{ | ||
data_manipulation::{last_point::LastPoint, map::StripExt}, | ||
local_db::DirectPointLocalDbChartSource, | ||
}, | ||
lines::AccountAbstractionWalletsGrowth, | ||
ChartProperties, MissingDatePolicy, Named, | ||
}; | ||
|
||
use chrono::NaiveDate; | ||
use entity::sea_orm_active_enums::ChartType; | ||
|
||
pub struct Properties; | ||
|
||
impl Named for Properties { | ||
fn name() -> String { | ||
"totalAccountAbstractionWallets".into() | ||
} | ||
} | ||
|
||
impl ChartProperties for Properties { | ||
type Resolution = NaiveDate; | ||
|
||
fn chart_type() -> ChartType { | ||
ChartType::Counter | ||
} | ||
fn missing_date_policy() -> MissingDatePolicy { | ||
MissingDatePolicy::FillPrevious | ||
} | ||
} | ||
|
||
pub type TotalAccountAbstractionWallets = | ||
DirectPointLocalDbChartSource<LastPoint<StripExt<AccountAbstractionWalletsGrowth>>, Properties>; | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
use crate::tests::simple_test::simple_test_counter; | ||
|
||
#[tokio::test] | ||
#[ignore = "needs database to run"] | ||
async fn update_total_account_abstraction_wallets() { | ||
simple_test_counter::<TotalAccountAbstractionWallets>( | ||
"update_total_account_abstraction_wallets", | ||
"1", | ||
None, | ||
) | ||
.await; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
stats/stats/src/charts/lines/user_ops/aa_wallets_growth.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
use crate::{ | ||
charts::chart::ChartProperties, | ||
data_source::kinds::{ | ||
data_manipulation::{map::StripExt, resolutions::last_value::LastValueLowerResolution}, | ||
local_db::{ | ||
parameters::update::batching::parameters::{Batch30Weeks, Batch30Years, Batch36Months}, | ||
DailyCumulativeLocalDbChartSource, DirectVecLocalDbChartSource, | ||
}, | ||
}, | ||
define_and_impl_resolution_properties, | ||
types::timespans::{Month, Week, Year}, | ||
MissingDatePolicy, Named, | ||
}; | ||
|
||
use chrono::NaiveDate; | ||
use entity::sea_orm_active_enums::ChartType; | ||
|
||
use super::new_aa_wallets::NewAccountAbstractionWalletsInt; | ||
|
||
pub struct Properties; | ||
|
||
impl Named for Properties { | ||
fn name() -> String { | ||
"accountAbstractionWalletsGrowth".into() | ||
} | ||
} | ||
|
||
impl ChartProperties for Properties { | ||
type Resolution = NaiveDate; | ||
|
||
fn chart_type() -> ChartType { | ||
ChartType::Line | ||
} | ||
fn missing_date_policy() -> MissingDatePolicy { | ||
MissingDatePolicy::FillPrevious | ||
} | ||
} | ||
|
||
define_and_impl_resolution_properties!( | ||
define_and_impl: { | ||
WeeklyProperties: Week, | ||
MonthlyProperties: Month, | ||
YearlyProperties: Year, | ||
}, | ||
base_impl: Properties | ||
); | ||
|
||
pub type AccountAbstractionWalletsGrowth = | ||
DailyCumulativeLocalDbChartSource<NewAccountAbstractionWalletsInt, Properties>; | ||
type AccountAbstractionWalletsGrowthS = StripExt<AccountAbstractionWalletsGrowth>; | ||
pub type AccountAbstractionWalletsGrowthWeekly = DirectVecLocalDbChartSource< | ||
LastValueLowerResolution<AccountAbstractionWalletsGrowthS, Week>, | ||
Batch30Weeks, | ||
WeeklyProperties, | ||
>; | ||
pub type AccountAbstractionWalletsGrowthMonthly = DirectVecLocalDbChartSource< | ||
LastValueLowerResolution<AccountAbstractionWalletsGrowthS, Month>, | ||
Batch36Months, | ||
MonthlyProperties, | ||
>; | ||
type AccountAbstractionWalletsGrowthMonthlyS = StripExt<AccountAbstractionWalletsGrowthMonthly>; | ||
pub type AccountAbstractionWalletsGrowthYearly = DirectVecLocalDbChartSource< | ||
LastValueLowerResolution<AccountAbstractionWalletsGrowthMonthlyS, Year>, | ||
Batch30Years, | ||
YearlyProperties, | ||
>; | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
use crate::tests::simple_test::simple_test_chart; | ||
|
||
#[tokio::test] | ||
#[ignore = "needs database to run"] | ||
async fn update_account_abstraction_wallets_growth() { | ||
simple_test_chart::<AccountAbstractionWalletsGrowth>( | ||
"update_account_abstraction_wallets_growth", | ||
vec![("2022-11-09", "1")], | ||
) | ||
.await; | ||
} | ||
|
||
#[tokio::test] | ||
#[ignore = "needs database to run"] | ||
async fn update_account_abstraction_wallets_growth_weekly() { | ||
simple_test_chart::<AccountAbstractionWalletsGrowthWeekly>( | ||
"update_account_abstraction_wallets_growth_weekly", | ||
vec![("2022-11-07", "1")], | ||
) | ||
.await; | ||
} | ||
|
||
#[tokio::test] | ||
#[ignore = "needs database to run"] | ||
async fn update_account_abstraction_wallets_growth_monthly() { | ||
simple_test_chart::<AccountAbstractionWalletsGrowthMonthly>( | ||
"update_account_abstraction_wallets_growth_monthly", | ||
vec![("2022-11-01", "1")], | ||
) | ||
.await; | ||
} | ||
|
||
#[tokio::test] | ||
#[ignore = "needs database to run"] | ||
async fn update_account_abstraction_wallets_growth_yearly() { | ||
simple_test_chart::<AccountAbstractionWalletsGrowthYearly>( | ||
"update_account_abstraction_wallets_growth_yearly", | ||
vec![("2022-01-01", "1")], | ||
) | ||
.await; | ||
} | ||
} |
Oops, something went wrong.